KyberSwap Docs
  • Introduction to KyberSwap
  • Getting Started
    • Quickstart
      • FAQ
    • Supported Exchanges And Networks
    • Foundational Topics
      • Decentralized Finance
        • Tokens
        • Stablecoins
        • DEX/DeFi Aggregator
        • Slippage
        • Price Impact
        • Zap
        • Maximal Extractable Value (MEV)
      • Decentralized Technologies
        • Wallets
        • Dapps
        • RPC
        • Oracles
        • On-Chain vs Off-Chain Data
      • Other Valuable Resources
  • KyberSwap Solutions
    • KyberSwap Interface
      • User Guides
        • Connect Your Wallet
        • Switching Networks
        • Instantly Swap At Superior Rates
        • Swap At Your Preferred Rates
        • Cross-chain Swap
        • Add Your Favourite Tokens
        • Get Crypto With Fiat
        • Bridge Your Assets Across Multiple Chains
      • Profiles
        • Profile Creation
        • Profile Customization
        • Sync Profile Across Devices
      • Notifications
        • Notification Center
    • KyberSwap Aggregator
      • Concepts
        • Dynamic Trade Routing
      • User Guides
        • Instantly Swap At Superior Rates
      • Developer Guides
        • Execute A Swap With The Aggregator API
        • Upgrading To APIv1
      • Aggregator API Specification
        • EVM Swaps
        • Permit
      • Contracts
        • Aggregator Contract Addresses
      • DEX IDs
      • Subgraphs
      • FAQ
    • KyberSwap Zap as a Service
      • KyberSwap Zap as a Service (ZaaS) API
        • ZaaS HTTP API
        • ZaaS GRPC API
      • KyberSwap Zap Liquidity Widget
      • Zap Fee Model
      • Zap's Supported Chains/Dexes
      • Zap's Deployed Contract Addresses
      • Zap's DEX IDs
    • KyberSwap Widget
      • Developer Guides
        • Integrating The KyberSwap Widget
        • Customizing The KyberSwap Widget
      • iFrame Alternative
      • Widget/iFrame Fee
    • KyberSwap Liquidity Widget
      • Integrating The KyberSwap Liquidity Widget
    • Limit Order
      • Concepts
        • Off-Chain Relay, On-Chain Settlement
        • Gasless Cancellation
      • User Guides
        • Swap At Your Preferred Rates
        • Update Limit Orders
        • Cancel Limit Orders
      • Developer Guides
        • Create Limit Order
        • Gasless Cancel
        • Hard Cancel
        • Fill Limit Order
      • Contracts
        • Limit Order Contract Addresses
      • Limit Order API Specification
        • General APIs
        • Maker APIs
        • Taker APIs
      • FAQ
    • KyberSwap OnChain Price Service
    • Fee Schedule
  • Governance
    • KyberDAO
      • User Guides
        • Participating in KyberDAO
        • Staking
        • Voting
        • Stake KNC And Enjoy Gas Savings
      • Fees to KyberDAO
      • KyberDAO Operator MultiSig
      • Contracts
        • KyberDAO Contract Repo
        • KyberDAO Contract Addresses
      • FAQ - Others
    • KNC Token
      • KNC Tokenomics & Utility
      • Gas Refund Program
      • KNC Contract Addresses
  • Security
    • Audits
  • Reference
    • Legacy
      • KyberSwap Classic
        • Concepts
          • Programmable Pricing Curves
          • Dynamic Auto-Adjusting Fees
          • Virtual Balances
          • Protocol Fees
        • Contracts
          • Classic Contract Repo
          • Classic Contract Addresses
          • Classic Contract Farming Addresses
      • KyberSwap Elastic
        • Concepts
          • Concentrated Liquidity
          • Reinvestment Curve
          • Tick-Range Mechanism
          • Pool Process Flows
          • Anti-Sniping Mechanism
          • Tick-Based Farming
          • Elastic Zap
          • TWAP Oracle
          • Elastic APR Calculations
        • Contracts
          • Elastic Contract Repo
          • Elastic Contract Addresses
          • Elastic Farming Contract Addresses
          • Elastic Zap Contract Addresses
          • Elastic Core Contracts
          • Elastic Core Libraries
          • Elastic Periphery Core Contracts
          • Elastic Peripheral Library Contracts
          • Elastic Peripheral Base Contracts
        • Subgraphs
      • Whitepapers
      • Audits
      • KyberAI
        • KyberScore
        • Concepts
        • On-Chain Indicators
          • Number Of Trades
          • Trading Volume
          • Netflow To Whale Wallets
          • Netflow To CEX
          • Number Of Transfers
          • Volume Of Transfers
          • Number Of Holders
          • Top Holders
        • Technical Indicators
          • Live Charts
          • Support & Resistance Levels
          • Live Trades
          • Funding Rate On CEX
          • Liquidations On CEX
        • Liquidity Analysis
      • Elastic Legacy
        • Elastic Legacy Contract Repo
        • Elastic Legacy Contract Addresses
        • Elastic Legacy Farming Contract Addresses
        • Remove Elastic Legacy Liquidity
      • Protocol
        • Overview
        • Smart Contract Architecture
        • Trust and Security Model
      • Integrations
        • Getting Started
        • Use Cases
        • Integration Types
        • Smart Contracts
        • Ethers JS
        • RESTful API
        • Slippage Rate Protection
        • Price Feed Security
        • Contract Events
        • Platform Fees
      • Reserves
        • Getting Started
          • Overview
          • Why Develop On Kyber
          • Create New Reserve
          • Existing Reserves
          • Customising Existing Reserves
        • Development Guides
          • Fed Price Reserve
          • Automated Price Reserve
          • Reserves with Ganache
          • Orderbook Reserve
        • Operations
          • Listing Policies
          • Reserve IDs
          • Reserve Rebates
          • Sanity Rates
      • Addresses
        • Introduction
        • Mainnet
        • Kovan
        • Rinkeby
        • Ropsten
      • API/ABI
        • Introduction
        • RESTful API
          • RESTful API Overview
          • RESTful API
        • Core Smart Contracts
          • IKyberNetworkProxy
          • KyberNetworkProxy
          • IKyberNetwork
          • ISimpleKyberProxy
          • IKyberMatchingEngine
          • KyberMatchingEngine
          • IKyberHint
          • KyberHintHandler
          • IKyberHintHandler
          • IKyberFeeHandler
          • IKyberStaking
          • KyberStaking
          • IKyberDao
          • KyberDao
          • IKyberStorage
          • KyberStorage
          • IKyberHistory
          • KyberHistory
          • IKyberReserve
          • KyberReserve
          • ConversionRates
          • LiquidityConversionRates
          • EpochUtils
          • IEpochUtils
          • KyberFeeHandler
        • Contract ABIs
          • ABIs
        • Code Snippets
          • Token Quantity Conversion
        • Misc Contracts
          • KyberNetwork
          • ConversionRatesInterface
          • PermissionGroups
          • SanityRates
          • Withdrawable
          • OrderbookReserveInterface
          • OrderbookReserveLister
    • KyberSwap Operator MultiSig
    • Permitable Tokens
    • Third-Party Integrations
    • KyberSwap Analytics
    • KyberSwap App
    • GitHub
    • KyberSwap Analytics
    • KyberSwap Blog
    • Kyber Network Press Kit
  • Socials
    • X
    • Discord
    • Telegram
    • LinkedIn
    • Reddit
    • Instagram
    • Tik Tok
  • Support
    • KyberSwap Help Center
    • Complaints Handling Process
