LogoLogo
  • Introduction
  • App
    • How to
      • Connect a wallet
      • Swap
      • Approve Spending
      • Open a Long Position
      • Open a Short Position
      • Withdraw Funds
      • Add Funds
      • Close Position
      • Increase Leverage
      • Pay Off Debt
      • Deposit Liquidity
      • Withdraw Liquidity
      • Add Liquidity
    • Smart contract addresses
      • Arbitrum
      • Blast
    • FAQ
  • Protocol mechanics
    • Providing Liquidity
    • Trading
    • Marginly MAX leverage specifics
  • Protocol architecture
    • Overview
    • Pools
      • Pool variables
      • Pool parameters
      • User positions
      • User actions
      • Pool Factory API
      • Pool API
    • TWAP oracle
    • Loan pricing
    • Errors
    • Marginly SDK
  • Router
    • Router architecture
    • Adapters
      • ApeSwapAdapter
      • BalancerAdapter
      • CamelotAdapter
      • KyberSwapClassicAdapter
      • KyberSwapElasticAdapter
      • UniswapV2Adapter
      • UniswapV3Adapter
      • WooFiAdapter
  • Risk Management
    • Risk Management Overview
    • Keeper service and smart contract description
    • Keeper contract architecture
    • Liquidations and Deleveraging
    • Volatility as risk proxy
    • Insurance pool
    • Shutdown mode
  • Economics
    • Marginly economics
  • Future plans
    • Beyond Marginly v1
    • Some ideas for Marginly v2
  • Trading Contest FAQ
  • Github
  • Audit
Powered by GitBook
On this page
  • KyberSwapElasticAdapter
  • IKyberElasticPool
  1. Router
  2. Adapters

KyberSwapElasticAdapter

KyberSwapElasticAdapter

constructor

constructor(struct PoolInput[] pools) public

swapExactInput

function swapExactInput(address recipient, address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut, bytes data) external returns (uint256 amountOut)

swap with exact input

Parameters

Name
Type
Description

recipient

address

recipient of amountOut of tokenOut

tokenIn

address

address of a token to swap on dex

tokenOut

address

address of a token to receive from dex

amountIn

uint256

exact amount of tokenIn to swap

minAmountOut

uint256

minimal amount of tokenOut to receive

data

bytes

data for AdapterCallback

swapExactOutput

function swapExactOutput(address recipient, address tokenIn, address tokenOut, uint256 maxAmountIn, uint256 amountOut, bytes data) external returns (uint256 amountIn)

swap with exact output

Parameters

Name
Type
Description

recipient

address

recipient of amountOut of tokenOut

tokenIn

address

address of a token to swap on dex

tokenOut

address

address of a token to receive from dex

maxAmountIn

uint256

maximal amount of tokenIn to swap

amountOut

uint256

exact amount of tokenOut to receive

data

bytes

data for AdapterCallback

swapCallback

function swapCallback(int256 deltaQty0, int256 deltaQty1, bytes data) external

IKyberElasticPool

swap

function swap(address recipient, int256 swapQty, bool isToken0, uint160 limitSqrtP, bytes data) external returns (int256 amount0Delta, int256 amount1Delta)
PreviousKyberSwapClassicAdapterNextUniswapV2Adapter

Last updated 1 year ago