mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
add liquidity complete
This commit is contained in:
parent
b73037d079
commit
1fe5eb1250
|
@ -153,8 +153,9 @@ contract InstaUniswapPool is Helper {
|
|||
function addLiquidity(address token, uint maxDepositedTokens) public payable returns (uint256 tokensMinted) {
|
||||
address exchangeAddr = getExchangeAddress(token);
|
||||
(uint exchangeEthBal, uint exchangeTokenBal) = getBal(token, exchangeAddr);
|
||||
uint tokenToDeposit = msg.value * (exchangeTokenBal/exchangeEthBal);
|
||||
uint tokenToDeposit = msg.value * exchangeTokenBal / exchangeEthBal + 1;
|
||||
require(tokenToDeposit < maxDepositedTokens, "Token to deposit is greater than Max token to Deposit");
|
||||
IERC20(token).transferFrom(msg.sender, address(this), tokenToDeposit);
|
||||
manageApproval(token, tokenToDeposit);
|
||||
tokensMinted = UniswapPool(exchangeAddr).addLiquidity.value(msg.value)(
|
||||
uint(0),
|
||||
|
@ -163,4 +164,5 @@ contract InstaUniswapPool is Helper {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user