From d22a16544b142c6f8f241e8d937d6afc7975d935 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Fri, 12 Jan 2024 03:17:01 +0530 Subject: [PATCH] feat: add zkEvm pool contracts --- scripts/configs/pools/polygonZkevm.ts | 30 ++++++++ scripts/generateAddresses.ts | 2 + src/AaveAddressBook.sol | 1 + src/AaveV3PolygonZkevm.sol | 105 ++++++++++++++++++++++++++ src/ts/AaveAddressBook.ts | 1 + src/ts/AaveV3PolygonZkevm.ts | 88 +++++++++++++++++++++ 6 files changed, 227 insertions(+) create mode 100644 scripts/configs/pools/polygonZkevm.ts create mode 100644 src/AaveV3PolygonZkevm.sol create mode 100644 src/ts/AaveV3PolygonZkevm.ts diff --git a/scripts/configs/pools/polygonZkevm.ts b/scripts/configs/pools/polygonZkevm.ts new file mode 100644 index 00000000..9d3a7450 --- /dev/null +++ b/scripts/configs/pools/polygonZkevm.ts @@ -0,0 +1,30 @@ +import {ChainId} from '../../generator/chains'; +import {PoolConfig} from '../types'; + +export const polygonZkevmProtoV3: PoolConfig = { + name: 'PolygonZkevm', + chainId: ChainId.zkevm, + POOL_ADDRESSES_PROVIDER: '0x36616cf17557639614c1cdDb356b1B83fc0B2132', + additionalAddresses: { + L2_ENCODER: '0x777fBA024bA1228fDa76149A4ff8B23475ed057D', + CAPS_PLUS_RISK_STEWARD: '0xAe13e4DA0952f0B8fE04E21df53716fCF799a923', + FREEZING_STEWARD: '0x33AE1f41546a2e05368Bf789b3d868813c0Ae658', + DEBT_SWAP_ADAPTER: '0xb9Ef6e27ef85fE393B9F8B8C23e794ff4596C7dF', + CONFIG_ENGINE: '0x1D0f881Ce1a646E2f27Dec3c57Fa056cB838BCC2', + POOL_ADDRESSES_PROVIDER_REGISTRY: '0x1236010CECea55998384e795B59815D871f5f94d', + RATES_FACTORY: '0x78946C514C385248b13AAf3056529a99E7E26BFC', + REPAY_WITH_COLLATERAL_ADAPTER: '0xBeC519531F0E78BcDdB295242fA4EC5251B38574', + SWAP_COLLATERAL_ADAPTER: '0x589750BA8aF186cE5B55391B0b7148cAD43a1619', + UI_INCENTIVE_DATA_PROVIDER: '0xCFDAdA7DCd2e785cF706BaDBC2B8Af5084d595e9', + UI_POOL_DATA_PROVIDER: '0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809', + WALLET_BALANCE_PROVIDER: '0x4172E6aAEC070ACB31aaCE343A58c93E4C70f44D', + WETH_GATEWAY: '0x6c23bAF050ec192afc0B967a93b83e6c5405df43', + WITHDRAW_SWAP_ADAPTER: '0x06C35Cfd3FC61eC2aC437f0d08840d5776b945af', + }, + initial: { + COLLECTOR: '0xe892E40C92c2E4D281Be59b2E6300F271d824E75', + DEFAULT_A_TOKEN_IMPL: '0xDe090EfCD6ef4b86792e2D84E55a5fa8d49D25D2', + DEFAULT_VARIABLE_DEBT_TOKEN_IMPL: '0x988B5d3863bdEE83339Be41cD31344Dfd9FD197c', + DEFAULT_STABLE_DEBT_TOKEN_IMPL: '0x96086C25d13943C80Ff9a19791a40Df6aFC08328', + }, +}; diff --git a/scripts/generateAddresses.ts b/scripts/generateAddresses.ts index e11df310..677a8340 100644 --- a/scripts/generateAddresses.ts +++ b/scripts/generateAddresses.ts @@ -22,6 +22,7 @@ import {harmonyProtoV3} from './configs/pools/harmony'; import {metisProtoV3} from './configs/pools/metis'; import {gnosisProtoV3} from './configs/pools/gnosis'; import {bnbProtoV3} from './configs/pools/bnb'; +import {polygonZkevmProtoV3} from './configs/pools/polygonZkevm'; import {optimismGoerliProtoV3, optimismProtoV3} from './configs/pools/optimism'; import { mumbaiProtoV2, @@ -114,6 +115,7 @@ async function main() { baseProtoV3, metisProtoV3, gnosisProtoV3, + polygonZkevmProtoV3, bnbProtoV3, arbitrumGoerliProtoV3, arbitrumProtoV3, diff --git a/src/AaveAddressBook.sol b/src/AaveAddressBook.sol index 560fe512..ef331dff 100644 --- a/src/AaveAddressBook.sol +++ b/src/AaveAddressBook.sol @@ -34,6 +34,7 @@ import {AaveV3Fuji} from './AaveV3Fuji.sol'; import {AaveV3Base} from './AaveV3Base.sol'; import {AaveV3Metis} from './AaveV3Metis.sol'; import {AaveV3Gnosis} from './AaveV3Gnosis.sol'; +import {AaveV3PolygonZkevm} from './AaveV3PolygonZkevm.sol'; import {AaveV3BNB} from './AaveV3BNB.sol'; import {AaveV3ArbitrumGoerli} from './AaveV3ArbitrumGoerli.sol'; import {AaveV3Arbitrum} from './AaveV3Arbitrum.sol'; diff --git a/src/AaveV3PolygonZkevm.sol b/src/AaveV3PolygonZkevm.sol new file mode 100644 index 00000000..fe91158e --- /dev/null +++ b/src/AaveV3PolygonZkevm.sol @@ -0,0 +1,105 @@ +// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +import {IPoolAddressesProvider, IPool, IPoolConfigurator, IAaveOracle, IPoolDataProvider, IACLManager} from './AaveV3.sol'; +import {ICollector} from './common/ICollector.sol'; + +library AaveV3PolygonZkevm { + // https://zkevm.polygonscan.com/address/0x36616cf17557639614c1cdDb356b1B83fc0B2132 + IPoolAddressesProvider internal constant POOL_ADDRESSES_PROVIDER = + IPoolAddressesProvider(0x36616cf17557639614c1cdDb356b1B83fc0B2132); + + // https://zkevm.polygonscan.com/address/0xb50201558B00496A145fE76f7424749556E326D8 + IPool internal constant POOL = IPool(0xb50201558B00496A145fE76f7424749556E326D8); + + // https://zkevm.polygonscan.com/address/0x7304979ec9E4EaA0273b6A037a31c4e9e5A75D16 + IPoolConfigurator internal constant POOL_CONFIGURATOR = + IPoolConfigurator(0x7304979ec9E4EaA0273b6A037a31c4e9e5A75D16); + + // https://zkevm.polygonscan.com/address/0x3e652E97ff339B73421f824F5b03d75b62F1Fb51 + IAaveOracle internal constant ORACLE = IAaveOracle(0x3e652E97ff339B73421f824F5b03d75b62F1Fb51); + + // https://zkevm.polygonscan.com/address/0x0000000000000000000000000000000000000000 + address internal constant PRICE_ORACLE_SENTINEL = 0x0000000000000000000000000000000000000000; + + // https://zkevm.polygonscan.com/address/0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741 + IPoolDataProvider internal constant AAVE_PROTOCOL_DATA_PROVIDER = + IPoolDataProvider(0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741); + + // https://zkevm.polygonscan.com/address/0x41585C50524fb8c3899B43D7D797d9486AAc94DB + IACLManager internal constant ACL_MANAGER = + IACLManager(0x41585C50524fb8c3899B43D7D797d9486AAc94DB); + + // https://zkevm.polygonscan.com/address/0xe59470B3BE3293534603487E00A44C72f2CD466d + address internal constant ACL_ADMIN = 0xe59470B3BE3293534603487E00A44C72f2CD466d; + + // https://zkevm.polygonscan.com/address/0xe892E40C92c2E4D281Be59b2E6300F271d824E75 + ICollector internal constant COLLECTOR = ICollector(0xe892E40C92c2E4D281Be59b2E6300F271d824E75); + + // https://zkevm.polygonscan.com/address/0xaD4F91D26254B6B0C6346b390dDA2991FDE2F20d + address internal constant DEFAULT_INCENTIVES_CONTROLLER = + 0xaD4F91D26254B6B0C6346b390dDA2991FDE2F20d; + + // https://zkevm.polygonscan.com/address/0xDe090EfCD6ef4b86792e2D84E55a5fa8d49D25D2 + address internal constant DEFAULT_A_TOKEN_IMPL_REV_1 = 0xDe090EfCD6ef4b86792e2D84E55a5fa8d49D25D2; + + // https://zkevm.polygonscan.com/address/0x988B5d3863bdEE83339Be41cD31344Dfd9FD197c + address internal constant DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1 = + 0x988B5d3863bdEE83339Be41cD31344Dfd9FD197c; + + // https://zkevm.polygonscan.com/address/0x96086C25d13943C80Ff9a19791a40Df6aFC08328 + address internal constant DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1 = + 0x96086C25d13943C80Ff9a19791a40Df6aFC08328; + + // https://zkevm.polygonscan.com/address/0xeb0a051be10228213BAEb449db63719d6742F7c4 + address internal constant EMISSION_MANAGER = 0xeb0a051be10228213BAEb449db63719d6742F7c4; + + // https://zkevm.polygonscan.com/address/0x777fBA024bA1228fDa76149A4ff8B23475ed057D + address internal constant L2_ENCODER = 0x777fBA024bA1228fDa76149A4ff8B23475ed057D; + + // https://zkevm.polygonscan.com/address/0xAe13e4DA0952f0B8fE04E21df53716fCF799a923 + address internal constant CAPS_PLUS_RISK_STEWARD = 0xAe13e4DA0952f0B8fE04E21df53716fCF799a923; + + // https://zkevm.polygonscan.com/address/0x33AE1f41546a2e05368Bf789b3d868813c0Ae658 + address internal constant FREEZING_STEWARD = 0x33AE1f41546a2e05368Bf789b3d868813c0Ae658; + + // https://zkevm.polygonscan.com/address/0xb9Ef6e27ef85fE393B9F8B8C23e794ff4596C7dF + address internal constant DEBT_SWAP_ADAPTER = 0xb9Ef6e27ef85fE393B9F8B8C23e794ff4596C7dF; + + // https://zkevm.polygonscan.com/address/0x1D0f881Ce1a646E2f27Dec3c57Fa056cB838BCC2 + address internal constant CONFIG_ENGINE = 0x1D0f881Ce1a646E2f27Dec3c57Fa056cB838BCC2; + + // https://zkevm.polygonscan.com/address/0x1236010CECea55998384e795B59815D871f5f94d + address internal constant POOL_ADDRESSES_PROVIDER_REGISTRY = + 0x1236010CECea55998384e795B59815D871f5f94d; + + // https://zkevm.polygonscan.com/address/0x78946C514C385248b13AAf3056529a99E7E26BFC + address internal constant RATES_FACTORY = 0x78946C514C385248b13AAf3056529a99E7E26BFC; + + // https://zkevm.polygonscan.com/address/0xBeC519531F0E78BcDdB295242fA4EC5251B38574 + address internal constant REPAY_WITH_COLLATERAL_ADAPTER = + 0xBeC519531F0E78BcDdB295242fA4EC5251B38574; + + // https://zkevm.polygonscan.com/address/0x589750BA8aF186cE5B55391B0b7148cAD43a1619 + address internal constant SWAP_COLLATERAL_ADAPTER = 0x589750BA8aF186cE5B55391B0b7148cAD43a1619; + + // https://zkevm.polygonscan.com/address/0xCFDAdA7DCd2e785cF706BaDBC2B8Af5084d595e9 + address internal constant UI_INCENTIVE_DATA_PROVIDER = 0xCFDAdA7DCd2e785cF706BaDBC2B8Af5084d595e9; + + // https://zkevm.polygonscan.com/address/0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809 + address internal constant UI_POOL_DATA_PROVIDER = 0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809; + + // https://zkevm.polygonscan.com/address/0x4172E6aAEC070ACB31aaCE343A58c93E4C70f44D + address internal constant WALLET_BALANCE_PROVIDER = 0x4172E6aAEC070ACB31aaCE343A58c93E4C70f44D; + + // https://zkevm.polygonscan.com/address/0x6c23bAF050ec192afc0B967a93b83e6c5405df43 + address internal constant WETH_GATEWAY = 0x6c23bAF050ec192afc0B967a93b83e6c5405df43; + + // https://zkevm.polygonscan.com/address/0x06C35Cfd3FC61eC2aC437f0d08840d5776b945af + address internal constant WITHDRAW_SWAP_ADAPTER = 0x06C35Cfd3FC61eC2aC437f0d08840d5776b945af; +} + +library AaveV3PolygonZkevmAssets {} + +library AaveV3PolygonZkevmEModes {} diff --git a/src/ts/AaveAddressBook.ts b/src/ts/AaveAddressBook.ts index 015c4d4f..ee1af527 100644 --- a/src/ts/AaveAddressBook.ts +++ b/src/ts/AaveAddressBook.ts @@ -31,6 +31,7 @@ export * as AaveV3Fuji from './AaveV3Fuji'; export * as AaveV3Base from './AaveV3Base'; export * as AaveV3Metis from './AaveV3Metis'; export * as AaveV3Gnosis from './AaveV3Gnosis'; +export * as AaveV3PolygonZkevm from './AaveV3PolygonZkevm'; export * as AaveV3BNB from './AaveV3BNB'; export * as AaveV3ArbitrumGoerli from './AaveV3ArbitrumGoerli'; export * as AaveV3Arbitrum from './AaveV3Arbitrum'; diff --git a/src/ts/AaveV3PolygonZkevm.ts b/src/ts/AaveV3PolygonZkevm.ts new file mode 100644 index 00000000..14ae3cdb --- /dev/null +++ b/src/ts/AaveV3PolygonZkevm.ts @@ -0,0 +1,88 @@ +// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR +// IPoolAddressesProvider https://zkevm.polygonscan.com/address/0x36616cf17557639614c1cdDb356b1B83fc0B2132 +export const POOL_ADDRESSES_PROVIDER = '0x36616cf17557639614c1cdDb356b1B83fc0B2132'; + +// IPool https://zkevm.polygonscan.com/address/0xb50201558B00496A145fE76f7424749556E326D8 +export const POOL = '0xb50201558B00496A145fE76f7424749556E326D8'; + +// IPoolConfigurator https://zkevm.polygonscan.com/address/0x7304979ec9E4EaA0273b6A037a31c4e9e5A75D16 +export const POOL_CONFIGURATOR = '0x7304979ec9E4EaA0273b6A037a31c4e9e5A75D16'; + +// IAaveOracle https://zkevm.polygonscan.com/address/0x3e652E97ff339B73421f824F5b03d75b62F1Fb51 +export const ORACLE = '0x3e652E97ff339B73421f824F5b03d75b62F1Fb51'; + +// https://zkevm.polygonscan.com/address/0x0000000000000000000000000000000000000000 +export const PRICE_ORACLE_SENTINEL = '0x0000000000000000000000000000000000000000'; + +// IPoolDataProvider https://zkevm.polygonscan.com/address/0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741 +export const AAVE_PROTOCOL_DATA_PROVIDER = '0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741'; + +// IACLManager https://zkevm.polygonscan.com/address/0x41585C50524fb8c3899B43D7D797d9486AAc94DB +export const ACL_MANAGER = '0x41585C50524fb8c3899B43D7D797d9486AAc94DB'; + +// https://zkevm.polygonscan.com/address/0xe59470B3BE3293534603487E00A44C72f2CD466d +export const ACL_ADMIN = '0xe59470B3BE3293534603487E00A44C72f2CD466d'; + +// ICollector https://zkevm.polygonscan.com/address/0xe892E40C92c2E4D281Be59b2E6300F271d824E75 +export const COLLECTOR = '0xe892E40C92c2E4D281Be59b2E6300F271d824E75'; + +// https://zkevm.polygonscan.com/address/0xaD4F91D26254B6B0C6346b390dDA2991FDE2F20d +export const DEFAULT_INCENTIVES_CONTROLLER = '0xaD4F91D26254B6B0C6346b390dDA2991FDE2F20d'; + +// https://zkevm.polygonscan.com/address/0xDe090EfCD6ef4b86792e2D84E55a5fa8d49D25D2 +export const DEFAULT_A_TOKEN_IMPL_REV_1 = '0xDe090EfCD6ef4b86792e2D84E55a5fa8d49D25D2'; + +// https://zkevm.polygonscan.com/address/0x988B5d3863bdEE83339Be41cD31344Dfd9FD197c +export const DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1 = '0x988B5d3863bdEE83339Be41cD31344Dfd9FD197c'; + +// https://zkevm.polygonscan.com/address/0x96086C25d13943C80Ff9a19791a40Df6aFC08328 +export const DEFAULT_STABLE_DEBT_TOKEN_IMPL_REV_1 = '0x96086C25d13943C80Ff9a19791a40Df6aFC08328'; + +// https://zkevm.polygonscan.com/address/0xeb0a051be10228213BAEb449db63719d6742F7c4 +export const EMISSION_MANAGER = '0xeb0a051be10228213BAEb449db63719d6742F7c4'; + +// https://zkevm.polygonscan.com/address/0x777fBA024bA1228fDa76149A4ff8B23475ed057D +export const L2_ENCODER = '0x777fBA024bA1228fDa76149A4ff8B23475ed057D'; + +// https://zkevm.polygonscan.com/address/0xAe13e4DA0952f0B8fE04E21df53716fCF799a923 +export const CAPS_PLUS_RISK_STEWARD = '0xAe13e4DA0952f0B8fE04E21df53716fCF799a923'; + +// https://zkevm.polygonscan.com/address/0x33AE1f41546a2e05368Bf789b3d868813c0Ae658 +export const FREEZING_STEWARD = '0x33AE1f41546a2e05368Bf789b3d868813c0Ae658'; + +// https://zkevm.polygonscan.com/address/0xb9Ef6e27ef85fE393B9F8B8C23e794ff4596C7dF +export const DEBT_SWAP_ADAPTER = '0xb9Ef6e27ef85fE393B9F8B8C23e794ff4596C7dF'; + +// https://zkevm.polygonscan.com/address/0x1D0f881Ce1a646E2f27Dec3c57Fa056cB838BCC2 +export const CONFIG_ENGINE = '0x1D0f881Ce1a646E2f27Dec3c57Fa056cB838BCC2'; + +// https://zkevm.polygonscan.com/address/0x1236010CECea55998384e795B59815D871f5f94d +export const POOL_ADDRESSES_PROVIDER_REGISTRY = '0x1236010CECea55998384e795B59815D871f5f94d'; + +// https://zkevm.polygonscan.com/address/0x78946C514C385248b13AAf3056529a99E7E26BFC +export const RATES_FACTORY = '0x78946C514C385248b13AAf3056529a99E7E26BFC'; + +// https://zkevm.polygonscan.com/address/0xBeC519531F0E78BcDdB295242fA4EC5251B38574 +export const REPAY_WITH_COLLATERAL_ADAPTER = '0xBeC519531F0E78BcDdB295242fA4EC5251B38574'; + +// https://zkevm.polygonscan.com/address/0x589750BA8aF186cE5B55391B0b7148cAD43a1619 +export const SWAP_COLLATERAL_ADAPTER = '0x589750BA8aF186cE5B55391B0b7148cAD43a1619'; + +// https://zkevm.polygonscan.com/address/0xCFDAdA7DCd2e785cF706BaDBC2B8Af5084d595e9 +export const UI_INCENTIVE_DATA_PROVIDER = '0xCFDAdA7DCd2e785cF706BaDBC2B8Af5084d595e9'; + +// https://zkevm.polygonscan.com/address/0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809 +export const UI_POOL_DATA_PROVIDER = '0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809'; + +// https://zkevm.polygonscan.com/address/0x4172E6aAEC070ACB31aaCE343A58c93E4C70f44D +export const WALLET_BALANCE_PROVIDER = '0x4172E6aAEC070ACB31aaCE343A58c93E4C70f44D'; + +// https://zkevm.polygonscan.com/address/0x6c23bAF050ec192afc0B967a93b83e6c5405df43 +export const WETH_GATEWAY = '0x6c23bAF050ec192afc0B967a93b83e6c5405df43'; + +// https://zkevm.polygonscan.com/address/0x06C35Cfd3FC61eC2aC437f0d08840d5776b945af +export const WITHDRAW_SWAP_ADAPTER = '0x06C35Cfd3FC61eC2aC437f0d08840d5776b945af'; + +export const CHAIN_ID = 1101; +export const ASSETS = {} as const; +export const E_MODES = {} as const;