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: add snapshot diffs and generator #10

Merged
merged 16 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ RPC_BASE=https://base.llamarpc.com
RPC_ZKEVM=https://zkevm-rpc.com
RPC_GNOSIS=https://rpc.ankr.com/gnosis
RPC_BNB=https://binance.llamarpc.com
RPC_SCROLL=https://rpc.scroll.io
RPC_ZKSYNC=https://mainnet.era.zksync.io

# Etherscan api keys for verification & download utils
ETHERSCAN_API_KEY_MAINNET=
Expand All @@ -30,5 +32,5 @@ ETHERSCAN_API_KEY_BASE=
ETHERSCAN_API_KEY_ZKEVM=
ETHERSCAN_API_KEY_GNOSIS=
ETHERSCAN_API_KEY_BNB=


ETHERSCAN_API_KEY_SCROLL=
ETHERSCAN_API_KEY_ZKSYNC=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# build and cache
cache/
out/
reports/
zkout/

# general
.env
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "lib/protocol-v3.1-upgrade"]
path = lib/protocol-v3.1-upgrade
url = https://github.com/bgd-labs/protocol-v3.1-upgrade
[submodule "lib/aave-capo"]
path = lib/aave-capo
url = https://github.com/bgd-labs/aave-capo
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/bgd-labs/aave-helpers
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ git-diff :
@mkdir -p diffs
@npx prettier ${before} ${after} --write
@printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --diff-algorithm=patience --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md

# Deploy
deploy-ledger :; FOUNDRY_PROFILE=${chain} forge script $(if $(filter zksync,${chain}),--zksync) ${contract} --rpc-url ${chain} $(if ${dry},--sender 0x25F2226B597E8F9514B3F68F00f494cF4f286491 -vvvv, --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv --slow --broadcast)
deploy-pk :; FOUNDRY_PROFILE=${chain} forge script $(if $(filter zksync,${chain}),--zksync) ${contract} --rpc-url ${chain} $(if ${dry},--sender 0x25F2226B597E8F9514B3F68F00f494cF4f286491 -vvvv, --private-key ${PRIVATE_KEY} --verify -vvvv --slow --broadcast)

run-script:; FOUNDRY_PROFILE=${network} forge script ${contract_path} --rpc-url ${network} --sig "run(bool)" ${broadcast} -vv
25 changes: 10 additions & 15 deletions certora/confs/rules.conf
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
{
"files": [
"certora/munged/src/contracts/RiskSteward.sol",
"lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol"
],
"link": [
"RiskSteward:CONFIG_ENGINE=AaveV3ConfigEngine",
],
"packages": [
"ds-test=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/forge-std/lib/ds-test/src",
"forge-std=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/forge-std/src",
"aave-v3-origin=lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src",
"aave-helpers=lib/protocol-v3.1-upgrade/lib/aave-helpers/src",
"aave-address-book=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/src",
"solidity-utils=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/solidity-utils/src",
"lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book:aave-v3-core=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core",
"lib/aave-helpers/lib/aave-address-book:aave-v3-core=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core",
"aave-helpers=lib/aave-helpers",
"forge-std=lib/aave-helpers/lib/forge-std/src",
"aave-address-book=lib/aave-helpers/lib/aave-address-book/src",
"solidity-utils=lib/aave-helpers/lib/solidity-utils/src",
"aave-v3-origin=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src",
"aave-v3-core=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/core",
"aave-v3-periphery=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/periphery",
"aave-capo=lib/aave-capo/src",
"lib/aave-capo:cl-synchronicity-price-adapter=lib/aave-capo/lib/cl-synchronicity-price-adapter/src",
"@aave/core-v3=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core",
"@aave/periphery-v3=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-periphery",
"aave-v3-core=lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src/core",
"aave-v3-periphery=lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src/periphery",
"protocol-v3.1-upgrade=lib/protocol-v3.1-upgrade"
"lib/aave-capo:cl-synchronicity-price-adapter=lib/aave-capo/lib/cl-synchronicity-price-adapter/src"
],
"optimistic_loop": true,
"loop_iter": "2",
Expand All @@ -33,3 +27,4 @@
"cache" :"none",
"msg": "RISK-STEWARD::rules"
}

24 changes: 9 additions & 15 deletions certora/confs/sanity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
"certora/munged/src/contracts/RiskSteward.sol",
],
"packages": [
"ds-test=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/forge-std/lib/ds-test/src",
"forge-std=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/forge-std/src",
"aave-v3-origin=lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src",
"aave-helpers=lib/protocol-v3.1-upgrade/lib/aave-helpers/src",
"aave-address-book=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/src",
"solidity-utils=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/solidity-utils/src",
"lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book:aave-v3-core=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core",
"lib/aave-helpers/lib/aave-address-book:aave-v3-core=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core",
"aave-helpers=lib/aave-helpers",
"forge-std=lib/aave-helpers/lib/forge-std/src",
"aave-address-book=lib/aave-helpers/lib/aave-address-book/src",
"solidity-utils=lib/aave-helpers/lib/solidity-utils/src",
"aave-v3-origin=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src",
"aave-v3-core=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/core",
"aave-v3-periphery=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/periphery",
"aave-capo=lib/aave-capo/src",
"lib/aave-capo:cl-synchronicity-price-adapter=lib/aave-capo/lib/cl-synchronicity-price-adapter/src",
"@aave/core-v3=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-core",
"@aave/periphery-v3=lib/protocol-v3.1-upgrade/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-periphery",
"aave-v3-core=lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src/core",
"aave-v3-periphery=lib/protocol-v3.1-upgrade/lib/aave-v3-origin/src/periphery",
"protocol-v3.1-upgrade=lib/protocol-v3.1-upgrade"
"lib/aave-capo:cl-synchronicity-price-adapter=lib/aave-capo/lib/cl-synchronicity-price-adapter/src"
],
"optimistic_loop": true,
"prover_args": ["-depth 15","-mediumTimeout 1000"],
Expand All @@ -26,4 +20,4 @@
"verify": "RiskSteward:certora/specs/sanity.spec",
"cache" :"none",
"msg": "RISK-STEWARD::sanity"
}
}
25 changes: 25 additions & 0 deletions diffs/pre_Scroll_example_post_Scroll_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Reserve changes

