Integration

Making the ebox In-Wallet Staking model available to your users consists of the following steps:
  1. 1.
    Setup: Tailoring to your project's needs by specifying the main token to be tracked, which bonuses to grant, special conditions, the payday interval, etc.
  2. 2.
    Technical integration: The results of the staking calculation are delivered over a PHP API. Claiming takes place through a smart contract.

Setup

Currently, setting up an instance of ebox In-Wallet Staking for your project requires getting in touch with us – Go right ahead and contact us, so we can work out your customized staking solution!
In the future, we will provide easy-to-use dashboards for fully automated setup & deployment of all ebox Business Solutions.

Technical Integration

Once your staking instance has been configured, it will be launched on our servers, periodically delivering the staking calculation results over a PHP API.
In regular intervals (which are defined during setup) the payday takes place, allowing users to claim their accumulated rewards through a smart contract.
These two aspects need to be made accessible to your users in a dashboard interface / website.

Rewards Data: PHP API

The staking API endpoint provides information on how high a user's currently expected reward is, together with all the bonuses (etc) that are active. Historical data is permanently stored on the ebox servers and can be queried retrospectively.

Endpoints

Begin by calling getStartEndTime, so as to know the start and end timestamp for available calculation data.
For querying the most recent dataset, pass the end timestamp to getDataForUser or getDataForAll.
post
getStartEndTime
Get start / end time
post
getDataForUser
Get data for user
post
getDataForAll
Get data for all users

Returned Data

Staking rewards data is returned in the JSON format.
Example:
[
{
"address": "0x1111111111111111111111111111111111111111",
"balance": 1234.5678,
"reward": 100.0123,
"bonusToken1": true,
"bonusToken2": false,
"bonusLP": true,
"bonusLongTermMonths": 8
},
{
"address": "0x2222222222222222222222222222222222222222",
"balance": 5678.9012,
"reward": 345.0012,
"bonusToken1": true,
"bonusToken2": true,
"bonusLP": false,
"bonusLongTermMonths": 3
}
]

Claiming: Smart Contract

For each staking instance, a separate claiming contract is deployed. Ownership of this contract is held by ebox, but can be passed to your project administrator if desired.

Functions

claimReward

Claims all outstanding rewards for the calling address.
claimReward()

getUnclaimedReward

Returns the amount of rewards claimable by the calling address.
getUnclaimedReward()

Returns:

  • uint
    • Amount of claimable tokens
      • 1 ETH = 10¹⁸ Wei, same for tokens with 18 decimals

Contract ABI

[{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getUnclaimedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]