-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KyberSwap Classic Adapter #34
base: main
Are you sure you want to change the base?
Conversation
uint112 vr1; | ||
uint256 feeInPrecision; | ||
if (sellToken < buyToken) { | ||
(r0, r1, vr0, vr1, feeInPrecision) = pair.getTradeInfo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use TradeParams here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. left some comments and questions
// Kyberswap handles arbirary amounts, but we limit the amount to 10x just | ||
// in case | ||
uint256 constant RESERVE_LIMIT_FACTOR = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"just in case" of what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk why this is being used below to divide the reserves
( | ||
tradeParams.r0, | ||
tradeParams.r1, | ||
tradeParams.vr0, | ||
tradeParams.vr1, | ||
tradeParams.feeInPrecision |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you not abbreviate these attributes? will save people having to inspect the interface and the names are not so big
struct TradeParams { | ||
uint112 r0; | ||
uint112 r1; | ||
uint112 vr0; | ||
uint112 vr1; | ||
uint256 feeInPrecision; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe TradePairAttributes is a better name?
/// @notice Executes a sell order on a given pool. | ||
/// @param pair The pair to trade on. | ||
/// @param sellToken The token being sold. | ||
/// @param buyToken The token being bought. | ||
/// @param amount The amount to be traded. | ||
/// @return calculatedAmount The amount of tokens received. | ||
function sell( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doenst inheritdoc work here?
function swap( | ||
bytes32 poolId, | ||
address sellToken, | ||
address buyToken, | ||
OrderSide side, | ||
uint256 specifiedAmount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inheritdoc?
/// @notice Given an input amount of an asset and pair reserves, returns the | ||
/// maximum output amount of the other asset | ||
/// @param amountIn The amount of the token being sold. | ||
/// @param vReserveIn The virtual reserve of the token being sold. | ||
/// @param vReserveOut The virtual reserve of the token being bought. | ||
/// @param feeInPrecision Fee in PRECISION points | ||
/// @return amountOut The amount of tokens received. | ||
function getAmountOut( | ||
uint256 amountIn, | ||
uint256 vReserveIn, | ||
uint256 vReserveOut, | ||
uint256 feeInPrecision | ||
) internal pure returns (uint256 amountOut) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this used for?
245d799
to
bdfbff4
Compare
No description provided.