forked from bgd-labs/aave-proposals
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
298 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...3_Eth_AmendSafetyModuleAAVEEmissions/AaveV3_AmendSafetyModuleAAVEEmissions_20231016.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,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; | ||
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol'; | ||
import {AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016} from './AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016.sol'; | ||
|
||
/** | ||
* @dev Deploy AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016 | ||
* command: make deploy-ledger contract=src/20231016_AaveV3_Eth_AmendSafetyModuleAAVEEmissions/AaveV3_AmendSafetyModuleAAVEEmissions_20231016.s.sol:DeployEthereum chain=mainnet | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
new AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016(); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Create Proposal | ||
* command: make deploy-ledger contract=src/20231016_AaveV3_Eth_AmendSafetyModuleAAVEEmissions/AaveV3_AmendSafetyModuleAAVEEmissions_20231016.s.sol:CreateProposal chain=mainnet | ||
*/ | ||
contract CreateProposal is EthereumScript { | ||
function run() external broadcast { | ||
GovHelpers.Payload[] memory payloads = new GovHelpers.Payload[](1); | ||
payloads[0] = GovHelpers.buildMainnet(address(0)); | ||
GovHelpers.createProposal( | ||
payloads, | ||
GovHelpers.ipfsHashFile( | ||
vm, | ||
'src/20231016_AaveV3_Eth_AmendSafetyModuleAAVEEmissions/AmendSafetyModuleAAVEEmissions.md' | ||
) | ||
); | ||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
...mendSafetyModuleAAVEEmissions/AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016.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,113 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol'; | ||
import {AaveSafetyModule} from 'aave-address-book/AaveSafetyModule.sol'; | ||
import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {IAaveEcosystemReserveController, AaveMisc} from "aave-address-book/AaveMisc.sol"; | ||
|
||
library DistributionTypes { | ||
struct AssetConfigInput { | ||
uint128 emissionPerSecond; | ||
uint256 totalStaked; | ||
address underlyingAsset; | ||
} | ||
|
||
struct UserStakeInput { | ||
address underlyingAsset; | ||
uint256 stakedByUser; | ||
uint256 totalStaked; | ||
} | ||
} | ||
|
||
|
||
interface IAaveDistributionManager { | ||
function configureAssets(DistributionTypes.AssetConfigInput[] calldata assetsConfigInput) external; | ||
function STAKED_TOKEN() external returns(address); | ||
function totalSupply() external returns(uint256); | ||
} | ||
|
||
/** | ||
* @title Amend Safety Module AAVE Emissions | ||
* @author Aave-Chan Initiative | ||
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xb0124fb0206676ee743e8d6221b7b3c317cb26a657551f11cb5fa23544772a73 | ||
* - Discussion: https://governance.aave.com/t/arfc-treasury-management-amend-safety-module-aave-emissions/14936 | ||
*/ | ||
contract AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016 is IProposalGenericExecutor { | ||
|
||
address public constant STKAAVE = AaveSafetyModule.STK_AAVE; | ||
address public constant STKABPT = AaveSafetyModule.STK_ABPT; | ||
|
||
address public constant ECOSYSTEM_RESERVE = AaveMisc.ECOSYSTEM_RESERVE; | ||
|
||
// New daily emission | ||
uint256 public constant DAILY_EMISSIONS = 385 ether; | ||
|
||
// Total cycle emission (90 days) | ||
uint256 public constant CYCLE_EMISSIONS = DAILY_EMISSIONS * 90; | ||
|
||
// Daily emission to seconds; 1 day * 24h * 3600 s = 86400 | ||
uint128 public constant EMISSIONS_PER_SECOND = uint128(DAILY_EMISSIONS / 86400); | ||
|
||
IAaveEcosystemReserveController public constant ECOSYSTEM_RESERVE_CONTROLLER | ||
= AaveMisc.AAVE_ECOSYSTEM_RESERVE_CONTROLLER; | ||
|
||
function execute() external { | ||
// stkAave from daily 550 to 285 converted to seconds as required | ||
_changeEmissions(STKAAVE, EMISSIONS_PER_SECOND); | ||
|
||
// stkABPT from daily 550 to 285 converted to seconds as required | ||
_changeEmissions(STKABPT, EMISSIONS_PER_SECOND); | ||
|
||
// Remove the approval as needed by the ecosystem reserve and change it to the emissions of a 90 day cycle | ||
_set90DayCycle(); | ||
} | ||
|
||
function _changeEmissions(address asset, uint128 newEmissions) internal { | ||
IAaveDistributionManager distributionManager = IAaveDistributionManager(asset); | ||
|
||
DistributionTypes.AssetConfigInput[] memory config = new DistributionTypes.AssetConfigInput[](1); | ||
|
||
config[0] = DistributionTypes.AssetConfigInput( | ||
newEmissions, // emissions per second | ||
distributionManager.totalSupply(), // total staked | ||
asset // underlying asset | ||
); | ||
|
||
distributionManager.configureAssets(config); | ||
} | ||
|
||
function _set90DayCycle() internal { | ||
|
||
// For requirement of the controller, first we reset allowance | ||
ECOSYSTEM_RESERVE_CONTROLLER.approve( | ||
ECOSYSTEM_RESERVE, | ||
AaveV3EthereumAssets.AAVE_UNDERLYING, | ||
STKAAVE, | ||
0 | ||
); | ||
|
||
ECOSYSTEM_RESERVE_CONTROLLER.approve( | ||
ECOSYSTEM_RESERVE, | ||
AaveV3EthereumAssets.AAVE_UNDERLYING, | ||
STKABPT, | ||
0 | ||
); | ||
|
||
// Then we set the amount 90 days * 385 daily emission (both on stkAave and stkABPT) => 90 * 550 = 34_650 | ||
ECOSYSTEM_RESERVE_CONTROLLER.approve( | ||
ECOSYSTEM_RESERVE, | ||
AaveV3EthereumAssets.AAVE_UNDERLYING, | ||
STKAAVE, | ||
CYCLE_EMISSIONS | ||
); | ||
|
||
ECOSYSTEM_RESERVE_CONTROLLER.approve( | ||
ECOSYSTEM_RESERVE, | ||
AaveV3EthereumAssets.AAVE_UNDERLYING, | ||
STKABPT, | ||
CYCLE_EMISSIONS | ||
); | ||
|
||
} | ||
} |
115 changes: 115 additions & 0 deletions
115
...ndSafetyModuleAAVEEmissions/AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016.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,115 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import 'forge-std/Test.sol'; | ||
import {GovHelpers} from 'aave-helpers/GovHelpers.sol'; | ||
import {AaveSafetyModule} from 'aave-address-book/AaveSafetyModule.sol'; | ||
import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol'; | ||
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; | ||
import {AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016} from './AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016.sol'; | ||
import {IAaveEcosystemReserveController, AaveMisc} from "aave-address-book/AaveMisc.sol"; | ||
import {IERC20} from "solidity-utils/contracts/oz-common/interfaces/IERC20.sol"; | ||
|
||
library DistributionTypes { | ||
struct AssetConfigInput { | ||
uint128 emissionPerSecond; | ||
uint256 totalStaked; | ||
address underlyingAsset; | ||
} | ||
|
||
struct UserStakeInput { | ||
address underlyingAsset; | ||
uint256 stakedByUser; | ||
uint256 totalStaked; | ||
} | ||
|
||
struct AssetResponse { | ||
uint128 emissionPerSecond; | ||
uint128 lastUpdateTimestamp; | ||
uint256 index; | ||
} | ||
} | ||
|
||
|
||
interface IAaveDistributionManager { | ||
function configureAssets(DistributionTypes.AssetConfigInput[] calldata assetsConfigInput) external; | ||
function STAKED_TOKEN() external returns(address); | ||
function totalSupply() external returns(uint256); | ||
function assets(address asset) external returns(DistributionTypes.AssetResponse memory); | ||
} | ||
|
||
/** | ||
* @dev Test for AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016 | ||
* command: make test-contract filter=AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016 | ||
*/ | ||
contract AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016_Test is ProtocolV3TestBase { | ||
|
||
AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016 internal proposal; | ||
|
||
address public constant STKAAVE = AaveSafetyModule.STK_AAVE; | ||
address public constant STKABPT = AaveSafetyModule.STK_ABPT; | ||
|
||
address public constant ECOSYSTEM_RESERVE = AaveMisc.ECOSYSTEM_RESERVE; | ||
|
||
IAaveEcosystemReserveController public constant ECOSYSTEM_RESERVE_CONTROLLER | ||
= AaveMisc.AAVE_ECOSYSTEM_RESERVE_CONTROLLER; | ||
|
||
uint256 public constant DAILY_EMISSIONS = 385 ether; | ||
|
||
// Total cycle emission (90 days) | ||
uint256 public constant CYCLE_EMISSIONS = DAILY_EMISSIONS * 90; | ||
|
||
// Daily emission to seconds; 1 day * 24h * 3600 s = 86400 | ||
uint128 public constant EMISSIONS_PER_SECOND = uint128(DAILY_EMISSIONS / 86400); | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 18364871); | ||
proposal = new AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016(); | ||
} | ||
|
||
function testProposalExecutionPep() public { | ||
|
||
ReserveConfig[] memory allConfigsBefore = createConfigurationSnapshot( | ||
'preAaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016', | ||
AaveV3Ethereum.POOL | ||
); | ||
|
||
|
||
GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.SHORT_EXECUTOR); | ||
|
||
|
||
ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot( | ||
'postAaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016', | ||
AaveV3Ethereum.POOL | ||
); | ||
|
||
|
||
/* | ||
Check emission changes, the value should be 385 ether * 86400 seconds on a day | ||
*/ | ||
IAaveDistributionManager aaveManager = IAaveDistributionManager(STKAAVE); | ||
DistributionTypes.AssetResponse memory aaveRes = aaveManager.assets(STKAAVE); | ||
assertEq(aaveRes.emissionPerSecond, EMISSIONS_PER_SECOND); | ||
|
||
IAaveDistributionManager bptManager = IAaveDistributionManager(STKABPT); | ||
DistributionTypes.AssetResponse memory bptRes = bptManager.assets(STKABPT); | ||
assertEq(bptRes.emissionPerSecond, EMISSIONS_PER_SECOND); | ||
|
||
/* | ||
Check cycles changes, the allowance should be 385 ether * 90 as described on the proposal | ||
*/ | ||
assertEq(IERC20(AaveV3EthereumAssets.AAVE_UNDERLYING).allowance(ECOSYSTEM_RESERVE, STKAAVE), CYCLE_EMISSIONS); | ||
assertEq(IERC20(AaveV3EthereumAssets.AAVE_UNDERLYING).allowance(ECOSYSTEM_RESERVE, STKABPT), CYCLE_EMISSIONS); | ||
|
||
|
||
diffReports( | ||
'preAaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016', | ||
'postAaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016' | ||
); | ||
|
||
e2eTest(AaveV3Ethereum.POOL); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...016_AaveV3_Eth_AmendSafetyModuleAAVEEmissions/AmendSafetyModuleAAVEEmissions.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,36 @@ | ||
--- | ||
title: "Amend Safety Module AAVE Emissions" | ||
author: "Aave-Chan Initiative" | ||
discussions: "https://governance.aave.com/t/arfc-treasury-management-amend-safety-module-aave-emissions/14936" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
This publication proposes reducing AAVE (Safety Incentives) distributions to the Safety Module (SM) by 30% and introducing a 90-day SM emission cycle. | ||
|
||
## Motivation | ||
|
||
The SM serves as the Aave Protocol’s self-protection smart contract. The Aave Protocol distributes 1,100 AAVE daily, split evenly across AAVE and B-80AAVE-20wETH deposits. | ||
|
||
Future proposals shall discuss the composition and aim to improve the overall capital efficiency of the SM. However, this publication intends to reduce AAVE emissions in the immediate future, saving the DAO valuable AAVE emissions while the broader SM upgrade is being advanced. It is widely accepted within the community that Aave DAO is overpaying for AAVE and B-80BAL-20wETH deposits. | ||
|
||
This publication proposes reducing AAVE emissions by ~30%. The revised AAVE emission is to be reduced from 1,100 AAVE/day to 770 AAVE/day. This represents a 330 AAVE/day reduction. The APR for stkAAVE holders is expected to reduce from 6.87% to 4.81%. Similarly, for the B-80BAL-20wETH deposits, yield is expected to fall from 14.35% to 10.05%. | ||
|
||
Please note that the 80AAVE/20wETH Balancer v1 pool is to be migrated to Balancer v2 in the future. This will present the community with an opportunity to further revise the AAVE emissions. It may also occur at a time when the DAO has vlAURA and/or veBAL at its disposal. | ||
|
||
For context, the Llama Part IV SM Upgrade suggests reducing the AAVE emission to stkAAVE holders by 75%. This is because slashing for stkAAVE is to be reduced, additional assets are to be added to the SM, and the emissions are to be redirected to those newly added assets. Since this proposal was published, stkAAVE has also gained the utility of discounted GHO borrowing rates. | ||
|
||
Similarly, Xenophon Labs recommended doubling the slashing percentage from 30% to 60% on the stkAAVE pool and lowering emissions by 80 AAVE/day, from 550 to 470. While this publication does not propose amending the slashing rate, the reduction in AAVE emissions is about double. | ||
|
||
## Specification | ||
|
||
## References | ||
|
||
- Implementation: [Ethereum](https://github.com/bgd-labs/aave-proposals/blob/main/src/20231016_AaveV3_Eth_AmendSafetyModuleAAVEEmissions/AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016.sol) | ||
- Tests: [Ethereum](https://github.com/bgd-labs/aave-proposals/blob/main/src/20231016_AaveV3_Eth_AmendSafetyModuleAAVEEmissions/AaveV3_Ethereum_AmendSafetyModuleAAVEEmissions_20231016.t.sol) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xb0124fb0206676ee743e8d6221b7b3c317cb26a657551f11cb5fa23544772a73) | ||
- [Discussion](https://governance.aave.com/t/arfc-treasury-management-amend-safety-module-aave-emissions/14936) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |