generated from AngleProtocol/boilerplate
-
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.
* feat: extra checks inside constructor * chore: remove useless gitkeeps * feat: handle rounding down of totalAssets * doc: add spe cification of assets being vested * feat: give allowance * feat: DeployERC4626Strategy script * feat: replace WAD to BPS * fix: deploy strategy script * chore: add utils dependency * tests: unit tests * tests: fuzz tests * fix: compilers warnings * chore: setup repo in ci * chore: add ethereum uri to coverage * fix: swap fuzz test now checks vesting * fix: correct bps value * refactor: rename Normal to Success * fix: correct fees according to BPS * fix: fees tests are correct * tests: improve tests with more robust * tests: numerical examples
- Loading branch information
1 parent
c2cf40c
commit 535bf2a
Showing
41 changed files
with
1,776 additions
and
16 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
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
Empty file.
Empty file.
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
Empty file.
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,56 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.19; | ||
|
||
import { ERC4626Strategy, BaseStrategy } from "../contracts/ERC4626Strategy.sol"; | ||
import "utils/src/CommonUtils.sol"; | ||
import "../test/Constants.t.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
contract DeployERC4626Strategy is Script, CommonUtils { | ||
function run() external { | ||
uint256 chainId = CHAIN_SOURCE; | ||
uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), "m/44'/60'/0'/0/", 0); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
address deployer = vm.addr(deployerPrivateKey); | ||
console.log("Deployer address: ", deployer); | ||
|
||
/** TODO complete */ | ||
address asset = _chainToContract(chainId, ContractType.AgUSD); | ||
address strategyAsset = _chainToContract(chainId, ContractType.StUSD); | ||
|
||
address integrator = _chainToContract(chainId, ContractType.GuardianMultisig); | ||
address developer = _chainToContract(chainId, ContractType.GuardianMultisig); | ||
address keeper = 0xa9bbbDDe822789F123667044443dc7001fb43C01; | ||
|
||
uint32 performanceFee = 1_000; // 10% | ||
uint32 developerFee = 2_000; // 20% | ||
|
||
string memory name = "stUSD Strategy"; | ||
string memory symbol = "stUSDStrat"; | ||
/** END complete */ | ||
|
||
ERC4626Strategy strategy = new ERC4626Strategy( | ||
BaseStrategy.ConstructorArgs( | ||
performanceFee, | ||
developerFee, | ||
integrator, | ||
developer, | ||
keeper, | ||
developer, | ||
integrator, | ||
ONEINCH_ROUTER, | ||
ONEINCH_ROUTER, | ||
1 weeks, | ||
name, | ||
symbol, | ||
asset, | ||
strategyAsset | ||
) | ||
); | ||
console.log("Strategy address: ", address(strategy)); | ||
|
||
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,23 @@ | ||
// SPDX-License-Identifier: Unlicensed | ||
pragma solidity 0.8.26; | ||
|
||
import "forge-std/Test.sol"; | ||
import "utils/src/CommonUtils.sol"; | ||
import { IERC20 } from "forge-std/interfaces/IERC20.sol"; | ||
|
||
contract BaseTest is Test, CommonUtils { | ||
// Useful addresses | ||
address public alice = makeAddr("alice"); | ||
address public bob = makeAddr("bob"); | ||
address public integrator = makeAddr("integrator"); | ||
address public keeper = makeAddr("keeper"); | ||
address public developer = makeAddr("developer"); | ||
|
||
function setUp() public virtual { | ||
vm.label(alice, "alice"); | ||
vm.label(bob, "bob"); | ||
vm.label(integrator, "integrator"); | ||
vm.label(keeper, "keeper"); | ||
vm.label(developer, "developer"); | ||
} | ||
} |
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,6 @@ | ||
// SPDX-License-Identifier: Unlicensed | ||
pragma solidity 0.8.26; | ||
|
||
uint256 constant CHAIN_SOURCE = 1; | ||
address constant ONEINCH_ROUTER = 0x111111125421cA6dc452d289314280a0f8842A65; | ||
address constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; |
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,42 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.8.26; | ||
|
||
import "./BaseTest.t.sol"; | ||
import "./Constants.t.sol"; | ||
import "../contracts/utils/Errors.sol"; | ||
import { IAccessControl } from "oz/access/AccessControl.sol"; | ||
import { ERC4626Strategy, BaseStrategy, ERC4626 } from "../contracts/ERC4626Strategy.sol"; | ||
|
||
contract ERC4626StrategyTest is BaseTest { | ||
ERC4626Strategy public strategy; | ||
address public asset; | ||
address public strategyAsset; | ||
|
||
function setUp() public virtual override { | ||
super.setUp(); | ||
|
||
vm.createSelectFork("mainnet", 20363172); | ||
|
||
asset = _chainToContract(CHAIN_SOURCE, ContractType.AgUSD); | ||
strategyAsset = _chainToContract(CHAIN_SOURCE, ContractType.StUSD); | ||
|
||
strategy = new ERC4626Strategy( | ||
BaseStrategy.ConstructorArgs( | ||
1_000, // 10% | ||
2_000, // 20% | ||
integrator, | ||
developer, | ||
keeper, | ||
developer, | ||
integrator, | ||
ONEINCH_ROUTER, | ||
ONEINCH_ROUTER, | ||
1 weeks, | ||
"stUSD Strategy", | ||
"stUSDStrat", | ||
asset, | ||
strategyAsset | ||
) | ||
); | ||
} | ||
} |
Empty file.
Oops, something went wrong.