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
}

Last updated