Powered by GitBook
On this page
  • DeadlineValidation​
  • Modifier: onlyNotExpired()​
  • _blockTimestamp()​
  • ERC721Permit​
  • ImmutableRouterStorage​
  • Immutables​
  • RouterTokenHelper​
  • unwrapWeth()​
  • transferAllTokens()​
  • refundEth()​
  • _transferTokens()​
  • RouterTokenHelperWithFee​
  • unwrapWethWithFee()​
  • transferAllTokensWithFee()​
  • Multicall​
  • multicall()​
  • LiquidityHelper​
  • Struct: AddLiquidityParams​
  • Struct: CallbackData​
  • proAMMMintCallback()​
  • _addLiquidity()​
  • _callbackData()​
  • _getPool()​

Was this helpful?

  1. Reference
  2. Legacy
  3. KyberSwap Elastic
  4. Contracts

Elastic Peripheral Base Contracts

PreviousElastic Peripheral Library ContractsNextSubgraphs

Last updated 2 years ago

Was this helpful?

DeadlineValidation

Validate if the block timestamp has not reached the deadline yet, use for transactions with a deadline.

Modifier: onlyNotExpired()

Reverts if the current block's timestamp is greater than the specified deadline.

Field
Type
Explanation

deadline

uint256

Timestamp to check against current block's timestamp

_blockTimestamp()

Returns the current block timestamp. Used for overriding by mock contracts for tests.

ERC721Permit

Nonfungible tokens that support an approve via signature, i.e. permit for ERC721.

ImmutableRouterStorage

Immutable variables that are used by Periphery contracts.

Immutables

Field
Type
Explanation

factory

address

Factory contract address

WETH

address

