Skip to content

Commit

Permalink
feat: collector pol migration
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlymite committed Nov 7, 2024
1 parent ceaea99 commit bd04f05
Show file tree
Hide file tree
Showing 12 changed files with 372 additions and 239 deletions.
Original file line number Diff line number Diff line change
@@ -1,46 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol';
import {AaveV3PayloadArbitrum} from 'aave-helpers/src/v3-config-engine/AaveV3PayloadArbitrum.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3Arbitrum, AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol';
import {PriceFeeds} from './Constants.sol';

/**
* @title Update Price Cap Adapters (CAPO)
* @author BGD Labs (@bgdlabs)
* - Snapshot: TODO
* - Discussion: TODO
*/
contract AaveV3Arbitrum_UpdatePriceCapAdaptersCAPO_20241101 is IProposalGenericExecutor {
function execute() external {
_updateV3PriceAdapters();
}

function _updateV3PriceAdapters() internal {
address[] memory assets = new address[](7);
address[] memory sources = new address[](7);

assets[0] = AaveV3ArbitrumAssets.USDC_UNDERLYING;
sources[0] = PriceFeeds.ARBITRUM_V3_USDC_FEED;

assets[1] = AaveV3ArbitrumAssets.USDCn_UNDERLYING;
sources[1] = PriceFeeds.ARBITRUM_V3_USDC_FEED;

assets[2] = AaveV3ArbitrumAssets.USDT_UNDERLYING;
sources[2] = PriceFeeds.ARBITRUM_V3_USDT_FEED;

assets[3] = AaveV3ArbitrumAssets.DAI_UNDERLYING;
sources[3] = PriceFeeds.ARBITRUM_V3_DAI_FEED;

assets[4] = AaveV3ArbitrumAssets.MAI_UNDERLYING;
sources[4] = PriceFeeds.ARBITRUM_V3_MAI_FEED;

assets[5] = AaveV3ArbitrumAssets.LUSD_UNDERLYING;
sources[5] = PriceFeeds.ARBITRUM_V3_LUSD_FEED;

assets[6] = AaveV3ArbitrumAssets.FRAX_UNDERLYING;
sources[6] = PriceFeeds.ARBITRUM_V3_FRAX_FEED;

AaveV3Arbitrum.ORACLE.setAssetSources(assets, sources);
contract AaveV3Arbitrum_UpdatePriceCapAdaptersCAPO_20241101 is AaveV3PayloadArbitrum {
function priceFeedsUpdates()
public
pure
override
returns (IAaveV3ConfigEngine.PriceFeedUpdate[] memory)
{
IAaveV3ConfigEngine.PriceFeedUpdate[]
memory feedsUpdate = new IAaveV3ConfigEngine.PriceFeedUpdate[](7);

feedsUpdate[0] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.USDC_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_USDC_FEED
});
feedsUpdate[1] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.USDCn_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_USDC_FEED
});
feedsUpdate[2] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.USDT_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_USDT_FEED
});
feedsUpdate[3] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.DAI_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_DAI_FEED
});
feedsUpdate[4] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.MAI_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_MAI_FEED
});
feedsUpdate[5] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.LUSD_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_LUSD_FEED
});
feedsUpdate[6] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3ArbitrumAssets.FRAX_UNDERLYING,
priceFeed: PriceFeeds.ARBITRUM_V3_FRAX_FEED
});

return feedsUpdate;
}
}
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3PayloadAvalanche} from 'aave-helpers/src/v3-config-engine/AaveV3PayloadAvalanche.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3Avalanche, AaveV3AvalancheAssets} from 'aave-address-book/AaveV3Avalanche.sol';
import {AaveV2Avalanche, AaveV2AvalancheAssets} from 'aave-address-book/AaveV2Avalanche.sol';
import {PriceFeeds} from './Constants.sol';
import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol';

/**
* @title Update Price Cap Adapters (CAPO)
* @author BGD Labs (@bgdlabs)
* - Snapshot: TODO
* - Discussion: TODO
*/
contract AaveV3Avalanche_UpdatePriceCapAdaptersCAPO_20241101 is IProposalGenericExecutor {
function execute() external {
contract AaveV3Avalanche_UpdatePriceCapAdaptersCAPO_20241101 is AaveV3PayloadAvalanche {
function _postExecute() internal override {
_updateV2PriceAdapters();
_updateV3PriceAdapters();
}

function _updateV3PriceAdapters() internal {
address[] memory assets = new address[](5);
address[] memory sources = new address[](5);
function priceFeedsUpdates()
public
pure
override
returns (IAaveV3ConfigEngine.PriceFeedUpdate[] memory)
{
IAaveV3ConfigEngine.PriceFeedUpdate[]
memory feedsUpdate = new IAaveV3ConfigEngine.PriceFeedUpdate[](5);

assets[0] = AaveV3AvalancheAssets.USDC_UNDERLYING;
sources[0] = PriceFeeds.AVALANCHE_V3_USDC_FEED;

assets[1] = AaveV3AvalancheAssets.USDt_UNDERLYING;
sources[1] = PriceFeeds.AVALANCHE_V3_USDT_FEED;

assets[2] = AaveV3AvalancheAssets.DAIe_UNDERLYING;
sources[2] = PriceFeeds.AVALANCHE_V3_DAI_FEED;

assets[3] = AaveV3AvalancheAssets.FRAX_UNDERLYING;
sources[3] = PriceFeeds.AVALANCHE_V3_FRAX_FEED;

assets[4] = AaveV3AvalancheAssets.MAI_UNDERLYING;
sources[4] = PriceFeeds.AVALANCHE_V3_MAI_FEED;
feedsUpdate[0] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3AvalancheAssets.USDC_UNDERLYING,
priceFeed: PriceFeeds.AVALANCHE_V3_USDC_FEED
});
feedsUpdate[1] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3AvalancheAssets.USDt_UNDERLYING,
priceFeed: PriceFeeds.AVALANCHE_V3_USDT_FEED
});
feedsUpdate[2] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3AvalancheAssets.DAIe_UNDERLYING,
priceFeed: PriceFeeds.AVALANCHE_V3_DAI_FEED
});
feedsUpdate[3] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3AvalancheAssets.FRAX_UNDERLYING,
priceFeed: PriceFeeds.AVALANCHE_V3_FRAX_FEED
});
feedsUpdate[4] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3AvalancheAssets.MAI_UNDERLYING,
priceFeed: PriceFeeds.AVALANCHE_V3_MAI_FEED
});

