πŸŒ€Swap

CxRouter

Cross-Chain swap contract allows users to execute aggregated swaps with external factories


constructor

constructor(address factory) public

CxSwap

Cross-Chain swap contract allows users to deposit liquidity and execute aggregated swaps with external factories


constructor

constructor(address _factory) public

_addLiquidity

function _addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin) internal returns (uint256 amountA, uint256 amountB)

Internal function to Add Liquidity to the selected pool

Parameters

Name
Type
Description

tokenA

address

address of first token to add

tokenB

address

address of second token to add

amountADesired

uint256

specifies the amount of tokens that should be added as liquidity

amountBDesired

uint256

specifies the amount of tokens that should be added as liquidity

amountAMin

uint256

specifies the minimum amount of first token that this transactions should succeed with

amountBMin

uint256

specifies the minimum amount of second token that this transactions should succeed with


addLiquidity

function addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) external returns (uint256 amountA, uint256 amountB, uint256 liquidity)

Add liquidity to the selected pool

Parameters

Name
Type
Description

tokenA

address

address of first token to add

tokenB

address

address of second token to add

amountADesired

uint256

specifies the amount of tokens that should be added as liquidity

amountBDesired

uint256

specifies the amount of tokens that should be added as liquidity

amountAMin

uint256

specifies the minimum amount of first token that this transactions should succeed with

amountBMin

uint256

specifies the minimum amount of second token that this transactions should succeed with

to

address

address to send liquidity tokens to

deadline

uint256

timestamp after which this transaction will be reverted


removeLiquidity

function removeLiquidity(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) external returns (uint256 amountA, uint256 amountB)

Remove liquidity from the selected pool

Parameters

Name
Type
Description

tokenA

address

address of first token to remove

tokenB

address

address of second token to remove

liquidity

uint256

specifies the amount of LP tokens that should be removed from liquidity pool

amountAMin

uint256

specifies the minimum amount of first token that this transactions should succeed with

amountBMin

uint256

specifies the minimum amount of second token that this transactions should succeed with

to

address

address to send tokens to

deadline

uint256

timestamp after which this transaction will be reverted


quote

function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) internal pure returns (uint256 amountB)

given some amount of an asset and pair reserves, returns an equivalent amount of the other asset

Parameters

Name
Type
Description

amountA

uint256

specifies the amount of first token

reserveA

uint256

specifies the reserves amount of first token

reserveB

uint256

specifies the reserves amount of second token

Last updated