Canonical WETH address

poolInitHash

bytes32

keccak256 hash of the pool's creation code. Used to compute the pool address without reading storage from the Factory

A helper contract to handle transfers, wrapping and unwrapping of tokens.

Unwraps the contract's entire WETH balance to ETH, then transfers them to the recipient.

Input Field
Type
Explanation

minAmount

uint256

Contract's WETH balance should not be lower than this amount

recioient

address

Desired recipient of unwrapped ETH

Transfers the contract's entire token balance to the recipient

Input Field
Type
Explanation

token

address

Token to transfer

minAmount

uint256

Contract's token balance should not be lower than this amount

recipient

address

Desired recipient of the token

Transfers all ETH balance to the sender.

Input Field
Type
Explanation

token

address

Token to transfer

sender

address

Address to pull token funds from

recipient

address

Desired recipient of the token

amount

uint256

Amount to be transferred

Unwraps the contract's entire WETH balance to ETH, then transfers them to the recipient. Charges a fee which is transferred to feeRecipient

Input Field
Type
Explanation

minAmount

uint256

Contract's WETH balance should not be lower than this amount

recipient

address

Desired recipient of unwrapped ETH

feeBps

uint256

Fee to charge in basis points

feeRecipient

address

Address to receive the fee charged

Transfers the contract's entire token balance to the recipient. Charges a fee which is transferred to feeRecipient.

Input Field
Type
Explanation

token

address

Token to transfer

minAmount

uint256

Contract's token balance should not be lower than this amount

recipient

address

Desired recipient of the token

feeBps

uint256

Fee to charge in basis points

feeRecipient

address

Address to receive the fee charged

Enables calling multiple methods in a single call to the contract.

Uses delegateCall to sequentially execute functions, then return the result of each execution.

Field
Type
Explanation

data

bytes[]

encoded function data for each of the calls to make to this contract

Field
Type
Explanation

results

bytes[]

results from each of the calls passed in

A helper contract to handle liquidity related actions, including mint/add/remove liquidity.

Used when minting a new position or adding liquidity to an existing one.

Field
Type
Explanation

token0

address

first token of the pool

token1

address

second token of the pool

fee

uint16

the pool's swap fee

tickLower

int24

position's lower tick

tickUpper

int24

position's upper tick

ticksPrevious

int24[2]

an array containing 2 values tickLowerPrevious and tickUpperPrevious which are expected to be the nearest initialized tick <= tickLower and tickUpper respectively

amount0Desired

uint256

token0 amount user wants to add

amount1Desired

uint256

token1 amount user wants to add

amount0Min

uint256

minimum token0 amount that should be used

amount1Min

uint256

minimum token1 amount that should be used

Data for callback from Pool contract.

Field
Type
Explanation

token0

address

first token of the pool

token1

address

second token of the pool

fee

uint16

the pool's swap fee

source

address

address to transfer token0/token1 from

Mint callback function implementation called by a Pool.

Input Field
Type
Explanation

deltaQty0

uint256

token0 amount requested by the pool

deltaQty1

uint256

token1 amount requested by the pool

data

bytes

Encoded CallbackData

Add liquidity to a pool. token0 and token1 should be in the correct order, i.e token0 < token1.

Type
Explanation

Parameters for addiing liquidity to a pool

Field
Type
Explanation

liquidity

uint128

amount of liquidity added

amount0

uint256

amount of token0 required

amount1

uint256

amount of token1 required

feeGrowthInsideLast

uint256

latest feeGrowthInsideLast calculated by the pool

pool

IProAMMPool

pool address

Function to encode input parameters to CallbackData

Input Field
Type
Explanation

token0

address

first token of the pool

token1

address

second token of the pool

fee

uint16

the pool's swap fee

Function for computing the pool address with the given input parameters.

Input Field
Type
Explanation

token0

address

first token of the pool

token1

address

second token of the pool

fee

uint16

the pool's swap fee

RouterTokenHelper

unwrapWeth()

transferAllTokens()

refundEth()

_transferTokens()

Internal function to help transfer tokens from the sender to the recipient. If token is WETH and the contract has enough ETH balance, then wrap and transfer WETH, otherwise use to handle transfers.

RouterTokenHelperWithFee

Inherits . Contains additional functions to charge a fee for transfers as well.

unwrapWethWithFee()

transferAllTokensWithFee()

Multicall

multicall()

Input

Output

LiquidityHelper

Struct: AddLiquidityParams

Struct: CallbackData

proAMMMintCallback()

_addLiquidity()

Input

Output

_callbackData()

_getPool()

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
RouterTokenHelper
RouteTokenHelper
AddLiquidityParams