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.
* reserve update * TokenLogic * updated * removed todo
- Loading branch information
Showing
6 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...torUpdates_20240322_before_AaveV2Polygon_ReserveFactorUpdates_20240322_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,51 @@ | ||
## Reserve changes | ||
|
||
### Reserve altered | ||
|
||
#### USDC ([0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174](https://polygonscan.com/address/0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174)) | ||
|
||
| description | value before | value after | | ||
| --- | --- | --- | | ||
| reserveFactor | 88 % | 93 % | | ||
|
||
|
||
#### DAI ([0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063](https://polygonscan.com/address/0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063)) | ||
|
||
| description | value before | value after | | ||
| --- | --- | --- | | ||
| reserveFactor | 86 % | 91 % | | ||
|
||
|
||
#### USDT ([0xc2132D05D31c914a87C6611C10748AEb04B58e8F](https://polygonscan.com/address/0xc2132D05D31c914a87C6611C10748AEb04B58e8F)) | ||
|
||
| description | value before | value after | | ||
| --- | --- | --- | | ||
| reserveFactor | 87 % | 92 % | | ||
|
||
|
||
## Raw diff | ||
|
||
```json | ||
{ | ||
"reserves": { | ||
"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": { | ||
"reserveFactor": { | ||
"from": 8800, | ||
"to": 9300 | ||
} | ||
}, | ||
"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063": { | ||
"reserveFactor": { | ||
"from": 8600, | ||
"to": 9100 | ||
} | ||
}, | ||
"0xc2132D05D31c914a87C6611C10748AEb04B58e8F": { | ||
"reserveFactor": { | ||
"from": 8700, | ||
"to": 9200 | ||
} | ||
} | ||
} | ||
} | ||
``` |
23 changes: 23 additions & 0 deletions
23
...240322_AaveV2Polygon_ReserveFactorUpdates/AaveV2Polygon_ReserveFactorUpdates_20240322.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,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; | ||
import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; | ||
|
||
/** | ||
* @title AaveV2Polygon_ReserveFactorUpdates_20240322 (April 3, 2024) | ||
* @author dd0sxx_TokenLogic | ||
* - Snapshot: Direct-to-AIP | ||
* - Discussion: https://governance.aave.com/t/arfc-reserve-factor-updates-polygon-aave-v2/13937/20 | ||
*/ | ||
contract AaveV2Polygon_ReserveFactorUpdates_20240322 is IProposalGenericExecutor { | ||
uint256 public constant DAI_RF = 91_00; | ||
uint256 public constant USDC_RF = 93_00; | ||
uint256 public constant USDT_RF = 92_00; | ||
|
||
function execute() external { | ||
AaveV2Polygon.POOL_CONFIGURATOR.setReserveFactor(AaveV2PolygonAssets.DAI_UNDERLYING, DAI_RF); | ||
AaveV2Polygon.POOL_CONFIGURATOR.setReserveFactor(AaveV2PolygonAssets.USDC_UNDERLYING, USDC_RF); | ||
AaveV2Polygon.POOL_CONFIGURATOR.setReserveFactor(AaveV2PolygonAssets.USDT_UNDERLYING, USDT_RF); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...0322_AaveV2Polygon_ReserveFactorUpdates/AaveV2Polygon_ReserveFactorUpdates_20240322.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,61 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV2Polygon, AaveV2PolygonAssets} from 'aave-address-book/AaveV2Polygon.sol'; | ||
import {ProtocolV2TestBase, ReserveConfig} from 'aave-helpers/ProtocolV2TestBase.sol'; | ||
|
||
import {AaveV2Polygon_ReserveFactorUpdates_20240322} from './AaveV2Polygon_ReserveFactorUpdates_20240322.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV2Polygon_ReserveFactorUpdates_20240322 | ||
* command: make test-contract filter=AaveV2Polygon_ReserveFactorUpdates_20240322 | ||
*/ | ||
contract AaveV2Polygon_ReserveFactorUpdates_20240322_Test is ProtocolV2TestBase { | ||
struct Changes { | ||
address asset; | ||
uint256 reserveFactor; | ||
} | ||
AaveV2Polygon_ReserveFactorUpdates_20240322 internal proposal; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('polygon'), 55391331); | ||
proposal = new AaveV2Polygon_ReserveFactorUpdates_20240322(); | ||
} | ||
|
||
/** | ||
* @dev executes the generic test suite including e2e and config snapshots | ||
*/ | ||
function test_defaultProposalExecution() public { | ||
(ReserveConfig[] memory allConfigsBefore, ReserveConfig[] memory allConfigsAfter) = defaultTest( | ||
'AaveV2Polygon_ReserveFactorUpdates_20240322', | ||
AaveV2Polygon.POOL, | ||
address(proposal) | ||
); | ||
|
||
address[] memory assetsChanged = new address[](3); | ||
assetsChanged[0] = AaveV2PolygonAssets.DAI_UNDERLYING; | ||
assetsChanged[1] = AaveV2PolygonAssets.USDC_UNDERLYING; | ||
assetsChanged[2] = AaveV2PolygonAssets.USDT_UNDERLYING; | ||
|
||
Changes[] memory assetChanges = new Changes[](3); | ||
assetChanges[0] = Changes({ | ||
asset: AaveV2PolygonAssets.DAI_UNDERLYING, | ||
reserveFactor: proposal.DAI_RF() | ||
}); | ||
assetChanges[1] = Changes({ | ||
asset: AaveV2PolygonAssets.USDC_UNDERLYING, | ||
reserveFactor: proposal.USDC_RF() | ||
}); | ||
assetChanges[2] = Changes({ | ||
asset: AaveV2PolygonAssets.USDT_UNDERLYING, | ||
reserveFactor: proposal.USDT_RF() | ||
}); | ||
|
||
_noReservesConfigsChangesApartFrom(allConfigsBefore, allConfigsAfter, assetsChanged); | ||
|
||
for (uint i = 0; i < assetChanges.length; i++) { | ||
ReserveConfig memory cfg = _findReserveConfig(allConfigsAfter, assetChanges[i].asset); | ||
assertEq(cfg.reserveFactor, assetChanges[i].reserveFactor); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/20240322_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates.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,37 @@ | ||
--- | ||
title: "ReserveFactorUpdates" | ||
author: "TokenLogic" | ||
discussions: "https://governance.aave.com/t/arfc-reserve-factor-updates-polygon-aave-v2/13937/21" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
This AIP is a continuation of proposal 54 on Governance v3 and increases the Reserve Factor (RF) for assets on Polygon v2 by 5.00%, up to a maximum of 99.99%. | ||
|
||
## Motivation | ||
|
||
This AIP will reduce deposit yield for assets on Polygon v2 by increasing the RF. With this upgrade being passed, users will be further encouraged to migrate from Polygon v2 to v3. | ||
|
||
Increasing the RF routes a larger portion of the interest paid by users to Aave DAO's Treasury. User's funds are not at risk of liquidation and the borrowing rate remains unchanged. | ||
|
||
Of the assets with an RF set at 99.99%, there is no change. All other asset reserves will have the RF increased by up to 5%. | ||
|
||
## Specification | ||
|
||
The following parameters are to be updated as follows: | ||
|
||
| Asset | Reserve Factor | | ||
| ----- | -------------- | | ||
| DAI | 91.00% | | ||
| USDC | 93.00% | | ||
| USDT | 92.00% | | ||
|
||
## References | ||
|
||
- Implementation: [AaveV2Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240322_AaveV2Polygon_ReserveFactorUpdates/AaveV2Polygon_ReserveFactorUpdates_20240322.sol) | ||
- Tests: [AaveV2Polygon](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240322_AaveV2Polygon_ReserveFactorUpdates/AaveV2Polygon_ReserveFactorUpdates_20240322.t.sol) | ||
- [Discussion](https://governance.aave.com/t/arfc-reserve-factor-updates-polygon-aave-v2/13937/21) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
58 changes: 58 additions & 0 deletions
58
src/20240322_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates_20240322.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, PolygonScript} from 'aave-helpers/ScriptUtils.sol'; | ||
import {AaveV2Polygon_ReserveFactorUpdates_20240322} from './AaveV2Polygon_ReserveFactorUpdates_20240322.sol'; | ||
|
||
/** | ||
* @dev Deploy Polygon | ||
* deploy-command: make deploy-ledger contract=src/20240322_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates_20240322.s.sol:DeployPolygon chain=polygon | ||
* verify-command: npx catapulta-verify -b broadcast/ReserveFactorUpdates_20240322.s.sol/137/run-latest.json | ||
*/ | ||
contract DeployPolygon is PolygonScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = GovV3Helpers.deployDeterministic( | ||
type(AaveV2Polygon_ReserveFactorUpdates_20240322).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/20240322_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates_20240322.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 actionsPolygon = new IPayloadsControllerCore.ExecutionAction[](1); | ||
actionsPolygon[0] = GovV3Helpers.buildAction( | ||
type(AaveV2Polygon_ReserveFactorUpdates_20240322).creationCode | ||
); | ||
payloads[0] = GovV3Helpers.buildPolygonPayload(vm, actionsPolygon); | ||
|
||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal( | ||
vm, | ||
payloads, | ||
GovV3Helpers.ipfsHashFile( | ||
vm, | ||
'src/20240322_AaveV2Polygon_ReserveFactorUpdates/ReserveFactorUpdates.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,14 @@ | ||
import {ConfigFile} from '../../generator/types'; | ||
export const config: ConfigFile = { | ||
rootOptions: { | ||
pools: ['AaveV2Polygon'], | ||
title: 'ReserveFactorUpdates', | ||
shortName: 'ReserveFactorUpdates', | ||
date: '20240322', | ||
author: 'TokenLogic', | ||
discussion: | ||
'https://governance.aave.com/t/arfc-reserve-factor-updates-polygon-aave-v2/13937/21', | ||
snapshot: '', | ||
}, | ||
poolOptions: {AaveV2Polygon: {configs: {}, cache: {blockNumber: 55391331}}}, | ||
}; |
9ac05c7
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 🌈