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

Was this helpful?

  1. For Developers
  2. PerpetualTokensFarmSDK

ISDK.sol

Interface that needs to be implemented into the project in order to use staking helper

In order to fully use this feature, you will have to insert param called farmAddress into your contract admin contract, and make setter for it

address public farmAddress;
function setFarmAddress(
    address _farmAddress
) 
    external onlyOnwer 
{ 
    require(_farmAddress != address(0x0));
    farmAddress = _farmAddress;
}
//"SPDX-License-Identifier: UNLICENSED"
pragma solidity 0.6.12;

interface ISDK {
    // In order to fund the farm you need to call fund

    function makeDepositRequest(
        address _user,
        uint256 _amount
    ) external;

    function finaliseDeposit(
        address user,
        uint256 stakeId
    ) external;

    // If warmup > 0 then these two functions above are used together to deposit

    function deposit(
        address _user,
        uint256 _amount
    ) external;

    // If warmup = 0 then only one function from above is used to deposit

    function ifPaymentCanPassInOneTx(
        address _user,
        uint256 _amount
    ) external view returns(bool);

    // If comes to withdrawal first getter ifPaymentCanPassInOneTx is called (returns true/false)

    function noticeReducedStakeWithoutStakeId(
        address _user,
        uint256 _amount
    ) external;

    // If getter ifPaymentCanPassInOneTx returns true then noticeReducedStakeWithoutStakeId is called

    function provideInfoForWithdrawWithoutStakeId(
        address _user,
        uint256 _amount
    )  external view returns(uint256[] memory, uint256[] memory);

    // If getter ifPaymentCanPassInOneTx returns false then provideInfoForWithdrawWithoutStakeId is called
    // provideInfoForWithdrawWithoutStakeId is returning array of stakes and stakes amount that should be
    // taken from each stake

    function noticeReducedStake(
        address _user,
        uint256 _amount,
        uint256 stakeId
    ) external;

    // And then you have all the info for which stakes and for what amount to call multiple times noticeReducedStake

    function withdrawRewards(
        address _user
    ) external;

    // To withdraw rewards user can call it directly on the contract but also contract admin can do it
}
PreviousParametersNextDeposit

Last updated 2 years ago

Was this helpful?