generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: typos * fix: adjust motivation * - Added revert to previous rate strategy. * - Added aAMPL impl address --------- Co-authored-by: eboado <[email protected]>
- Loading branch information
Showing
6 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...tion_20240402_before_AaveV2Ethereum_UpgradeAMPLImplementation_20240402_after.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## Reserve changes | ||
|
||
### Reserves altered | ||
|
||
#### AMPL ([0xD46bA6D942050d489DBd938a2C909A5d5039A161](https://etherscan.io/address/0xD46bA6D942050d489DBd938a2C909A5d5039A161)) | ||
|
||
| description | value before | value after | | ||
| --- | --- | --- | | ||
| aTokenImpl | [0x6fBC3BE5ee5273598d1491D41bB45F6d05a7541A](https://etherscan.io/address/0x6fBC3BE5ee5273598d1491D41bB45F6d05a7541A) | [0x1F32642b216d19DAEb1531862647195a626F4193](https://etherscan.io/address/0x1F32642b216d19DAEb1531862647195a626F4193) | | ||
| interestRateStrategy | [0xa324C768Bdd002b3387CE1c691A549268f63250b](https://etherscan.io/address/0xa324C768Bdd002b3387CE1c691A549268f63250b) | [0xB2D822cAdb9040F3164829BC34e41a93cA3E01e5](https://etherscan.io/address/0xB2D822cAdb9040F3164829BC34e41a93cA3E01e5) | | ||
| variableRateSlope2 | 0 % | 300 % | | ||
| interestRate | ![before](/.assets/b066e7c9810c83ee1ab3a3bfa76a5f71483e3a32.svg) | ![after](/.assets/505a717515dde97057a00382ab87b2fbe4243854.svg) | | ||
|
||
## Raw diff | ||
|
||
```json | ||
{ | ||
"reserves": { | ||
"0xD46bA6D942050d489DBd938a2C909A5d5039A161": { | ||
"aTokenImpl": { | ||
"from": "0x6fBC3BE5ee5273598d1491D41bB45F6d05a7541A", | ||
"to": "0x1F32642b216d19DAEb1531862647195a626F4193" | ||
}, | ||
"interestRateStrategy": { | ||
"from": "0xa324C768Bdd002b3387CE1c691A549268f63250b", | ||
"to": "0xB2D822cAdb9040F3164829BC34e41a93cA3E01e5" | ||
} | ||
} | ||
}, | ||
"strategies": { | ||
"0xD46bA6D942050d489DBd938a2C909A5d5039A161": { | ||
"address": { | ||
"from": "0xa324C768Bdd002b3387CE1c691A549268f63250b", | ||
"to": "0xB2D822cAdb9040F3164829BC34e41a93cA3E01e5" | ||
}, | ||
"variableRateSlope2": { | ||
"from": 0, | ||
"to": "3000000000000000000000000000" | ||
} | ||
} | ||
} | ||
} | ||
``` |
48 changes: 48 additions & 0 deletions
48
...2Ethereum_UpgradeAMPLImplementation/AaveV2Ethereum_UpgradeAMPLImplementation_20240402.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {IAaveV2ConfigEngine} from 'aave-helpers/v2-config-engine/IAaveV2ConfigEngine.sol'; | ||
import {IV2RateStrategyFactory} from 'aave-helpers/v2-config-engine/IV2RateStrategyFactory.sol'; | ||
import {EngineFlags} from 'aave-helpers/v3-config-engine/EngineFlags.sol'; | ||
import {AaveV2EthereumAssets} from 'aave-address-book/AaveV2Ethereum.sol'; | ||
import {AaveV2Ethereum, AaveV2PayloadEthereum} from 'aave-helpers/v2-config-engine/AaveV2PayloadEthereum.sol'; | ||
|
||
/** | ||
* @title Upgrade AMPL implementation | ||
* @author BGD Labs | ||
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xb7226dd6441b67225924082215f7a512bfd98252897ee43a879084e07ab53607 | ||
* - Discussion: https://governance.aave.com/t/arfc-aampl-interim-distribution/17184 | ||
*/ | ||
contract AaveV2Ethereum_UpgradeAMPLImplementation_20240402 is AaveV2PayloadEthereum { | ||
address constant A_TOKEN_IMPL = 0x1F32642b216d19DAEb1531862647195a626F4193; | ||
|
||
function _preExecute() internal override { | ||
AaveV2Ethereum.POOL_CONFIGURATOR.updateAToken( | ||
AaveV2EthereumAssets.AMPL_UNDERLYING, | ||
A_TOKEN_IMPL | ||
); | ||
} | ||
|
||
function rateStrategiesUpdates() | ||
public | ||
pure | ||
override | ||
returns (IAaveV2ConfigEngine.RateStrategyUpdate[] memory) | ||
{ | ||
IAaveV2ConfigEngine.RateStrategyUpdate[] | ||
memory rateStrategies = new IAaveV2ConfigEngine.RateStrategyUpdate[](1); | ||
rateStrategies[0] = IAaveV2ConfigEngine.RateStrategyUpdate({ | ||
asset: AaveV2EthereumAssets.AMPL_UNDERLYING, | ||
params: IV2RateStrategyFactory.RateStrategyParams({ | ||
optimalUtilizationRate: EngineFlags.KEEP_CURRENT, | ||
baseVariableBorrowRate: EngineFlags.KEEP_CURRENT, | ||
variableRateSlope1: EngineFlags.KEEP_CURRENT, | ||
variableRateSlope2: _bpsToRay(300_00), | ||
stableRateSlope1: EngineFlags.KEEP_CURRENT, | ||
stableRateSlope2: EngineFlags.KEEP_CURRENT | ||
}) | ||
}); | ||
|
||
return rateStrategies; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...thereum_UpgradeAMPLImplementation/AaveV2Ethereum_UpgradeAMPLImplementation_20240402.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV2Ethereum} from 'aave-address-book/AaveV2Ethereum.sol'; | ||
|
||
import 'forge-std/Test.sol'; | ||
import {ProtocolV2TestBase, ReserveConfig} from 'aave-helpers/ProtocolV2TestBase.sol'; | ||
import {AaveV2Ethereum_UpgradeAMPLImplementation_20240402} from './AaveV2Ethereum_UpgradeAMPLImplementation_20240402.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV2Ethereum_UpgradeAMPLImplementation_20240402 | ||
* command: make test-contract filter=AaveV2Ethereum_UpgradeAMPLImplementation_20240402 | ||
*/ | ||
contract AaveV2Ethereum_UpgradeAMPLImplementation_20240402_Test is ProtocolV2TestBase { | ||
AaveV2Ethereum_UpgradeAMPLImplementation_20240402 internal proposal; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 19591457); | ||
proposal = new AaveV2Ethereum_UpgradeAMPLImplementation_20240402(); | ||
} | ||
|
||
/** | ||
* @dev executes the generic test suite including e2e and config snapshots | ||
*/ | ||
function test_defaultProposalExecution() public { | ||
defaultTest( | ||
'AaveV2Ethereum_UpgradeAMPLImplementation_20240402', | ||
AaveV2Ethereum.POOL, | ||
address(proposal) | ||
); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/UpgradeAMPLImplementation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: "Upgrade AMPL implementation" | ||
author: "BGD Labs" | ||
discussions: "https://governance.aave.com/t/arfc-aampl-interim-distribution/17184" | ||
snapshot: "https://snapshot.org/#/aave.eth/proposal/0xb7226dd6441b67225924082215f7a512bfd98252897ee43a879084e07ab53607" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
Disable withdrawals and transfers for aAMPL so a distribution snapshot can be taken. | ||
|
||
## Motivation | ||
|
||
Due to a problem in the aAMPL custom implementation, the supply and balances don't correspond to the claims of AMPL suppliers. | ||
While work is being made to determined the exact claims, there has been a proposal for the distribution of an initial 300'000 USD. As there are still active AMPL borrow positions, a situation could occur in which a user repays his debt and another user withdraws their aAMPL, causing issues in for a fair distribution. | ||
|
||
Therefore transfers aAMPL and withdrawals of AMPL will be disabled, while repayments and liquidations will stay intact. | ||
|
||
In addition, after validating there is no impact of it on the borrow side, the interest rate strategy of AMPL is reverted to the one that was configured before [proposal 16](https://vote.onaave.com/proposal/?proposalId=16), when parameters where lowered for pre-caution. | ||
The goal of this is to, as intended, still apply growth on the borrow side, specially for currently healthy positions (non-liquidated). | ||
|
||
## Specification | ||
|
||
The proposal will call: | ||
|
||
- `AaveV2Ethereum.POOL_CONFIGURATOR.updateAToken(AaveV2EthereumAssets.AMPL_UNDERLYING, A_TOKEN_IMPL);` to replace the aToken implementation | ||
- Change the AMPL interest rate strategy to the previous one, with the following configuration: | ||
|
||
| Parameter | Current | Recommended | | ||
| -------------- | ------- | ----------- | | ||
| Base | 20% | No Change | | ||
| Slope1 | 0% | No Change | | ||
| Slope2 | 0% | 300% | | ||
| Uoptimal | 80% | No Change | | ||
| Reserve Factor | 99.00% | No Change | | ||
|
||
## References | ||
|
||
- Implementation: [AaveV2Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/AaveV2Ethereum_UpgradeAMPLImplementation_20240402.sol) | ||
- Tests: [AaveV2Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/AaveV2Ethereum_UpgradeAMPLImplementation_20240402.t.sol) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xb7226dd6441b67225924082215f7a512bfd98252897ee43a879084e07ab53607) | ||
- [Discussion](https://governance.aave.com/t/arfc-aampl-interim-distribution/17184) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
58 changes: 58 additions & 0 deletions
58
...0240402_AaveV2Ethereum_UpgradeAMPLImplementation/UpgradeAMPLImplementation_20240402.s.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol'; | ||
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; | ||
import {AaveV2Ethereum_UpgradeAMPLImplementation_20240402} from './AaveV2Ethereum_UpgradeAMPLImplementation_20240402.sol'; | ||
|
||
/** | ||
* @dev Deploy Ethereum | ||
* deploy-command: make deploy-ledger contract=src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/UpgradeAMPLImplementation_20240402.s.sol:DeployEthereum chain=mainnet | ||
* verify-command: npx catapulta-verify -b broadcast/UpgradeAMPLImplementation_20240402.s.sol/1/run-latest.json | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = GovV3Helpers.deployDeterministic( | ||
type(AaveV2Ethereum_UpgradeAMPLImplementation_20240402).creationCode | ||
); | ||
|
||
// compose action | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actions = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actions[0] = GovV3Helpers.buildAction(payload0); | ||
|
||
// register action at payloadsController | ||
GovV3Helpers.createPayload(actions); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Create Proposal | ||
* command: make deploy-ledger contract=src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/UpgradeAMPLImplementation_20240402.s.sol:CreateProposal chain=mainnet | ||
*/ | ||
contract CreateProposal is EthereumScript { | ||
function run() external { | ||
// create payloads | ||
PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); | ||
|
||
// compose actions for validation | ||
IPayloadsControllerCore.ExecutionAction[] | ||
memory actionsEthereum = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsEthereum[0] = GovV3Helpers.buildAction( | ||
type(AaveV2Ethereum_UpgradeAMPLImplementation_20240402).creationCode | ||
); | ||
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); | ||
|
||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal( | ||
vm, | ||
payloads, | ||
GovV3Helpers.ipfsHashFile( | ||
vm, | ||
'src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/UpgradeAMPLImplementation.md' | ||
) | ||
); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/20240402_AaveV2Ethereum_UpgradeAMPLImplementation/config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {ConfigFile} from '../../generator/types'; | ||
export const config: ConfigFile = { | ||
rootOptions: { | ||
pools: ['AaveV2Ethereum'], | ||
title: 'Upgrade AMPL implementation', | ||
shortName: 'UpgradeAMPLImplementation', | ||
date: '20240402', | ||
author: 'BGD Labs', | ||
discussion: 'https://governance.aave.com/t/arfc-aampl-interim-distribution/17184', | ||
snapshot: | ||
'https://snapshot.org/#/aave.eth/proposal/0xb7226dd6441b67225924082215f7a512bfd98252897ee43a879084e07ab53607', | ||
}, | ||
poolOptions: {AaveV2Ethereum: {configs: {OTHERS: {}}, cache: {blockNumber: 19568854}}}, | ||
}; |
ab46df3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foundry report
Build log
Test success 🌈