Last active
May 18, 2020 03:52
-
-
Save tienshaoku/deb65cd7f2d3c9c2a440216622c0d011 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function addLiquidity() public payable returns(uint[3] memory) { | |
require(msg.value == ETHAmount); | |
require(Dai.transferFrom(msg.sender, address(this), DaiAmount)); | |
// Do remember to approve | |
Dai.approve(address(uniswapV2Router01), DaiAmount); | |
(addLiquidityResult[0], addLiquidityResult[1], addLiquidityResult[2]) = uniswapV2Router01.addLiquidityETH{value: ETHAmount}( | |
DaiAddress, DaiAmount, 0, 0, msg.sender, now + 120); | |
return addLiquidityResult; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment