Skip to content

Commit

Permalink
feat: initial support for gov v3 (#54)
Browse files Browse the repository at this point in the history
Co-authored-by: kartojal <david@web3ops.co>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Release bot :robot <gitbot@bgdlabs.com>
  • Loading branch information
4 people authored Nov 8, 2023
1 parent 9a4b6c5 commit a2d7fd2
Show file tree
Hide file tree
Showing 67 changed files with 2,830 additions and 5,122 deletions.
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

0 comments on commit a2d7fd2

Please sign in to comment.