Website logo
⌘K
Introduction
Liquidity Model
For Stakers
For Market-Makers
Our Design
Hedging
Omni-chain Liquidity
Chain Agnostic Trading
Long-Tail Assets
Shared Ecosystem
How to use Tradable
Getting Started
Deposit/ Withdraw
Trading on Tradable
Trading Mechanisms
Order Types
Margin
Liquidation
Fair Access
How to integrate tradable x
Talk to the team
Account
Dashboard
Staking
Trade
Tradable Features
Smart Contracts
Deployment Addresses
TradableStaking
TradableSideVault
TradableSettingsMessageAdapter
TradableMarginVault
TradableMarginHandler
userAccount
Docs powered by Archbee
Smart Contracts

TradableStaking

5min

Summary Of Staking Contract

  • This contract is in charge of handling and tracking the staking balance of liquidity providers.
  • When the stake method is called it means that funds have already gotten into the side vault and the user balance in our system has already been stored in the vault owned by the staking contract.
  • Staking creates a struct store that is mapped to a user address that contains all the details including timestamp of stake, shares and balance of a user's staking position.
  • The details stored in the Stake struct is used to calculate the share of the total reward generated by liquidity providers that a specific provider has.
  • When the method unstake is called it is used to withdraw from a liquidity provider staking position depending on the side of the reward pool.
  • It should be recognized that no fund is being handled in this contract during staking and unstaking it just hold and verifies that funds can be withdrawn and that funds were deposited.
  • All funds holding is done in the side vault.
  • Once withdrawal is confirmed a callback message is sent to the side vault to approve sending of funds to the user using the sendMessage method.

Functions:

withdrawalValidation

function withdrawalValidation(address user, ITradableSettings.AcceptedToken memory selectedToken, uint256 amount, address dstVault) external { ..... }

Parameters:

Name

Type

Description

user

address

address of the user that initiated the withdrawal transaction

selectedToken

ITradableSettings.AcceptedToken

struct holding the important information about one of the accepted tokens

amount

uint256

amount of tokens that is being withdrawn

dstVault

address

address of the vault that is going to send the tokens out to the user

depositValidation

function depositValidation(address caller, address user, ITradableSettings.AcceptedToken memory selectedToken, uint256 amount) external { ..... }

Parameters:

Name

Type

Description

user

address

address of the user that initiated the withdrawal transaction

selectedToken

ITradableSettings.AcceptedToken

struct holding the important information about one of the accepted tokens

amount

uint256

amount of tokens that is being withdrawn

caller

address

address to specify a special deposit caller attached to the user in a case where it is needed.



Updated 03 Mar 2023
Did this page help you?
PREVIOUS
Deployment Addresses
NEXT
TradableSideVault
Docs powered by Archbee
TABLE OF CONTENTS
Summary Of Staking Contract
Functions:
withdrawalValidation
Parameters:
depositValidation
Parameters:
Docs powered by Archbee