Skip to content

Commit 4617818

Browse files
authored
fix: imports (#226)
* fix: imports from toolbox * fix: imports again
1 parent c585dd3 commit 4617818

4 files changed

Lines changed: 77 additions & 20 deletions

File tree

src/commands/governance.ts

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import {
2-
IDataWarehouse_ABI,
3-
IVotingMachineWithProofs_ABI,
4-
IVotingPortal_ABI,
5-
} from '@bgd-labs/aave-address-book/abis';
61
import type {Command} from '@commander-js/extra-typings';
72
import {confirm, input, select} from '@inquirer/prompts';
83
import {type Hex, encodeAbiParameters, encodeFunctionData, getContract} from 'viem';
@@ -20,6 +15,68 @@ const localCacheAdapter = customStorageProvider(fileSystemStorageAdapter);
2015
import {refreshCache} from '@bgd-labs/aave-v3-governance-cache/refreshCache';
2116
import {ChainList} from '@bgd-labs/toolbox';
2217

18+
const VOTING_PORTAL_ABI = [
19+
{
20+
type: 'function',
21+
name: 'VOTING_MACHINE',
22+
stateMutability: 'view',
23+
inputs: [],
24+
outputs: [{name: '', type: 'address', internalType: 'address'}],
25+
},
26+
{
27+
type: 'function',
28+
name: 'VOTING_MACHINE_CHAIN_ID',
29+
stateMutability: 'view',
30+
inputs: [],
31+
outputs: [{name: '', type: 'uint256', internalType: 'uint256'}],
32+
},
33+
] as const;
34+
35+
const VOTING_MACHINE_WITH_PROOFS_ABI = [
36+
{
37+
type: 'function',
38+
name: 'DATA_WAREHOUSE',
39+
stateMutability: 'view',
40+
inputs: [],
41+
outputs: [{name: '', type: 'address', internalType: 'address'}],
42+
},
43+
{
44+
type: 'function',
45+
name: 'submitVote',
46+
stateMutability: 'nonpayable',
47+
inputs: [
48+
{name: 'proposalId', type: 'uint256', internalType: 'uint256'},
49+
{name: 'support', type: 'bool', internalType: 'bool'},
50+
{
51+
name: 'votingBalanceProofs',
52+
type: 'tuple[]',
53+
internalType: 'struct VotingBalanceProof[]',
54+
components: [
55+
{name: 'underlyingAsset', type: 'address', internalType: 'address'},
56+
{name: 'slot', type: 'uint128', internalType: 'uint128'},
57+
{name: 'proof', type: 'bytes', internalType: 'bytes'},
58+
],
59+
},
60+
],
61+
outputs: [],
62+
},
63+
] as const;
64+
65+
const DATA_WAREHOUSE_ABI = [
66+
{
67+
type: 'function',
68+
name: 'processStorageRoot',
69+
stateMutability: 'nonpayable',
70+
inputs: [
71+
{name: 'account', type: 'address', internalType: 'address'},
72+
{name: 'blockHash', type: 'bytes32', internalType: 'bytes32'},
73+
{name: 'blockHeaderRLP', type: 'bytes', internalType: 'bytes'},
74+
{name: 'accountStateProofRLP', type: 'bytes', internalType: 'bytes'},
75+
],
76+
outputs: [],
77+
},
78+
] as const;
79+
2380
enum DialogOptions {
2481
DETAILS = 0,
2582
IPFS_TEXT = 1,
@@ -161,7 +218,7 @@ export function addCommand(program: Command) {
161218
});
162219
const portal = getContract({
163220
address: cache.proposal.votingPortal,
164-
abi: IVotingPortal_ABI,
221+
abi: VOTING_PORTAL_ABI,
165222
client: DEFAULT_GOVERNANCE_CLIENT,
166223
});
167224
const [machine, chainId] = await Promise.all([
@@ -184,7 +241,7 @@ export function addCommand(program: Command) {
184241
logSuccess(
185242
'encoded calldata',
186243
encodeFunctionData({
187-
abi: IVotingMachineWithProofs_ABI,
244+
abi: VOTING_MACHINE_WITH_PROOFS_ABI,
188245
functionName: 'submitVote',
189246
args: [selectedProposalId, support, proofs],
190247
}),
@@ -196,7 +253,7 @@ export function addCommand(program: Command) {
196253
if (moreInfo === DialogOptions.HOW_TO_REGISTER_STORAGE_ROOTS) {
197254
const portalContract = getContract({
198255
address: cache.proposal.votingPortal,
199-
abi: IVotingPortal_ABI,
256+
abi: VOTING_PORTAL_ABI,
200257
client: DEFAULT_GOVERNANCE_CLIENT,
201258
});
202259
const [machine, chainId] = await Promise.all([
@@ -205,7 +262,7 @@ export function addCommand(program: Command) {
205262
]);
206263
const machineContract = getContract({
207264
address: machine,
208-
abi: IVotingMachineWithProofs_ABI,
265+
abi: VOTING_MACHINE_WITH_PROOFS_ABI,
209266
client: getClient(Number(chainId)),
210267
});
211268
const dataWarehouse = await machineContract.read.DATA_WAREHOUSE();
@@ -234,7 +291,7 @@ export function addCommand(program: Command) {
234291
logSuccess(
235292
'Encoded callData',
236293
encodeFunctionData({
237-
abi: IDataWarehouse_ABI,
294+
abi: DATA_WAREHOUSE_ABI,
238295
functionName: 'processStorageRoot',
239296
args: [root.address, cache.proposal.snapshotBlockHash, blockRPL, accountRPL],
240297
}),
@@ -314,7 +371,7 @@ export function addCommand(program: Command) {
314371

315372
const portal = getContract({
316373
address: proposal.votingPortal,
317-
abi: IVotingPortal_ABI,
374+
abi: VOTING_PORTAL_ABI,
318375
client: DEFAULT_GOVERNANCE_CLIENT,
319376
});
320377
const chainId = await portal.read.VOTING_MACHINE_CHAIN_ID();

src/govv3/governance.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {AaveSafetyModule, AaveV3Ethereum, GovernanceV3Ethereum} from '@bgd-labs/aave-address-book';
2-
import {IGovernanceCore_ABI} from '@bgd-labs/aave-address-book/abis';
2+
import {IGovernance_ABI} from '@bgd-labs/toolbox';
33
import merge from 'deepmerge';
44
import {
55
type Client,
@@ -29,7 +29,7 @@ import {VOTING_SLOTS, WAREHOUSE_SLOTS, getAccountRPL, getProof} from './proofs';
2929
import {ProposalState, type ProposalExecutedEvent} from '@bgd-labs/aave-v3-governance-cache';
3030

3131
export interface Governance {
32-
governanceContract: GetContractReturnType<typeof IGovernanceCore_ABI, Client>;
32+
governanceContract: GetContractReturnType<typeof IGovernance_ABI, Client>;
3333
/**
3434
* Thin caching wrapper on top of getProposal.
3535
* If the proposal state is final, the proposal will be stored in json and fetched from there.
@@ -78,7 +78,7 @@ interface GetGovernanceParams {
7878

7979
export const getGovernance = ({address, client}: GetGovernanceParams): Governance => {
8080
const governanceContract = getContract({
81-
abi: IGovernanceCore_ABI,
81+
abi: IGovernance_ABI,
8282
address,
8383
client,
8484
});
@@ -110,7 +110,7 @@ export const getGovernance = ({address, client}: GetGovernanceParams): Governanc
110110
from: EOA,
111111
to: governanceContract.address,
112112
input: encodeFunctionData({
113-
abi: IGovernanceCore_ABI,
113+
abi: IGovernance_ABI,
114114
functionName: 'executeProposal',
115115
args: [proposalId],
116116
}),

src/govv3/payloadsController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {IPayloadsControllerCore_ABI} from '@bgd-labs/aave-address-book/abis';
1+
import {IPayloadsController_ABI} from '@bgd-labs/toolbox';
22
import {
33
type Client,
44
type GetContractReturnType,
@@ -27,7 +27,7 @@ export const HUMAN_READABLE_PAYLOAD_STATE = {
2727
};
2828

2929
export interface PayloadsController {
30-
controllerContract: GetContractReturnType<typeof IPayloadsControllerCore_ABI, Client>;
30+
controllerContract: GetContractReturnType<typeof IPayloadsController_ABI, Client>;
3131
getSimulationPayloadForExecution: (id: number) => Promise<TenderlyRequest>;
3232
simulatePayloadExecutionOnTenderly: (
3333
id: number,
@@ -41,7 +41,7 @@ const SLOTS = {
4141

4242
export const getPayloadsController = (address: Hex, client: Client): PayloadsController => {
4343
const controllerContract = getContract({
44-
abi: IPayloadsControllerCore_ABI,
44+
abi: IPayloadsController_ABI,
4545
address,
4646
client,
4747
});
@@ -54,7 +54,7 @@ export const getPayloadsController = (address: Hex, client: Client): PayloadsCon
5454
from: EOA,
5555
to: controllerContract.address,
5656
input: encodeFunctionData({
57-
abi: IPayloadsControllerCore_ABI,
57+
abi: IPayloadsController_ABI,
5858
functionName: 'executePayload',
5959
args: [id],
6060
}),

src/reports/raw-storage-diff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import {bytes32ToAddress} from '../utils/storageSlots';
33
import {RawStorage, SlotDiff} from './snapshot-types';
44
import {isKnownAddress} from '../govv3/utils/checkAddress';
55
import {Address, getContract, isAddress, zeroHash} from 'viem';
6-
import {IPool_ABI} from '@bgd-labs/aave-address-book/abis';
76
import {
87
getClient,
98
BlockscoutStyleSourceCode,
109
diffCode,
1110
getSourceCode,
11+
IPool_ABI,
1212
parseBlockscoutStyleSourceCode,
1313
parseEtherscanStyleSourceCode,
1414
StandardJsonInput,

0 commit comments

Comments
 (0)