Pool (ERC-20)
This documentation covers ERC-20 functionality for denominating pool tokens. For Bunicorn Stable-specific functionality, see Pool.

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

1
event Approval(address indexed owner, address indexed spender, uint value);
Copied!
Emitted each time an approval occurs via approve or permit.

Transfer

1
event Transfer(address indexed from, address indexed to, uint value);
Copied!
Emitted each time a transfer occurs via transfer, transferFrom, mint, or burn.

Read-Only Functions

name

1
function name() external pure returns (string memory);
Copied!
Return Bunicorn Pool Token (LP token) for each pool.

symbol

1
function symbol() external pure returns (string memory);
Copied!
Returns BPT symbol for each pool.

decimals

1
function decimals() external pure returns (uint8);
Copied!
Returns 18 for all pools.

totalSupply

1
function totalSupply() external view returns (uint);
Copied!
Returns the total amount of BPT tokens for a pool.

balanceOf

1
function balanceOf(address owner) external view returns (uint);
Copied!
Returns the amount of BPT tokens owned by an address.

allowance

1
function allowance(address owner, address spender) external view returns (uint);
Copied!
Returns the amount of liquidity tokens owned by an address that a spender is allowed to transfer via transferFrom.

DOMAIN_SEPARATOR

1
function DOMAIN_SEPARATOR() external view returns (bytes32);
Copied!
Returns a domain separator for use in permit.

PERMIT_TYPEHASH

1
function PERMIT_TYPEHASH() external view returns (bytes32);
Copied!
Returns a typehash for use in permit.

nonces

1
function nonces(address owner) external view returns (uint);
Copied!
Returns the current nonce for an address for use in permit.

State-Changing Functions

approve

1
function approve(address spender, uint value) external returns (bool);
Copied!
Lets msg.sender set their allowance for a spender.
    Emits Approval.

transfer

1
function transfer(address to, uint value) external returns (bool);
Copied!
Lets msg.sender send pool tokens to an address.
    Emits Transfer.

transferFrom

1
function transferFrom(address from, address to, uint value) external returns (bool);
Copied!
Sends pool tokens from one address to another.
    Requires approval.
    Emits Transfer.

permit

1
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
Copied!
Sets the allowance for a spender where approval is granted via a signature.
    Emits Approval.

Interface

1
pragma solidity 0.6.12;
2
3
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
4
5
interface IERC20Permit is IERC20 {
6
function permit(
7
address owner,
8
address spender,
9
uint256 value,
10
uint256 deadline,
11
uint8 v,
12
bytes32 r,
13
bytes32 s
14
) external;
15
}
Copied!
Last modified 3mo ago