Skip to content

Commit 2b773b8

Browse files
chore: update writeup (#17)
* chore: update deps and fix cli input * chore: add instructions to use the generator
1 parent 650d51e commit 2b773b8

File tree

5 files changed

+505
-709
lines changed

5 files changed

+505
-709
lines changed

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ The `AaveStewardsInjector` contract also introduces an `EXPIRATION_PERIOD` to di
100100

101101
```sh
102102
cp .env.example .env
103+
yarn
103104
forge install
104105
```
105106

@@ -113,6 +114,76 @@ forge test
113114

114115
<br>
115116

117+
## Instructions and FAQ's
118+
119+
### How to I use the generator tooling to bootstrap the update?
120+
121+
Run `yarn generate` on your terminal in order to start the generator. The generator is a CLI tool which will generate the required helper contract which can be then run to submit updates to the risk steward. The generator will generate the helper contract in the `src/contracts/updates` directory.
122+
123+
To get a full list of available commands run `yarn generate --help`
124+
125+
```sh
126+
yarn generate --help
127+
yarn run v1.22.19
128+
$ tsx generator/cli --help
129+
Usage: proposal-generator [options]
130+
131+
CLI to generate aave proposals
132+
133+
Options:
134+
-V, --version output the version number
135+
-f, --force force creation (might overwrite existing files)
136+
-p, --pools <pools...> (choices: "AaveV3Ethereum", "AaveV3EthereumLido", "AaveV3EthereumEtherFi", "AaveV3Polygon",
137+
"AaveV3Avalanche", "AaveV3Optimism", "AaveV3Arbitrum", "AaveV3Metis", "AaveV3Base", "AaveV3Gnosis",
138+
"AaveV3Scroll", "AaveV3BNB")
139+
-t, --title <string> aip title
140+
-a, --author <string> author
141+
-d, --discussion <string> forum link
142+
-c, --configFile <string> path to config file
143+
-h, --help display help for command
144+
```
145+
146+
Running `yarn generate` you should be able to do the risk updates:
147+
148+
```bash
149+
yarn generate
150+
yarn run v1.22.19
151+
$ tsx generator/cli
152+
? Chains this proposal targets AaveV3Ethereum
153+
? Short title of your steward update that will be used as contract name (please refrain from including author or date) TestRateUpdate
154+
? Author of your proposal BGD Labs
155+
? Link to forum discussion (Link to forum)
156+
157+
? What do you want to do on AaveV3Ethereum? (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
158+
❯◉ RateStrategiesUpdates
159+
◯ CapsUpdates (supplyCap, borrowCap)
160+
◯ CollateralsUpdates (ltv,lt,lb,debtCeiling,liqProtocolFee,eModeCategory)
161+
◯ LstPriceCapUpdates (snapshotTimestamp,snapshotRatio,maxYearlyRatioGrowthPercent)
162+
◯ StablePriceCapUpdates (priceCap)
163+
164+
? Select the assets you want to amend WETH
165+
Fetching info for WETH
166+
? optimalUtilizationRate 90 %
167+
? baseVariableBorrowRate 0 %
168+
? variableRateSlope1 2.5 %
169+
? variableRateSlope2 78 %
170+
✨ Done in 38.32s.
171+
```
172+
173+
The generator generates the scripts for doing the updates in `src/contracts/updates` directory.
174+
175+
The script can be executed by running: `make run-script network=mainnet contract_path=src/contracts/examples/EthereumExample.sol:EthereumExample broadcast=false` where the bool inside the `broadcast=` determines if the calldata should be sent to safe. The script also emits the calldata for doing the update in the console which can be used on the safe manually as well.
176+
177+
### Before I will submit anything to sign, how do I test out the update, or get visibility from what will happen?
178+
179+
Running the script generated on the contracts in `src/contracts/updates` directory with `broadcast=false`, there will files written into the diffs directory, which will show the params changed for the asset by the update, with before and after values which can be validated with what update is expected.
180+
181+
### Once I have full assurance it looks correct, how do I submit to Safe?
182+
183+
Once the script on the comments of the generated contract has been run with `broadcast=false`, there will be calldata emitted on the console with the contract to call. Please copy the calldata and the contract to execute it on (i.e RiskSteward) from the console and input it on the [gnosis safe UI](https://app.safe.global/) transaction builder.
184+
185+
If you wish to not use the UI and send the update directly please put `broadcast=true` when running the script to directly broadcast the tx using the gnosis safe.
186+
116187
## License
117188

118189
Copyright © 2024, Aave DAO, represented by its governance smart contracts.

generator/features/capsUpdates.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,24 @@ import {numberPrompt, translateJsNumberToSol} from '../prompts/numberPrompt';
88

99
export async function fetchCapsUpdate(required?: boolean): Promise<CapsUpdatePartial> {
1010
return {
11-
supplyCap: await numberPrompt({
12-
message: 'New supply cap',
13-
required,
14-
}),
15-
borrowCap: await numberPrompt({
16-
message: 'New borrow cap',
17-
required,
18-
}),
11+
supplyCap: await numberPrompt(
12+
{
13+
message: 'New supply cap',
14+
required,
15+
},
16+
{
17+
skipTransform: false,
18+
}
19+
),
20+
borrowCap: await numberPrompt(
21+
{
22+
message: 'New borrow cap',
23+
required,
24+
},
25+
{
26+
skipTransform: false,
27+
}
28+
),
1929
};
2030
}
2131

@@ -34,7 +44,7 @@ export const capsUpdates: FeatureModule<CapsUpdates> = {
3444
const response: CapsUpdates = [];
3545
for (const asset of assets) {
3646
console.log(`collecting info for ${asset}`);
37-
response.push({asset, ...(await fetchCapsUpdate())});
47+
response.push({asset, ...(await fetchCapsUpdate(true))});
3848
}
3949
return response;
4050
},
@@ -53,7 +63,7 @@ export const capsUpdates: FeatureModule<CapsUpdates> = {
5363
asset: ${translateAssetToAssetLibUnderlying(cfg.asset, pool)},
5464
supplyCap: ${translateJsNumberToSol(cfg.supplyCap)},
5565
borrowCap: ${translateJsNumberToSol(cfg.borrowCap)}
56-
});`,
66+
});`
5767
)
5868
.join('\n')}
5969

