INative1155

Git Source

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

NameTypeDescription
argsNative1155ConfigurationThe arguments to initialize the contract with.

uri

Returns the URI for token type id.

function uri(uint256 id) external view returns (string memory);

Parameters

NameTypeDescription
iduint256The id of the token.

Returns

NameTypeDescription
<none>stringThe URI of the token.

setPrefixUri

Sets the base URI for all tokens.

Ony callable by the admin.

function setPrefixUri(string calldata _uri) external;

Parameters

NameTypeDescription
_uristringThe base URI.

name

Returns the name of the token.

function name() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe name of the token.

symbol

Returns the symbol of the token.

function symbol() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe 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

NameTypeDescription
accountaddressThe address of the account.
iduint256The id of the pool.

Returns

NameTypeDescription
<none>uint256amount of staking shares.

balanceOfBatch

Batch version of balanceOf().

function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

Parameters

NameTypeDescription
accountsaddress[]The addresses of the accounts.
idsuint256[]The ids of the pool.

Returns

NameTypeDescription
<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

NameTypeDescription
accountaddressThe address of the account.
iduint256

Returns

NameTypeDescription
<none>uint256amount of pool shares.

balanceOfUnderlyingBatch

Batch version of balanceOfUnderlying().

function balanceOfUnderlyingBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

Parameters

NameTypeDescription
accountsaddress[]The addresses of the accounts.
idsuint256[]The ids of the pool.

Returns

NameTypeDescription
<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

NameTypeDescription
amountsuint256[]List of amount for each pool
idsuint256[]List of pool ids

Returns

NameTypeDescription
<none>boolWhether the staking was successful.

Events

SetURIPrefix

Emitted when the base uri is changed

event SetURIPrefix(string uri);

Parameters

NameTypeDescription
uristringThe new base uri