Skip to content
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

Merged
merged 3 commits into from
Jun 20, 2023
Merged

deploy script for v2 vaults #83

merged 3 commits into from
Jun 20, 2023

Conversation

brkomir
Copy link
Contributor

@brkomir brkomir commented Jun 13, 2023

No description provided.

@brkomir brkomir requested review from 0xrin1 and coolhill June 13, 2023 21:38
Copy link
Contributor

@0xrin1 0xrin1 left a 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

Comment on lines 97 to 119
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);
}
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 22 to 28
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);
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see approach in #69

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brkomir brkomir requested review from 0xrin1 and dxganta and removed request for coolhill June 16, 2023 10:23

constructor() CREATE3Script(vm.envString("VERSION")) {}

contract DeployScript is MainnetDepolyBase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling error => MainnetDepolyBase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dxganta dxganta self-requested a review June 19, 2023 16:25
@brkomir brkomir merged commit 17c9045 into main Jun 20, 2023
@brkomir brkomir deleted the v2-deploy-script branch June 20, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants