This documentation covers ERC-20 functionality for denominating pool tokens. For Bunicorn Stable-specific functionality, see .
Code
The typical ERC20 functions are inherited from OpenZeppelin's ERC20 token implementation. In addition, the ERC20Permit library containing a permit
function for meta-approvals is used.
Events
Approval
Copy event Approval(address indexed owner, address indexed spender, uint value);
Emitted each time an approval occurs via approve or permit.
Transfer
Copy event Transfer(address indexed from, address indexed to, uint value);
Emitted each time a transfer occurs via transfer, transferFrom, mint, or burn.
Read-Only Functions
name
Copy function name() external pure returns (string memory);
Return Bunicorn Pool Token (LP token) for each pool.
symbol
Copy function symbol() external pure returns (string memory);
Returns BPT symbol for each pool.
decimals
Copy function decimals() external pure returns (uint8);
Returns 18
for all pools.
totalSupply
Copy function totalSupply() external view returns (uint);
Returns the total amount of BPT tokens for a pool.
balanceOf
Copy function balanceOf(address owner) external view returns (uint);
Returns the amount of BPT tokens owned by an address.
allowance
Copy function allowance(address owner, address spender) external view returns (uint);
Returns the amount of liquidity tokens owned by an address that a spender is allowed to transfer via transferFrom.
DOMAIN_SEPARATOR
Copy function DOMAIN_SEPARATOR() external view returns (bytes32);
Returns a domain separator for use in permit.
PERMIT_TYPEHASH
Copy function PERMIT_TYPEHASH() external view returns (bytes32);
Returns a typehash for use in permit.
nonces
Copy function nonces(address owner) external view returns (uint);
Returns the current nonce for an address for use in permit.
State-Changing Functions
approve
Copy function approve(address spender, uint value) external returns (bool);
Lets msg.sender
set their allowance for a spender.
transfer
Copy function transfer(address to, uint value) external returns (bool);
Lets msg.sender
send pool tokens to an address.
transferFrom
Copy function transferFrom(address from, address to, uint value) external returns (bool);
Sends pool tokens from one address to another.
permit
Copy function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
Sets the allowance for a spender where approval is granted via a signature.
Interface
Copy pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IERC20Permit is IERC20 {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
}