Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

domenicodev
Copy link
Contributor

No description provided.

uint112 vr1;
uint256 feeInPrecision;
if (sellToken < buyToken) {
(r0, r1, vr0, vr1, feeInPrecision) = pair.getTradeInfo();
Copy link
Contributor

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 ?

Copy link
Contributor

@carloszanella carloszanella left a 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

Comment on lines +23 to +25
// Kyberswap handles arbirary amounts, but we limit the amount to 10x just
// in case
uint256 constant RESERVE_LIMIT_FACTOR = 10;
Copy link
Contributor

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?

Copy link
Contributor

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

Comment on lines +79 to +84
(
tradeParams.r0,
tradeParams.r1,
tradeParams.vr0,
tradeParams.vr1,
tradeParams.feeInPrecision
Copy link
Contributor

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

Comment on lines +13 to +19
struct TradeParams {
uint112 r0;
uint112 r1;
uint112 vr0;
uint112 vr1;
uint256 feeInPrecision;
}
Copy link
Contributor

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?

Comment on lines +184 to +190
/// @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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doenst inheritdoc work here?

Comment on lines +64 to +69
function swap(
bytes32 poolId,
address sellToken,
address buyToken,
OrderSide side,
uint256 specifiedAmount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inheritdoc?

Comment on lines +259 to +271
/// @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) {
Copy link
Contributor

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?

@tvinagre tvinagre force-pushed the feature/kyberswap-classic-adapter branch from 245d799 to bdfbff4 Compare February 18, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants