-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add listing engines to helpers (#52)
- Added base contracts for listings on non-Ethereum networks. - Added scripts for listing engine deployment on non-Ethereum networks.
- Loading branch information
Showing
8 changed files
with
185 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
ETHERSCAN_API_KEY= | ||
RPC_URL= | ||
PRIVATE_KEY= | ||
MNEMONIC_INDEX= | ||
LEDGER_SENDER= | ||
|
||
# Test rpc_endpoints | ||
RPC_MAINNET=https://rpc.flashbots.net | ||
RPC_AVALANCHE=https://api.avax.network/ext/bc/C/rpc | ||
RPC_OPTIMISM=https://mainnet.optimism.io | ||
RPC_POLYGON=https://polygon-rpc.com | ||
RPC_POLYGON=https://polygon-rpc.com | ||
RPC_ARBITRUM=https://arb1.arbitrum.io/rpc | ||
RPC_FANTOM=https://rpc.ftm.tools | ||
RPC_HARMONY=https://api.harmony.one | ||
|
||
ETHERSCAN_API_KEY_MAINNET= | ||
ETHERSCAN_API_KEY_POLYGON= | ||
ETHERSCAN_API_KEY_AVALANCHE= | ||
ETHERSCAN_API_KEY_FANTOM= | ||
ETHERSCAN_API_KEY_OPTIMISM= | ||
ETHERSCAN_API_KEY_ARBITRUM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
import {Script} from 'forge-std/Script.sol'; | ||
import {AaveV3Optimism} from 'aave-address-book/AaveV3Optimism.sol'; | ||
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 {GenericV3ListingEngine} from '../src/v3-listing-engine/GenericV3ListingEngine.sol'; | ||
|
||
/** | ||
* Helper contract to enforce correct chain selection in scripts | ||
*/ | ||
abstract contract WithChainIdValidation is Script { | ||
constructor(uint256 chainId) { | ||
require(block.chainid == chainId, 'CHAIN_ID_MISMATCH'); | ||
} | ||
} | ||
|
||
abstract contract OptimismScript is WithChainIdValidation { | ||
constructor() WithChainIdValidation(10) {} | ||
} | ||
|
||
abstract contract ArbitrumScript is WithChainIdValidation { | ||
constructor() WithChainIdValidation(42161) {} | ||
} | ||
|
||
abstract contract PolygonScript is WithChainIdValidation { | ||
constructor() WithChainIdValidation(137) {} | ||
} | ||
|
||
abstract contract AvalancheScript is WithChainIdValidation { | ||
constructor() WithChainIdValidation(43114) {} | ||
} | ||
|
||
contract DeployListingEngineOpt is OptimismScript { | ||
function run() external { | ||
vm.startBroadcast(); | ||
new GenericV3ListingEngine( | ||
AaveV3Optimism.POOL_CONFIGURATOR, | ||
AaveV3Optimism.ORACLE, | ||
AaveV3Optimism.DEFAULT_A_TOKEN_IMPL_REV_1, | ||
AaveV3Optimism.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Optimism.DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Optimism.DEFAULT_INCENTIVES_CONTROLLER, | ||
AaveV3Optimism.COLLECTOR | ||
); | ||
vm.stopBroadcast(); | ||
} | ||
} | ||
|
||
contract DeployListingEngineArb is ArbitrumScript { | ||
function run() external { | ||
vm.startBroadcast(); | ||
new GenericV3ListingEngine( | ||
AaveV3Arbitrum.POOL_CONFIGURATOR, | ||
AaveV3Arbitrum.ORACLE, | ||
AaveV3Arbitrum.DEFAULT_A_TOKEN_IMPL_REV_1, | ||
AaveV3Arbitrum.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Arbitrum.DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Arbitrum.DEFAULT_INCENTIVES_CONTROLLER, | ||
AaveV3Arbitrum.COLLECTOR | ||
); | ||
vm.stopBroadcast(); | ||
} | ||
} | ||
|
||
contract DeployListingEnginePol is PolygonScript { | ||
function run() external { | ||
vm.startBroadcast(); | ||
new GenericV3ListingEngine( | ||
AaveV3Polygon.POOL_CONFIGURATOR, | ||
AaveV3Polygon.ORACLE, | ||
AaveV3Polygon.DEFAULT_A_TOKEN_IMPL_REV_1, | ||
AaveV3Polygon.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Polygon.DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Polygon.DEFAULT_INCENTIVES_CONTROLLER, | ||
AaveV3Polygon.COLLECTOR | ||
); | ||
vm.stopBroadcast(); | ||
} | ||
} | ||
|
||
contract DeployListingEngineAva is AvalancheScript { | ||
function run() external { | ||
vm.startBroadcast(); | ||
new GenericV3ListingEngine( | ||
AaveV3Avalanche.POOL_CONFIGURATOR, | ||
AaveV3Avalanche.ORACLE, | ||
AaveV3Avalanche.DEFAULT_A_TOKEN_IMPL_REV_1, | ||
AaveV3Avalanche.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Avalanche.DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1, | ||
AaveV3Avalanche.DEFAULT_INCENTIVES_CONTROLLER, | ||
AaveV3Avalanche.COLLECTOR | ||
); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3ListingBase, IGenericV3ListingEngine} from './AaveV3ListingBase.sol'; | ||
|
||
/** | ||
* @dev Base smart contract for an Aave v3.0.1 (compatible with 3.0.0) listing on v3 Arbitrum. | ||
* @author BGD Labs | ||
*/ | ||
abstract contract AaveV3ListingArbitrum is AaveV3ListingBase { | ||
constructor(IGenericV3ListingEngine listingEngine) AaveV3ListingBase(listingEngine) {} | ||
|
||
function getPoolContext() | ||
public | ||
pure | ||
override | ||
returns (IGenericV3ListingEngine.PoolContext memory) | ||
{ | ||
return | ||
IGenericV3ListingEngine.PoolContext({networkName: 'Arbitrum', networkAbbreviation: 'Arb'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3ListingBase, IGenericV3ListingEngine} from './AaveV3ListingBase.sol'; | ||
|
||
/** | ||
* @dev Base smart contract for an Aave v3.0.1 (compatible with 3.0.0) listing on v3 Avalanche. | ||
* @author BGD Labs | ||
*/ | ||
abstract contract AaveV3ListingAvalanche is AaveV3ListingBase { | ||
constructor(IGenericV3ListingEngine listingEngine) AaveV3ListingBase(listingEngine) {} | ||
|
||
function getPoolContext() | ||
public | ||
pure | ||
override | ||
returns (IGenericV3ListingEngine.PoolContext memory) | ||
{ | ||
return | ||
IGenericV3ListingEngine.PoolContext({networkName: 'Avalanche', networkAbbreviation: 'Ava'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3ListingBase, IGenericV3ListingEngine} from './AaveV3ListingBase.sol'; | ||
|
||
/** | ||
* @dev Base smart contract for an Aave v3.0.1 (compatible with 3.0.0) listing on v3 Optimism. | ||
* @author BGD Labs | ||
*/ | ||
abstract contract AaveV3ListingOptimism is AaveV3ListingBase { | ||
constructor(IGenericV3ListingEngine listingEngine) AaveV3ListingBase(listingEngine) {} | ||
|
||
function getPoolContext() | ||
public | ||
pure | ||
override | ||
returns (IGenericV3ListingEngine.PoolContext memory) | ||
{ | ||
return | ||
IGenericV3ListingEngine.PoolContext({networkName: 'Optimism', networkAbbreviation: 'Opt'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters