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.
- Loading branch information
Showing
8 changed files
with
406 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions
125
...20240125_before_AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125_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,125 @@ | ||
## Reserve changes | ||
|
||
### Reserves added | ||
|
||
#### PYUSD ([0x6c3ea9036406852006290770BEdFcAbA0e23A0e8](https://etherscan.io/address/0x6c3ea9036406852006290770BEdFcAbA0e23A0e8)) | ||
|
||
| description | value | | ||
| --- | --- | | ||
| decimals | 6 | | ||
| isActive | true | | ||
| isFrozen | false | | ||
| supplyCap | 10,000,000 PYUSD | | ||
| borrowCap | 9,000,000 PYUSD | | ||
| debtCeiling | 0 $ | | ||
| isSiloed | false | | ||
| isFlashloanable | true | | ||
| eModeCategory | 0 | | ||
| oracle | [0x8f1dF6D7F2db73eECE86a18b4381F4707b918FB1](https://etherscan.io/address/0x8f1dF6D7F2db73eECE86a18b4381F4707b918FB1) | | ||
| oracleDecimals | 8 | | ||
| oracleDescription | PYUSD / USD | | ||
| oracleLatestAnswer | 0.99946 | | ||
| usageAsCollateralEnabled | false | | ||
| ltv | 0 % | | ||
| liquidationThreshold | 0 % | | ||
| liquidationBonus | 0 % | | ||
| liquidationProtocolFee | 0 % | | ||
| reserveFactor | 20 % | | ||
| aToken | [0x0C0d01AbF3e6aDfcA0989eBbA9d6e85dD58EaB1E](https://etherscan.io/address/0x0C0d01AbF3e6aDfcA0989eBbA9d6e85dD58EaB1E) | | ||
| aTokenImpl | [0x7EfFD7b47Bfd17e52fB7559d3f924201b9DbfF3d](https://etherscan.io/address/0x7EfFD7b47Bfd17e52fB7559d3f924201b9DbfF3d) | | ||
| variableDebtToken | [0x57B67e4DE077085Fd0AF2174e9c14871BE664546](https://etherscan.io/address/0x57B67e4DE077085Fd0AF2174e9c14871BE664546) | | ||
| variableDebtTokenImpl | [0xaC725CB59D16C81061BDeA61041a8A5e73DA9EC6](https://etherscan.io/address/0xaC725CB59D16C81061BDeA61041a8A5e73DA9EC6) | | ||
| stableDebtToken | [0x5B393DB4c72B1Bd82CE2834F6485d61b137Bc7aC](https://etherscan.io/address/0x5B393DB4c72B1Bd82CE2834F6485d61b137Bc7aC) | | ||
| stableDebtTokenImpl | [0x15C5620dfFaC7c7366EED66C20Ad222DDbB1eD57](https://etherscan.io/address/0x15C5620dfFaC7c7366EED66C20Ad222DDbB1eD57) | | ||
| borrowingEnabled | true | | ||
| stableBorrowRateEnabled | false | | ||
| isBorrowableInIsolation | false | | ||
| interestRateStrategy | [0xAC4f9019608f3A359Ba6a576DC4deC9561D2e514](https://etherscan.io/address/0xAC4f9019608f3A359Ba6a576DC4deC9561D2e514) | | ||
| aTokenName | Aave Ethereum PYUSD | | ||
| aTokenSymbol | aEthPYUSD | | ||
| isPaused | false | | ||
| stableDebtTokenName | Aave Ethereum Stable Debt PYUSD | | ||
| stableDebtTokenSymbol | stableDebtEthPYUSD | | ||
| variableDebtTokenName | Aave Ethereum Variable Debt PYUSD | | ||
| variableDebtTokenSymbol | variableDebtEthPYUSD | | ||
| optimalUsageRatio | 80 % | | ||
| maxExcessUsageRatio | 20 % | | ||
| baseVariableBorrowRate | 0 % | | ||
| variableRateSlope1 | 6 % | | ||
| variableRateSlope2 | 80 % | | ||
| baseStableBorrowRate | 9 % | | ||
| stableRateSlope1 | 13 % | | ||
| stableRateSlope2 | 300 % | | ||
| optimalStableToTotalDebtRatio | 20 % | | ||
| maxExcessStableToTotalDebtRatio | 80 % | | ||
| interestRate | ![ir](/.assets/7dc62027c00efdf4a27a7ad723f8f7ca99f89d77.svg) | | ||
|
||
|
||
## Raw diff | ||
|
||
```json | ||
{ | ||
"reserves": { | ||
"0x6c3ea9036406852006290770BEdFcAbA0e23A0e8": { | ||
"from": null, | ||
"to": { | ||
"aToken": "0x0C0d01AbF3e6aDfcA0989eBbA9d6e85dD58EaB1E", | ||
"aTokenImpl": "0x7EfFD7b47Bfd17e52fB7559d3f924201b9DbfF3d", | ||
"aTokenName": "Aave Ethereum PYUSD", | ||
"aTokenSymbol": "aEthPYUSD", | ||
"borrowCap": 9000000, | ||
"borrowingEnabled": true, | ||
"debtCeiling": 0, | ||
"decimals": 6, | ||
"eModeCategory": 0, | ||
"interestRateStrategy": "0xAC4f9019608f3A359Ba6a576DC4deC9561D2e514", | ||
"isActive": true, | ||
"isBorrowableInIsolation": false, | ||
"isFlashloanable": true, | ||
"isFrozen": false, | ||
"isPaused": false, | ||
"isSiloed": false, | ||
"liquidationBonus": 0, | ||
"liquidationProtocolFee": 0, | ||
"liquidationThreshold": 0, | ||
"ltv": 0, | ||
"oracle": "0x8f1dF6D7F2db73eECE86a18b4381F4707b918FB1", | ||
"oracleDecimals": 8, | ||
"oracleDescription": "PYUSD / USD", | ||
"oracleLatestAnswer": 99946000, | ||
"reserveFactor": 2000, | ||
"stableBorrowRateEnabled": false, | ||
"stableDebtToken": "0x5B393DB4c72B1Bd82CE2834F6485d61b137Bc7aC", | ||
"stableDebtTokenImpl": "0x15C5620dfFaC7c7366EED66C20Ad222DDbB1eD57", | ||
"stableDebtTokenName": "Aave Ethereum Stable Debt PYUSD", | ||
"stableDebtTokenSymbol": "stableDebtEthPYUSD", | ||
"supplyCap": 10000000, | ||
"symbol": "PYUSD", | ||
"underlying": "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8", | ||
"usageAsCollateralEnabled": false, | ||
"variableDebtToken": "0x57B67e4DE077085Fd0AF2174e9c14871BE664546", | ||
"variableDebtTokenImpl": "0xaC725CB59D16C81061BDeA61041a8A5e73DA9EC6", | ||
"variableDebtTokenName": "Aave Ethereum Variable Debt PYUSD", | ||
"variableDebtTokenSymbol": "variableDebtEthPYUSD" | ||
} | ||
} | ||
}, | ||
"strategies": { | ||
"0xAC4f9019608f3A359Ba6a576DC4deC9561D2e514": { | ||
"from": null, | ||
"to": { | ||
"baseStableBorrowRate": "90000000000000000000000000", | ||
"baseVariableBorrowRate": 0, | ||
"maxExcessStableToTotalDebtRatio": "800000000000000000000000000", | ||
"maxExcessUsageRatio": "200000000000000000000000000", | ||
"optimalStableToTotalDebtRatio": "200000000000000000000000000", | ||
"optimalUsageRatio": "800000000000000000000000000", | ||
"stableRateSlope1": "130000000000000000000000000", | ||
"stableRateSlope2": "3000000000000000000000000000", | ||
"variableRateSlope1": "60000000000000000000000000", | ||
"variableRateSlope2": "800000000000000000000000000" | ||
} | ||
} | ||
} | ||
} | ||
``` |
65 changes: 65 additions & 0 deletions
65
...AddPYUSDToAaveV3EthereumMarket/AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125.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,65 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {AaveV3Ethereum, AaveV3EthereumEModes} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {AaveV3PayloadEthereum} from 'aave-helpers/v3-config-engine/AaveV3PayloadEthereum.sol'; | ||
import {EngineFlags} from 'aave-helpers/v3-config-engine/EngineFlags.sol'; | ||
import {IAaveV3ConfigEngine} from 'aave-helpers/v3-config-engine/IAaveV3ConfigEngine.sol'; | ||
import {IV3RateStrategyFactory} from 'aave-helpers/v3-config-engine/IV3RateStrategyFactory.sol'; | ||
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; | ||
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol'; | ||
|
||
/** | ||
* @title Add PYUSD to Aave v3 Ethereum Market | ||
* @author JosepBove (ACI) | ||
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xb91949efad61b134b913d93b00f73ca8a122259e6d1458cf793f22a0eebfd5d5 | ||
* - Discussion: https://governance.aave.com/t/arfc-add-pyusd-to-aave-v3-ethereum-market/16218/ | ||
*/ | ||
contract AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125 is AaveV3PayloadEthereum { | ||
using SafeERC20 for IERC20; | ||
|
||
address public constant PYUSD = 0x6c3ea9036406852006290770BEdFcAbA0e23A0e8; | ||
uint256 public constant PYUSD_SEED_AMOUNT = 1e6; | ||
|
||
function _postExecute() internal override { | ||
IERC20(PYUSD).forceApprove(address(AaveV3Ethereum.POOL), PYUSD_SEED_AMOUNT); | ||
AaveV3Ethereum.POOL.supply(PYUSD, PYUSD_SEED_AMOUNT, address(AaveV3Ethereum.COLLECTOR), 0); | ||
} | ||
|
||
function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) { | ||
IAaveV3ConfigEngine.Listing[] memory listings = new IAaveV3ConfigEngine.Listing[](1); | ||
|
||
listings[0] = IAaveV3ConfigEngine.Listing({ | ||
asset: PYUSD, | ||
assetSymbol: 'PYUSD', | ||
priceFeed: 0x8f1dF6D7F2db73eECE86a18b4381F4707b918FB1, | ||
eModeCategory: AaveV3EthereumEModes.NONE, | ||
enabledToBorrow: EngineFlags.ENABLED, | ||
stableRateModeEnabled: EngineFlags.DISABLED, | ||
borrowableInIsolation: EngineFlags.DISABLED, | ||
withSiloedBorrowing: EngineFlags.DISABLED, | ||
flashloanable: EngineFlags.ENABLED, | ||
ltv: 0, | ||
liqThreshold: 0, | ||
liqBonus: 0, | ||
reserveFactor: 20_00, | ||
supplyCap: 10_000_000, | ||
borrowCap: 9_000_000, | ||
debtCeiling: 0, | ||
liqProtocolFee: 10_00, | ||
rateStrategyParams: IV3RateStrategyFactory.RateStrategyParams({ | ||
optimalUsageRatio: _bpsToRay(80_00), | ||
baseVariableBorrowRate: _bpsToRay(0), | ||
variableRateSlope1: _bpsToRay(6_00), | ||
variableRateSlope2: _bpsToRay(80_00), | ||
stableRateSlope1: _bpsToRay(13_00), | ||
stableRateSlope2: _bpsToRay(300_00), | ||
baseStableRateOffset: _bpsToRay(3_00), | ||
stableRateExcessOffset: _bpsToRay(8_00), | ||
optimalStableToTotalDebtRatio: _bpsToRay(20_00) | ||
}) | ||
}); | ||
|
||
return listings; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...dPYUSDToAaveV3EthereumMarket/AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125.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,42 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; | ||
import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol'; | ||
|
||
import 'forge-std/Test.sol'; | ||
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol'; | ||
import {AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125} from './AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125.sol'; | ||
|
||
/** | ||
* @dev Test for AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125 | ||
* command: make test-contract filter=AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125 | ||
*/ | ||
contract AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125_Test is ProtocolV3TestBase { | ||
AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125 internal proposal; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl('mainnet'), 19161904); | ||
proposal = new AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125(); | ||
} | ||
|
||
/** | ||
* @dev executes the generic test suite including e2e and config snapshots | ||
*/ | ||
function test_defaultProposalExecution() public { | ||
defaultTest( | ||
'AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125', | ||
AaveV3Ethereum.POOL, | ||
address(proposal) | ||
); | ||
} | ||
|
||
function test_collectorHasPYUSDFunds() public { | ||
GovV3Helpers.executePayload(vm, address(proposal)); | ||
(address aTokenAddress, , ) = AaveV3Ethereum | ||
.AAVE_PROTOCOL_DATA_PROVIDER | ||
.getReserveTokensAddresses(proposal.PYUSD()); | ||
assertGe(IERC20(aTokenAddress).balanceOf(address(AaveV3Ethereum.COLLECTOR)), 10 ** 6); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AddPYUSDToAaveV3EthereumMarket.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,61 @@ | ||
--- | ||
title: "Add PYUSD to Aave v3 Ethereum Pool" | ||
author: "JosepBove (ACI)" | ||
discussions: "https://governance.aave.com/t/arfc-add-pyusd-to-aave-v3-ethereum-market/16218/" | ||
--- | ||
|
||
## Simple Summary | ||
|
||
This AIP proposes the onboarding of the PYUSD stablecoin, minted by Paxos Trust Company, into the Aave V3 Ethereum pool. | ||
|
||
## Motivation | ||
|
||
PYUSD is a USD-pegged stablecoin minted through Paxos. While it’s still young, it has grown to a circulating supply of over $230M with strong peg resilience. Onboarding this asset into Aave will: | ||
|
||
Build synergies between Aave and PYUSD. | ||
Offer Aave users an additional stablecoin option. | ||
Strengthen the relationship between the PYUSD & the GHO stablecoin. (Trident may explore the deployment of a PYUSD/GHO pool) | ||
We propose a PYUSD onboarding outside isolation mode but without collateral properties. | ||
|
||
## Specification | ||
|
||
Ticker: PYUSD | ||
Contract address: 0x6c3ea9036406852006290770bedfcaba0e23a0e8 | ||
Price Feed: 0x8f1df6d7f2db73eece86a18b4381f4707b918fb1 | ||
|
||
Chainlink Oracle: https://data.chain.link/ethereum/mainnet/stablecoins/PYUSD-usd | ||
|
||
The table below illustrates the configured risk parameters for **PYUSD** | ||
|
||
| Parameter | Value | | ||
| ------------------------- | -----------------------------------------: | | ||
| Isolation Mode | false | | ||
| Borrowable | ENABLED | | ||
| Collateral Enabled | false | | ||
| Supply Cap (PYUSD) | 10,000,000 | | ||
| Borrow Cap (PYUSD) | 9,000,000 | | ||
| Debt Ceiling | USD 0 | | ||
| LTV | 0 % | | ||
| LT | 0 % | | ||
| Liquidation Bonus | 0 % | | ||
| Liquidation Protocol Fee | 10 % | | ||
| Reserve Factor | 20 % | | ||
| Base Variable Borrow Rate | 0 % | | ||
| Variable Slope 1 | 6 % | | ||
| Variable Slope 2 | 80 % | | ||
| Uoptimal | 80 % | | ||
| Flashloanable | ENABLED | | ||
| Siloed Borrowing | DISABLED | | ||
| Borrowable in Isolation | DISABLED | | ||
| Oracle | 0x8f1df6d7f2db73eece86a18b4381f4707b918fb1 | | ||
|
||
## References | ||
|
||
- Implementation: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240125_AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125.sol) | ||
- Tests: [AaveV3Ethereum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240125_AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125.t.sol) | ||
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xb91949efad61b134b913d93b00f73ca8a122259e6d1458cf793f22a0eebfd5d5) | ||
- [Discussion](https://governance.aave.com/t/arfc-add-pyusd-to-aave-v3-ethereum-market/16218/) | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
58 changes: 58 additions & 0 deletions
58
...veV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AddPYUSDToAaveV3EthereumMarket_20240125.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 {AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125} from './AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125.sol'; | ||
|
||
/** | ||
* @dev Deploy Ethereum | ||
* deploy-command: make deploy-ledger contract=src/20240125_AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AddPYUSDToAaveV3EthereumMarket_20240125.s.sol:DeployEthereum chain=mainnet | ||
* verify-command: npx catapulta-verify -b broadcast/AddPYUSDToAaveV3EthereumMarket_20240125.s.sol/1/run-latest.json | ||
*/ | ||
contract DeployEthereum is EthereumScript { | ||
function run() external broadcast { | ||
// deploy payloads | ||
address payload0 = GovV3Helpers.deployDeterministic( | ||
type(AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125).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/20240125_AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AddPYUSDToAaveV3EthereumMarket_20240125.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(AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket_20240125).creationCode | ||
); | ||
payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); | ||
|
||
// create proposal | ||
vm.startBroadcast(); | ||
GovV3Helpers.createProposal( | ||
vm, | ||
payloads, | ||
GovV3Helpers.ipfsHashFile( | ||
vm, | ||
'src/20240125_AaveV3Ethereum_AddPYUSDToAaveV3EthereumMarket/AddPYUSDToAaveV3EthereumMarket.md' | ||
) | ||
); | ||
} | ||
} |
Oops, something went wrong.
6ce4cb9
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 🌈