Skip to main content

Factory

initializeFactory​

ParameterDescription
templateEthereum address of exchange template

Smart Contract​

initializeFactory(template: address)

Web3​

factoryContract.methods.initializeFactory(template).send()

createExchange​

ParameterTypeDescription
tokenaddressEthereum address of an ERC20 token
Returns
addressEthereum address of a Unicorn exchange

Smart Contract​

createExchange(token: address): address

Web3​

factoryContract.methods.createExchange(token).send()

getExchange​

ParameterTypeDescription
tokenaddressEthereum address of an ERC20 token
Returns
addressEthereum address of a Unicorn exchange

Smart Contract​

@constant
getExchange(token: address): address

Web3​

factoryContract.methods.getExchange(token).call()

getToken​

ParameterTypeDescription
exchangeaddressEthereum address of a Unicorn exchange
Returns
addressEthereum address of an ERC20 token

Smart Contract​

@constant
getToken(exchange: address): address

Web3​

factoryContract.methods.getToken(exchange).call()

getTokenWithId​

ParameterTypeDescription
token_iduint256Unicorn ID for an ERC20 token
Returns
addressEthereum address of an ERC20 token

Smart Contract​

@constant
getTokenWithId(token_id: uint256): address

Web3​

factoryContract.methods.getTokenWithId(token_id).call()