-
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
11 changed files
with
201 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/target | ||
.env | ||
.env | ||
./contracts/broadcast/ |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ out/ | |
!/broadcast | ||
/broadcast/*/31337/ | ||
/broadcast/**/dry-run/ | ||
/broadcast/ | ||
|
||
# Docs | ||
docs/ | ||
|
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
Submodule foundry-devops
added at
47393d
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,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.26; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {AaveLooper} from "../src/AaveLooper.sol"; | ||
import {HelperConfig} from "./HelperConfig.s.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
|
||
contract DeployAaveLooper is Script { | ||
address owner; | ||
address lendingPool; | ||
address incentives; | ||
|
||
function run() external { | ||
HelperConfig helperConfig = new HelperConfig(); | ||
HelperConfig.NetworkConfig memory networkConfig = helperConfig.getActiveNetworkConfig(); | ||
|
||
owner = networkConfig.deployerAddress; | ||
lendingPool = networkConfig.aaveLendingPool; | ||
incentives = networkConfig.aaveIncentives; | ||
|
||
require(owner != address(0), "Owner address not set"); | ||
require(lendingPool != address(0), "Lending Pool address not set"); | ||
require(incentives != address(0), "Incentives Controller address not set"); | ||
|
||
// Start broadcasting transactions | ||
vm.startBroadcast(); | ||
|
||
// Deploy the AaveLooper contract | ||
AaveLooper looper = new AaveLooper(owner, lendingPool, incentives); | ||
|
||
console2.log("AaveLooper deployed at:", address(looper)); | ||
|
||
// Stop broadcasting transactions | ||
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,34 @@ | ||
// 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 EnterAavePosition 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.usdt); | ||
initialAmount = vm.envOr("INITIAL_AMOUNT", uint256(1000000000000000000)); | ||
iterations = vm.envOr("ITERATIONS", uint256(1)); | ||
AaveLooper looper = AaveLooper(aaveLooper); | ||
|
||
vm.startBroadcast(); | ||
ERC20(supplyAsset).approve(aaveLooper, initialAmount); | ||
uint256 liquidity = looper.enterPosition(supplyAsset, borrowAsset, initialAmount, iterations); | ||
vm.stopBroadcast(); | ||
|
||
console2.log("Entered position. Final liquidity:", liquidity); | ||
} | ||
} |
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,68 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.26; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {AaveLooper} from "../src/AaveLooper.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
|
||
contract HelperConfig is Script { | ||
NetworkConfig public activeNetworkConfig; | ||
|
||
struct NetworkConfig { | ||
uint256 deployerKey; | ||
address deployerAddress; | ||
address aaveLendingPool; | ||
address aaveIncentives; | ||
address usdc; | ||
address usdt; | ||
address dai; | ||
address weth; | ||
} | ||
|
||
constructor() { | ||
if (block.chainid == 42161) { | ||
uint256 deployerKey = vm.envUint("PRIVATE_KEY"); | ||
activeNetworkConfig = NetworkConfig({ | ||
deployerKey: deployerKey, | ||
deployerAddress: vm.addr(deployerKey), | ||
aaveLendingPool: 0x794a61358D6845594F94dc1DB02A252b5b4814aD, | ||
aaveIncentives: 0x929EC64c34a17401F460460D4B9390518E5B473e, | ||
usdc: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831, | ||
usdt: 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9, | ||
dai: 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1, | ||
weth: 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 | ||
}); | ||
} else if (block.chainid == 1) { | ||
uint256 deployerKey = vm.envUint("PRIVATE_KEY"); | ||
activeNetworkConfig = NetworkConfig({ | ||
deployerKey: deployerKey, | ||
deployerAddress: vm.addr(deployerKey), | ||
aaveLendingPool: 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9, | ||
aaveIncentives: 0x8164Cc65827dcFe994AB23944CBC90e0aa80bFcb, | ||
usdc: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, | ||
usdt: 0xdAC17F958D2ee523a2206206994597C13D831ec7, | ||
dai: 0x6B175474E89094C44Da98b954EedeAC495271d0F, | ||
weth: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 | ||
}); | ||
// sepolia | ||
} else if (block.chainid == 11155111) { | ||
uint256 deployerKey = vm.envUint("PRIVATE_KEY"); | ||
activeNetworkConfig = NetworkConfig({ | ||
deployerKey: deployerKey, | ||
deployerAddress: vm.addr(deployerKey), | ||
aaveLendingPool: 0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951, | ||
aaveIncentives: 0x4DA5c4da71C5a167171cC839487536d86e083483, | ||
usdc: 0x94a9D9AC8a22534E3FaCa9F4e7F2E2cf85d5E4C8, | ||
usdt: 0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0, | ||
dai: 0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357, | ||
weth: 0xC558DBdd856501FCd9aaF1E62eae57A9F0629a3c | ||
}); | ||
} else { | ||
revert("Unsupported network"); | ||
} | ||
} | ||
|
||
function getActiveNetworkConfig() public view returns (NetworkConfig memory) { | ||
return activeNetworkConfig; | ||
} | ||
} |
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