Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial support for gov v3 #54

Merged
merged 96 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
3a9cf3a
feat: initial support for gov v3
sakulstra Aug 21, 2023
1cf6a03
feat: gov v3 adjustments
sakulstra Aug 21, 2023
1437828
fix: add startBlocks etc
sakulstra Aug 21, 2023
f9dffad
fix: properly allow simulations
sakulstra Aug 22, 2023
5d17f39
fix: return response
sakulstra Aug 22, 2023
d519760
fix: add seplia blockCreated
sakulstra Aug 22, 2023
cc7e313
fix: require gov address
sakulstra Aug 22, 2023
abbe436
fix: broken import
sakulstra Aug 22, 2023
5042db0
feat: add some exports
sakulstra Aug 22, 2023
606a867
fix: expose enum
sakulstra Aug 22, 2023
28e783e
fix: export correct type
sakulstra Aug 22, 2023
453d2a7
feat: add reports generator
sakulstra Aug 23, 2023
c026c83
feat: proposal state enum
sakulstra Aug 23, 2023
07dad2e
fix: remove types
sakulstra Aug 23, 2023
d71d915
fix: dont use finalized
sakulstra Aug 23, 2023
8d3b7ca
fix: identation
sakulstra Aug 23, 2023
01a6bba
fix: correct links
sakulstra Aug 23, 2023
7525951
fix: expose way to deploy proposal
sakulstra Aug 30, 2023
23c46e7
fix: return address
sakulstra Aug 30, 2023
8e358df
feat: make contract walletClient
sakulstra Aug 30, 2023
73bdfdf
fix: expose fork warping
sakulstra Aug 30, 2023
3673a55
fix: remove generic
sakulstra Aug 30, 2023
d528de6
feat: also warp blocks
sakulstra Sep 5, 2023
294fb45
fix: await warping
sakulstra Sep 5, 2023
29dc759
fix: use interfaces from address-book
sakulstra Sep 5, 2023
36031dd
fix: expose method to get simulation payload
sakulstra Sep 6, 2023
26b6505
stash: stash local cahnges
sakulstra Sep 6, 2023
2139238
feat: add utility for setting bits
sakulstra Sep 7, 2023
35cee9f
feat: allow simulating proposals
sakulstra Sep 7, 2023
42526f7
feat: migrate to commander
sakulstra Sep 7, 2023
99666f8
feat: add initial vote impelmentation
sakulstra Sep 7, 2023
a0f6766
feat: add initial proof utils
sakulstra Sep 7, 2023
eef58ef
fix: proofs
sakulstra Sep 7, 2023
53a605e
fix: refactor diff snapshots
sakulstra Sep 7, 2023
8e38663
fix: add some comments
sakulstra Sep 7, 2023
74971e6
fix: refactor governance commands
sakulstra Sep 11, 2023
b9d4109
feat: gov v3
sakulstra Sep 11, 2023
b9f43f7
fix: test fix
sakulstra Sep 11, 2023
b073910
feat: add npmrc
sakulstra Sep 11, 2023
0aa1903
feat: fully migrate ci
sakulstra Sep 11, 2023
41fb3fe
fix: remove gov v2
sakulstra Sep 12, 2023
17b8997
fix: expand to 32bytes
sakulstra Sep 12, 2023
b2b7d6c
feat: stash proofing
sakulstra Sep 12, 2023
88d5f20
fix: voting proof generator
sakulstra Sep 12, 2023
181d303
fix: add output
sakulstra Sep 12, 2023
096c587
fix: type & exports
sakulstra Sep 12, 2023
bd832fe
fix: fix some issues here and there
sakulstra Sep 12, 2023
a0c9134
fix: types
sakulstra Sep 12, 2023
80b7d9b
fix: export generator
sakulstra Sep 12, 2023
4a22998
fix: another type fix
sakulstra Sep 12, 2023
c7c0006
fix: improve simulation cli
sakulstra Sep 12, 2023
92812db
fix: fix governance execution [skip ci]
sakulstra Sep 12, 2023
0964185
cleanup: remove yargs
sakulstra Sep 12, 2023
f621e5e
feat: add proposal reports
sakulstra Sep 13, 2023
af85048
fix: spacing
sakulstra Sep 13, 2023
e0ea58f
votingProofs: add ability to get voting proofs
sakulstra Sep 13, 2023
5176dcb
fix: optimize the proofs
sakulstra Sep 14, 2023
f2cc05c
fix: new gov cli ui
sakulstra Sep 16, 2023
bb67522
feat: add encoded data
sakulstra Sep 16, 2023
566b2a3
storageRoots: add initial storageRoot support
sakulstra Sep 16, 2023
d87fe57
feat: stash current progress
sakulstra Sep 18, 2023
a46cfb8
fix: patch some types
sakulstra Sep 18, 2023
b178485
refactor: smal refactorings
sakulstra Sep 18, 2023
d85d6f3
fix: add scripts for fetching proofs etc
sakulstra Sep 19, 2023
98948e1
fix: typo
sakulstra Sep 19, 2023
c2368bf
fix: improve error handling
sakulstra Sep 19, 2023
af25729
fix: add some more logs
sakulstra Sep 22, 2023
2434e4a
fix: allow value tenderly utils unwrap
sakulstra Sep 25, 2023
0fe7d08
feat: expose tenderly setCode
sakulstra Sep 25, 2023
33723b0
docs: improve readme
sakulstra Sep 28, 2023
c06ff40
typo: fix typo
sakulstra Sep 28, 2023
2464556
fix: improve logs
sakulstra Oct 4, 2023
2ef907c
fix: autopad
sakulstra Oct 4, 2023
49442e9
fix: add nop tx
sakulstra Oct 4, 2023
31628d8
fix: check if txn was a success
sakulstra Oct 4, 2023
66dca0c
fix: update deps
sakulstra Oct 4, 2023
e4a2688
fix: use mainnet as default
sakulstra Oct 10, 2023
476657b
fix: remove error log
sakulstra Oct 10, 2023
535f586
fix: show correct version
sakulstra Oct 10, 2023
5552e3d
fix: remove goerli leftovers
sakulstra Oct 10, 2023
38cb1db
feat: show address if missing block explorer (#61)
kartojal Oct 11, 2023
4f6ed60
Merge branch 'main' into feat/gov-v3
sakulstra Oct 11, 2023
531fd62
fix: remove duplcate method
sakulstra Oct 11, 2023
56a951e
feat: use getProofs
sakulstra Oct 24, 2023
d6cf0f2
feat: add gnosis
sakulstra Oct 24, 2023
8ce278d
fix: stop using fallback rpc
sakulstra Oct 31, 2023
3a31ac6
fix: update payloadId undefined check
sakulstra Nov 3, 2023
3d18135
fix: update deps
sakulstra Nov 3, 2023
9bfce3a
fix: add some more logs
sakulstra Nov 3, 2023
c92485f
fix: update test
sakulstra Nov 3, 2023
921c91d
fix: use logs instead of filters
sakulstra Nov 3, 2023
5219ac6
feat: readable dates
sakulstra Nov 6, 2023
4944505
fix: fetch correct logs for executed
sakulstra Nov 6, 2023
f56689e
fix: nicer errors
sakulstra Nov 8, 2023
f740d85
fix: better error messages
sakulstra Nov 8, 2023
7d5b7ab
feat: add yarn lock
sakulstra Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
PINATA_KEY=
PINATA_SECRET=

RPC_MAINNET=
RPC_MAINNET=https://eth.llamarpc.com
RPC_ARBITRUM=
RPC_POLYGON=
RPC_OPTIMISM=
RPC_BASE=
RPC_GOERLI=
RPC_BNB=
RPC_GNOSIS=

TENDERLY_ACCESS_TOKEN=
TENDERLY_PROJECT_SLUG=
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

dist
node_modules
yarn-error.log

# proposal cache
cache
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.6.1
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# BGD Labs <> Aave CLI

## About

`aave-cli` is a command line tool providing commands to automate certain tasks when interacting with the aave protocol.
For a full overview of features you can run `aave-cli --help`

## Fork

`aave-cli fork --help` can ge used to generate tenderly forks. The cli allows executing certain proposal/actionset IDs, an address or even local payload via aave governance.
`aave-cli fork --chainId <id>` can ge used to generate tenderly forks.
The cli allows executing certain proposal/actionset IDs, an address or even local payload via aave governance.
For a full overview of commands please run `aave-cli fork --help`

## Ipfs

Expand All @@ -14,9 +19,21 @@

`aave-cli diff <from> <to>` can be used to diff two config snapshots & generate a human readable report.

## Simulate
## Governance

### Simulation

`aave-cli governance simulate [proposalId]` can be used to simulate a certain proposal on tenderly (e2e across all networks). This feature is intended to be used by systems like seatbelt.

### View

`aave-cli governance view` will start a command line ui for the aave governance.
The command line ui, explains how to vote and generates the proofs needed for voting or registering roots.

### GetStorageRoots

`aave-cli governance getStorageRoots --proposalId <id>` is a utilitiy that generates the storage roots for the data warehouse.

`aave-cli simulate-proposal [proposalId]` can be used to simulate a certain proposal on tenderly (e2e across all networks). This feature is intended to be used by systems like seatbelt.
### GetVotingProofs

**Note**: currently nothing else is done in this script. You need to manually check the tenderly changes.
In the future we plan to support seatbelt report generation from here.
`aave-cli governance getVotingProofs --proposalId <id> --voter <voter>` generates the voting proofs for a specific address.
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
},
"homepage": "https://github.com/bgd-labs/report-engine#readme",
"devDependencies": {
"@types/node-fetch": "^2.6.4",
"@types/object-hash": "^3.0.3",
"@types/yargs": "^17.0.24",
"@types/node-fetch": "^2.6.9",
"@types/object-hash": "^3.0.6",
"tsup": "^7.2.0",
"tsx": "^3.12.7",
"typescript": "^5.1.6",
"vitest": "^0.34.1"
"tsx": "^3.14.0",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"type": "module",
"main": "./dist/index.cjs",
Expand All @@ -41,7 +40,7 @@
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"types": "./dist/AaveAddressBook.d.cts",
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
Expand All @@ -52,17 +51,20 @@
"access": "public"
},
"dependencies": {
"@bgd-labs/aave-address-book": "^1.33.0",
"@bgd-labs/aave-address-book": "2.10.0",
"@commander-js/extra-typings": "^11.1.0",
"@inquirer/prompts": "^3.2.0",
"bs58": "^5.0.0",
"chalk": "^4.1.2",
"commander": "^11.0.0",
"deepmerge": "^4.3.1",
"dotenv": "^16.3.1",
"gray-matter": "^4.0.3",
"ipfs-only-hash": "^4.0.0",
"json-bigint": "^1.0.0",
"node-fetch": "^2.6.9",
"object-hash": "^3.0.0",
"viem": "^1.6.2",
"yargs": "^17.7.2",
"zod": "^3.21.4"
"viem": "^1.18.9",
"zod": "^3.22.4"
}
}
41 changes: 29 additions & 12 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
#!/usr/bin/env node
import 'dotenv/config';
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import * as ipfsCmd from './commands/ipfs-upload';
import * as diffSnapshot from './commands/diff-snaphots';
import * as simulateProposal from './commands/simulate-proposal';
import * as fork from './commands/fork';
import { Command, Option } from '@commander-js/extra-typings';
import { addCommand as addIpfsCommand } from './commands/ipfsUpload';
import { addCommand as addDiffSnapshots } from './commands/diffSnaphots';
import { addCommand as addGovernance } from './commands/governance';
import { addCommand as addFork } from './commands/fork';
import packageJson from '../package.json';

