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

Set Debt Swap Adapter as Flash Borrower on Relevant Networks #255

Merged
merged 30 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bf06843
feat: Setup payloads with new generator
Zer0dot Aug 9, 2023
f889585
feat: Update readme
Zer0dot Aug 9, 2023
3b39662
feat: Payload deploy scripts
Zer0dot Aug 9, 2023
7e864bb
test: Update tests
Zer0dot Aug 9, 2023
2e1cb14
misc: Add missing space
Zer0dot Aug 10, 2023
5d0e9b9
feat: Add addresses
Zer0dot Aug 24, 2023
b938601
feat: Link discussion
Zer0dot Aug 28, 2023
d7769cb
misc: clean
Zer0dot Aug 28, 2023
9c5833c
feat: Link discussion
Zer0dot Aug 28, 2023
99b4376
feat: Link discussion
Zer0dot Aug 28, 2023
5914e61
feat: Link discussion
Zer0dot Aug 28, 2023
57d2cd8
feat: Link discussion
Zer0dot Aug 28, 2023
564bdf3
feat: Link discussion in md
Zer0dot Aug 28, 2023
7e4bc55
feat: Add Ethereum adapter address
Zer0dot Aug 28, 2023
7da49be
feat: Add Polygon adapter address
Zer0dot Aug 28, 2023
75cb365
feat: Add Avalanche adapter address
Zer0dot Aug 28, 2023
2ff3b8a
feat: Add Optimism adapter address
Zer0dot Aug 28, 2023
bb6ad84
feat: Add Arbitrum adapter address
Zer0dot Aug 28, 2023
973ab11
Merge branch 'main' into feat/set-debt-swap-adapter-as-flash-borrower
Zer0dot Aug 28, 2023
9830910
Merge branch 'main' into feat/set-debt-swap-adapter-as-flash-borrower
Zer0dot Sep 29, 2023
63a0de8
forge install: aave-address-book
Zer0dot Sep 29, 2023
681a752
feat: Add Base to proposal
Zer0dot Sep 29, 2023
79f6c10
misc: Add Base to readme
Zer0dot Sep 29, 2023
dd65da3
Merge branch 'main' into feat/set-debt-swap-adapter-as-flash-borrower
sakulstra Sep 29, 2023
b8af52d
fix: set base in .env example
sakulstra Sep 29, 2023
fd38fd0
Update src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/Ad…
sakulstra Sep 29, 2023
aab1583
Update src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/Ad…
sakulstra Sep 29, 2023
b5408f9
Apply suggestions from code review
sakulstra Sep 29, 2023
7411dcd
fix: adjust foundry scripts
sakulstra Oct 3, 2023
2d69f70
Update src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/Ad…
sakulstra Oct 9, 2023
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,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Raw diff

```json
{}
```
2 changes: 1 addition & 1 deletion generator/templates/test.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract ${contractName}_Test is Protocol${protocolVersion}TestBase {
vm.createSelectFork(vm.rpcUrl('${getAlias(chain)}'), ${await getBlock(
chain
)});
proposal = new ${contractName}();
proposal = new ${contractName}();
}

