Skip to content

Commit

Permalink
feat: add polygon zkEVM contracts (#320)
Browse files Browse the repository at this point in the history
* feat: Add Polygon ZkEVM a.DI and Gov V3 addresses

* feat: add zkEvm pool contracts

* feat: add missing addresses

* chore: some rename

* fix: rename

* fix: file name

* fix: file name

* fix: ts rename

---------

Co-authored-by: Harsh Pandey <harshsatishpandey@gmail.com>
  • Loading branch information
sendra and brotherlymite authored Jan 12, 2024
1 parent a53910d commit 772807c
Show file tree
Hide file tree
Showing 14 changed files with 342 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/configs/governance/polygonZkEvm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {ChainId} from '../../generator/chains';
import {GovernanceConfig} from '../types';

export const governanceConfigPolygonZkEvm: GovernanceConfig = {
name: 'PolygonZkEvm',
CHAIN_ID: ChainId.zkevm,
ADDRESSES: {
CROSS_CHAIN_CONTROLLER: '0xed7e0874526B9BB9E36C7e9472ed7ed324CEeE3B',
PAYLOADS_CONTROLLER: '0xa2d22795E0D85D4Cb14Cbb14Df7bb8fec1016615',
PC_DATA_HELPER: '0xF1c11BE0b4466728DDb7991A0Ac5265646ec9672',
},
};
14 changes: 14 additions & 0 deletions scripts/configs/networks/polygonZkEvm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {NetworkAddresses} from '../types';
import {ChainId} from '../../generator/chains';

export const polygonZkEvmAddresses: NetworkAddresses = {
name: 'PolygonZkEvm',
chainId: ChainId.zkevm,
addresses: {
PARASWAP_FEE_CLAIMER: '0xAe940e61E9863178b71500c9B5faE2a04Da361a1',
TRANSPARENT_PROXY_FACTORY: '0x8B6851156023f4f5A66F68BEA80851c3D905Ac93',
PROXY_ADMIN: '0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2',
CREATE_3_FACTORY: '0xE2E8Badc5d50f8a6188577B89f50701cDE2D4e19',
PROTOCOL_GUARDIAN: '0x8C05474F1f0161F71276677De0a2d8a347583c45',
},
};
30 changes: 30 additions & 0 deletions scripts/configs/pools/polygonZkEvm.ts
Original file line number Diff line number Diff line change
@@ -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',
},
};
6 changes: 6 additions & 0 deletions scripts/generateAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -57,7 +58,9 @@ import {metisAddresses} from './configs/networks/metis';
import {gnosisAddresses} from './configs/networks/gnosis';
import {bnbAddresses} from './configs/networks/bnb';
import {scrollAddresses} from './configs/networks/scroll';
import {polygonZkEvmAddresses} from './configs/networks/polygonZkEvm';
import {governanceConfigScroll} from './configs/governance/scroll';
import {governanceConfigPolygonZkEvm} from './configs/governance/polygonZkEvm';

async function main() {
// cleanup ts artifacts
Expand Down Expand Up @@ -86,6 +89,7 @@ async function main() {
governanceConfigBNB,
governanceConfigGnosis,
governanceConfigScroll,
governanceConfigPolygonZkEvm,
].map((config) => generateGovernanceLibrary(config)),
);
const v2LibraryNames = await Promise.all(
Expand All @@ -112,6 +116,7 @@ async function main() {
baseProtoV3,
metisProtoV3,
gnosisProtoV3,
polygonZkEvmProtoV3,
bnbProtoV3,
arbitrumGoerliProtoV3,
arbitrumProtoV3,
Expand All @@ -138,6 +143,7 @@ async function main() {
gnosisAddresses,
bnbAddresses,
scrollAddresses,
polygonZkEvmAddresses,
sepoliaAddresses,
mumbaiAddresses,
].map((addresses) => generateNetworkAddresses(addresses));
Expand Down
1 change: 1 addition & 0 deletions scripts/generator/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export enum ChainId {
base = 8453,
bnb = 56,
gnosis = 100,
zkevm = 1101,
}
8 changes: 8 additions & 0 deletions scripts/generator/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
base,
bsc,
gnosis,
polygonZkEvm,
} from 'viem/chains';
import {ChainId} from './chains';

Expand Down Expand Up @@ -175,4 +176,11 @@ export const RPC_PROVIDERS = {
multicall: true,
},
}),
[ChainId.zkevm]: createPublicClient({
chain: polygonZkEvm,
transport: http(),
batch: {
multicall: true,
},
}),
} as const;
3 changes: 3 additions & 0 deletions src/AaveAddressBook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {GovernanceV3Base} from './GovernanceV3Base.sol';
import {GovernanceV3BNB} from './GovernanceV3BNB.sol';
import {GovernanceV3Gnosis} from './GovernanceV3Gnosis.sol';
import {GovernanceV3Scroll} from './GovernanceV3Scroll.sol';
import {GovernanceV3PolygonZkEvm} from './GovernanceV3PolygonZkEvm.sol';
import {AaveV2EthereumAMM} from './AaveV2EthereumAMM.sol';
import {AaveV2EthereumArc} from './AaveV2EthereumArc.sol';
import {AaveV2Ethereum} from './AaveV2Ethereum.sol';
Expand All @@ -33,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';
Expand All @@ -55,6 +57,7 @@ import {MiscMetis} from './MiscMetis.sol';
import {MiscGnosis} from './MiscGnosis.sol';
import {MiscBNB} from './MiscBNB.sol';
import {MiscScroll} from './MiscScroll.sol';
import {MiscPolygonZkEvm} from './MiscPolygonZkEvm.sol';
import {MiscSepolia} from './MiscSepolia.sol';
import {MiscMumbai} from './MiscMumbai.sol';
import {AaveGovernanceV2, IGovernanceStrategy} from './AaveGovernanceV2.sol';
Expand Down
105 changes: 105 additions & 0 deletions src/AaveV3PolygonZkEvm.sol
Original file line number Diff line number Diff line change
@@ -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 {}
23 changes: 23 additions & 0 deletions src/GovernanceV3PolygonZkEvm.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR
import {IGovernanceCore, IPayloadsControllerCore, IDataWarehouse, IVotingStrategy} from './GovernanceV3.sol';

