UnifiFactory.sol
Last updated
Last updated
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.
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 Polygon 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 Polygon, can be accessed using the allPairsLength
function.
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 WMATIC, UNIFI will return the same pair address as UNIFI, WMATIC.
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 Polygon.
If the index number is too high, as in, there aren't enough pairs created yet, the function will return address(0).
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 Polygon, this call will return 200 as an uint value.
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.
A call to the feeToSetter
function returns the address to which the feeTo
would send trading fees, if trading fees were collected.
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.
uTrade V2 Factory (Solidity)
uTrade V2 Factory Interface as JSON
uTrade V2 Factory Interface as Typescript
Import statement codeblock (when available)
Network
Address
Polygon Main Net
0x4FEE52912f81B78C3CdcB723728926ED6a893D27
(Link)