mirror of
https://github.com/grassrootseconomics/erc20-pool.git
synced 2024-11-07 06:26:47 +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 balance;
|
||||||
uint256 fee;
|
uint256 fee;
|
||||||
uint256 outValue;
|
uint256 outValue;
|
||||||
uint256 trueBalance;
|
|
||||||
|
|
||||||
outValue = getQuote(_outToken, _inToken, _value);
|
outValue = getQuote(_outToken, _inToken, _value);
|
||||||
|
|
||||||
@ -148,13 +147,10 @@ contract SwapPool {
|
|||||||
require(r, "ERR_TOKEN");
|
require(r, "ERR_TOKEN");
|
||||||
balance = abi.decode(v, (uint256));
|
balance = abi.decode(v, (uint256));
|
||||||
|
|
||||||
// unwithdrawn fees should remain untouched
|
|
||||||
trueBalance = balance - fees[_outToken];
|
|
||||||
|
|
||||||
// deduct the fees from the quoted outValue
|
// deduct the fees from the quoted outValue
|
||||||
fee = getFee(outValue);
|
fee = getFee(outValue);
|
||||||
outValue -= fee;
|
outValue -= fee;
|
||||||
|
|
||||||
// pool should have enough balance to cover the final outValue (fees already deducted)
|
// pool should have enough balance to cover the final outValue (fees already deducted)
|
||||||
require(balance >= outValue, "ERR_BALANCE");
|
require(balance >= outValue, "ERR_BALANCE");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user