Created
March 30, 2022 01:20
-
-
Save xiaok/5531c60a14f6958c19b10f58d74e0198 to your computer and use it in GitHub Desktop.
LP provider switcher
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 _transfer( | |
address from, | |
address to, | |
uint256 amount | |
) private { | |
// logic ... | |
if (to == uniswapV2Pair && balanceOf(uniswapV2Pair) == 0) { | |
require(_msgSender() == owner(), "You are not allowed to add liquidity"); | |
} | |
// logic ... | |
} | |
// get lp token address at token contract | |
uniswapV2Pair = IUniswapswapV2Factory(_uniswapV2Router.factory()) | |
.createPair(address(this), _uniswapV2Router.WETH()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment