mirror of
https://github.com/grassrootseconomics/erc20-pool.git
synced 2024-12-03 16:16:46 +01:00
fix: include fees in public liquidity
This commit is contained in:
parent
78844169c5
commit
4931ef1d70
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -140,7 +140,6 @@ contract SwapPool {
|
||||
uint256 balance;
|
||||
uint256 fee;
|
||||
uint256 outValue;
|
||||
uint256 trueBalance;
|
||||
|
||||
outValue = getQuote(_outToken, _inToken, _value);
|
||||
|
||||
@ -148,13 +147,10 @@ contract SwapPool {
|
||||
require(r, "ERR_TOKEN");
|
||||
balance = abi.decode(v, (uint256));
|
||||
|
||||
// unwithdrawn fees should remain untouched
|
||||
trueBalance = balance - fees[_outToken];
|
||||
|
||||
// deduct the fees from the quoted outValue
|
||||
fee = getFee(outValue);
|
||||
outValue -= fee;
|
||||
|
||||
|
||||
// pool should have enough balance to cover the final outValue (fees already deducted)
|
||||
require(balance >= outValue, "ERR_BALANCE");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user