iToken

setup

// Can only be called by factory contract during createExchange()
setup(token_addr: address):

Parameter

Description

token_addr

Ethereum address of an ERC20 Token

addLiquidity

@payable
addLiquidity(
    min_liquidity: uint256,
    max_tokens: uint256,
    deadline: uint256
): uint256

Parameter

Type

Description

msg.value

uint256

Amount of ETH added

min_liquidity

uint256

Minimum minted liquidity

max_tokens

uint256

Maximum ERC20 tokens added

deadline

uint256

Transaction deadline

Returns

uint256

Amount of liquidity tokens minted

removeLiquidity

Parameter

Type

Description

amount

uint256

Amount of liquidity burned

min_eth

uint256

Minimum ETH removed

min_tokens

uint256

Minimum ERC20 tokens removed

deadline

uint256

Transaction deadline

Returns

uint256

Amount of ETH removed

uint256

Amount of ERC20 tokens removed.

default

Parameter

Type

Description

msg.value

uint256

Amount of ETH sold

ethToTokenSwapInput

Parameter

Type

Description

msg.value

uint256

Amount of ETH sold

min_tokens

uint256

Minimum ERC20 tokens bought

deadline

uint256

Transaction deadline

Returns

uint256

Amount of ERC20 tokens bought

ethToTokenTransferInput

Parameter

Type

Description

msg.value

uint256

Amount of ETH sold

min_tokens

uint256

Minimum ERC20 tokens bought

deadline

uint256

Transaction deadline

recipient

address

Address that receives ERC20 tokens

Returns

uint256

Amount of ERC20 tokens bought

ethToTokenSwapOutput

Parameter

Type

Description

msg.value

uint256

Maximum ETH sold

tokens_bought

uint256

Amount of ERC20 tokens bought

deadline

uint256

Transaction deadline

Returns

uint256

Amount of ETH sold

ethToTokenTransferOutput

Parameter

Type

Description

msg.value

uint256

Maximum ETH sold

tokens_bought

uint256

Amount of ERC20 tokens bought

deadline

uint256

Transaction deadline

recipient

address

Address that receives ERC20 tokens

Returns

uint256

Amount of ETH sold

tokenToEthSwapInput

Parameter

Type

Description

tokens_sold

uint256

Amount of ERC20 tokens sold

min_eth

uint256

Minimum ETH bought

deadline

uint256

Transaction deadline

Returns

uint256

Amount of ETH bought

tokenToEthTransferInput

Parameter

Type

Description

tokens_sold

uint256

Amount of ERC20 tokens sold

min_eth

uint256

Minimum ETH bought

deadline

uint256

Transaction deadline

recipient

address

Address that receives ETH

Returns

uint256

Amount of ETH bought

tokenToEthSwapOutput

Parameter

Type

Description

eth_bought

uint256

Amount of ETH bought

max_tokens

uint256

Maximum ERC20 tokens sold

deadline

uint256

Transaction deadline

Returns

uint256

Amount of ERC20 tokens sold

tokenToEthTransferOutput

Parameter

Type

Description

eth_bought

uint256

Amount of ETH bought

max_tokens

uint256

Maximum ERC20 tokens sold

deadline

uint256

Transaction deadline

recipient

address

Address that receives ETH

Returns

uint256

Amount of ERC20 tokens sold

tokenToTokenSwapInput

Parameter

Type

Description

tokens_sold

uint256

Amount of input ERC20 tokens sold

min_tokens_bought

uint256

Minimum output ERC20 tokens bought

min_eth_bought

uint256

Minimum ETH bought as intermediary

deadline

uint256

Transaction deadline

token_addr

address

Address of output ERC20 token

Returns

uint256

Amount of output ERC20 tokens bought

tokenToTokenTransferInput

Parameter

Type

Description

tokens_sold

uint256

Amount of input ERC20 tokens sold

min_tokens_bought

uint256

Minimum output ERC20 tokens bought

min_eth_bought

uint256

Minimum ETH bought as intermediary

deadline

uint256

Transaction deadline

recipient

address

Address that receives output ERC20 tokens

token_addr

address

Address of output ERC20 token

Returns

uint256

Amount of output ERC20 tokens bought

tokenToTokenSwapOutput

Parameter

Type

Description

tokens_bought

uint256

Amount of output ERC20 tokens bought

max_tokens_sold

uint256

Maximum input ERC20 tokens bought