generator/features/collateralsUpdates.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {percentPrompt, translateJsPercentToSol} from '../prompts/percentPrompt';
99

1010
export async function fetchCollateralUpdate(
1111
pool: PoolIdentifier,
12-
required?: boolean,
12+
required?: boolean
1313
): Promise<CollateralUpdatePartial> {
1414
return {
1515
ltv: await percentPrompt({
@@ -24,10 +24,15 @@ export async function fetchCollateralUpdate(
2424
message: 'Liquidation bonus',
2525
required,
2626
}),
27-
debtCeiling: await numberPrompt({
28-
message: 'Debt ceiling',
29-
required,
30-
}),
27+
debtCeiling: await numberPrompt(
28+
{
29+
message: 'Debt ceiling',
30+
required,
31+
},
32+
{
33+
skipTransform: false,
34+
}
35+
),
3136
liqProtocolFee: await percentPrompt({
3237
message: 'Liquidation protocol fee',
3338
required,
@@ -73,7 +78,7 @@ export const collateralsUpdates: FeatureModule<CollateralUpdates> = {
7378
liqBonus: ${translateJsPercentToSol(cfg.liqBonus)},
7479
debtCeiling: ${translateJsNumberToSol(cfg.debtCeiling)},
7580
liqProtocolFee: ${translateJsPercentToSol(cfg.liqProtocolFee)}
76-
});`,
81+
});`
7782
)
7883
.join('\n')}
7984

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"prettier": "2.8.7",
2727
"prettier-plugin-solidity": "1.1.3",
2828
"vitest": "^2.0.4",
29-
"@bgd-labs/aave-address-book": "^4.3.1",
30-
"@bgd-labs/aave-cli": "^0.16.2",
29+
"@bgd-labs/aave-address-book": "^4.3.2",
30+
"@bgd-labs/aave-cli": "^1.1.0",
3131
"@bgd-labs/js-utils": "^1.4.2",
3232
"@inquirer/prompts": "^3.3.0",
3333
"@inquirer/testing": "^2.1.13",

0 commit comments

Comments
 (0)