AaveV3Avalanche.ORACLE.setAssetSources(assets, sources);
return feedsUpdate;
}

function _updateV2PriceAdapters() internal {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol';
import {AaveV3PayloadBNB} from 'aave-helpers/src/v3-config-engine/AaveV3PayloadBNB.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3BNB, AaveV3BNBAssets} from 'aave-address-book/AaveV3BNB.sol';
import {PriceFeeds} from './Constants.sol';

/**
* @title Update Price Cap Adapters (CAPO)
* @author BGD Labs (@bgdlabs)
* - Snapshot: TODO
* - Discussion: TODO
*/
contract AaveV3BNB_UpdatePriceCapAdaptersCAPO_20241101 is IProposalGenericExecutor {
function execute() external {
_updateV3PriceAdapters();
}

function _updateV3PriceAdapters() internal {
address[] memory assets = new address[](3);
address[] memory sources = new address[](3);

assets[0] = AaveV3BNBAssets.USDC_UNDERLYING;
sources[0] = PriceFeeds.BNB_V3_USDC_FEED;

assets[1] = AaveV3BNBAssets.USDT_UNDERLYING;
sources[1] = PriceFeeds.BNB_V3_USDT_FEED;
contract AaveV3BNB_UpdatePriceCapAdaptersCAPO_20241101 is AaveV3PayloadBNB {
function priceFeedsUpdates()
public
pure
override
returns (IAaveV3ConfigEngine.PriceFeedUpdate[] memory)
{
IAaveV3ConfigEngine.PriceFeedUpdate[]
memory feedsUpdate = new IAaveV3ConfigEngine.PriceFeedUpdate[](3);

assets[2] = AaveV3BNBAssets.FDUSD_UNDERLYING;
sources[2] = PriceFeeds.BNB_V3_FDUSD_FEED;
feedsUpdate[0] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3BNBAssets.USDC_UNDERLYING,
priceFeed: PriceFeeds.BNB_V3_USDC_FEED
});
feedsUpdate[1] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3BNBAssets.USDT_UNDERLYING,
priceFeed: PriceFeeds.BNB_V3_USDT_FEED
});
feedsUpdate[2] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3BNBAssets.FDUSD_UNDERLYING,
priceFeed: PriceFeeds.BNB_V3_FDUSD_FEED
});

AaveV3BNB.ORACLE.setAssetSources(assets, sources);
return feedsUpdate;
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/src/interfaces/IProposalGenericExecutor.sol';
import {AaveV3PayloadBase} from 'aave-helpers/src/v3-config-engine/AaveV3PayloadBase.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3Base, AaveV3BaseAssets} from 'aave-address-book/AaveV3Base.sol';
import {PriceFeeds} from './Constants.sol';

/**
* @title Update Price Cap Adapters (CAPO)
* @author BGD Labs (@bgdlabs)
* - Snapshot: TODO
* - Discussion: TODO
*/
contract AaveV3Base_UpdatePriceCapAdaptersCAPO_20241101 is IProposalGenericExecutor {
function execute() external {
_updateV3PriceAdapters();
}

function _updateV3PriceAdapters() internal {
address[] memory assets = new address[](2);
address[] memory sources = new address[](2);

assets[0] = AaveV3BaseAssets.USDC_UNDERLYING;
sources[0] = PriceFeeds.BASE_V3_USDC_FEED;
contract AaveV3Base_UpdatePriceCapAdaptersCAPO_20241101 is AaveV3PayloadBase {
function priceFeedsUpdates()
public
pure
override
returns (IAaveV3ConfigEngine.PriceFeedUpdate[] memory)
{
IAaveV3ConfigEngine.PriceFeedUpdate[]
memory feedsUpdate = new IAaveV3ConfigEngine.PriceFeedUpdate[](2);

assets[1] = AaveV3BaseAssets.USDbC_UNDERLYING;
sources[1] = PriceFeeds.BASE_V3_USDC_FEED;
feedsUpdate[0] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3BaseAssets.USDC_UNDERLYING,
priceFeed: PriceFeeds.BASE_V3_USDC_FEED
});
feedsUpdate[1] = IAaveV3ConfigEngine.PriceFeedUpdate({
asset: AaveV3BaseAssets.USDbC_UNDERLYING,
priceFeed: PriceFeeds.BASE_V3_USDC_FEED
});

AaveV3Base.ORACLE.setAssetSources(assets, sources);
return feedsUpdate;
}
}
Loading

0 comments on commit bd04f05

Please sign in to comment.