diff --git a/.env.example b/.env.example index ac2daa50..436a5f93 100644 --- a/.env.example +++ b/.env.example @@ -18,4 +18,4 @@ ETHERSCAN_API_KEY_AVALANCHE= ETHERSCAN_API_KEY_FANTOM= ETHERSCAN_API_KEY_OPTIMISM= ETHERSCAN_API_KEY_ARBITRUM= -ETHERSCAN_API_KEY_BASE= \ No newline at end of file +ETHERSCAN_API_KEY_BASE= diff --git a/Makefile b/Makefile index a0c15143..fd61488d 100644 --- a/Makefile +++ b/Makefile @@ -21,12 +21,14 @@ deploy-engine-arb :; forge script scripts/AaveV3ConfigEngine.s.sol:DeployEngine deploy-engine-pol :; forge script scripts/AaveV3ConfigEngine.s.sol:DeployEnginePol --rpc-url polygon --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-engine-ava :; forge script scripts/AaveV3ConfigEngine.s.sol:DeployEngineAva --rpc-url avalanche --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-engine-met :; forge script scripts/AaveV3ConfigEngine.s.sol:DeployEngineMet --rpc-url metis --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv +deploy-engine-bas :; forge script scripts/AaveV3ConfigEngine.s.sol:DeployEngineBas --rpc-url base --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-eth :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryEth --rpc-url mainnet --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-pol :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryPol --rpc-url polygon --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-opt :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryOpt --rpc-url optimism --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-arb :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryArb --rpc-url arbitrum --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-ava :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryAva --rpc-url avalanche --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-met :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryMet --rpc-url metis --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv +deploy-rates-factory-bas :; forge script scripts/V3RateStrategyFactory.s.sol:DeployRatesFactoryBas --rpc-url base --broadcast --legacy --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-forwarder-pol :; forge script scripts/CrosschainForwarders.s.sol:DeployPol --rpc-url mainnet --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-forwarder-opt :; forge script scripts/CrosschainForwarders.s.sol:DeployOpt --rpc-url mainnet --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-forwarder-arb :; forge script scripts/CrosschainForwarders.s.sol:DeployArb --rpc-url mainnet --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv @@ -37,6 +39,7 @@ deploy-steward-opt :; forge script scripts/RiskStewards.s.sol:DeployOpt --rpc-ur deploy-steward-arb :; forge script scripts/RiskStewards.s.sol:DeployArb --rpc-url arbitrum --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-steward-ava :; forge script scripts/RiskStewards.s.sol:DeployAva --rpc-url avalanche --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-steward-met :; forge script scripts/RiskStewards.s.sol:DeployMet --rpc-url metis --broadcast --ledger --legacy --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv +deploy-steward-bas :; forge script scripts/RiskStewards.s.sol:DeployBas --rpc-url base --broadcast --ledger --legacy --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-v2-eth :; forge script scripts/V2RateStrategyFactory.s.sol:DeployV2RatesFactoryEth --mnemonics random --rpc-url mainnet --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv deploy-rates-factory-v2-eth-amm :; forge script scripts/V2RateStrategyFactory.s.sol:DeployV2RatesFactoryEthAMM --mnemonics random --rpc-url mainnet --broadcast --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv diff --git a/diffs/preTestEngineAssetEModeUpdate_postTestEngineAssetEModeUpdate.md b/diffs/preTestEngineAssetEModeUpdate_postTestEngineAssetEModeUpdate.md index 3d021e29..f3dc8d41 100644 --- a/diffs/preTestEngineAssetEModeUpdate_postTestEngineAssetEModeUpdate.md +++ b/diffs/preTestEngineAssetEModeUpdate_postTestEngineAssetEModeUpdate.md @@ -7,6 +7,11 @@ | description | value before | value after | | --- | --- | --- | | eModeCategory | 0 | 1 | +| eMode.label | - | ETH correlated | +| eMode.ltv | - | 90 % | +| eMode.liquidationThreshold | - | 93 % | +| eMode.liquidationBonus | - | 1 % | +| eMode.priceSource | - | 0x0000000000000000000000000000000000000000 | ## Raw diff diff --git a/diffs/preTestEngineListing_postTestEngineListing.md b/diffs/preTestEngineListing_postTestEngineListing.md index 62500a16..4f42258f 100644 --- a/diffs/preTestEngineListing_postTestEngineListing.md +++ b/diffs/preTestEngineListing_postTestEngineListing.md @@ -53,6 +53,11 @@ | optimalStableToTotalDebtRatio | 20 % | | maxExcessStableToTotalDebtRatio | 80 % | | interestRate | ![ir](/.assets/19b2f23d55d76d891e7d30c29aa97741efed9d17.svg) | +| eMode.label | Stablecoins | +| eMode.ltv | 97 % | +| eMode.liquidationThreshold | 97.5 % | +| eMode.liquidationBonus | 1 % | +| eMode.priceSource | 0x0000000000000000000000000000000000000000 | ## Raw diff diff --git a/foundry.toml b/foundry.toml index 2569092d..343c3a8a 100644 --- a/foundry.toml +++ b/foundry.toml @@ -28,6 +28,6 @@ avalanche={key="${ETHERSCAN_API_KEY_AVALANCHE}",chainId=43114} polygon={key="${ETHERSCAN_API_KEY_POLYGON}",chainId=137} arbitrum={key="${ETHERSCAN_API_KEY_ARBITRUM}",chainId=42161} fantom={key="${ETHERSCAN_API_KEY_FANTOM}",chainId=250} -base = { key="any", chainId=8453, url='https://basescan.org/' } +base={key="${ETHERSCAN_API_KEY_BASE}",chain=8453} # See more config options https://github.com/gakonst/foundry/tree/master/config \ No newline at end of file diff --git a/lib/aave-address-book b/lib/aave-address-book index df2735e6..50b9acc8 160000 --- a/lib/aave-address-book +++ b/lib/aave-address-book @@ -1 +1 @@ -Subproject commit df2735e63e5775ab38e774db6d952cb8174f95bc +Subproject commit 50b9acc87adc355d669895bdfc884a79fd4b9abe diff --git a/scripts/AaveV3ConfigEngine.s.sol b/scripts/AaveV3ConfigEngine.s.sol index d3ed019f..d9821032 100644 --- a/scripts/AaveV3ConfigEngine.s.sol +++ b/scripts/AaveV3ConfigEngine.s.sol @@ -11,6 +11,7 @@ import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol'; import {AaveV3Polygon} from 'aave-address-book/AaveV3Polygon.sol'; import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol'; import {AaveV3Metis} from 'aave-address-book/AaveV3Metis.sol'; +import {AaveV3Base} from 'aave-address-book/AaveV3Base.sol'; import {CapsEngine} from '../src/v3-config-engine/libraries/CapsEngine.sol'; import {BorrowEngine} from '../src/v3-config-engine/libraries/BorrowEngine.sol'; import {CollateralEngine} from '../src/v3-config-engine/libraries/CollateralEngine.sol'; @@ -217,6 +218,39 @@ library DeployEngineMetLib { } } +library DeployEngineBaseLib { + function deploy() internal returns (address) { + IEngine.EngineLibraries memory engineLibraries = IEngine.EngineLibraries({ + listingEngine: Create2Utils._create2Deploy('v1', type(ListingEngine).creationCode), + eModeEngine: Create2Utils._create2Deploy('v1', type(EModeEngine).creationCode), + borrowEngine: Create2Utils._create2Deploy('v1', type(BorrowEngine).creationCode), + collateralEngine: Create2Utils._create2Deploy('v1', type(CollateralEngine).creationCode), + priceFeedEngine: Create2Utils._create2Deploy('v1', type(PriceFeedEngine).creationCode), + rateEngine: Create2Utils._create2Deploy('v1', type(RateEngine).creationCode), + capsEngine: Create2Utils._create2Deploy('v1', type(CapsEngine).creationCode) + }); + IEngine.EngineConstants memory engineConstants = IEngine.EngineConstants({ + pool: AaveV3Base.POOL, + poolConfigurator: AaveV3Base.POOL_CONFIGURATOR, + ratesStrategyFactory: IV3RateStrategyFactory(AaveV3Base.RATES_FACTORY), + oracle: AaveV3Base.ORACLE, + rewardsController: AaveV3Base.DEFAULT_INCENTIVES_CONTROLLER, + collector: address(AaveV3Base.COLLECTOR) + }); + + return + address( + new Engine( + AaveV3Base.DEFAULT_A_TOKEN_IMPL_REV_1, + AaveV3Base.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, + AaveV3Base.DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1, + engineConstants, + engineLibraries + ) + ); + } +} + contract DeployEngineEth is EthereumScript { function run() external broadcast { DeployEngineEthLib.deploy(); @@ -251,4 +285,10 @@ contract DeployEngineMet is MetisScript { function run() external broadcast { DeployEngineMetLib.deploy(); } -} \ No newline at end of file +} + +contract DeployEngineBas is BaseScript { + function run() external broadcast { + DeployEngineBaseLib.deploy(); + } +} diff --git a/scripts/RiskStewards.s.sol b/scripts/RiskStewards.s.sol index 730ab136..5b1b352c 100644 --- a/scripts/RiskStewards.s.sol +++ b/scripts/RiskStewards.s.sol @@ -10,6 +10,7 @@ import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol'; import {AaveV3Metis} from 'aave-address-book/AaveV3Metis.sol'; import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol'; import {AaveV3Optimism} from 'aave-address-book/AaveV3Optimism.sol'; +import {AaveV3Base} from 'aave-address-book/AaveV3Base.sol'; contract DeployEth is EthereumScript { function run() external broadcast { @@ -70,3 +71,13 @@ contract DeployAva is AvalancheScript { ); } } + +contract DeployBas is BaseScript { + function run() external broadcast { + new CapsPlusRiskSteward( + AaveV3Base.AAVE_PROTOCOL_DATA_PROVIDER, + IAaveV3ConfigEngine(AaveV3Base.LISTING_ENGINE), + 0xfbeB4AcB31340bA4de9C87B11dfBf7e2bc8C0bF1 + ); + } +} diff --git a/scripts/V3RateStrategyFactory.s.sol b/scripts/V3RateStrategyFactory.s.sol index af9eebec..af99d09c 100644 --- a/scripts/V3RateStrategyFactory.s.sol +++ b/scripts/V3RateStrategyFactory.s.sol @@ -11,16 +11,15 @@ import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol'; import {AaveV3Polygon} from 'aave-address-book/AaveV3Polygon.sol'; import {AaveV3Avalanche} from 'aave-address-book/AaveV3Avalanche.sol'; import {AaveV3Metis} from 'aave-address-book/AaveV3Metis.sol'; +import {AaveV3Base} from 'aave-address-book/AaveV3Base.sol'; import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol'; import {V3RateStrategyFactory} from '../src/v3-config-engine/V3RateStrategyFactory.sol'; library DeployRatesFactoryLib { // TODO check also by param, potentially there could be different contracts, but with exactly same params - function _getUniqueStrategiesOnPool(IPool pool) - internal - view - returns (IDefaultInterestRateStrategy[] memory) - { + function _getUniqueStrategiesOnPool( + IPool pool + ) internal view returns (IDefaultInterestRateStrategy[] memory) { address[] memory listedAssets = pool.getReservesList(); IDefaultInterestRateStrategy[] memory uniqueRateStrategies = new IDefaultInterestRateStrategy[]( listedAssets.length @@ -140,6 +139,17 @@ library DeployRatesFactoryMetLib { } } +library DeployRatesFactoryBasLib { + function deploy() internal returns (address, address[] memory) { + return + DeployRatesFactoryLib._createAndSetupRatesFactory( + AaveV3Base.POOL_ADDRESSES_PROVIDER, + AaveMisc.TRANSPARENT_PROXY_FACTORY_BASE, + AaveMisc.PROXY_ADMIN_BASE + ); + } +} + contract DeployRatesFactoryEth is EthereumScript { function run() external broadcast { DeployRatesFactoryEthLib.deploy(); @@ -175,3 +185,9 @@ contract DeployRatesFactoryMet is MetisScript { DeployRatesFactoryMetLib.deploy(); } } + +contract DeployRatesFactoryBas is BaseScript { + function run() external broadcast { + DeployRatesFactoryBasLib.deploy(); + } +} diff --git a/src/ScriptUtils.sol b/src/ScriptUtils.sol index 7c8da750..c9da2aef 100644 --- a/src/ScriptUtils.sol +++ b/src/ScriptUtils.sol @@ -110,4 +110,4 @@ library Create2Utils { function addressFromLast20Bytes(bytes32 bytesValue) internal pure returns (address) { return address(uint160(uint256(bytesValue))); } -} \ No newline at end of file +} diff --git a/src/v3-config-engine/AaveV3PayloadBasenet.sol b/src/v3-config-engine/AaveV3PayloadBasenet.sol new file mode 100644 index 00000000..7575b4c8 --- /dev/null +++ b/src/v3-config-engine/AaveV3PayloadBasenet.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {AaveV3Base} from 'aave-address-book/AaveV3Base.sol'; +import './AaveV3PayloadBase.sol'; + +/** + * @dev Base smart contract for an Aave v3.0.2 (compatible with 3.0.0) listing on v3 Base. + * @author BGD Labs + */ +abstract contract AaveV3PayloadBasenet is AaveV3PayloadBase(IEngine(AaveV3Base.LISTING_ENGINE)) { + function getPoolContext() public pure override returns (IEngine.PoolContext memory) { + return IEngine.PoolContext({networkName: 'Base', networkAbbreviation: 'Bas'}); + } +}