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

Op enable borrow #23

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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,25 @@
## Reserve changes

### Reserves altered

#### OP ([0x4200000000000000000000000000000000000042](https://optimistic.etherscan.io/address/0x4200000000000000000000000000000000000042))

| description | value before | value after |
| --- | --- | --- |
| borrowingEnabled | false | true |


## Raw diff

```json
{
"reserves": {
"0x4200000000000000000000000000000000000042": {
"borrowingEnabled": {
"from": false,
"to": true
}
}
}
}
```
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, OptimismScript} from 'aave-helpers/ScriptUtils.sol';
import {AaveV3_Optimism_EnableBorrowOfOPToken_20231016} from './AaveV3_Optimism_EnableBorrowOfOPToken_20231016.sol';

/**
* @dev Deploy AaveV3_Optimism_EnableBorrowOfOPToken_20231016
* command: make deploy-ledger contract=src/20231016_AaveV3_Opt_EnableBorrowOfOPToken/AaveV3_EnableBorrowOfOPToken_20231016.s.sol:DeployOptimism chain=optimism
*/
contract DeployOptimism is OptimismScript {
function run() external broadcast {
new AaveV3_Optimism_EnableBorrowOfOPToken_20231016();
}
}

/**
* @dev Create Proposal
* command: make deploy-ledger contract=src/20231016_AaveV3_Opt_EnableBorrowOfOPToken/AaveV3_EnableBorrowOfOPToken_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.buildOptimism(address(0));
GovHelpers.createProposal(
payloads,
GovHelpers.ipfsHashFile(
vm,
'src/20231016_AaveV3_Opt_EnableBorrowOfOPToken/EnableBorrowOfOPToken.md'
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3PayloadOptimism, IEngine, EngineFlags} from 'aave-helpers/v3-config-engine/AaveV3PayloadOptimism.sol';
import {AaveV3Optimism, AaveV3OptimismAssets} from 'aave-address-book/AaveV3Optimism.sol';


/**
* @title Enable borrow of OP token
* @author Alice Rozengarden (@Rozengarden - Aave-chan initiative)
* - Snapshot: https://snapshot.org/#/aave.eth/proposal/0x617adb838ce95e319f06f72e177ad62cd743c2fe3fd50d6340dfc8606fbdd0b3
* - Discussion: https://governance.aave.com/t/arfc-op-risk-parameters-update-aave-v3-optimism-pool/14633
*/
contract AaveV3_Optimism_EnableBorrowOfOPToken_20231016 is AaveV3PayloadOptimism {
function borrowsUpdates() public pure override returns (IEngine.BorrowUpdate[] memory) {
IEngine.BorrowUpdate[] memory borrowsUpdate = new IEngine.BorrowUpdate[](1);

borrowsUpdate[0] = IEngine.BorrowUpdate({
asset: AaveV3OptimismAssets.OP_UNDERLYING,
reserveFactor: EngineFlags.KEEP_CURRENT,
enabledToBorrow: EngineFlags.ENABLED,
flashloanable: EngineFlags.KEEP_CURRENT,
stableRateModeEnabled: EngineFlags.KEEP_CURRENT,
borrowableInIsolation: EngineFlags.KEEP_CURRENT,
withSiloedBorrowing: EngineFlags.KEEP_CURRENT
});

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

import 'forge-std/Test.sol';
import {GovHelpers} from 'aave-helpers/GovHelpers.sol';
import {AaveGovernanceV2} from 'aave-address-book/AaveGovernanceV2.sol';
import {AaveV3Optimism, AaveV3OptimismAssets} from 'aave-address-book/AaveV3Optimism.sol';
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3_Optimism_EnableBorrowOfOPToken_20231016} from './AaveV3_Optimism_EnableBorrowOfOPToken_20231016.sol';

/**
* @dev Test for AaveV3_Optimism_EnableBorrowOfOPToken_20231016
* command: make test-contract filter=AaveV3_Optimism_EnableBorrowOfOPToken_20231016
*/
contract AaveV3_Optimism_EnableBorrowOfOPToken_20231016_Test is ProtocolV3TestBase {
AaveV3_Optimism_EnableBorrowOfOPToken_20231016 internal proposal;

function setUp() public {
vm.createSelectFork(vm.rpcUrl('optimism'), 110936488);
proposal = new AaveV3_Optimism_EnableBorrowOfOPToken_20231016();
}

function testProposalExecution() public {
ReserveConfig[] memory allConfigsBefore = createConfigurationSnapshot(
'preAaveV3_Optimism_EnableBorrowOfOPToken_20231016',
AaveV3Optimism.POOL
);

GovHelpers.executePayload(vm, address(proposal), AaveGovernanceV2.OPTIMISM_BRIDGE_EXECUTOR);

ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot(
'postAaveV3_Optimism_EnableBorrowOfOPToken_20231016',
AaveV3Optimism.POOL
);
_noReservesConfigsChangesApartFrom(
allConfigsBefore,
allConfigsAfter,
AaveV3OptimismAssets.OP_UNDERLYING
);
diffReports(
'preAaveV3_Optimism_EnableBorrowOfOPToken_20231016',
'postAaveV3_Optimism_EnableBorrowOfOPToken_20231016'
);

e2eTest(AaveV3Optimism.POOL);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: "Enable borrow of OP token"
author: "Alice Rozengarden (@Rozengarden - Aave-chan initiative)"
discussions: "https://governance.aave.com/t/arfc-op-risk-parameters-update-aave-v3-optimism-pool/14633"
---

## Simple Summary

This proposal update the OP lending pool to make it reflect the change voted in a previous AIP

## Motivation

While a [previous AIP](https://app.aave.com/governance/proposal/337/) updated the parameters of the lending pool to change the borrow rate, it didn't enable the borrow of the Optimism token. Thus this AIP goal is to add the finishing touch to the previously mentionned AIP.

## Specification

- **Asset**: OP
- **OP Contract Address**: [0x4200000000000000000000000000000000000042](https://optimistic.etherscan.io/address/0x4200000000000000000000000000000000000042)

**New Risk Parameters**:

| Parameter | Value |
| --- | --- |
| Asset | OP |
| Enabled to Borrow | Enabled |

As a reminder, here are the previously updated parameters:

| Parameter | Value |
| --- | --- |
| Asset | OP |
| Supply Cap | 10M |
| Borrow Cap | 500k |
| Loan To Value (LTV) | 30% |
| Liquidation Threshold (LT) | 40% |
| Liquidation Penalty (LP) | 10% |
| Liquidation Protocol Fee (LPF) | 10% |
| Stable Borrow | Disabled |
| Base Variable Rate | 0% |
| Slope1 | 7% |
| Slope2 | 300% |
| Optimal Ratio | 45% |
| Reserve Factor (RF) | 20% |


## References

- Implementation: [Optimism](https://github.com/bgd-labs/aave-proposals/blob/main/src/20231016_AaveV3_Opt_EnableBorrowOfOPToken/AaveV3_Optimism_EnableBorrowOfOPToken_20231016.sol)
- Tests: [Optimism](https://github.com/bgd-labs/aave-proposals/blob/main/src/20231016_AaveV3_Opt_EnableBorrowOfOPToken/AaveV3_Optimism_EnableBorrowOfOPToken_20231016.t.sol)
- [Snapshot](https://snapshot.org/#/aave.eth/proposal/0x617adb838ce95e319f06f72e177ad62cd743c2fe3fd50d6340dfc8606fbdd0b3)
- [Discussion](https://governance.aave.com/t/arfc-op-risk-parameters-update-aave-v3-optimism-pool/14633)

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).