INative1155
Author: 0xvv @ Kiln
This contract allows users to stake in any of the vPools with any amount of ETH and track their position. Users are given non transferable shares to track their stake, shares of different pools are not equivalent. Users can interact with the contract using the ERC-1155 style interface, but the contract is not ERC-1155 compliant as it does not support transfers.
Functions
initialize
Initializes the contract with the given parameters.
function initialize(Native1155Configuration calldata args) external;
Parameters
| Name | Type | Description |
|---|---|---|
args | Native1155Configuration | The arguments to initialize the contract with. |
uri
Returns the URI for token type id.
function uri(uint256 id) external view returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
id | uint256 | The id of the token. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The URI of the token. |
setPrefixUri
Sets the base URI for all tokens.
Ony callable by the admin.
function setPrefixUri(string calldata _uri) external;
Parameters
| Name | Type | Description |
|---|---|---|
_uri | string | The base URI. |
name
Returns the name of the token.
function name() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The name of the token. |
symbol
Returns the symbol of the token.
function symbol() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The symbol of the token. |
balanceOf
Returns the amount of staking shares of a given pool for an account.
function balanceOf(address account, uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
id | uint256 | The id of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of staking shares. |
balanceOfBatch
Batch version of balanceOf().
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | The addresses of the accounts. |
ids | uint256[] | The ids of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | list of amounts of staking shares. |
balanceOfUnderlying
Returns the amount of pool shares for an account in a given pool.
function balanceOfUnderlying(address account, uint256 id) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The address of the account. |
id | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | amount of pool shares. |
balanceOfUnderlyingBatch
Batch version of balanceOfUnderlying().
function balanceOfUnderlyingBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
accounts | address[] | The addresses of the accounts. |
ids | uint256[] | The ids of the pool. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | list of amounts of pool shares. |
stake
Stake the given amounts of ETH in the given pools.
Sum of amounts must be equal to msg.value.
The length of amounts and ids must be equal.
function stake(uint256[] calldata amounts, uint256[] calldata ids) external payable returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
amounts | uint256[] | List of amount for each pool |
ids | uint256[] | List of pool ids |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Whether the staking was successful. |
Events
SetURIPrefix
Emitted when the base uri is changed
event SetURIPrefix(string uri);
Parameters
| Name | Type | Description |
|---|---|---|
uri | string | The new base uri |