IDualMining

Git Source

Functions

init

Initialize dual mining. Can only be called by VAULT_MINING contract

function init(UD60x18 initialParentAccRewardsPerShare) external;

addRewards

Add rewards to the contract

function addRewards(UD60x18 amount) external;

getRewardsAvailable

Return amount of rewards not yet allocated

function getRewardsAvailable() external view returns (UD60x18);

updatePool

Trigger an update for this mining pool. Can only be called by VAULT_MINING contract

function updatePool(UD60x18 poolRewards, UD60x18 accRewardsPerShare) external;

updateUser

Trigger an update for a specific user. Can only be called by VAULT_MINING contract

function updateUser(
    address user,
    UD60x18 oldShares,
    UD60x18 oldRewardDebt,
    UD60x18 poolRewards,
    UD60x18 userRewards,
    UD60x18 accRewardsPerShare
) external;

claim

Claim rewards. Can only be called by VAULT_MINING contract

The claim is done through VAULT_MINING, as we need to trigger updates through VAULT_MINING before being able to claim the rewards anyway.

function claim(address user) external;

Parameters

NameTypeDescription
useraddressThe user for which to claim

getPendingUserRewards

Return amount of pending rewards (not yet claimed) for the given user

function getPendingUserRewards(address user) external view returns (UD60x18);

getUserInfo

Return internal variables for the given user

function getUserInfo(address user) external view returns (UserInfo memory);

Events

Initialized

event Initialized(address indexed caller, UD60x18 initialParentAccRewardsPerShare, uint256 timestamp);

Claim

event Claim(address indexed user, UD60x18 rewardAmount);

MiningEnded

event MiningEnded(UD60x18 finalParentAccRewardsPerShare);

Errors

DualMining__AlreadyInitialized

error DualMining__AlreadyInitialized();

DualMining__NoMiningRewards

error DualMining__NoMiningRewards();

DualMining__NoShareSupply

error DualMining__NoShareSupply();

DualMining__NotAuthorized

error DualMining__NotAuthorized(address caller);

DualMining__NotInitialized

error DualMining__NotInitialized();

DualMining__MiningEnded

error DualMining__MiningEnded();

Structs

UserInfo

struct UserInfo {
    uint256 lastUpdateTimestamp;
    UD60x18 lastParentAccTotalRewards;
    UD60x18 lastAccTotalRewards;
    UD60x18 reward;
}