-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deploy script for v2 vaults #83
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM tbh I think we should just abstract a bit more so that testnet deployment + fixtures are written without duplication
function _deposit(sc4626 _vault, uint256 _amount) internal { | ||
_vault.asset().approve(address(_vault), _amount); | ||
_vault.deposit(_amount, deployerAddress); | ||
} | ||
|
||
function _swapWethForUsdc(uint256 _amount) internal { | ||
weth.deposit{value: _amount}(); | ||
|
||
weth.approve(C.UNISWAP_V3_SWAP_ROUTER, _amount); | ||
|
||
ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({ | ||
tokenIn: address(weth), | ||
tokenOut: address(usdc), | ||
fee: 500, // 0.05% | ||
recipient: deployerAddress, | ||
deadline: block.timestamp + 1000, | ||
amountIn: _amount, | ||
amountOutMinimum: 0, | ||
sqrtPriceLimitX96: 0 | ||
}); | ||
|
||
ISwapRouter(C.UNISWAP_V3_SWAP_ROUTER).exactInputSingle(params); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use these in v1 deployments too, we should abstract into a helper of some sort to reduce duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract DeployScript is CREATE3Script { | ||
uint256 deployerPrivateKey = uint256(vm.envBytes32("PRIVATE_KEY")); | ||
address deployerAddress = vm.addr(deployerPrivateKey); | ||
address keeper = vm.envAddress("KEEPER"); | ||
|
||
WETH weth = WETH(payable(C.WETH)); | ||
ERC20 usdc = ERC20(C.USDC); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we make a base class that then the mainnet + testnet deployments can both use
difference in the mainnet & testnet deployments being then only what happens after the deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see approach in #69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
constructor() CREATE3Script(vm.envString("VERSION")) {} | ||
|
||
contract DeployScript is MainnetDepolyBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling error => MainnetDepolyBase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.