Skip to content

Instantly share code, notes, and snippets.

@xiaok
Created March 30, 2022 01:20
Show Gist options
  • Save xiaok/5531c60a14f6958c19b10f58d74e0198 to your computer and use it in GitHub Desktop.
Save xiaok/5531c60a14f6958c19b10f58d74e0198 to your computer and use it in GitHub Desktop.
LP provider switcher
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