diff --git a/scripts/configs/abis.ts b/scripts/configs/abis.ts index 9b77739a..310bdfd6 100644 --- a/scripts/configs/abis.ts +++ b/scripts/configs/abis.ts @@ -1,5 +1,5 @@ -import {ChainId} from '../generator/chains'; import {governanceConfigMainnet} from './governance/ethereum'; +import {mainnetProtoV2Pool, mainnetProtoV3Pool} from './pools/ethereum'; export const ABI_INTERFACES = [ 'IAaveGovernanceV2', @@ -41,4 +41,8 @@ export const DOWNLOAD_ABI_INTERFACES = [ address: governanceConfigMainnet.ADDRESSES.VM_DATA_HELPER, name: 'IVotingMachineDataHelper', }, + { + address: mainnetProtoV3Pool.additionalAddresses.UI_POOL_DATA_PROVIDER, + name: 'IUiPoolDataProvider', + }, ]; diff --git a/scripts/configs/governance/ethereum.ts b/scripts/configs/governance/ethereum.ts index 1586b947..71c18ede 100644 --- a/scripts/configs/governance/ethereum.ts +++ b/scripts/configs/governance/ethereum.ts @@ -28,6 +28,7 @@ export const governanceConfigGoerli: GovernanceConfig = { PC_DATA_HELPER: '0xbd2db358f3C82F2883132A6584e22F38A979e768', META_DELEGATE_HELPER: '0x1966133c190475E8385Dc1b4150B5f81c70DC578', GOV_DATA_HELPER: '0x160e2d1456B815d6a3d281218538dd6E2e3C841f', + GOVERNANCE_POWER_STRATEGY: '0x1ba21Fb1bDF4234CAe0AD1e02cF6750d7938E358', }, }; @@ -47,5 +48,6 @@ export const governanceConfigMainnet: GovernanceConfig = { VM_DATA_HELPER: '0x77976B51569896523EE215962Ee91ff236Fa50E8', META_DELEGATE_HELPER: '0x94363B11b37BC3ffe43AB09cff5A010352FE85dC', EMERGENCY_REGISTRY: '0x73C6Fb358dDA8e84D50e98A98F7c0dF32e15C7e9', + GOVERNANCE_POWER_STRATEGY: '0xa198Fac58E02A5C5F8F7e877895d50cFa9ad1E04', }, }; diff --git a/scripts/configs/types.ts b/scripts/configs/types.ts index 5697099a..749f3520 100644 --- a/scripts/configs/types.ts +++ b/scripts/configs/types.ts @@ -25,6 +25,7 @@ export type GovernanceV3Addresses = { PC_DATA_HELPER?: Hex; META_DELEGATE_HELPER?: Hex; EMERGENCY_REGISTRY?: Hex; + GOVERNANCE_POWER_STRATEGY?: Hex; }; export interface GovernanceConfig { diff --git a/scripts/generateABIs.ts b/scripts/generateABIs.ts index a3fa8300..8ee29c56 100644 --- a/scripts/generateABIs.ts +++ b/scripts/generateABIs.ts @@ -6,11 +6,15 @@ import {ABI_INTERFACES, DOWNLOAD_ABI_INTERFACES} from './configs/abis'; const awaitableExec = util.promisify(exec); -export async function generateABIs() { +export async function generateABIs(removeExisting: boolean) { if (existsSync('./src/ts/abis')) { - rmSync('./src/ts/abis', {recursive: true}); + if (removeExisting) { + rmSync('./src/ts/abis', {recursive: true}); + mkdirSync('./src/ts/abis'); + } + } else { + mkdirSync('./src/ts/abis'); } - mkdirSync('./src/ts/abis'); for (const INTERFACE of ABI_INTERFACES) { const {stdout, stderr} = await awaitableExec(`forge inspect ${INTERFACE} abi`); if (stderr) { @@ -25,13 +29,18 @@ export async function generateABIs() { ); } for (const INTERFACE of DOWNLOAD_ABI_INTERFACES) { + const fileName = `./src/ts/abis/${INTERFACE.name}.ts`; + if (existsSync(fileName)) { + console.log(`skipping download of abi ${INTERFACE.name} as it already exists`); + continue; + } const {stdout, stderr} = await awaitableExec(`cast interface -j ${INTERFACE.address}`); if (stderr) { throw new Error(`Failed to generate abi for ${INTERFACE.name} from ${INTERFACE.address}`); } const varName = `${INTERFACE.name}_ABI`; writeFileSync( - `./src/ts/abis/${INTERFACE.name}.ts`, + fileName, prefixWithGeneratedWarning( `export const ${varName} = ${JSON.stringify(JSON.parse(stdout.trim()), null, 2)} as const;`, ), diff --git a/scripts/generator/governanceV3Generator.ts b/scripts/generator/governanceV3Generator.ts index 923ce598..bae1ca20 100644 --- a/scripts/generator/governanceV3Generator.ts +++ b/scripts/generator/governanceV3Generator.ts @@ -74,10 +74,11 @@ function getGovernancePowerStrategy(governance: Address, publicClient: PublicCli async function getGovernanceV3Addresses({CHAIN_ID, ADDRESSES}: GovernanceConfig) { let addresses: Addresses = {...ADDRESSES}; if (ADDRESSES.GOVERNANCE) { - addresses.GOVERNANCE_POWER_STRATEGY = await getGovernancePowerStrategy( - ADDRESSES.GOVERNANCE, - RPC_PROVIDERS[CHAIN_ID], - ); + // TODO: comment back in when governance v3 is live + // addresses.GOVERNANCE_POWER_STRATEGY = await getGovernancePowerStrategy( + // ADDRESSES.GOVERNANCE, + // RPC_PROVIDERS[CHAIN_ID], + // ); addresses.GOVERNANCE = {value: addresses.GOVERNANCE, type: 'IGovernanceCore'}; } diff --git a/scripts/generator/protocolV2Generator.ts b/scripts/generator/protocolV2Generator.ts index 9864a047..3ef51875 100644 --- a/scripts/generator/protocolV2Generator.ts +++ b/scripts/generator/protocolV2Generator.ts @@ -1,6 +1,5 @@ import {Hex, PublicClient, getContract} from 'viem'; import {AddressInfo, PoolConfig, ReserveData} from '../configs/types'; -import {UI_POOL_DATA_PROVIDER_ABI} from '../abi/uipooldata_provider'; import {RPC_PROVIDERS} from './clients'; import {appendFileSync, writeFileSync} from 'fs'; import { @@ -15,6 +14,7 @@ import {LENDING_POOL_V2_ABI} from '../abi/lending_pool_v2_abi'; import {A_TOKEN_V2_ABI} from '../abi/aToken_v2_abi'; import {INCENTIVES_CONTROLLER_ABI} from '../abi/incentivesController_abi'; import {generateAssetsLibrary} from './assetsLibraryGenerator'; +import {IUiPoolDataProvider_ABI} from '../../src/ts/abis/IUiPoolDataProvider'; export interface PoolV2Addresses { POOL_ADDRESSES_PROVIDER: AddressInfo; @@ -106,7 +106,7 @@ export async function getPoolV2Addresses(pool: PoolConfig): Promise