Created
February 16, 2020 17:28
-
-
Save nazariyv/27762bfa553d8216917f892e1f52169e to your computer and use it in GitHub Desktop.
FrontRunner-3
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
function ethToToken(uint256 minTokens, uint256 deadline, address payable _uni) external restricted { | |
Uniswap uni = Uniswap(_uni); | |
uint256 ethBalance = address(this).balance; | |
uint256 tokensBoughtActual = uni.ethToTokenSwapInput.value(ethBalance)({ min_tokens: minTokens, deadline: deadline }); | |
emit UniswapTokenBoughtActual(tokensBoughtActual); | |
} | |
function tokenToEth(uint256 tokensToSell, uint256 minEth, uint256 deadline, address payable _uni) external restricted { | |
Uniswap uni = Uniswap(_uni); | |
uint256 actualEthBought = uni.tokenToEthSwapInput({ tokens_sold: tokensToSell, min_eth: minEth, deadline: deadline }); | |
emit UniswapEthBoughtActual(actualEthBought); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment