IVaultMining

Git Source

Functions

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);

getPendingVaultRewards

Return amount of pending rewards (not yet allocated) for a specific vault

function getPendingVaultRewards(address vault) external view returns (UD60x18);

getUserRewards

Return the amount of user rewards already allocated and available to claim. This only account for l.userRewards[user] and does NOT include pending reward updates.

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

getPendingUserRewardsFromVault

Return amount of pending rewards (not yet claimed) for a user for a vault This DOES NOT account for l.userRewards[user] and only account for pending rewards of given vault

function getPendingUserRewardsFromVault(address user, address vault) external view returns (UD60x18);

getTotalUserRewards

Return amount of total rewards (not yet claimed) for a user. This accounts for l.userRewards[user] and pending rewards of all vaults

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

getTotalVotes

Return the total amount of votes across all vaults (Used to calculate share of rewards allocation for each vault)

function getTotalVotes() external view returns (UD60x18);

getVaultInfo

Return internal variables for a vault

function getVaultInfo(address vault) external view returns (VaultInfo memory);

getUserInfo

Return internal variables for a user, on a specific vault

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

getRewardsPerYear

Get the amount of rewards emitted per year

function getRewardsPerYear() external view returns (UD60x18);

getVoteMultiplier

Get the vote multiplier for a given vault

function getVoteMultiplier(address vault) external view returns (UD60x18);

getDualMiningPools

Return list of dual mining pools for a given vault

function getDualMiningPools(address vault) external view returns (address[] memory);

previewOptionParams

OptionReward.previewOptionParams wrapper, returns the params for the option reward token. Note that the on-chain price is constantly updating, therefore, the strike price returned may not be the same as the strike price at the time of underwriting.

function previewOptionParams() external view returns (UD60x18 strike, uint64 maturity);

Returns

NameTypeDescription
strikeUD60x18the option strike price (18 decimals)
maturityuint64the option maturity timestamp

claim

Allocate pending rewards for a list of vaults, and claim given amount of rewards.

function claim(address[] calldata vaults, UD60x18 amount) external;

Parameters

NameTypeDescription
vaultsaddress[]The vaults for which to trigger allocation of pending rewards
amountUD60x18The amount of rewards to claim.

claimAll

Allocate pending rewards for a list of vaults, and claim max amount of rewards possible.

function claimAll(address[] calldata vaults) external;

updateUser

Trigger an update for a user on a specific vault This needs to be called by the vault, anytime the user's shares change Can only be called by a vault registered on the VaultRegistry

function updateUser(address user, UD60x18 newUserShares, UD60x18 newTotalShares, UD60x18 utilisationRate) external;

Parameters

NameTypeDescription
useraddressThe user to update
newUserSharesUD60x18The new amount of shares for the user
newTotalSharesUD60x18The new amount of total shares for the vault
utilisationRateUD60x18DEPRECATED: This function no longer uses the utilisationRate which has been left blank in case it is used again.

updateVault

Trigger an update for a vault

function updateVault(address vault) external;

updateVaults

Trigger an update for all vaults

function updateVaults() external;

updateUser

Trigger an update for a user on a specific vault

function updateUser(address user, address vault) external;

Events

AllocateRewards

event AllocateRewards(address indexed user, address indexed vault, UD60x18 rewardAmount);

Claim

event Claim(address indexed user, UD60x18 rewardAmount);

UpdateVaultVotes

event UpdateVaultVotes(address indexed vault, UD60x18 votes, UD60x18 voteMultiplier);

SetRewardsPerYear

event SetRewardsPerYear(UD60x18 rewardsPerYear);

SetVoteMultiplier

event SetVoteMultiplier(address indexed vault, UD60x18 voteMultiplier);

AddDualMiningPool

event AddDualMiningPool(address indexed vault, address dualMiningPool);

RemoveDualMiningPool

event RemoveDualMiningPool(address indexed vault, address dualMiningPool);

Errors

VaultMining__NotVault

error VaultMining__NotVault(address caller);

VaultMining__InsufficientRewards

error VaultMining__InsufficientRewards(address user, UD60x18 rewardsAvailable, UD60x18 rewardsRequested);

Structs

VaultInfo

struct VaultInfo {
    UD60x18 totalShares;
    UD60x18 votes;
    uint256 __deprecated_lastRewardTimestamp;
    UD60x18 accRewardsPerShare;
    UD60x18 rewardDebt;
}

UserInfo

struct UserInfo {
    UD60x18 shares;
    UD60x18 __deprecated_reward;
    UD60x18 rewardDebt;
}

VaultVotes

struct VaultVotes {
    address vault;
    UD60x18 votes;
}