LogoLogo
AppAbout
  • 🙂Meet TokensFarm
  • Overview
    • 💻Our Products
    • ⚙️Features
    • 🚀Launch a Farm for Your Project
    • 🔏Using Gnosis Safe
  • For Developers
    • TokensFarmSDK
      • Getters
      • Setters
      • Parameters
      • ISDK.sol
      • Deposit
      • Withdraw
    • Integrate TokensFarm
      • Requesting Farm Data
      • Get Farm Address and Full Details
      • Monitoring a Farm's Status
      • Deposit into a farm
      • Withdraw from a farm
      • TokensFarm Contract Interface
      • How to integrate TokensFarmSDK
      • How to Embed TokensFarm
      • Getters of TokensFarm Contract
    • PerpetualTokensFarmSDK
      • Getters
      • Setters
      • Parameters
      • ISDK.sol
      • Deposit
      • Withdraw
    • PerpetualTokensFarm
      • Getters
      • Setters
      • Parameters
      • Deposit
      • Withdraw
  • About
    • 🔉Social Media
    • 🏢About DcentraLab
    • ❓FAQ
    • 📜Tokensfarm Audits
    • 📞Support
    • ⚖️Legal
Powered by GitBook
On this page
  • Get info from relevant contract public fields
  • Getters
  • Get the Address of a Staked Token
  • Get the Amount of Deposited ERC-20 Tokens via stakeId
  • Get pending reward amount
  • How many time a user staked
  • Get deposit timestamp
  • Get withdraw timestamp

Was this helpful?

  1. For Developers
  2. Integrate TokensFarm

Getters of TokensFarm Contract

Get info from relevant contract public fields

The staked ERC-20 token's address

IERC20 public tokenStaked;

Total amount of tokens deposited to a farm

 uint256 public totalDeposits;

Total amount of tokens that were paid out as rewards

uint256 public paidOut;

The current total rewards amount

uint256 public totalRewards;

The amount of tokens rewarded per second

uint256 public rewardPerSecond;

The farm's start and end times

uint256 public startTime;
uint256 public endTime;

The early withdrawal penalty

EarlyWithdrawPenalty public penalty;

The fee rates in percentages %

uint256 public stakeFeePercent;
uint256 public rewardFeePercent;
uint256 public flatFeeAmount;

The number of farm participants

uint256 public noOfUsers;

The addresses of all farm participants and mapping of users to get the index

address[] public participants;
mapping(address => uint256) public id;

Getters

Get the Address of a Staked Token

IERC20 public tokenStaked;

Get the Amount of Deposited ERC-20 Tokens via stakeId

function deposited(address _user, uint256 stakeId)
Parameters
Type
Description

user

address

The user address whose data you fetch

stakeId

uint256

The stakeId of the particular stake

returns:

Parameters
Type
Description

stake.amount

uint256

The resulting number will be the ERC-20 amount that was deposited in the requested stake.

Get pending reward amount

function pending(address _user, uint256 stakeId)
Parameters
Type
Description

user

address

The user address whose data you fetch

stakeId

uint256

The stakeId of the particular stake

returns:

Parameters
Type
Description

rewardAmount

uint256

The amount of pending ERC-20 rewards

How many time a user staked

To get the number of user stakes from a TokensFarm contract, you must call getNumberOfUserStakes on the TokensFarm smart contract.

function getNumberOfUserStakes(address user)
Parameters
Type
Description

user

address

The user address whose data you fetch

returns:

Parameters
Type
Description

stakeInfo[user].length

uint256

The resulting number will represent how many times the user has staked.

Get deposit timestamp

function depositTimestamp(address _user, uint256 stakeId)
Parameters
Type
Description

user

address

The user address whose data you fetch

stakeId

uint256

The stakeId of the particular stake

returns:

Parameters
Type
Description

timestamp

uint256

The timestamp of the deposit

Get withdraw timestamp

function withdrawTimestamp(address _user, uint256 stakeId)
Parameters
Type
Description

user

address

The user address whose data you fetch

stakeId

uint256

The stakeId of the particular stake

returns:

Parameters
Type
Description

timestamp

uint256

The timestamp of the withdraw

PreviousHow to Embed TokensFarmNextPerpetualTokensFarmSDK

Last updated 3 years ago

Was this helpful?