function testProposalExecution() public {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {GovHelpers} from 'aave-helpers/GovHelpers.sol';
import {EthereumScript, OptimismScript, ArbitrumScript, PolygonScript, AvalancheScript} from 'aave-helpers/ScriptUtils.sol';
import {AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';
import {AaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';
import {AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';
import {AaveV3_Polygon_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Polygon_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';
import {AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';

/**
* @dev Deploy AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809
* command: make deploy-ledger contract=src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower.s.sol:DeployEthereum chain=mainnet
*/
contract DeployEthereum is EthereumScript {
function run() external broadcast {
new AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809();
}
}

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

/**
* @dev Deploy AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809
* command: make deploy-ledger contract=src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower.s.sol:DeployArbitrum chain=arbitrum
*/
contract DeployArbitrum is ArbitrumScript {
function run() external broadcast {
new AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809();
}
}

/**
* @dev Deploy AaveV3_Polygon_AddDebtSwapAdapterAsFlashBorrower_20230809
* command: make deploy-ledger contract=src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower.s.sol:DeployPolygon chain=polygon
*/
contract DeployPolygon is PolygonScript {
function run() external broadcast {
new AaveV3_Polygon_AddDebtSwapAdapterAsFlashBorrower_20230809();
}
}

/**
* @dev Deploy AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809
* command: make deploy-ledger contract=src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower.s.sol:DeployAvalanche chain=avalanche
*/
contract DeployAvalanche is AvalancheScript {
function run() external broadcast {
new AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809();
}
}

/**
* @dev Create Proposal
* command: make deploy-ledger contract=src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower.s.sol:CreateProposal chain=mainnet
*/
contract CreateProposal is EthereumScript {
function run() external broadcast {
GovHelpers.Payload[] memory payloads = new GovHelpers.Payload[](4);
payloads[0] = GovHelpers.buildMainnet(address(0));
payloads[1] = GovHelpers.buildOptimism(address(0));
payloads[2] = GovHelpers.buildArbitrum(address(0));
payloads[3] = GovHelpers.buildPolygon(address(0));
GovHelpers.createProposal(
payloads,
GovHelpers.ipfsHashFile(
vm,
'src/20230809_AaveV3_Multi_AddDebtSwapAdapterAsFlashBorrower/AddDebtSwapAdapterAsFlashBorrower.md'
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {AaveV3Arbitrum, AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol';

/**
* @title Add DebtSwapAdapter as FlashBorrower
* @author BGD labs
* - Snapshot: TODO
Zer0dot marked this conversation as resolved.
Show resolved Hide resolved
* - Discussion: TODO
Zer0dot marked this conversation as resolved.
Show resolved Hide resolved
*/
contract AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809 is IProposalGenericExecutor {
address public constant NEW_FLASH_BORROWER = 0x9E8e9D6b0D24216F59043db68BDda1620892f549;

function execute() external {
AaveV3Arbitrum.ACL_MANAGER.addFlashBorrower(NEW_FLASH_BORROWER);
}
}
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 {AaveV3Arbitrum, AaveV3ArbitrumAssets} from 'aave-address-book/AaveV3Arbitrum.sol';
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';

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

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

function testProposalExecution() public {


ReserveConfig[] memory allConfigsBefore = createConfigurationSnapshot(
'preAaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809',
AaveV3Arbitrum.POOL
);

assertFalse(AaveV3Arbitrum.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

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

assertTrue(AaveV3Arbitrum.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot(
'postAaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809',
AaveV3Arbitrum.POOL
);

diffReports('preAaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809', 'postAaveV3_Arbitrum_AddDebtSwapAdapterAsFlashBorrower_20230809');
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {AaveV3Avalanche, AaveV3AvalancheAssets} from 'aave-address-book/AaveV3Avalanche.sol';

/**
* @title Add DebtSwapAdapter as FlashBorrower
* @author BGD labs
* - Snapshot: TODO
* - Discussion: TODO
Zer0dot marked this conversation as resolved.
Show resolved Hide resolved
*/
contract AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809 is IProposalGenericExecutor {
address public constant NEW_FLASH_BORROWER = 0x8A9b2c132EA7676EE267F5b97b622083d6E3a2d4;

function execute() external {
AaveV3Avalanche.ACL_MANAGER.addFlashBorrower(NEW_FLASH_BORROWER);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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 {AaveV3Avalanche, AaveV3AvalancheAssets} from 'aave-address-book/AaveV3Avalanche.sol';
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';

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

function setUp() public {
vm.createSelectFork(vm.rpcUrl('avalanche'), 33710216);
proposal = new AaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809();
}

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

assertFalse(AaveV3Avalanche.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

GovHelpers.executePayload(
vm,
address(proposal),
0xa35b76E4935449E33C56aB24b23fcd3246f13470 // avalanche guardian
);

assertTrue(AaveV3Avalanche.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot(
'postAaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809',
AaveV3Avalanche.POOL
);

diffReports(
'preAaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809',
'postAaveV3_Avalanche_AddDebtSwapAdapterAsFlashBorrower_20230809'
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';

/**
* @title Add DebtSwapAdapter as FlashBorrower
* @author BGD labs
* - Snapshot: TODO
* - Discussion: TODO
Zer0dot marked this conversation as resolved.
Show resolved Hide resolved
*/
contract AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809 is IProposalGenericExecutor {
address public constant NEW_FLASH_BORROWER = 0x8761e0370f94f68Db8EaA731f4fC581f6AD0Bd68;

function execute() external {
AaveV3Ethereum.ACL_MANAGER.addFlashBorrower(NEW_FLASH_BORROWER);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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 {AaveV3Ethereum, AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {ProtocolV3TestBase, ReserveConfig} from 'aave-helpers/ProtocolV3TestBase.sol';
import {AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';

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

function setUp() public {
vm.createSelectFork(vm.rpcUrl('mainnet'), 17879754);
proposal = new AaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809();
}

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

assertFalse(AaveV3Ethereum.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

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

assertTrue(AaveV3Ethereum.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot(
'postAaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809',
AaveV3Ethereum.POOL
);

diffReports(
'preAaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809',
'postAaveV3_Ethereum_AddDebtSwapAdapterAsFlashBorrower_20230809'
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IProposalGenericExecutor} from 'aave-helpers/interfaces/IProposalGenericExecutor.sol';
import {AaveV3Optimism, AaveV3OptimismAssets} from 'aave-address-book/AaveV3Optimism.sol';

/**
* @title Add DebtSwapAdapter as FlashBorrower
* @author BGD labs
* - Snapshot: TODO
* - Discussion: TODO
Zer0dot marked this conversation as resolved.
Show resolved Hide resolved
*/
contract AaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809 is IProposalGenericExecutor {
address public constant NEW_FLASH_BORROWER = 0xcFaE0D8c5707FCc6478D6a65fFA31efADeF8b8EC;

function execute() external {
AaveV3Optimism.ACL_MANAGER.addFlashBorrower(NEW_FLASH_BORROWER);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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_AddDebtSwapAdapterAsFlashBorrower_20230809} from './AaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809.sol';

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

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

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

assertFalse(AaveV3Optimism.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

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

assertTrue(AaveV3Optimism.ACL_MANAGER.isFlashBorrower(proposal.NEW_FLASH_BORROWER()));

ReserveConfig[] memory allConfigsAfter = createConfigurationSnapshot(
'postAaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809',
AaveV3Optimism.POOL
);

diffReports(
'preAaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809',
'postAaveV3_Optimism_AddDebtSwapAdapterAsFlashBorrower_20230809'
);
}
}
Loading