Skip to content

Commit

Permalink
feat: gho libraries (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Nov 25, 2024
1 parent 29c04b5 commit c63b6ab
Show file tree
Hide file tree
Showing 36 changed files with 268 additions and 326 deletions.
67 changes: 30 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
},
"homepage": "https://github.com/bgd-labs/aave-address-book#readme",
"devDependencies": {
"@bgd-labs/react-web3-icons": "^1.5.3",
"@bgd-labs/rpc-env": "^1.0.3",
"@bgd-labs/react-web3-icons": "^1.7.2",
"@bgd-labs/rpc-env": "^2.1.2",
"@types/node": "^22.4.1",
"@uniswap/token-lists": "^1.0.0-beta.33",
"ajv": "^8.12.0",
Expand Down
27 changes: 14 additions & 13 deletions safe.csv
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,19 @@ address,name,chainId
0xC7be5307ba715ce89b152f3Df0658295b3dbA8E2,AaveV3EthereumLido WALLET_BALANCE_PROVIDER,1
0x0B8C700917a6991FEa7198dDFC80bc8962b5055D,AaveV3EthereumLido WETH_GATEWAY,1
0x43eDB797834151D041619EEF833Edc784B509dAE,AaveV3EthereumLido WITHDRAW_SWAP_ADAPTER,1
0x5756880B6a1EAba0175227bf02a7E87c1e02B28C,GhoEthereum GHO_CCIP_TOKEN_POOL,1
0xb639D208Bcf0589D54FaC24E655C79EC529762B8,GhoEthereum GHO_FLASHMINTER_FACILITATOR,1
0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b,GhoEthereum GHO_LIQUIDITY_COMMITTEE,1
0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f,GhoEthereum GHO_TOKEN,1
0x167527DB01325408696326e3580cd8e55D99Dc1A,GhoEthereum GSM_REGISTRY,1
0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578,GhoEthereum GSM_USDC,1
0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,GhoEthereum GSM_USDC_FEE_STRATEGY,1
0xef6beCa8D9543eC007bceA835aF768B58F730C1f,GhoEthereum GSM_USDC_ORACLE_SWAP_FREEZER,1
0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a,GhoEthereum GSM_USDC_PRICE_STRATEGY,1
0x686F8D21520f4ecEc7ba577be08354F4d1EB8262,GhoEthereum GSM_USDT,1
0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,GhoEthereum GSM_USDT_FEE_STRATEGY,1
0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5,GhoEthereum GSM_USDT_ORACLE_SWAP_FREEZER,1
0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c,GhoEthereum GSM_USDT_PRICE_STRATEGY,1
0xEd42a7D8559a463722Ca4beD50E0Cc05a386b0e1,GovernanceV3Ethereum CROSS_CHAIN_CONTROLLER,1
0x1699FE9CaDC8a0b6c93E06B62Ab4592a0fFEcF61,GovernanceV3Ethereum DATA_WAREHOUSE,1
0x73C6Fb358dDA8e84D50e98A98F7c0dF32e15C7e9,GovernanceV3Ethereum EMERGENCY_REGISTRY,1
Expand Down Expand Up @@ -765,18 +778,6 @@ address,name,chainId
0xcc3C54B95f3f1867A43009B80ed4DD930E3cE2F7,MiscEthereum CREATE_3_FACTORY,1
0x25F2226B597E8F9514B3F68F00f494cF4f286491,MiscEthereum ECOSYSTEM_RESERVE,1
0xb49f677943BC038e9857d61E7d053CaA2C1734C1,MiscEthereum EUR_USD_AGGREGATOR,1
0x5756880B6a1EAba0175227bf02a7E87c1e02B28C,MiscEthereum GHO_CCIP_TOKEN_POOL,1
0xb639D208Bcf0589D54FaC24E655C79EC529762B8,MiscEthereum GHO_FLASHMINTER_FACILITATOR,1
0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f,MiscEthereum GHO_TOKEN,1
0x167527DB01325408696326e3580cd8e55D99Dc1A,MiscEthereum GSM_REGISTRY,1
0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578,MiscEthereum GSM_USDC,1
0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,MiscEthereum GSM_USDC_FEE_STRATEGY,1
0xef6beCa8D9543eC007bceA835aF768B58F730C1f,MiscEthereum GSM_USDC_ORACLE_SWAP_FREEZER,1
0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a,MiscEthereum GSM_USDC_PRICE_STRATEGY,1
0x686F8D21520f4ecEc7ba577be08354F4d1EB8262,MiscEthereum GSM_USDT,1
0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5,MiscEthereum GSM_USDT_FEE_STRATEGY,1
0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5,MiscEthereum GSM_USDT_ORACLE_SWAP_FREEZER,1
0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c,MiscEthereum GSM_USDT_PRICE_STRATEGY,1
0x9abf798f5314BFd793A9E57A654BEd35af4A1D60,MiscEthereum PARASWAP_FEE_CLAIMER,1
0x2CFe3ec4d5a6811f4B8067F0DE7e47DfA938Aa30,MiscEthereum PROTOCOL_GUARDIAN,1
0xD3cF979e676265e4f6379749DECe4708B9A22476,MiscEthereum PROXY_ADMIN,1
Expand Down Expand Up @@ -1781,6 +1782,7 @@ address,name,chainId
0xBc790382B3686abffE4be14A030A96aC6154023a,AaveV3Arbitrum WALLET_BALANCE_PROVIDER,42161
0x5760E34c4003752329bC77790B1De44C2799F8C3,AaveV3Arbitrum WETH_GATEWAY,42161
0x5598BbFA2f4fE8151f45bBA0a3edE1b54B51a0a9,AaveV3Arbitrum WITHDRAW_SWAP_ADAPTER,42161
0xF168B83598516A532a85995b52504a2Fa058C068,GhoArbitrum GHO_CCIP_TOKEN_POOL,42161
0xCbFB78a3Eeaa611b826E37c80E4126c8787D29f0,GovernanceV3Arbitrum CROSS_CHAIN_CONTROLLER,42161
0xFF1137243698CaA18EE364Cc966CF0e02A4e6327,GovernanceV3Arbitrum EXECUTOR_LVL_1,42161
0x1A0581dd5C7C3DA4Ba1CDa7e0BcA7286afc4973b,GovernanceV3Arbitrum GOVERNANCE_GUARDIAN,42161
Expand All @@ -1789,7 +1791,6 @@ address,name,chainId
0xE3B770Dc4ae3f8bECaB3Ed12dE692c741603e16A,GovernanceV3Arbitrum PC_DATA_HELPER,42161
0xaa944aD95e51CB83C1f35FAEEDfC7d2c31B0BB4d,MiscArbitrum AAVE_CL_ROBOT_OPERATOR,42161
0x3b56998Ec06477704622ca8e2eA1b4db134cec32,MiscArbitrum CREATE_3_FACTORY,42161
0xF168B83598516A532a85995b52504a2Fa058C068,MiscArbitrum GHO_CCIP_TOKEN_POOL,42161
0x7d9103572bE58FfE99dc390E8246f02dcAe6f611,MiscArbitrum LEGACY_BRIDGE_EXECUTOR,42161
0x9abf798f5314BFd793A9E57A654BEd35af4A1D60,MiscArbitrum PARASWAP_FEE_CLAIMER,42161
0xCb45E82419baeBCC9bA8b1e5c7858e48A3B26Ea6,MiscArbitrum PROTOCOL_GUARDIAN,42161
Expand Down
65 changes: 5 additions & 60 deletions scripts/clients.ts
Original file line number Diff line number Diff line change
@@ -1,73 +1,18 @@
import {Chain, HttpTransportConfig, createClient, http} from 'viem';
import {
mainnet,
arbitrum,
polygon,
optimism,
metis,
base,
baseSepolia,
sepolia,
bsc,
avalanche,
gnosis,
polygonZkEvm,
scroll,
celo,
avalancheFuji,
optimismSepolia,
scrollSepolia,
arbitrumSepolia,
// deprecated
harmonyOne,
fantomTestnet,
fantom,
zksync,
} from 'viem/chains';
import {HttpTransportConfig, createClient, http} from 'viem';
import {Client} from 'viem';
import {ChainId, getRPCUrl} from '@bgd-labs/rpc-env';
import {ChainList, getRPCUrl} from '@bgd-labs/rpc-env';

const commonConfig: HttpTransportConfig = {timeout: 30_000, batch: true};
const batchConfig = {batch: {multicall: true}};

export const CHAIN_ID_CHAIN_MAP: Record<number, Chain> = {
[ChainId.mainnet]: mainnet,
[ChainId.sepolia]: sepolia,
[ChainId.optimism]: optimism,
[ChainId.optimism_sepolia]: optimismSepolia,
[ChainId.bnb]: bsc,
[ChainId.gnosis]: gnosis,
[ChainId.polygon]: polygon,
[ChainId.fantom]: fantom,
[ChainId.fantom_testnet]: fantomTestnet,
[ChainId.zksync]: zksync,
[ChainId.metis]: metis,
[ChainId.base]: base,
[ChainId.base_sepolia]: baseSepolia,
[ChainId.arbitrum_one]: arbitrum,
[ChainId.arbitrum_sepolia]: arbitrumSepolia,
[ChainId.avalanche]: avalanche,
[ChainId.fuji]: avalancheFuji,
[ChainId.scroll]: scroll,
[ChainId.scroll_sepolia]: scrollSepolia,
[ChainId.harmony]: harmonyOne,
[ChainId.zkEVM]: polygonZkEvm,
[ChainId.celo]: celo,
};

const clientCache: Record<number, Client> = {};

export function getClient(chainId: number) {
if (!clientCache[chainId]) {
let rpcURL;
try {
rpcURL = getRPCUrl(chainId as any, process.env.ALCHEMY_API_KEY);
} catch (e) {
// if we cannot find an rpc in env we'll pass undefined
// which will select the most reliable public rpc
}
const rpcURL = getRPCUrl(chainId as any, {alchemyKey: process.env.ALCHEMY_API_KEY});

clientCache[chainId] = createClient({
chain: CHAIN_ID_CHAIN_MAP[chainId],
chain: ChainList[chainId],
transport: http(rpcURL, commonConfig),
...batchConfig,
});
Expand Down
10 changes: 10 additions & 0 deletions scripts/configs/gho/arbitrum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ChainId} from '@bgd-labs/rpc-env';
import {GhoAddresses} from '../types';

export const ghoArbitrum: GhoAddresses = {
name: 'Arbitrum',
chainId: ChainId.arbitrum,
addresses: {
GHO_CCIP_TOKEN_POOL: '0xF168B83598516A532a85995b52504a2Fa058C068',
},
};
23 changes: 23 additions & 0 deletions scripts/configs/gho/ethereum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {ChainId} from '@bgd-labs/rpc-env';
import {GhoAddresses} from '../types';

export const ghoEthereum: GhoAddresses = {
name: 'Ethereum',
chainId: ChainId.mainnet,
addresses: {
GHO_TOKEN: '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f',
GHO_CCIP_TOKEN_POOL: '0x5756880B6a1EAba0175227bf02a7E87c1e02B28C',
GHO_FLASHMINTER_FACILITATOR: '0xb639D208Bcf0589D54FaC24E655C79EC529762B8',
GHO_LIQUIDITY_COMMITTEE: '0xA1c93D2687f7014Aaf588c764E3Ce80aF016229b',
// TODO: perhaps makes sense to create a generator for GSM to automatically pull GSMs, for now let's see how this evolves
GSM_REGISTRY: '0x167527DB01325408696326e3580cd8e55D99Dc1A',
GSM_USDC: '0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578',
GSM_USDT: '0x686F8D21520f4ecEc7ba577be08354F4d1EB8262',
GSM_USDC_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5',
GSM_USDT_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5',
GSM_USDC_PRICE_STRATEGY: '0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a',
GSM_USDT_PRICE_STRATEGY: '0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c',
GSM_USDC_ORACLE_SWAP_FREEZER: '0xef6beCa8D9543eC007bceA835aF768B58F730C1f',
GSM_USDT_ORACLE_SWAP_FREEZER: '0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5',
},
};
2 changes: 1 addition & 1 deletion scripts/configs/governance/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {GovernanceConfig} from '../types';

export const governanceConfigArbitrum: GovernanceConfig = {
name: 'Arbitrum',
CHAIN_ID: ChainId.arbitrum_one,
CHAIN_ID: ChainId.arbitrum,
ADDRESSES: {
CROSS_CHAIN_CONTROLLER: '0xCbFB78a3Eeaa611b826E37c80E4126c8787D29f0',
PAYLOADS_CONTROLLER: '0x89644CA1bB8064760312AE4F03ea41b05dA3637C',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {GovernanceConfig} from '../types';

export const governanceConfigFuji: GovernanceConfig = {
name: 'Fuji',
CHAIN_ID: ChainId.fuji,
CHAIN_ID: ChainId.avalanche_fuji,
ADDRESSES: {
CROSS_CHAIN_CONTROLLER: '0x5488A48E5C22175548E8d68622211F5928cBbf23',
VOTING_MACHINE: '0x79Edd77c76F95b6b69907CaD1d8241F9DB0e3FD0',
Expand Down
3 changes: 1 addition & 2 deletions scripts/configs/networks/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const arbitrumAddresses: NetworkAddresses<{
LEGACY_BRIDGE_EXECUTOR: Hex;
}> = {
name: 'Arbitrum',
chainId: ChainId.arbitrum_one,
chainId: ChainId.arbitrum,
addresses: {
PARASWAP_FEE_CLAIMER: '0x9abf798f5314BFd793A9E57A654BEd35af4A1D60',
TRANSPARENT_PROXY_FACTORY: '0x9b643d4ac937bee8bfb1ec76401c22e18c318429',
Expand All @@ -18,7 +18,6 @@ export const arbitrumAddresses: NetworkAddresses<{
PROTOCOL_GUARDIAN: '0xCb45E82419baeBCC9bA8b1e5c7858e48A3B26Ea6',
wstETH_stETH_AGGREGATOR: '0xB1552C5e96B312d0Bf8b554186F846C40614a540',
rETH_ETH_AGGREGATOR: '0xF3272CAfe65b190e76caAF483db13424a3e23dD2',
GHO_CCIP_TOKEN_POOL: '0xF168B83598516A532a85995b52504a2Fa058C068',
LEGACY_BRIDGE_EXECUTOR: '0x7d9103572bE58FfE99dc390E8246f02dcAe6f611',
},
};
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const avalancheAddresses: NetworkAddresses = {

export const avalancheFujiAddresses: NetworkAddresses = {
name: 'Fuji',
chainId: ChainId.fuji,
chainId: ChainId.avalanche_fuji,
addresses: {
GHO_TOKEN: '0x9c04928Cc678776eC1C1C0E46ecC03a5F47A7723',
TRANSPARENT_PROXY_FACTORY: '0x5f4d15d761528c57a5C30c43c1DAb26Fc5452731',
Expand Down
16 changes: 0 additions & 16 deletions scripts/configs/networks/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ export const ethereumAddresses: NetworkAddresses<{
PROXY_ADMIN_LONG: Hex;
AAVE_SWAPPER: Hex;
AAVE_POL_ETH_BRIDGE: Hex;
GSM_REGISTRY: Hex;
GSM_USDC: Hex;
GSM_USDT: Hex;
sDAI_POT: Hex;
stEUR: Hex;
agEUR_EUR_AGGREGATOR: Hex;
Expand All @@ -35,19 +32,6 @@ export const ethereumAddresses: NetworkAddresses<{
AAVE_CL_ROBOT_OPERATOR: '0x1cDF8879eC8bE012bA959EB515b11008E0cb6323',
PROTOCOL_GUARDIAN: '0x2CFe3ec4d5a6811f4B8067F0DE7e47DfA938Aa30',
AAVE_MERKLE_DISTRIBUTOR: '0xa88c6D90eAe942291325f9ae3c66f3563B93FE10',
GHO_TOKEN: '0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f',
GHO_FLASHMINTER_FACILITATOR: '0xb639D208Bcf0589D54FaC24E655C79EC529762B8',
GHO_CCIP_TOKEN_POOL: '0x5756880B6a1EAba0175227bf02a7E87c1e02B28C',
// TODO: perhaps makes sense to create a generator for GSM to automatically pull GSMs, for now let's see how this evolves
GSM_REGISTRY: '0x167527DB01325408696326e3580cd8e55D99Dc1A',
GSM_USDC: '0x0d8eFfC11dF3F229AA1EA0509BC9DFa632A13578',
GSM_USDT: '0x686F8D21520f4ecEc7ba577be08354F4d1EB8262',
GSM_USDC_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5',
GSM_USDT_FEE_STRATEGY: '0xD4478A76aCeA81D3768A0ACB6e38f25eEB6Eb1B5',
GSM_USDC_PRICE_STRATEGY: '0x430BEdcA5DfA6f94d1205Cb33AB4f008D0d9942a',
GSM_USDT_PRICE_STRATEGY: '0x4c707764cbFB4FFa078e169e6b8A6AdbE7526a2c',
GSM_USDC_ORACLE_SWAP_FREEZER: '0xef6beCa8D9543eC007bceA835aF768B58F730C1f',
GSM_USDT_ORACLE_SWAP_FREEZER: '0x71381e6718b37C12155CB961Ca3D374A8BfFa0e5',
sDAI_POT: '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7',
stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23',
agEUR_EUR_AGGREGATOR: '0xb4d5289C58CE36080b0748B47F859D8F50dFAACb',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {PoolConfig} from '../types';

export const arbitrumProtoV3: PoolConfig = {
name: 'Arbitrum',
chainId: ChainId.arbitrum_one,
chainId: ChainId.arbitrum,
POOL_ADDRESSES_PROVIDER: '0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb',
additionalAddresses: {
CAPS_PLUS_RISK_STEWARD: '0xADf86b537eF08591c2777E144322E8b0Ca7E82a7',
Expand Down
4 changes: 2 additions & 2 deletions scripts/configs/pools/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {PoolConfig} from '../types';

export const fujiProtoV2: PoolConfig = {
name: 'Fuji',
chainId: ChainId.fuji,
chainId: ChainId.avalanche_fuji,
POOL_ADDRESSES_PROVIDER: '0x7fdC1FdF79BE3309bf82f4abdAD9f111A6590C0f',
additionalAddresses: {
FAUCET: '0x90E5BAc5A98fff59617080848959f44eACB4Cd7B',
Expand All @@ -17,7 +17,7 @@ export const fujiProtoV2: PoolConfig = {

export const fujiProtoV3: PoolConfig = {
name: 'Fuji',
chainId: ChainId.fuji,
chainId: ChainId.avalanche_fuji,
POOL_ADDRESSES_PROVIDER: '0x07D04EfAAA0Ac69D19d107795aF247C42Eb50F1C',
additionalAddresses: {
CONFIG_ENGINE: '0x4058FE01Aa090E0841F4E08f79D2607C4861142E',
Expand Down
Loading

0 comments on commit c63b6ab

Please sign in to comment.