UnifiFactory.sol
Primary Uses - The uTrade V2 Factory contract creates an LP token for any pairs listed on uTrade V2, and indexes them for easy retrieval. In addition, it can return the address of the LP token based on a call of the addresses of the two tokens that make up the liquidity pool.
uTrade V2 Factory Code / Interfaces
uTrade V2 Factory Contract Addresses
Events
PairCreated
Anytime a pair is created on uTrade V2 using the createPair
function, a PairCreated
event is emitted. Contracts can be deployed to listen for new pairs on the uTrade V2 IoTeX Factory address.
token0 is the token address of the first asset in the token pair.
token1 is the token address of the second asset in the token pair.
pair is the address of the newly created uTrade V2 liquidity pool.
uint refers to the index of this uTrade V2 Factory. For example, the first liquidity pool created on uTrade V2 is 1, the second liquidity pool is 2, and so on. This number can used with the
allPairs(uint)
to return the address. The current number, and therefore the total number of LP pools on uTrade V2 ETH, can be accessed using theallPairsLength
function.
Read-Only Functions
getPair
A call to the getPair
function returns the address of the pair for tokenA and tokenB.
If the pair does not exist, the call will return address(0).
The order of the tokens is irrelevant in this call. For example, a call for IOTX, UP will return the same pair address as UP, IOTX.
allPairs
A call to the allPairs
function returns the address of a pair based on the indexed uint value assigned upon creation of the LP.
For example,
allPairs(0)
will return the first pair created on uTrade V2 IoTeX.If the index number is too high, as in, there aren't enough pairs created yet, the function will return address(0).
allPairsLength
A call to the allPairsLength
function returns the current number of pairs.
For example, if there are 201 total liquidity pool pairs on uTrade V2 IoTeX, this call will return 200 as an uint value.
feeTo
A call to the feeTo
function returns the percentage of trading fees that Unifi Protocol receives.
Due to the nature of UP Token economics, this is set to zero, but is preserved for flexibility in the future.
feeToSetter
A call to the feeToSetter
function returns the address to which the feeTo
would send trading fees, if trading fees were collected.
State-Changing Functions
createPair
Creates a liquidity pool pair for tokenA and tokenB if one does not currently exist. After the function is confirmed on chain, a PairCreated
event is emitted.
Interface Code
Last updated