Skip to content

Commit

Permalink
Add second AIP for GHO Cross-Chain Launch (bgd-labs#356)
Browse files Browse the repository at this point in the history
* Add proposal for Gho Incident Report 20231113 (#1)

* chore: add payload and deploy script for update of GHO variable debt token

* forge install: gho-core

* chore: add gho-core to dependency

* test: Add tests for update of gho variable token

* test: Add tests for update of gho variable token

* fix: add modifier in method of interface

* fix: remove gho dependency from repo and fix test

* fix: Remove unnecesary dependency

* fix: Add latest details

---------

Co-authored-by: miguelmtzinf <[email protected]>

* fix: Make new impl constant (#3)

* fix: Amend AIP text (#4)

* fix: Make new impl constant

* fix: Fix AIP text

* test: Tweak default tests with borrow cap update (#5)

* fix: lint issue (#6)

* test: Add diffs from test running (#7)

* fix: Add payload address (#8)

* fix: Fix payload address in script (bgd-labs#9)

* fix: Remove unneeded diff file (bgd-labs#10)

* feat: Add proposal to onboard GHO

* fix: Fix AIP name

* fix: Update GHO ir

* fix: Fix diff report

* fix: Fix typo in AIP text

Co-authored-by: Harsh Pandey <[email protected]>

* fix: Fix typo in AIP text

Co-authored-by: Harsh Pandey <[email protected]>

* fix: Fix tests

* fix: Fix lint

---------

Co-authored-by: Parth Patel <[email protected]>
Co-authored-by: Harsh Pandey <[email protected]>
  • Loading branch information
3 people authored Jun 26, 2024
1 parent e8167f7 commit c7161d8
Show file tree
Hide file tree
Showing 7 changed files with 430 additions and 0 deletions.
1 change: 1 addition & 0 deletions .assets/014904fabcaa28d579bed688e1e3c35928c86f7c.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
## Reserve changes

### Reserves added

#### GHO ([0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33](https://arbiscan.io/address/0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33))

| description | value |
| --- | --- |
| decimals | 18 |
| isActive | true |
| isFrozen | false |
| supplyCap | 1,000,000 GHO |
| borrowCap | 900,000 GHO |
| debtCeiling | 0 $ |
| isSiloed | false |
| isFlashloanable | true |
| eModeCategory | 0 |
| oracle | [0xB05984aD83C20b3ADE7bf97a9a0Cb539DDE28DBb](https://arbiscan.io/address/0xB05984aD83C20b3ADE7bf97a9a0Cb539DDE28DBb) |
| oracleDecimals | 8 |
| oracleLatestAnswer | 1 |
| usageAsCollateralEnabled | false |
| ltv | 0 % |
| liquidationThreshold | 0 % |
| liquidationBonus | 0 % |
| liquidationProtocolFee | 0 % |
| reserveFactor | 10 % |
| aToken | [0xeBe517846d0F36eCEd99C735cbF6131e1fEB775D](https://arbiscan.io/address/0xeBe517846d0F36eCEd99C735cbF6131e1fEB775D) |
| aTokenImpl | [0x1Be1798b70aEe431c2986f7ff48d9D1fa350786a](https://arbiscan.io/address/0x1Be1798b70aEe431c2986f7ff48d9D1fa350786a) |
| variableDebtToken | [0x18248226C16BF76c032817854E7C83a2113B4f06](https://arbiscan.io/address/0x18248226C16BF76c032817854E7C83a2113B4f06) |
| variableDebtTokenImpl | [0x5E76E98E0963EcDC6A065d1435F84065b7523f39](https://arbiscan.io/address/0x5E76E98E0963EcDC6A065d1435F84065b7523f39) |
| stableDebtToken | [0x687871030477bf974725232F764aa04318A8b9c8](https://arbiscan.io/address/0x687871030477bf974725232F764aa04318A8b9c8) |
| stableDebtTokenImpl | [0x0c2C95b24529664fE55D4437D7A31175CFE6c4f7](https://arbiscan.io/address/0x0c2C95b24529664fE55D4437D7A31175CFE6c4f7) |
| borrowingEnabled | true |
| stableBorrowRateEnabled | false |
| isBorrowableInIsolation | false |
| interestRateStrategy | [0x36d32fD7a72AD600be60Ccb71D3718E455025CaA](https://arbiscan.io/address/0x36d32fD7a72AD600be60Ccb71D3718E455025CaA) |
| liquidityIndex | 1 |
| variableBorrowIndex | 1 |
| aTokenName | Aave Arbitrum GHO |
| aTokenSymbol | aArbGHO |
| currentLiquidityRate | 0 % |
| currentVariableBorrowRate | 0 % |
| isPaused | false |
| stableDebtTokenName | Aave Arbitrum Stable Debt GHO |
| stableDebtTokenSymbol | stableDebtArbGHO |
| variableDebtTokenName | Aave Arbitrum Variable Debt GHO |
| variableDebtTokenSymbol | variableDebtArbGHO |
| optimalUsageRatio | 90 % |
| maxExcessStableToTotalDebtRatio | 100 % |
| maxExcessUsageRatio | 10 % |
| optimalStableToTotalDebtRatio | 0 % |
| baseVariableBorrowRate | 0 % |
| variableRateSlope1 | 12 % |
| variableRateSlope2 | 65 % |
| baseStableBorrowRate | 12 % |
| stableRateSlope1 | 0 % |
| stableRateSlope2 | 0 % |
| interestRate | ![ir](/.assets/014904fabcaa28d579bed688e1e3c35928c86f7c.svg) |


## Raw diff

```json
{
"reserves": {
"0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33": {
"from": null,
"to": {
"aToken": "0xeBe517846d0F36eCEd99C735cbF6131e1fEB775D",
"aTokenImpl": "0x1Be1798b70aEe431c2986f7ff48d9D1fa350786a",
"aTokenName": "Aave Arbitrum GHO",
"aTokenSymbol": "aArbGHO",
"borrowCap": 900000,
"borrowingEnabled": true,
"currentLiquidityRate": 0,
"currentVariableBorrowRate": 0,
"debtCeiling": 0,
"decimals": 18,
"eModeCategory": 0,
"interestRateStrategy": "0x36d32fD7a72AD600be60Ccb71D3718E455025CaA",
"isActive": true,
"isBorrowableInIsolation": false,
"isFlashloanable": true,
"isFrozen": false,
"isPaused": false,
"isSiloed": false,
"liquidationBonus": 0,
"liquidationProtocolFee": 0,
"liquidationThreshold": 0,
"liquidityIndex": "1000000000000000000000000000",
"ltv": 0,
"oracle": "0xB05984aD83C20b3ADE7bf97a9a0Cb539DDE28DBb",
"oracleDecimals": 8,
"oracleLatestAnswer": 100000000,
"reserveFactor": 1000,
"stableBorrowRateEnabled": false,
"stableDebtToken": "0x687871030477bf974725232F764aa04318A8b9c8",
"stableDebtTokenImpl": "0x0c2C95b24529664fE55D4437D7A31175CFE6c4f7",
"stableDebtTokenName": "Aave Arbitrum Stable Debt GHO",
"stableDebtTokenSymbol": "stableDebtArbGHO",
"supplyCap": 1000000,
"symbol": "GHO",
"underlying": "0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33",
"usageAsCollateralEnabled": false,
"variableBorrowIndex": "1000000000000000000000000000",
"variableDebtToken": "0x18248226C16BF76c032817854E7C83a2113B4f06",
"variableDebtTokenImpl": "0x5E76E98E0963EcDC6A065d1435F84065b7523f39",
"variableDebtTokenName": "Aave Arbitrum Variable Debt GHO",
"variableDebtTokenSymbol": "variableDebtArbGHO"
}
}
},
"strategies": {
"0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33": {
"from": null,
"to": {
"address": "0x36d32fD7a72AD600be60Ccb71D3718E455025CaA",
"baseStableBorrowRate": "120000000000000000000000000",
"baseVariableBorrowRate": 0,
"maxExcessStableToTotalDebtRatio": "1000000000000000000000000000",
"maxExcessUsageRatio": "100000000000000000000000000",
"optimalStableToTotalDebtRatio": 0,
"optimalUsageRatio": "900000000000000000000000000",
"stableRateSlope1": 0,
"stableRateSlope2": 0,
"variableRateSlope1": "120000000000000000000000000",
"variableRateSlope2": "650000000000000000000000000"
}
}
}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3Arbitrum, AaveV3ArbitrumEModes} from 'aave-address-book/AaveV3Arbitrum.sol';
import {AaveV3PayloadArbitrum} from 'aave-helpers/v3-config-engine/AaveV3PayloadArbitrum.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 GHO Cross-Chain Launch Part 2
* @author Aave Labs
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0x2a6ffbcff41a5ef98b7542f99b207af9c1e79e61f859d0a62f3bf52d3280877a
* - Discussion: https://governance.aave.com/t/arfc-gho-cross-chain-launch/17616
*/
contract AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613 is AaveV3PayloadArbitrum {
using SafeERC20 for IERC20;

address public constant GHO = 0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33;
uint256 public constant GHO_SEED_AMOUNT = 1e18;

function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) {
IAaveV3ConfigEngine.Listing[] memory listings = new IAaveV3ConfigEngine.Listing[](1);

listings[0] = IAaveV3ConfigEngine.Listing({
asset: GHO,
assetSymbol: 'GHO',
priceFeed: 0xB05984aD83C20b3ADE7bf97a9a0Cb539DDE28DBb,
eModeCategory: AaveV3ArbitrumEModes.NONE,
enabledToBorrow: EngineFlags.ENABLED,
stableRateModeEnabled: EngineFlags.DISABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.ENABLED,
ltv: 0,
liqThreshold: 0,
liqBonus: 0,
reserveFactor: 10_00,
supplyCap: 1_000_000,
borrowCap: 900_000,
debtCeiling: 0,
liqProtocolFee: 0,
rateStrategyParams: IV3RateStrategyFactory.RateStrategyParams({
optimalUsageRatio: _bpsToRay(90_00),
baseVariableBorrowRate: _bpsToRay(0),
variableRateSlope1: _bpsToRay(12_00),
variableRateSlope2: _bpsToRay(65_00),
stableRateSlope1: _bpsToRay(0),
stableRateSlope2: _bpsToRay(0),
baseStableRateOffset: _bpsToRay(0),
stableRateExcessOffset: _bpsToRay(0),
optimalStableToTotalDebtRatio: _bpsToRay(0)
})
});

return listings;
}

function _postExecute() internal override {
IERC20(GHO).forceApprove(address(AaveV3Arbitrum.POOL), GHO_SEED_AMOUNT);
AaveV3Arbitrum.POOL.supply(GHO, GHO_SEED_AMOUNT, address(0), 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';
import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol';
import {ProtocolV3TestBase} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol';
import {GovernanceV3Arbitrum} from 'aave-address-book/GovernanceV3Arbitrum.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';

import {AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613} from './AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613.sol';

/**
* @dev Test for AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613
* command: FOUNDRY_PROFILE=arbitrum forge test --match-path=src/20240613_AaveV3Arbitrum_GHOCrossChainLaunchPart2/AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613.t.sol -vv
*/
contract AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613_Test is ProtocolV3TestBase {
AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613 internal proposal;

function setUp() public {
vm.createSelectFork(vm.rpcUrl('arbitrum'), 225178100);
proposal = new AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613();
}

/**
* @dev executes the generic test suite including e2e and config snapshots
*/
function test_defaultProposalExecution() public {
// Mock Executor receives GHO, also makes sure total supply >= supply cap so e2e tests pass
deal(proposal.GHO(), GovernanceV3Arbitrum.EXECUTOR_LVL_1, 1_000_000e18, true);

defaultTest(
'AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613',
AaveV3Arbitrum.POOL,
address(proposal)
);

(address aTokenAddress, , ) = AaveV3Arbitrum
.AAVE_PROTOCOL_DATA_PROVIDER
.getReserveTokensAddresses(proposal.GHO());
assertGe(IERC20(aTokenAddress).balanceOf(address(0)), proposal.GHO_SEED_AMOUNT());
}

function test_defaultProposalExecutionExactSeed() public {
// Mock Executor receives GHO seed amount
deal(proposal.GHO(), GovernanceV3Arbitrum.EXECUTOR_LVL_1, proposal.GHO_SEED_AMOUNT());

GovV3Helpers.executePayload(vm, address(proposal));

(address aTokenAddress, , ) = AaveV3Arbitrum
.AAVE_PROTOCOL_DATA_PROVIDER
.getReserveTokensAddresses(proposal.GHO());
assertGe(IERC20(aTokenAddress).balanceOf(address(0)), proposal.GHO_SEED_AMOUNT());
}

function testFail_defaultProposalExecutionNoSeed() public {
GovV3Helpers.executePayload(vm, address(proposal));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: "GHO Cross-Chain - Part 2"
author: "Aave Labs"
discussions: "https://governance.aave.com/t/arfc-gho-cross-chain-launch/17616"
snapshot: "https://snapshot.org/#/aave.eth/proposal/0x2a6ffbcff41a5ef98b7542f99b207af9c1e79e61f859d0a62f3bf52d3280877a"
---

## Simple Summary

This AIP is the Part 2 for the GHO Cross-Chain proposal and proposes the configuration of GHO on Arbitrum Aave V3 Pool in connection with the cross-chain implementation strategy.

Following the successful expansion of GHO to the Arbitrum network, this AIP proposes to onboard GHO into the Arbitrum Aave Pool as a borrowable asset, adopting risk parameters formulated by Chaos Labs.

## Motivation

The implementation of the GHO Cross Chain proposal required the proposal AIP to be split into two separate AIPs. This proposal is the second AIP (“Part 2”) for configuration of GHO on Arbitrum Aave Pool adopting risk parameters formulated by Chaos Labs.

## Specification

The table below illustrates the configured risk parameters for **GHO**

| Parameter | Value |
| ---------------------------------- | -----------------------------------------: |
| Isolation Mode | false |
| Borrowable | ENABLED |
| Collateral Enabled | false |
| Supply Cap (GHO) | 1,000,000 |
| Borrow Cap (GHO) | 900,000 |
| Debt Ceiling | USD 0 |
| LTV | 0 % |
| LT | 0 % |
| Liquidation Bonus | 0 % |
| Liquidation Protocol Fee | 0 % |
| Reserve Factor | 10 % |
| Base Variable Borrow Rate | 0 % |
| Variable Slope 1 | 12 % |
| Variable Slope 2 | 65 % |
| Uoptimal | 90 % |
| Stable Borrowing | DISABLED |
| Stable Slope1 | 0 % |
| Stable Slope2 | 0 % |
| Base Stable Rate Offset | 0 % |
| Stable Rate Excess Offset | 0 % |
| Optimal Stable To Total Debt Ratio | 0 % |
| Flashloanable | ENABLED |
| Siloed Borrowing | DISABLED |
| Borrowable in Isolation | DISABLED |
| Oracle | 0xB05984aD83C20b3ADE7bf97a9a0Cb539DDE28DBb |

## References

- Implementation: [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240613_AaveV3Arbitrum_GHOCrossChainLaunchPart2/AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613.sol)
- Tests: [AaveV3Arbitrum](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20240613_AaveV3Arbitrum_GHOCrossChainLaunchPart2/AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613.t.sol)
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0x2a6ffbcff41a5ef98b7542f99b207af9c1e79e61f859d0a62f3bf52d3280877a)
- [Discussion](https://governance.aave.com/t/arfc-gho-cross-chain-launch/17616)

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/GovV3Helpers.sol';
import {AaveV3Arbitrum} from 'aave-address-book/AaveV3Arbitrum.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {EthereumScript, ArbitrumScript} from 'aave-helpers/ScriptUtils.sol';
import {AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613} from './AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613.sol';

/**
* @dev Deploy Arbitrum
* deploy-command: make deploy-ledger contract=src/20240613_AaveV3Arbitrum_GHOCrossChainLaunchPart2/GHOCrossChainLaunchPart2_20240613.s.sol:DeployArbitrum chain=arbitrum
* verify-command: FOUNDRY_PROFILE=arbitrum npx catapulta-verify -b broadcast/GHOCrossChainLaunchPart2_20240613.s.sol/42161/run-latest.json
*/
contract DeployArbitrum is ArbitrumScript {
function run() external broadcast {
// deploy payloads
address payload0 = GovV3Helpers.deployDeterministic(
type(AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613).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/20240613_AaveV3Arbitrum_GHOCrossChainLaunchPart2/GHOCrossChainLaunchPart2_20240613.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 actionsArbitrum = new IPayloadsControllerCore.ExecutionAction[](1);
actionsArbitrum[0] = GovV3Helpers.buildAction(
type(AaveV3Arbitrum_GHOCrossChainLaunchPart2_20240613).creationCode
);
payloads[0] = GovV3Helpers.buildArbitrumPayload(vm, actionsArbitrum);

// create proposal
vm.startBroadcast();
GovV3Helpers.createProposal(
vm,
payloads,
GovernanceV3Ethereum.VOTING_PORTAL_ETH_POL,
GovV3Helpers.ipfsHashFile(
vm,
'src/20240613_AaveV3Arbitrum_GHOCrossChainLaunchPart2/GHOCrossChainLaunchPart2.md'
)
);
}
}
Loading

0 comments on commit c7161d8

Please sign in to comment.