The unstaking process is a three-stage process:
user requests an exit or unstake (user tx)
exit request is processed and ETH is sourced to pay for the exit
user claims exited ETH (user tx)
When user request an exit, they burn their shares (receipt tokens in their wallet) in exchange for one or exit queue tickets.
These tickets have a status based on wether or not they can be claimed (user is able to claim their ETH), which depends on the liquidity provided to the exit queues by the vPools.
You can find more details about tickets and casks here.
Used to request an exit (unstake) of any amount of ETH, up to the maximum user balance.
When initiating an exit, you must specify the quantity of integration tokens to exit. Subsequently, the integration contract will generate one or several tickets in the associated vPool exit queues.
This can only be executed by calling a smart contract method:
Used to retrieve all exit queue tickets for a user, providing the status of each ticket. This information enables you to inform the user about the availability of their exited ETH for claiming. Additionally, you have the option to permit users to claim a portion of their exit request if it is partially fulfilled, with the ability to claim the remainder once it becomes available.
Using The Graph
Query
Example results
Here you will retrieve all the different exit tickets of an account.
ticketId
is the id of the ticket, and also the id of the NFT representing this ticket
size
is the size of the ticket in vPool Shares (not ETH !)
maxExitable
is the maximum amount of eth that can be retrieved by the ticket. Shares locked inside tickets are not earning rewards anymore.
fulfillableAmount
is the amount of vPool shares that are currently fulfillable
fulfillableBy
is a list of casks that fulfill a ticket
exitQueue.address
is the address of the exit queue contract where the ticket is held
To retrieve the status of the ticket, it's pretty simple:
unfulfillable
when fulfillableAmount
is 0
partially fulfillable
when fulfillableAmount
< size
fulfillable
when fulfillableAmount
= size
Used to claim the ETH of a user who has requested to exit the pool.
You can use TheGraph query above to retrieve all the required information. In the case where we would want to claim all the tickets from the example query above (assuming we would have a new cask with id 1
that fulfills all the tickets), the transaction would look like
You must pass only one cask ID per ticket, if the ticket is matched by more than one cask, pass the lowest cask id and the code will automatically claim on all the casks matching the ticket
This page provides an overview of the various contract interactions when staking.
The examples below when calling smart contract functions (e.g. stake()) are done using cast,
a cli tool, only as an illustration of how the transactions or view calls should be performed.
All of the contract calls below are for: Liquid20C, Liquid20A & Native20 contracts
Integrating Kiln into native workflow will require a mix of smart contract calls and TheGraph queries:
Smart contract
Our smart contract ABI's can be found and the contract address will be provided by Kiln once it is deployed.
The Graph
Use the credentials provided by Kiln if using the public instance, or your own credentials if you are hosting your own instance.
Action | How to... | Description |
---|
Used to retrieve the historical reward rate of the pool so that it can be displayed to your users in your native workflow.
The pool reward rate can only ever be based on a rolling historical average (we can never predict the future rate). The data returned includes the average of the last week, last month, last 3 months, last 6 months and 'all time'.
It is up to you to choose the which historical rolling average to use, but most partners currently use the last week.
TIP: you need to convert the results to a percentage (%). For example:
'All Time' Gross Reward Rate returns: 26478817328005117
Convert to %
26478817328005117 / 10^18 =
.02647 (2.647%)
Using The Graph
Query
Example results
Used to retrieve the rewards of the given user based on their staked position
TIP: the result is in wei, you need to convert it to ETH. For example:
allTimeRewards = 46478817328005117
Convert to ETH
46478817328005117 / 10^18 = 0.046478817
ETH
allTimeRewards
= ((sharesBalance * totalUnderlyingSupply) / totalSupply) - adjustedTotalDeposited
Using The Graph
Query
Example results
TheGraph query | Get the historical reward rate of the pool (last week, month, 3 months, 6 months, All Time). |
contract call | Stake any amount of ETH into the pool. |
TheGraph query | Get a list of all deposits / stakes made from a wallet |
Current value of stake(s) | contract callTheGraph query | Get the current underlying value of a wallet's staked position. Includes original stake + accrued rewards. |
TheGraph query | Get the historical reward rate of the wallet's staked position. |
Unstake | contract call | Initiate an exit (or unstake) of a wallet's full or partial staked position. |
Unstake status | TheGraph query | Get the current status of a wallet's exit request. |
Withdraw unstaked ETH | contract call | Claim unstaked ETH once the exit request has been fulfilled. |
Used to stake any amount of ETH into the pool.
This can only be executed by calling a smart contract method:
Used to find the amount of shares for a given wallet from the integration contract
Using the smart contract view methods
Allows you to obtain the value (in ETH) of the users current staked position
For example, consider the scenario where a user staked 12 ETH several months ago. Every time they visit your app, you want to showcase the current value of the staked position accounting for the accrued value from staking rewards over time.
You can simply query the smart contract with the users wallet.
Using the smart contract view methods
Using TheGraph queries
TheGraph queries