Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 1.79 KB

staking.md

File metadata and controls

38 lines (24 loc) · 1.79 KB

Staking contract

Create staking

// Create new staking by user with selected option
// optionId - staking option ID
// amount - amount of tokens that user wants to stake
function createOrder(uint256 optionId, uint256 amount) external returns(bool) {

Withdraw tokens + reward from staking

// withdraw staking amount + rewards for selected order by user
function withdraw(uint256 id) external returns(bool) {

Withdraw tokens from staking without reward

// in case of empty rewards Pool user can withdraw tokens without reward
function withdrawWithoutReward(uint256 id) external returns(bool) {

Change staking option to another with longer staking period

// user may change staking option to another with longer staking period
// id - staking order id that user wants to upgrade
// optionId - new option than user wants to use for his staking order
function upgradeOrder(uint256 id, uint256 optionId) external returns(bool) {

Add more tokens to existing staking

// user can add more tokens to existing staking order
// id - staking order where user wants to add token
// amount - amount of tokens user wants to add
function addToOrder(uint256 id, uint256 amount) external returns(bool) {

View functions

Get number of staking orders of user

// returns number of staking by user
function getNumberOrders(address user) external view returns(uint256 number) {

Get all staking orders of user

// returns staking orders by user
function getOrders(address user) external view returns(Order[] memory order) {

Get selected staking order of user

// returns selected staking order by user
function getOrder(address user, uint256 id) external view returns(Order memory order) {

Get rewards earne by user in selected staking order

// returns amount of reward earned by user in selected staking order
//user - address of user wallet
//id - order id of user
function calculateReward(address user, uint256 id) external view returns(uint256 reward) {

Get available staking options

// returns all options
function getOptions() external view returns(Option[] memory) {

Get selected staking option

// returns selected option
function getOption(uint256 id) external view returns(Option memory option) {