-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
216 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.26; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {AaveLooper} from "../src/AaveLooper.sol"; | ||
import {ERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
import {DevOpsTools} from "../lib/foundry-devops/src/DevOpsTools.sol"; | ||
import {HelperConfig} from "./HelperConfig.s.sol"; | ||
|
||
contract Exit is Script { | ||
HelperConfig helperConfig = new HelperConfig(); | ||
address aaveLooper = DevOpsTools.get_most_recent_deployment("AaveLooper", block.chainid); | ||
address supplyAsset; | ||
address borrowAsset; | ||
uint256 initialAmount; | ||
uint256 iterations; | ||
|
||
function run() external { | ||
HelperConfig.NetworkConfig memory networkConfig = helperConfig.getActiveNetworkConfig(); | ||
|
||
supplyAsset = vm.envOr("SUPPLY_ASSET", networkConfig.usdc); | ||
borrowAsset = vm.envOr("BORROW_ASSET", networkConfig.weth); | ||
initialAmount = vm.envOr("INITIAL_AMOUNT", uint256(1000000)); | ||
|
||
AaveLooper looper = AaveLooper(aaveLooper); | ||
|
||
console2.log("Supply asset:", supplyAsset); | ||
console2.log("Borrow asset:", borrowAsset); | ||
|
||
vm.startBroadcast(); | ||
looper.exitPosition(supplyAsset, borrowAsset, 5, 500); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.26; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {AaveLooper} from "../src/AaveLooper.sol"; | ||
import {ERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
import {DevOpsTools} from "../lib/foundry-devops/src/DevOpsTools.sol"; | ||
import {HelperConfig} from "./HelperConfig.s.sol"; | ||
|
||
contract Repay is Script { | ||
HelperConfig helperConfig = new HelperConfig(); | ||
address aaveLooper = DevOpsTools.get_most_recent_deployment("AaveLooper", block.chainid); | ||
address supplyAsset; | ||
address borrowAsset; | ||
uint256 initialAmount; | ||
uint256 iterations; | ||
|
||
function run() external { | ||
console2.log("Aave looper address:", aaveLooper); | ||
HelperConfig.NetworkConfig memory networkConfig = helperConfig.getActiveNetworkConfig(); | ||
|
||
supplyAsset = vm.envOr("SUPPLY_ASSET", networkConfig.usdc); | ||
borrowAsset = vm.envOr("BORROW_ASSET", networkConfig.weth); | ||
initialAmount = vm.envOr("INITIAL_AMOUNT", uint256(1000000)); | ||
|
||
AaveLooper looper = AaveLooper(aaveLooper); | ||
|
||
console2.log("Supply asset:", supplyAsset); | ||
console2.log("Borrow asset:", borrowAsset); | ||
|
||
vm.startBroadcast(); | ||
looper._repayBorrow(borrowAsset, 1); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.26; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {AaveLooper} from "../src/AaveLooper.sol"; | ||
import {ERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
import {DevOpsTools} from "../lib/foundry-devops/src/DevOpsTools.sol"; | ||
import {HelperConfig} from "./HelperConfig.s.sol"; | ||
|
||
contract ExitWithFlashloan is Script { | ||
HelperConfig helperConfig = new HelperConfig(); | ||
address aaveLooper = DevOpsTools.get_most_recent_deployment("AaveLooper", block.chainid); | ||
address supplyAsset; | ||
address borrowAsset; | ||
uint256 initialAmount; | ||
uint256 iterations; | ||
|
||
function run() external { | ||
HelperConfig.NetworkConfig memory networkConfig = helperConfig.getActiveNetworkConfig(); | ||
|
||
supplyAsset = vm.envOr("SUPPLY_ASSET", networkConfig.usdc); | ||
borrowAsset = vm.envOr("BORROW_ASSET", networkConfig.weth); | ||
initialAmount = vm.envOr("INITIAL_AMOUNT", uint256(1000000)); | ||
|
||
AaveLooper looper = AaveLooper(aaveLooper); | ||
|
||
console2.log("Supply asset:", supplyAsset); | ||
console2.log("Borrow asset:", borrowAsset); | ||
|
||
vm.startBroadcast(); | ||
looper.exitPositionWithFlashLoan(supplyAsset, borrowAsset); | ||
vm.stopBroadcast(); | ||
} | ||
} |
Oops, something went wrong.