UnifiERC20.sol
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.
| |
uTrade V2 UnifiERC20 (Solidity) | |
uTrade V2 UnifiERC20 Interface as JSON | Link Here |
uTrade V2 UnifiERC20 as Typescript | Link Here |
Import statement codeblock (when available) | |
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. event Approval(address indexed owner, address indexed spender, uint value);
The
Approval
event is emitted anytime an approve
or permit
function is called.event Transfer(address indexed from, address indexed to, uint value);
The
Transfer
event is emitted anytime a transfer of LP tokens occurs, by the transfer
, transferFrom
, mint
, or burn
functions.function name() external pure returns (string memory);
The
name
function will return "Unifi LPs" for all liquidity pool contracts.function symbol() external pure returns (string memory);
The
symbol
function will return "Unifi-LP" for all liquidity pool contracts.function decimals() external pure returns (uint8);
The
decimals
function returns "18" as a uint8 value, which is the precision for each uToken on uTrade V2.function totalSupply() external view returns (uint);
The
totalSupply
function returns the total amount uTokens for a pair.function balanceOf(address owner) external view returns (uint);
The
balanceOf
function returns the balance of uTokens for the provided address.function allowance(address owner, address spender) external view returns (uint);
The
allowance
function returns the amount of tokens an address is approved to transfer when using the transferFrom
function.function DOMAIN_SEPARATOR() external view returns (bytes32);
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.function PERMIT_TYPEHASH() external view returns (bytes32);
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.function nonces(address owner) external view returns (uint);
The
nonces
function is used in the permit function. It returns the current nonce of the address provided.function approve(address spender, uint value) external returns (bool);
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.function transfer(address to, uint value) external returns (bool);
The
transfer
function lets an address send uTokens from one address to another, and returns a boolean value and emits a Transfer
event.function transferFrom(address from, address to, uint value) external returns (bool);
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.function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
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.
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 IUnifiERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
Last modified 17d ago