library GovernanceV3PolygonZkEvm {
// https://zkevm.polygonscan.com/address/0xed7e0874526B9BB9E36C7e9472ed7ed324CEeE3B
address internal constant CROSS_CHAIN_CONTROLLER = 0xed7e0874526B9BB9E36C7e9472ed7ed324CEeE3B;

// https://zkevm.polygonscan.com/address/0xa2d22795E0D85D4Cb14Cbb14Df7bb8fec1016615
IPayloadsControllerCore internal constant PAYLOADS_CONTROLLER =
IPayloadsControllerCore(0xa2d22795E0D85D4Cb14Cbb14Df7bb8fec1016615);

// https://zkevm.polygonscan.com/address/0xF1c11BE0b4466728DDb7991A0Ac5265646ec9672
address internal constant PC_DATA_HELPER = 0xF1c11BE0b4466728DDb7991A0Ac5265646ec9672;

// https://zkevm.polygonscan.com/address/0xe59470B3BE3293534603487E00A44C72f2CD466d
address internal constant EXECUTOR_LVL_1 = 0xe59470B3BE3293534603487E00A44C72f2CD466d;

// https://zkevm.polygonscan.com/address/0x0000000000000000000000000000000000000000
address internal constant EXECUTOR_LVL_2 = 0x0000000000000000000000000000000000000000;
}
20 changes: 20 additions & 0 deletions src/MiscPolygonZkEvm.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

library MiscPolygonZkEvm {
// https://zkevm.polygonscan.com/address/0xAe940e61E9863178b71500c9B5faE2a04Da361a1
address internal constant PARASWAP_FEE_CLAIMER = 0xAe940e61E9863178b71500c9B5faE2a04Da361a1;

// https://zkevm.polygonscan.com/address/0x8B6851156023f4f5A66F68BEA80851c3D905Ac93
address internal constant TRANSPARENT_PROXY_FACTORY = 0x8B6851156023f4f5A66F68BEA80851c3D905Ac93;

// https://zkevm.polygonscan.com/address/0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2
address internal constant PROXY_ADMIN = 0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2;

// https://zkevm.polygonscan.com/address/0xE2E8Badc5d50f8a6188577B89f50701cDE2D4e19
address internal constant CREATE_3_FACTORY = 0xE2E8Badc5d50f8a6188577B89f50701cDE2D4e19;

// https://zkevm.polygonscan.com/address/0x8C05474F1f0161F71276677De0a2d8a347583c45
address internal constant PROTOCOL_GUARDIAN = 0x8C05474F1f0161F71276677De0a2d8a347583c45;
}
3 changes: 3 additions & 0 deletions src/ts/AaveAddressBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * as GovernanceV3Base from './GovernanceV3Base';
export * as GovernanceV3BNB from './GovernanceV3BNB';
export * as GovernanceV3Gnosis from './GovernanceV3Gnosis';
export * as GovernanceV3Scroll from './GovernanceV3Scroll';
export * as GovernanceV3PolygonZkEvm from './GovernanceV3PolygonZkEvm';
export * as AaveV2EthereumAMM from './AaveV2EthereumAMM';
export * as AaveV2EthereumArc from './AaveV2EthereumArc';
export * as AaveV2Ethereum from './AaveV2Ethereum';
Expand All @@ -30,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';
Expand All @@ -52,6 +54,7 @@ export * as MiscMetis from './MiscMetis';
export * as MiscGnosis from './MiscGnosis';
export * as MiscBNB from './MiscBNB';
export * as MiscScroll from './MiscScroll';
export * as MiscPolygonZkEvm from './MiscPolygonZkEvm';
export * as MiscSepolia from './MiscSepolia';
export * as MiscMumbai from './MiscMumbai';
export * as AaveGovernanceV2 from './AaveGovernanceV2';
Expand Down
Loading

0 comments on commit 772807c

Please sign in to comment.