yargs(hideBin(process.argv))
.command(ipfsCmd)
.command(diffSnapshot)
.command(simulateProposal)
.command(fork)
.demandCommand().argv;
const program = new Command();

program
.name('aave-cli')
.description('CLI to interact with the aave ecosystem')
.option('-v, --verbose', 'Showing logs for all the taken steps')
.on('option:verbose', function () {
process.env.VERBOSE = 'true';
})
.addOption(
new Option('--format <format>', 'Set preferred output format').default('raw').choices(['raw', 'encoded'] as const)
)
.on('option:format', function (format) {
process.env.FORMAT = format;
})
.version(packageJson.version)
.showHelpAfterError();
addGovernance(program);
addDiffSnapshots(program);
addFork(program);
addIpfsCommand(program);

program.parse();
34 changes: 0 additions & 34 deletions src/commands/diff-snaphots.ts

This file was deleted.

24 changes: 24 additions & 0 deletions src/commands/diffSnaphots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Command } from '@commander-js/extra-typings';
import { diffReports } from '../reports/diff-reports';
import { readJsonString, readJsonFile } from '../utils/json';
import fs from 'fs';

export function addCommand(program: Command) {
program
.command('diff-snapshots')
.description('generate a snapshot diff report')
.argument('<from>')
.argument('<to>')
.option('-o, --out <string>', 'output path')
.option('--stringMode', 'expects input to be a string, not paths')
.action(async (_from, _to, options) => {
const from = options.stringMode ? readJsonString(_from) : readJsonFile(_from);
const to = options.stringMode ? readJsonString(_to) : readJsonFile(_to);
const content = await diffReports(from, to);
if (options.out) {
fs.writeFileSync(options.out, content);
} else {
console.log(content);
}
});
}
Loading