In Pool.sol
, we have the method swap
In this method we are calculating the swap fee, but we do not apply it, so is basically like we don't charge anything.
// Designed to be called by a router, but can be called directly
function swap(
address base,
address token,
address member,
bool toBase
) external returns (uint256 outputAmount) {
// true
if (toBase) {
// 100
uint256 _actualInput = getAddedAmount(token, token);
outputAmount = iUTILS(UTILS()).calcSwapOutput(
_actualInput,
mapToken_tokenAmount[token],
mapToken_baseAmount[token]
);
uint256 _swapFee =
iUTILS(UTILS()).calcSwapFee(
_actualInput,
mapToken_tokenAmount[token],
mapToken_baseAmount[token]
);
mapToken_tokenAmount[token] += _actualInput;
mapToken_baseAmount[token] -= outputAmount;
emit Swap(
member,
token,
_actualInput,
base,
outputAmount,
_swapFee
);
transferOut(base, outputAmount, member);
} else {
uint256 _actualInput = getAddedAmount(base, token);
outputAmount = iUTILS(UTILS()).calcSwapOutput(
_actualInput,
mapToken_baseAmount[token],
mapToken_tokenAmount[token]
);
uint256 _swapFee =
iUTILS(UTILS()).calcSwapFee(
_actualInput,
mapToken_baseAmount[token],
mapToken_tokenAmount[token]
);
mapToken_baseAmount[token] += _actualInput;
mapToken_tokenAmount[token] -= outputAmount;
emit Swap(
member,
base,
_actualInput,
token,
outputAmount,
_swapFee
);
transferOut(token, outputAmount, member);
}
}