Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

OP Borrow activation - Review #334

Merged
merged 10 commits into from
Oct 17, 2023
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(0x9c11F54bA3c44ED7945D2405C15060bcD209f53e);
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,29 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3PayloadOptimism, IEngine, EngineFlags} from 'aave-helpers/v3-config-engine/AaveV3PayloadOptimism.sol';
import {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,54 @@
---
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 updates the OP lending pool to make it reflect the change voted in AIP-337.

## Motivation

While a [previous AIP](https://app.aave.com/governance/proposal/337/) updated the parameters of the Aave V3 Optimism pool for the OP asset, it didn't enable the borrow of the Optimism token. Thus this AIP proposes to deliver the second part of the AIP-337 by enabling borrowing of OP tokens matching it's original intent.

## 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/).