diff --git a/src/govv3/governance.ts b/src/govv3/governance.ts index de8defa..93c6bb0 100644 --- a/src/govv3/governance.ts +++ b/src/govv3/governance.ts @@ -11,7 +11,12 @@ import { } from 'viem'; import merge from 'deepmerge'; import { FilterLogWithTimestamp, getLogs } from '../utils/logs'; -import { IGovernanceCore_ABI } from '@bgd-labs/aave-address-book'; +import { + AaveSafetyModule, + AaveV3Ethereum, + GovernanceV3Ethereum, + IGovernanceCore_ABI, +} from '@bgd-labs/aave-address-book'; import { TenderlyRequest, TenderlySimulationResponse, tenderly } from '../utils/tenderlyClient'; import { EOA } from '../utils/constants'; import { @@ -24,9 +29,6 @@ import { Proof, VOTING_SLOTS, WAREHOUSE_SLOTS, getAccountRPL, getProof } from '. import { readJSONCache, writeJSONCache } from '../utils/cache'; import { logInfo } from '../utils/logger'; -// TODO remove once final -const AaveSafetyModule = { STK_AAVE: '0x1406A9Ea2B0ec8FD4bCa4F876DAae2a70a9856Ec' } as const; - type CreatedLog = FilterLogWithTimestamp; type QueuedLog = FilterLogWithTimestamp; type CanceledLog = FilterLogWithTimestamp; @@ -288,7 +290,6 @@ export const getGovernance = ({ async getVotingProofs(proposalId: bigint, voter: Hex, votingChainId: bigint) { const proposal = await getProposal(proposalId); - // TODO: replace with real addresses const [stkAaveProof, aaveProof, aAaveProof, representativeProof] = await Promise.all([ getProof( publicClient, @@ -298,28 +299,25 @@ export const getGovernance = ({ ), getProof( publicClient, - '0xb6D88BfC5b145a558b279cf7692e6F02064889d0', - [getSolidityStorageSlotAddress(VOTING_SLOTS['0xb6D88BfC5b145a558b279cf7692e6F02064889d0'].balance, voter)], + AaveV3Ethereum.ASSETS.AAVE.UNDERLYING, + [getSolidityStorageSlotAddress(VOTING_SLOTS[AaveV3Ethereum.ASSETS.AAVE.UNDERLYING].balance, voter)], proposal.snapshotBlockHash ), getProof( publicClient, - '0xD1ff82609FB63A0eee6FE7D2896d80d29491cCCd', + AaveV3Ethereum.ASSETS.AAVE.A_TOKEN, [ - getSolidityStorageSlotAddress(VOTING_SLOTS['0xD1ff82609FB63A0eee6FE7D2896d80d29491cCCd'].balance, voter), - getSolidityStorageSlotAddress(VOTING_SLOTS['0xD1ff82609FB63A0eee6FE7D2896d80d29491cCCd'].delegation, voter), + getSolidityStorageSlotAddress(VOTING_SLOTS[AaveV3Ethereum.ASSETS.AAVE.A_TOKEN].balance, voter), + getSolidityStorageSlotAddress(VOTING_SLOTS[AaveV3Ethereum.ASSETS.AAVE.A_TOKEN].delegation, voter), ], proposal.snapshotBlockHash ), getProof( publicClient, - '0x586207Df62c7D5D1c9dBb8F61EdF77cc30925C4F', + GovernanceV3Ethereum.GOVERNANCE, [ getSolidityStorageSlotBytes( - getSolidityStorageSlotAddress( - VOTING_SLOTS['0x586207Df62c7D5D1c9dBb8F61EdF77cc30925C4F'].representative, - voter - ), + getSolidityStorageSlotAddress(VOTING_SLOTS[GovernanceV3Ethereum.GOVERNANCE].representative, voter), toHex(votingChainId, { size: 32 }) ), ], diff --git a/src/govv3/proofs.ts b/src/govv3/proofs.ts index ec32dd2..3e29897 100644 --- a/src/govv3/proofs.ts +++ b/src/govv3/proofs.ts @@ -1,9 +1,6 @@ -import { GovernanceV3Goerli } from '@bgd-labs/aave-address-book'; +import { AaveSafetyModule, AaveV3Ethereum, GovernanceV3Ethereum } from '@bgd-labs/aave-address-book'; import { Block, Hex, PublicClient, fromRlp, toHex, toRlp } from 'viem'; -// TODO remove once final -const AaveSafetyModule = { STK_AAVE: '0x1406A9Ea2B0ec8FD4bCa4F876DAae2a70a9856Ec' } as const; - /** * Slots that represent configuration values relevant for all accounts */ @@ -18,12 +15,12 @@ export const WAREHOUSE_SLOTS = { */ export const VOTING_SLOTS = { [AaveSafetyModule.STK_AAVE]: { balance: 0n }, // balance - ['0xD1ff82609FB63A0eee6FE7D2896d80d29491cCCd' /*AaveV3Ethereum.ASSETS.AAVE.A_TOKEN*/]: { + [AaveV3Ethereum.ASSETS.AAVE.A_TOKEN]: { balance: 52n, // balance delegation: 64n, }, // delegation - ['0xb6D88BfC5b145a558b279cf7692e6F02064889d0' /*AaveV3Ethereum.ASSETS.AAVE.UNDERLYING*/]: { balance: 0n }, // balance - [GovernanceV3Goerli.GOVERNANCE]: { representative: 9n }, // representative + [AaveV3Ethereum.ASSETS.AAVE.UNDERLYING]: { balance: 0n }, // balance + [GovernanceV3Ethereum.GOVERNANCE]: { representative: 9n }, // representative } as const; export interface Proof {