all files / contracts/interfaces/ IStaking.sol

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98                                                                                                                                                                                                   
// SPDX-License-Identifier: MIT
 
pragma solidity >=0.6.2;
 
import '../libs/Stakes.sol';
 
interface IStaking {
    /**
     * @dev Possible states an allocation can be
     * States:
     * - Null = Staker == address(0)
     * - Pending = not Null && tokens > 0 && escrowAddress status == Pending
     * - Active = Pending && escrowAddress status == Launched
     * - Closed = Active && closedAt != 0
     * - Completed = Closed && closedAt && escrowAddress status == Complete
     */
    enum AllocationState {
        Null,
        Pending,
        Active,
        Closed,
        Completed
    }
 
    /**
     * @dev Possible sort fields
     * Fields:
     * - None = Do not sort
     * - Stake = Sort by stake amount
     */
    enum SortField {
        None,
        Stake
    }
 
    /**
     * @dev Allocate THXC tokens for the purpose of serving queries of a subgraph deployment
     * An allocation is created in the allocate() function and consumed in claim()
     */
    struct Allocation {
        address escrowAddress;
        address staker;
        uint256 tokens; // Tokens allocated to a escrowAddress
        uint256 createdAt; // Time when allocation was created
        uint256 closedAt; // Time when allocation was closed
    }
 
    function rewardPool() external view returns (address);
 
    function setMinimumStake(uint256 _minimumStake) external;
 
    function setLockPeriod(uint32 _lockPeriod) external;
 
    function setRewardPool(address _rewardPool) external;
 
    function isAllocation(address _escrowAddress) external view returns (bool);
 
    function hasStake(address _indexer) external view returns (bool);
 
    function hasAvailableStake(address _indexer) external view returns (bool);
 
    function getAllocation(
        address _escrowAddress
    ) external view returns (Allocation memory);
 
    function getAllocationState(
        address _escrowAddress
    ) external view returns (AllocationState);
 
    function getStakedTokens(address _staker) external view returns (uint256);
 
    function getStaker(
        address _staker
    ) external view returns (Stakes.Staker memory);
 
    function stake(uint256 _tokens) external;
 
    function unstake(uint256 _tokens) external;
 
    function withdraw() external;
 
    function slash(
        address _slasher,
        address _staker,
        address _escrowAddress,
        uint256 _tokens
    ) external;
 
    function allocate(address escrowAddress, uint256 _tokens) external;
 
    function closeAllocation(address _escrowAddress) external;
 
    function getListOfStakers()
        external
        view
        returns (address[] memory, Stakes.Staker[] memory);
}