-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/v-1.5' into audit/24-03
- Loading branch information
Showing
79 changed files
with
5,428 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.15 | ||
pragma solidity ^0.8.15; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {MultiStrategyVault, IERC4626, IERC20, Allocation} from "../src/vaults/MultiStrategyVault.sol"; | ||
|
||
contract AllocateFunds is Script { | ||
Allocation[] internal allocations; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
// allocations.push(Allocation({index:0,amount:20e18})); | ||
|
||
// MultiStrategyVault(0xcede40B40F7AF69f5Aa6b12D75fd5eA9cE138b93).pullFunds(allocations); | ||
|
||
// allocations.push(Allocation({index:1,amount:10e18})); | ||
// allocations.push(Allocation({index:2,amount:5e18})); | ||
// allocations.push(Allocation({index:3,amount:5e18})); | ||
|
||
// MultiStrategyVault(0xcede40B40F7AF69f5Aa6b12D75fd5eA9cE138b93).pushFunds(allocations); | ||
|
||
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,21 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.15 | ||
pragma solidity ^0.8.15; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {FeeRecipientProxy} from "../../src/utils/FeeRecipientProxy.sol"; | ||
|
||
contract Deploy is Script { | ||
address deployer; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
deployer = vm.addr(deployerPrivateKey); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
new FeeRecipientProxy{salt: bytes32("FeeRecipientProxy")}(deployer); | ||
|
||
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,49 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.25 | ||
pragma solidity ^0.8.25; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {MultiStrategyVault, IERC4626, IERC20} from "../../src/vaults/MultiStrategyVault.sol"; | ||
|
||
contract DeployMultiStrategyVault is Script { | ||
address deployer; | ||
|
||
IERC20 internal asset; | ||
IERC4626[] internal strategies; | ||
uint256 internal defaultDepositIndex; | ||
uint256[] internal withdrawalQueue; | ||
uint256 internal depositLimit; | ||
address internal owner; | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
deployer = vm.addr(deployerPrivateKey); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
// @dev edit this values below | ||
asset = IERC20(0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F); | ||
|
||
strategies = [ | ||
IERC4626(0x61dCd1Da725c0Cdb2C6e67a0058E317cA819Cf5f), | ||
IERC4626(0x9168AC3a83A31bd85c93F4429a84c05db2CaEF08), | ||
IERC4626(0x2D0483FefAbA4325c7521539a3DFaCf94A19C472), | ||
IERC4626(0x6076ebDFE17555ed3E6869CF9C373Bbd9aD55d38) | ||
]; | ||
|
||
defaultDepositIndex = uint256(0); | ||
|
||
withdrawalQueue = [0, 1, 2, 3]; | ||
|
||
depositLimit = type(uint256).max; | ||
|
||
owner = deployer; | ||
|
||
// Actual deployment | ||
MultiStrategyVault vault = new MultiStrategyVault(); | ||
|
||
vault.initialize(asset, strategies, defaultDepositIndex, withdrawalQueue, depositLimit, deployer); | ||
|
||
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,30 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.25 | ||
|
||
pragma solidity ^0.8.25; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {stdJson} from "forge-std/StdJson.sol"; | ||
import {AaveV3Depositor, IERC20} from "../../../src/strategies/aave/aaveV3/AaveV3Depositor.sol"; | ||
|
||
contract DeployStrategy is Script { | ||
using stdJson for string; | ||
|
||
function run() public { | ||
string memory json = vm.readFile( | ||
string.concat( | ||
vm.projectRoot(), | ||
"./srcript/deploy/aave/AaveV3DepositorDeployConfig.json" | ||
) | ||
); | ||
|
||
AaveV3Depositor strategy = new AaveV3Depositor(); | ||
|
||
strategy.initialize( | ||
json.readAddress(".baseInit.asset"), | ||
json.readAddress(".baseInit.owner"), | ||
json.readBool(".baseInit.autoHarvest"), | ||
abi.encode(json.readAddress(".strategyInit.aaveDataProvider")) | ||
); | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"baseInit": { | ||
"asset": "", | ||
"owner": "", | ||
"autoHarvest": false | ||
}, | ||
"strategyInit": { | ||
"aaveDataProvider": "0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3" | ||
}, | ||
"harvest": {} | ||
} |
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,49 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.25 | ||
|
||
pragma solidity ^0.8.25; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {stdJson} from "forge-std/StdJson.sol"; | ||
import {AuraCompounder, IERC20, BatchSwapStep, IAsset, AuraValues, HarvestValues, HarvestTradePath, TradePath} from "../../../src/strategies/aura/AuraCompounder.sol"; | ||
|
||
contract DeployStrategy is Script { | ||
using stdJson for string; | ||
|
||
function run() public { | ||
string memory json = vm.readFile( | ||
string.concat( | ||
vm.projectRoot(), | ||
"./srcript/deploy/aura/AuraCompounderDeployConfig.json" | ||
) | ||
); | ||
|
||
// Read strategy init values | ||
AuraValues memory auraValues_ = abi.decode( | ||
json.parseRaw(".strategyInit"), | ||
(AuraValues) | ||
); | ||
|
||
// Deploy Strategy | ||
AuraCompounder strategy = new AuraCompounder(); | ||
|
||
strategy.initialize( | ||
json.readAddress(".baseInit.asset"), | ||
json.readAddress(".baseInit.owner"), | ||
json.readBool(".baseInit.autoHarvest"), | ||
abi.encode(auraValues_) | ||
); | ||
|
||
HarvestValues memory harvestValues_ = abi.decode( | ||
json.parseRaw(".harvest.harvestValues"), | ||
(HarvestValues) | ||
); | ||
|
||
HarvestTradePath[] memory tradePaths_ = abi.decode( | ||
json.parseRaw(".harvest.tradePaths"), | ||
(HarvestTradePath[]) | ||
); | ||
|
||
strategy.setHarvestValues(harvestValues_, tradePaths_); | ||
} | ||
} |
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 @@ | ||
{ | ||
"baseInit": { | ||
"asset": "", | ||
"owner": "", | ||
"autoHarvest": false | ||
}, | ||
"strategyInit": { | ||
"auraBooster": "0xA57b8d98dAE62B26Ec3bcC4a365338157060B234", | ||
"balPoolId": "0x596192bb6e41802428ac943d2f1476c1af25cc0e000000000000000000000659", | ||
"balVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", | ||
"pid": 189, | ||
"underlyings": [ | ||
"0x596192bB6e41802428Ac943D2f1476C1Af25CC0E", | ||
"0xbf5495Efe5DB9ce00f80364C8B423567e58d2110", | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | ||
] | ||
}, | ||
"harvest": { | ||
"harvestValues": { | ||
"amountsInLen": 2, | ||
"baseAsset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||
"indexIn": 2, | ||
"indexInUserData": 1 | ||
}, | ||
"tradePaths": [ | ||
{ | ||
"assets": [ | ||
"0xba100000625a3754423978a60c9317c58a424e3D", | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | ||
], | ||
"limits": [ | ||
57896044618658097711785492504343953926634992332820282019728792003956564819967, | ||
57896044618658097711785492504343953926634992332820282019728792003956564819967 | ||
], | ||
"minTradeAmount": 0, | ||
"swaps": [ | ||
{ | ||
"a-poolId": "0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014", | ||
"b-assetInIndex": 0, | ||
"c-assetOutIndex": 1, | ||
"d-amount": 0, | ||
"e-userData": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"assets": [ | ||
"0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | ||
], | ||
"limits": [ | ||
57896044618658097711785492504343953926634992332820282019728792003956564819967, | ||
57896044618658097711785492504343953926634992332820282019728792003956564819967 | ||
], | ||
"minTradeAmount": 0, | ||
"swaps": [ | ||
{ | ||
"a-poolId": "0xcfca23ca9ca720b6e98e3eb9b6aa0ffc4a5c08b9000200000000000000000274", | ||
"b-assetInIndex": 0, | ||
"c-assetOutIndex": 1, | ||
"d-amount": 0, | ||
"e-userData": "" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
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,49 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.25 | ||
|
||
pragma solidity ^0.8.25; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {stdJson} from "forge-std/StdJson.sol"; | ||
import {BalancerCompounder, IERC20, BatchSwapStep, IAsset, BalancerValues, HarvestValues, HarvestTradePath, TradePath} from "../../../src/strategies/balancer/BalancerCompounder.sol"; | ||
|
||
contract DeployStrategy is Script { | ||
using stdJson for string; | ||
|
||
function run() public { | ||
string memory json = vm.readFile( | ||
string.concat( | ||
vm.projectRoot(), | ||
"./srcript/deploy/balancer/BalancerCompounderDeployConfig.json" | ||
) | ||
); | ||
|
||
BalancerValues memory balancerValues_ = abi.decode( | ||
json.parseRaw(string.concat(".strategyInit")), | ||
(BalancerValues) | ||
); | ||
|
||
// Deploy Strategy | ||
BalancerCompounder strategy = new BalancerCompounder(); | ||
|
||
strategy.initialize( | ||
json.readAddress(".baseInit.asset"), | ||
json.readAddress(".baseInit.owner"), | ||
json.readBool(".baseInit.autoHarvest"), | ||
abi.encode(balancerValues_) | ||
); | ||
|
||
HarvestValues memory harvestValues_ = abi.decode( | ||
json.parseRaw(".harvest.harvestValues"), | ||
(HarvestValues) | ||
); | ||
|
||
HarvestTradePath[] memory tradePaths_ = abi.decode( | ||
json.parseRaw(".harvest.tradePaths"), | ||
(HarvestTradePath[]) | ||
); | ||
|
||
// Set harvest values | ||
strategy.setHarvestValues(harvestValues_, tradePaths_); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
script/deploy/balancer/BalancerCompounderDeployConfig.json
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,48 @@ | ||
{ | ||
"baseInit": { | ||
"asset": "", | ||
"owner": "", | ||
"autoHarvest": false | ||
}, | ||
"strategyInit": { | ||
"balMinter": "0x239e55F427D44C3cc793f49bFB507ebe76638a2b", | ||
"balPoolId": "0x596192bb6e41802428ac943d2f1476c1af25cc0e000000000000000000000659", | ||
"balVault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", | ||
"gauge": "0xee01c0d9c0439c94D314a6ecAE0490989750746C", | ||
"underlyings": [ | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||
"0xE7e2c68d3b13d905BBb636709cF4DfD21076b9D2", | ||
"0xf951E335afb289353dc249e82926178EaC7DEd78" | ||
] | ||
}, | ||
"harvest": { | ||
"harvestValues": { | ||
"amountsInLen": 2, | ||
"baseAsset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||
"indexIn": 0, | ||
"indexInUserData": 0 | ||
}, | ||
"tradePaths": [ | ||
{ | ||
"assets": [ | ||
"0xba100000625a3754423978a60c9317c58a424e3D", | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | ||
], | ||
"limits": [ | ||
57896044618658097711785492504343953926634992332820282019728792003956564819967, | ||
57896044618658097711785492504343953926634992332820282019728792003956564819967 | ||
], | ||
"minTradeAmount": 10000000000000000000, | ||
"swaps": [ | ||
{ | ||
"a-poolId": "0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014", | ||
"b-assetInIndex": 0, | ||
"c-assetOutIndex": 1, | ||
"d-amount": 0, | ||
"e-userData": "" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
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,31 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
// Docgen-SOLC: 0.8.25 | ||
|
||
pragma solidity ^0.8.25; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {stdJson} from "forge-std/StdJson.sol"; | ||
|
||
import {BeefyDepositor, IERC20} from "../../../src/strategies/beefy/BeefyDepositor.sol"; | ||
|
||
contract BeefyDepositorTest is Script { | ||
using stdJson for string; | ||
|
||
function run() public { | ||
string memory json = vm.readFile( | ||
string.concat( | ||
vm.projectRoot(), | ||
"./srcript/deploy/beefy/BeefyDepositorDeployConfig.json" | ||
) | ||
); | ||
|
||
BeefyDepositor strategy = new BeefyDepositor(); | ||
|
||
strategy.initialize( | ||
json.readAddress(".baseInit.asset"), | ||
json.readAddress(".baseInit.owner"), | ||
json.readBool(".baseInit.autoHarvest"), | ||
abi.encode(json.readAddress(".strategyInit.beefyVault")) | ||
); | ||
} | ||
} |
Oops, something went wrong.