UnifiERC20.sol
Last updated
Last updated
Primary Uses - UnifiERC20.sol essentially ports the properties of ERC-20 tokens on to Unifi LP Tokens, or uTokens. An example of this in practice would be the 'approve' transaction.
Each uTrade V2 Liquidity Pool uses the uTrade V2 ERC20 Interface in the contract. An example would be 0x96351b805FB389B761c1318B43a7dC0C679BEd5E
(Link) for the UNIFI / ETH pair.
The Approval
event is emitted anytime an approve
or permit
function is called.
The Transfer
event is emitted anytime a transfer of LP tokens occurs, by the transfer
, transferFrom
, mint
, or burn
functions.
The name
function will return "Unifi LPs" for all liquidity pool contracts.
The symbol
function will return "Unifi-LP" for all liquidity pool contracts.
The decimals
function returns "18" as a uint8 value, which is the precision for each uToken on uTrade V2.
The totalSupply
function returns the total amount uTokens for a pair.
The balanceOf
function returns the balance of uTokens for the provided address.
The allowance
function returns the amount of tokens an address is approved to transfer when using the transferFrom
function.
The DOMAIN_SEPARATOR
function is used in the permit
function, and is one of the components that allows transactions to get through without a prior approve transaction. Calling a read function returns the bytes32 data that is required for use in permit
function.
The PERMIT_TYPEHASH
function is used in the permit
function, and is one of the components that allows transactions to get through without a prior approve transaction. Calling a read function returns the bytes32 data that is required for use in the permit
function.
The nonces
function is used in the permit function. It returns the current nonce of the address provided.
The approve
function sets a value for the amount of LP tokens the address provided is allowed to transfer. Returns a boolean value and emits the Approval
event.
The transfer
function lets an address send uTokens from one address to another, and returns a boolean value and emits a Transfer
event.
The transferFrom
function sends uTokens from one address to another. This requires the sending address to have approval to send uTokens. Returns a boolean value and emits a Transfer
event.
The permit function allows a sender to use a signature in lieu of an approval transaction, and sets the allowance for an address to send.
uTrade V2 UnifiERC20 (Solidity)
uTrade V2 UnifiERC20 Interface as JSON
Link Here
uTrade V2 UnifiERC20 as Typescript
Link Here
Import statement codeblock (when available)
Parameter
Type
Description
owner
address
The owner of the address.
spender
address
The spender of the uTokens.
value
uint
The amount of uTokens to be transferred.
deadline
uint
The UNIX timestamp for which this transaction must be completed. If the transaction is mined after this deadline, the transaction will revert.
v
uint8
The v value of the permit. This is one of the three values that makes up the approval signature.
r
bytes32
The r value of the permit. This is one of the three values that makes up the approval signature.
s
bytes32
The s value of the permit. This is one of the three values that makes up the approval signature.