### Reserves altered

#### wstETH ([0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32](https://scrollscan.com/address/0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32))

| description | value before | value after |
| --- | --- | --- |
| supplyCap | 22,000 wstETH | 30,000 wstETH |


## Raw diff

```json
{
"reserves": {
"0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32": {
"supplyCap": {
"from": 22000,
"to": 30000
}
}
}
}
```
25 changes: 25 additions & 0 deletions diffs/pre_arbitrum_example_post_arbitrum_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Reserve changes

### Reserves altered

#### wstETH ([0x5979D7b546E38E414F7E9822514be443A4800529](https://arbiscan.io/address/0x5979D7b546E38E414F7E9822514be443A4800529))

| description | value before | value after |
| --- | --- | --- |
| supplyCap | 69,000 wstETH | 75,600 wstETH |


## Raw diff

```json
{
"reserves": {
"0x5979D7b546E38E414F7E9822514be443A4800529": {
"supplyCap": {
"from": 69000,
"to": 75600
}
}
}
}
```
25 changes: 25 additions & 0 deletions diffs/pre_avalanche_example_post_avalanche_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Reserve changes

### Reserves altered

#### USDC ([0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E](https://snowtrace.io/address/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E))

| description | value before | value after |
| --- | --- | --- |
| supplyCap | 170,000,000 USDC | 200,000,000 USDC |


## Raw diff

```json
{
"reserves": {
"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E": {
"supplyCap": {
"from": 170000000,
"to": 200000000
}
}
}
}
```
48 changes: 48 additions & 0 deletions diffs/pre_base_example_post_base_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Reserve changes

### Reserve altered

#### WETH ([0x4200000000000000000000000000000000000006](https://basescan.org/address/0x4200000000000000000000000000000000000006))

| description | value before | value after |
| --- | --- | --- |
| liquidationThreshold | 83 % [8300] | 84 % [8400] |


#### USDC ([0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913](https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913))

| description | value before | value after |
| --- | --- | --- |
| ltv | 75 % [7500] | 77 % [7700] |
| liquidationThreshold | 78 % [7800] | 79 % [7900] |
| liquidationBonus | 5 % | 6 % |


## Raw diff

```json
{
"reserves": {
"0x4200000000000000000000000000000000000006": {
"liquidationThreshold": {
"from": 8300,
"to": 8400
}
},
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": {
"liquidationBonus": {
"from": 10500,
"to": 10600
},
"liquidationThreshold": {
"from": 7800,
"to": 7900
},
"ltv": {
"from": 7500,
"to": 7700
}
}
}
}
```
30 changes: 30 additions & 0 deletions diffs/pre_bnb_example_post_bnb_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Raw diff

```json
{
"strategies": {
"0x2170Ed0880ac9A755fd29B2688956BD959F933F8": {
"baseVariableBorrowRate": {
"from": "0",
"to": "10000000000000000000000000"
},
"maxVariableBorrowRate": {
"from": "827000000000000000000000000",
"to": "940000000000000000000000000"
},
"optimalUsageRatio": {
"from": "800000000000000000000000000",
"to": "850000000000000000000000000"
},
"variableRateSlope1": {
"from": "27000000000000000000000000",
"to": "30000000000000000000000000"
},
"variableRateSlope2": {
"from": "800000000000000000000000000",
"to": "900000000000000000000000000"
}
}
}
}
```
5 changes: 5 additions & 0 deletions diffs/pre_ethereum_example_post_ethereum_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
25 changes: 25 additions & 0 deletions diffs/pre_gnosis_example_post_gnosis_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Reserve changes

### Reserves altered

#### wstETH ([0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6](https://gnosisscan.io/address/0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6))

| description | value before | value after |
| --- | --- | --- |
| supplyCap | 7,500 wstETH | 8,000 wstETH |


## Raw diff

```json
{
"reserves": {
"0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6": {
"supplyCap": {
"from": 7500,
"to": 8000
}
}
}
}
```
25 changes: 25 additions & 0 deletions diffs/pre_metis_example_post_metis_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Reserve changes

### Reserves altered

#### WETH ([0x420000000000000000000000000000000000000A](https://explorer.metis.io/address/0x420000000000000000000000000000000000000A))

| description | value before | value after |
| --- | --- | --- |
| supplyCap | 2,300 WETH | 3,000 WETH |


## Raw diff

```json
{
"reserves": {
"0x420000000000000000000000000000000000000A": {
"supplyCap": {
"from": 2300,
"to": 3000
}
}
}
}
```
25 changes: 25 additions & 0 deletions diffs/pre_optimism_example_post_optimism_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Reserve changes

### Reserves altered

#### wstETH ([0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb](https://optimistic.etherscan.io/address/0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb))

| description | value before | value after |
| --- | --- | --- |
| supplyCap | 34,500 wstETH | 40,000 wstETH |


## Raw diff

```json
{
"reserves": {
"0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb": {
"supplyCap": {
"from": 34500,
"to": 40000
}
}
}
}
```
Loading
Loading