max_eth_sold

uint256

Maximum ETH bought as intermediary

deadline

uint256

Transaction deadline

token_addr

address

Address of output ERC20 token

Returns

uint256

Amount of input ERC20 tokens sold

tokenToTokenTransferOutput

Parameter

Type

Description

tokens_bought

uint256

Amount of output ERC20 tokens bought

max_tokens_sold

uint256

Maximum input ERC20 tokens bought

max_eth_sold

uint256

Maximum ETH bought as intermediary

deadline

uint256

Transaction deadline

recipient

address

Address that receives output ERC20 tokens

token_addr

address

Address of output ERC20 token

Returns

uint256

Amount of input ERC20 tokens sold

tokenToExchangeSwapInput

Parameter

Type

Description

tokens_sold

uint256

Amount of input ERC20 tokens sold

min_tokens_bought

uint256

Minimum output ERC20 tokens bought

min_eth_bought

uint256

Minimum ETH bought as intermediary

deadline

uint256

Transaction deadline

exchange_addr

address

Address of output ERC20 token exchange

Returns

uint256

Amount of output ERC20 tokens bought

tokenToExchangeTransferInput

Parameter

Type

Description

tokens_sold

uint256

Amount of input ERC20 tokens sold

min_tokens_bought

uint256

Minimum output ERC20 tokens bought

min_eth_bought

uint256

Minimum ETH bought as intermediary

deadline

uint256

Transaction deadline

recipient

address

Address that receives output ERC20 tokens

exchange_addr

address

Address of output ERC20 token exchange

Returns

uint256

Amount of output ERC20 tokens bought

tokenToExchangeSwapOutput

Parameter

Type

Description

tokens_bought

uint256

Amount of output ERC20 tokens bought

max_tokens_sold

uint256

Maximum input ERC20 tokens bought

max_eth_sold

uint256

Maximum ETH bought as intermediary

deadline

uint256

Transaction deadline

exchange_addr

address

Address of output ERC20 token exchange

Returns

uint256

Amount of input ERC20 tokens sold

tokenToExchangeTransferOutput

Parameter

Type

Description

tokens_bought

uint256

Amount of output ERC20 tokens bought

max_tokens_sold

uint256

Maximum input ERC20 tokens bought

max_eth_sold

uint256

Maximum ETH bought as intermediary

deadline

uint256

Transaction deadline

recipient

address

Address that receives output ERC20 tokens

exchange_addr

address

Address of output ERC20 token exchange

Returns

uint256

Amount of input ERC20 tokens sold

getEthToTokenInputPrice

Parameter

Type

Description

eth_sold

uint256

Amount of ETH sold

Returns

uint256

Amount of ERC20 tokens that can be bought

getEthToTokenOutputPrice

Parameter

Type

Description

tokens_bought

uint256

Amount of ERC20 tokens bought

Returns

uint256

Amount of ETH that must be sold

getTokenToEthInputPrice

Parameter

Type

Description

tokens_sold

uint256

Amount of ERC20 tokens sold

Returns

uint256

Amount of ETH that can be bought

getTokenToEthOutputPrice

Parameter

Type

Description

eth_bought

uint256

Amount of ETH bought

Returns

uint256

Amount of ERC20 tokens that must be sold

tokenAddress

Returns

address

Address of ERC20 token sold on exchange

factoryAddress

Returns

address

Address of factory that created exchange

name

Returns

bytes32

Name of liquidity token

symbol

Returns

bytes32

Symbol of liquidity token

decimals

Returns

uint256

Decimals of liquidity token

balanceOf

Parameter

Type

Description

_owner

address

Ethereum address

Returns

uint256

Liquidity token balance of address

transfer

Parameter

Type

Description

_to

address

Recipient address

_value

uint256

Amount transferred

Returns

bool

True if successful. Reverts or false on failure

transferFrom

Parameter

Type

Description

_from

address

Sender address

_to

address

Recipient address

_value

uint256

Amount transferred

Returns

bool

True if successful. Reverts or false on failure

approve

Parameter

Type

Description

_spender

address

Address of approved spender

_value

uint256

Spender allowance

Returns

bool

True if successful. Reverts or false on failure

allowance

Parameter

Type

Description

_owner

address

Address of liquidity token owner

_spender

uint256

Address of approved spender

Returns

uint256

Spender allowance

Last updated

Was this helpful?