UnifiERC20.sol

Primary Uses - UnifiERC20.sol essentially ports the properties of BEP-20 tokens on to Unifi LP Tokens, or uTokens. An example of this in practice would be the 'approve' transaction.

uTrade V2 UnifiERC20 Code / Interfaces

uTrade V2 UnifiERC20 (Solidity)

BscScan Verified Pair (UNIFI / BNB)

uTrade V2 UnifiERC20 Interface as JSON

Link Here

uTrade V2 UnifiERC20 as Typescript

Link Here

Import statement codeblock (when available)

uTrade V2 UnifiERC20 Contract Addresses

Each uTrade V2 Liquidity Pool uses the uTrade V2 ERC20 Interface in the contract. An example would be 0x76AE2c33bcce5A45128eF2060C6280a452568396 (Link) for the UNIFI / BNB pair.

Events

Approval

event Approval(address indexed owner, address indexed spender, uint value);

The Approval event is emitted anytime an approve or permit function is called.

Transfer

The Transfer event is emitted anytime a transfer of LP tokens occurs, by the transfer, transferFrom, mint, or burn functions.

Read-Only Functions

name

The name function will return "Unifi LPs" for all liquidity pool contracts.

symbol

The symbol function will return "Unifi-LP" for all liquidity pool contracts.

decimals

The decimals function returns "18" as a uint8 value, which is the precision for each uToken on uTrade V2.

totalSupply

The totalSupply function returns the total amount uTokens for a pair.

balanceOf

The balanceOf function returns the balance of uTokens for the provided address.

allowance

The allowance function returns the amount of tokens an address is approved to transfer when using the transferFrom function.

DOMAIN_SEPARATOR

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.

PERMIT_TYPEHASH

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.

nonces

The nonces function is used in the permit function. It returns the current nonce of the address provided.

State-Changing Functions

approve

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.

transfer

The transfer function lets an address send uTokens from one address to another, and returns a boolean value and emits a Transfer event.

transferFrom

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 Transferevent.

permit

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.

Function Parameter Breakdown

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.

Interface Code

Last updated

Was this helpful?