Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Onboard SCR on AaveV3Scroll #539

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
## Reserve changes

### Reserves added

#### SCR ([0xd29687c813D741E2F938F4aC377128810E217b1b](https://scrollscan.com/address/0xd29687c813D741E2F938F4aC377128810E217b1b))

| description | value |
| --- | --- |
| decimals | 18 |
| isActive | true |
| isFrozen | false |
| supplyCap | 360,000 SCR |
| borrowCap | 180,000 SCR |
| debtCeiling | 0 $ [0] |
| isSiloed | false |
| isFlashloanable | true |
| oracle | [0x26f6F7C468EE309115d19Aa2055db5A74F8cE7A5](https://scrollscan.com/address/0x26f6F7C468EE309115d19Aa2055db5A74F8cE7A5) |
| oracleDecimals | 8 |
| oracleDescription | SCR / USD |
| oracleLatestAnswer | 0.929571 |
| usageAsCollateralEnabled | false |
| ltv | 0 % [0] |
| liquidationThreshold | 0 % [0] |
| liquidationBonus | 0 % |
| liquidationProtocolFee | 0 % [0] |
| reserveFactor | 20 % [2000] |
| aToken | [0x25718130C2a8eb94e2e1FAFB5f1cDd4b459aCf64](https://scrollscan.com/address/0x25718130C2a8eb94e2e1FAFB5f1cDd4b459aCf64) |
| aTokenImpl | [0x92EDe4ABd9df4Bfb49b4d723e4c932e35c47C54C](https://scrollscan.com/address/0x92EDe4ABd9df4Bfb49b4d723e4c932e35c47C54C) |
| variableDebtToken | [0xFFbA405BBF25B2e6C454d18165F2fd8786858c6B](https://scrollscan.com/address/0xFFbA405BBF25B2e6C454d18165F2fd8786858c6B) |
| variableDebtTokenImpl | [0x49bA16C08130FF8cFADE263B49387A8555bc057B](https://scrollscan.com/address/0x49bA16C08130FF8cFADE263B49387A8555bc057B) |
| borrowingEnabled | true |
| isBorrowableInIsolation | false |
| interestRateStrategy | [0xC37353E5766164D8654D3CB395acfDcA4c2E7Ddc](https://scrollscan.com/address/0xC37353E5766164D8654D3CB395acfDcA4c2E7Ddc) |
| aTokenName | Aave Scroll SCR |
| aTokenSymbol | aScrSCR |
| aTokenUnderlyingBalance | 100 SCR [100000000000000000000] |
| id | 4 |
| isPaused | false |
| variableDebtTokenName | Aave Scroll Variable Debt SCR |
| variableDebtTokenSymbol | variableDebtScrSCR |
| virtualAccountingActive | true |
| virtualBalance | 100 SCR [100000000000000000000] |
| optimalUsageRatio | 45 % |
| maxVariableBorrowRate | 307 % |
| baseVariableBorrowRate | 0 % |
| variableRateSlope1 | 7 % |
| variableRateSlope2 | 300 % |
| interestRate | ![ir](https://dash.onaave.com/api/static?variableRateSlope1=70000000000000000000000000&variableRateSlope2=3000000000000000000000000000&optimalUsageRatio=450000000000000000000000000&baseVariableBorrowRate=0&maxVariableBorrowRate=3070000000000000000000000000) |


## Raw diff

```json
{
"reserves": {
"0xd29687c813D741E2F938F4aC377128810E217b1b": {
"from": null,
"to": {
"aToken": "0x25718130C2a8eb94e2e1FAFB5f1cDd4b459aCf64",
"aTokenImpl": "0x92EDe4ABd9df4Bfb49b4d723e4c932e35c47C54C",
"aTokenName": "Aave Scroll SCR",
"aTokenSymbol": "aScrSCR",
"aTokenUnderlyingBalance": "100000000000000000000",
"borrowCap": 180000,
"borrowingEnabled": true,
"debtCeiling": 0,
"decimals": 18,
"id": 4,
"interestRateStrategy": "0xC37353E5766164D8654D3CB395acfDcA4c2E7Ddc",
"isActive": true,
"isBorrowableInIsolation": false,
"isFlashloanable": true,
"isFrozen": false,
"isPaused": false,
"isSiloed": false,
"liquidationBonus": 0,
"liquidationProtocolFee": 0,
"liquidationThreshold": 0,
"ltv": 0,
"oracle": "0x26f6F7C468EE309115d19Aa2055db5A74F8cE7A5",
"oracleDecimals": 8,
"oracleDescription": "SCR / USD",
"oracleLatestAnswer": "92957100",
"reserveFactor": 2000,
"supplyCap": 360000,
"symbol": "SCR",
"underlying": "0xd29687c813D741E2F938F4aC377128810E217b1b",
"usageAsCollateralEnabled": false,
"variableDebtToken": "0xFFbA405BBF25B2e6C454d18165F2fd8786858c6B",
"variableDebtTokenImpl": "0x49bA16C08130FF8cFADE263B49387A8555bc057B",
"variableDebtTokenName": "Aave Scroll Variable Debt SCR",
"variableDebtTokenSymbol": "variableDebtScrSCR",
"virtualAccountingActive": true,
"virtualBalance": "100000000000000000000"
}
}
},
"strategies": {
"0xd29687c813D741E2F938F4aC377128810E217b1b": {
"from": null,
"to": {
"address": "0xC37353E5766164D8654D3CB395acfDcA4c2E7Ddc",
"baseVariableBorrowRate": "0",
"maxVariableBorrowRate": "3070000000000000000000000000",
"optimalUsageRatio": "450000000000000000000000000",
"variableRateSlope1": "70000000000000000000000000",
"variableRateSlope2": "3000000000000000000000000000"
}
}
}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3Scroll} from 'aave-address-book/AaveV3Scroll.sol';
import {AaveV3PayloadScroll} from 'aave-helpers/src/v3-config-engine/AaveV3PayloadScroll.sol';
import {EngineFlags} from 'aave-v3-origin/contracts/extensions/v3-config-engine/EngineFlags.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {SafeERC20} from 'solidity-utils/contracts/oz-common/SafeERC20.sol';
import {IEmissionManager} from 'aave-v3-origin/contracts/rewards/interfaces/IEmissionManager.sol';
/**
* @title Onboard SCR to Aave V3 Scroll
* @author ACI
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0xef7dfa4e96e5f6a7337648d2dd3882f7b10e969c9564c118a34ce99eccec9383
* - Discussion: https://governance.aave.com/t/arfc-onboard-scr-to-aave-v3-scroll-instance/19688
*/
contract AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203 is AaveV3PayloadScroll {
using SafeERC20 for IERC20;

address public constant SCR = 0xd29687c813D741E2F938F4aC377128810E217b1b;
uint256 public constant SCR_SEED_AMOUNT = 100 * 1e18;
address public constant SCR_ADMIN = 0xac140648435d03f784879cd789130F22Ef588Fcd;

function _postExecute() internal override {
IERC20(SCR).forceApprove(address(AaveV3Scroll.POOL), SCR_SEED_AMOUNT);
AaveV3Scroll.POOL.supply(SCR, SCR_SEED_AMOUNT, address(AaveV3Scroll.COLLECTOR), 0);

(address aSCR, , ) = AaveV3Scroll.AAVE_PROTOCOL_DATA_PROVIDER.getReserveTokensAddresses(SCR);
IEmissionManager(AaveV3Scroll.EMISSION_MANAGER).setEmissionAdmin(SCR, SCR_ADMIN);
IEmissionManager(AaveV3Scroll.EMISSION_MANAGER).setEmissionAdmin(aSCR, SCR_ADMIN);
}

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

listings[0] = IAaveV3ConfigEngine.Listing({
asset: SCR,
assetSymbol: 'SCR',
priceFeed: 0x26f6F7C468EE309115d19Aa2055db5A74F8cE7A5,
enabledToBorrow: EngineFlags.ENABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.ENABLED,
ltv: 0,
liqThreshold: 0,
liqBonus: 0,
reserveFactor: 20_00,
supplyCap: 360_000,
borrowCap: 180_000,
debtCeiling: 0,
liqProtocolFee: 0,
rateStrategyParams: IAaveV3ConfigEngine.InterestRateInputData({
optimalUsageRatio: 45_00,
baseVariableBorrowRate: 0,
variableRateSlope1: 7_00,
variableRateSlope2: 300_00
})
});

return listings;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {GovV3Helpers} from 'aave-helpers/src/GovV3Helpers.sol';
import {AaveV3Scroll} from 'aave-address-book/AaveV3Scroll.sol';
import {GovernanceV3Scroll} from 'aave-address-book/GovernanceV3Scroll.sol';
import {IERC20} from 'solidity-utils/contracts/oz-common/interfaces/IERC20.sol';
import {IEmissionManager} from 'aave-v3-origin/contracts/rewards/interfaces/IEmissionManager.sol';

import 'forge-std/Test.sol';
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol';
import {AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203} from './AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203.sol';

/**
* @dev Test for AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203
* command: FOUNDRY_PROFILE=scroll forge test --match-path=src/20241203_AaveV3Scroll_OnboardSCRToAaveV3Scroll/AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203.t.sol -vv
*/
contract AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203_Test is ProtocolV3TestBase {
AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203 internal proposal;

function setUp() public {
vm.createSelectFork(vm.rpcUrl('scroll'), 11609572);
proposal = new AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203();

// Simulate SEED funds
address SCR_WHALE = 0x212499E4E77484E565E1965Ea220D30B1c469233;
vm.startPrank(SCR_WHALE);
IERC20(proposal.SCR()).transfer(GovernanceV3Scroll.EXECUTOR_LVL_1, proposal.SCR_SEED_AMOUNT());
vm.stopPrank();
}

/**
* @dev executes the generic test suite including e2e and config snapshots
*/
function test_defaultProposalExecution() public {
defaultTest(
'AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203',
AaveV3Scroll.POOL,
address(proposal)
);
}

function test_collectorHasSCRFunds() public {
GovV3Helpers.executePayload(vm, address(proposal));
(address aTokenAddress, , ) = AaveV3Scroll
.AAVE_PROTOCOL_DATA_PROVIDER
.getReserveTokensAddresses(proposal.SCR());
assertGe(IERC20(aTokenAddress).balanceOf(address(AaveV3Scroll.COLLECTOR)), 100 * 10 ** 18);
}

function test_SCRAdmin() public {
GovV3Helpers.executePayload(vm, address(proposal));
(address aSCR, , ) = AaveV3Scroll.AAVE_PROTOCOL_DATA_PROVIDER.getReserveTokensAddresses(
proposal.SCR()
);
assertEq(
IEmissionManager(AaveV3Scroll.EMISSION_MANAGER).getEmissionAdmin(proposal.SCR()),
proposal.SCR_ADMIN()
);
assertEq(
IEmissionManager(AaveV3Scroll.EMISSION_MANAGER).getEmissionAdmin(aSCR),
proposal.SCR_ADMIN()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: "Onboard SCR to Aave V3 Scroll"
author: "ACI"
discussions: "https://governance.aave.com/t/arfc-onboard-scr-to-aave-v3-scroll-instance/19688"
snapshot: "https://snapshot.org/#/aave.eth/proposal/0xef7dfa4e96e5f6a7337648d2dd3882f7b10e969c9564c118a34ce99eccec9383"
---

## Simple Summary

The current ARFC aims to onboard SCR, the native token of Scroll, on the Aave V3 Scroll Instance. This onboarding will allow Aave users to supply and borrow SCR, thereby enhancing the utility and liquidity of the Scroll token within the DeFi ecosystem and more specifically, within the Aave ecosystem.

## Motivation

Scroll is an Ethereum Layer 2 chain which already has an Aave instance deployment and SCR is the governance token for the Scroll L2. By onboarding SCR to Aave V3, we aim to create new opportunities for Aave users to engage with this emerging staking ecosystem, while expanding SCR’s liquidity.

**Benefits of listing this token:**

Provide opportunities for Aave users to borrow against their SCR to unlock liquidity, or alternatively to borrow SCR against other collateral allowing them to participate in Scroll governance.

**Market Impact:**

We see no significant market impact from onboarding SCR except for providing new opportunities to Aave users which may cause users to switch from borrowing other tokens against their collateral. Overall we see onboarding SCR as net good for Aave users as it expands opportunities for them to engage in a new L2 ecosystem.

**Chain to be deployed/listed:**

Scroll.

**Proof of Liquidity (POL) and Deposit Commitments:**

POL and Deposit Commitments will be discussed at the ARFC stage.

As disclosed by Marc Zeller, founder of ACI, the ACI Multisig has received 510K SCR on behalf of Aave DAO. Those funds will be coordinated with Karpatkey and Tokenlogic to define best usage of this airdrop.

## Specification

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

| Parameter | Value |
| ------------------------- | -----------------------------------------: |
| Isolation Mode | false |
| Borrowable | ENABLED |
| Collateral Enabled | true |
| Supply Cap (SCR) | 360,000 |
| Borrow Cap (SCR) | 180,000 |
| Debt Ceiling | USD 0 |
| LTV | 0 % |
| LT | 0 % |
| Liquidation Bonus | 0 % |
| Liquidation Protocol Fee | 0 % |
| Reserve Factor | 20 % |
| Base Variable Borrow Rate | 0 % |
| Variable Slope 1 | 7 % |
| Variable Slope 2 | 300 % |
| Uoptimal | 45 % |
| Flashloanable | ENABLED |
| Siloed Borrowing | DISABLED |
| Borrowable in Isolation | DISABLED |
| Oracle | 0x26f6F7C468EE309115d19Aa2055db5A74F8cE7A5 |

Additionaly [0xac140648435d03f784879cd789130F22Ef588Fcd](https://scrollscan.com/address/0xac140648435d03f784879cd789130F22Ef588Fcd) has been set as the emission admin for SCR and the corresponding aToken.

## References

- Implementation: [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20241203_AaveV3Scroll_OnboardSCRToAaveV3Scroll/AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203.sol)
- Tests: [AaveV3Scroll](https://github.com/bgd-labs/aave-proposals-v3/blob/main/src/20241203_AaveV3Scroll_OnboardSCRToAaveV3Scroll/AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203.t.sol)
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0xef7dfa4e96e5f6a7337648d2dd3882f7b10e969c9564c118a34ce99eccec9383)
- [Discussion](https://governance.aave.com/t/arfc-onboard-scr-to-aave-v3-scroll-instance/19688)

## 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/src/GovV3Helpers.sol';
import {AaveV3Scroll} from 'aave-address-book/AaveV3Scroll.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {EthereumScript, ScrollScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol';
import {AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203} from './AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203.sol';

/**
* @dev Deploy Scroll
* deploy-command: make deploy-ledger contract=src/20241203_AaveV3Scroll_OnboardSCRToAaveV3Scroll/OnboardSCRToAaveV3Scroll_20241203.s.sol:DeployScroll chain=scroll
* verify-command: FOUNDRY_PROFILE=scroll npx catapulta-verify -b broadcast/OnboardSCRToAaveV3Scroll_20241203.s.sol/534352/run-latest.json
*/
contract DeployScroll is ScrollScript {
function run() external broadcast {
// deploy payloads
address payload0 = GovV3Helpers.deployDeterministic(
type(AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203).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/20241203_AaveV3Scroll_OnboardSCRToAaveV3Scroll/OnboardSCRToAaveV3Scroll_20241203.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 actionsScroll = new IPayloadsControllerCore.ExecutionAction[](1);
actionsScroll[0] = GovV3Helpers.buildAction(
type(AaveV3Scroll_OnboardSCRToAaveV3Scroll_20241203).creationCode
);
payloads[0] = GovV3Helpers.buildScrollPayload(vm, actionsScroll);

// create proposal
vm.startBroadcast();
GovV3Helpers.createProposal(
vm,
payloads,
GovernanceV3Ethereum.VOTING_PORTAL_ETH_POL,
GovV3Helpers.ipfsHashFile(
vm,
'src/20241203_AaveV3Scroll_OnboardSCRToAaveV3Scroll/OnboardSCRToAaveV3Scroll.md'
)
);
}
}
Loading
Loading