Skip to main content

RewardSplitter

Git Source ↗

Inherits: IRewardSplitter, Initializable ↗, Multicall →

The RewardSplitter can be used to split the rewards of the fee recipient of the Vault based on configured shares.

Structs

ShareHolder

Structure for storing information about share holder

struct ShareHolder {
uint128 shares;
uint128 rewardPerShare;
}

Properties

NameTypeDescription
sharesuint128The amount of shares the account has
rewardPerShareuint128The last synced reward per share

Events

ClaimerUpdated

Event emitted when the claim on behalf flag is updated

event ClaimerUpdated(address indexed caller, address indexed claimer);

Parameters

NameTypeDescription
calleraddressThe address of the account that called the function
claimeraddressThe address of the claimer that can claim rewards on behalf of shareholders

SharesIncreased

Event emitted when the number of shares is increased for an account

event SharesIncreased(address indexed account, uint256 amount);

Parameters

NameTypeDescription
accountaddressThe address of the account for which the shares were increased
amountuint256The amount of shares that were added

SharesDecreased

Event emitted when the number of shares is decreased for an account

event SharesDecreased(address indexed account, uint256 amount);

Parameters

NameTypeDescription
accountaddressThe address of the account for which the shares were decreased
amountuint256The amount of shares that were deducted

RewardsSynced

Event emitted when the rewards are synced from the vault.

event RewardsSynced(uint256 totalRewards, uint256 rewardPerShare);

Parameters

NameTypeDescription
totalRewardsuint256The new total amount of rewards
rewardPerShareuint256The new reward per share

RewardsWithdrawn

Event emitted when the rewards are withdrawn from the splitter

event RewardsWithdrawn(address indexed account, uint256 amount);

Parameters

NameTypeDescription
accountaddressThe address of the account for which the rewards were withdrawn
amountuint256The amount of rewards that were withdrawn

ExitQueueEnteredOnBehalf

Event emitted when the rewards are claimed on behalf

event ExitQueueEnteredOnBehalf(address indexed onBehalf, uint256 positionTicket, uint256 amount);

Parameters

NameTypeDescription
onBehalfaddressThe address of the account on behalf of which the rewards were claimed
positionTicketuint256The position ticket in the exit queue
amountuint256The amount of rewards that were claimed

ExitedAssetsClaimedOnBehalf

Event emitted when the exited assets are claimed on behalf

event ExitedAssetsClaimedOnBehalf(address indexed onBehalf, uint256 positionTicket, uint256 amount);

Parameters

NameTypeDescription
onBehalfaddressThe address of the account on behalf of which the assets were claimed
positionTicketuint256The position ticket in the exit queue
amountuint256The amount of assets that were claimed

Errors

NotHarvested

error NotHarvested();

InvalidAccount

error InvalidAccount();

InvalidAmount

error InvalidAmount();

Functions

onlyVaultAdmin

Modifier to check if the caller is the vault admin

modifier onlyVaultAdmin() ;

setClaimer

Sets the claimer address that can claim rewards on behalf of shareholders.

function setClaimer(address _claimer) external onlyVaultAdmin;

Parameters

NameTypeDescription
_claimeraddressThe address of the claimer Can only be called by the vault admin.

totalRewards

The total amount of unclaimed rewards in the splitter

function totalRewards() external view override returns (uint128);

Returns

NameTypeDescription
<none>uint128The total amount of rewards

sharesOf

Retrieves the amount of splitter shares for the given account. The shares are used to calculate the amount of rewards the account is entitled to.

function sharesOf(address account) external view override returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address of the account to get shares for

rewardsOf

Retrieves the amount of rewards the account is entitled to. The rewards are calculated based on the amount of shares the account has. Note, rewards must be synced using the syncRewards function.

function rewardsOf(address account) public view override returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address of the account to get rewards for

canSyncRewards

Checks whether new rewards can be synced from the vault.

function canSyncRewards() external view override returns (bool);

Returns

NameTypeDescription
<none>boolTrue if new rewards can be synced, false otherwise

increaseShares

Increases the amount of shares for the given account. Can only be called by the owner.

function increaseShares(address account, uint128 amount) external override onlyVaultAdmin;

Parameters

NameTypeDescription
accountaddressThe address of the account to increase shares for
amountuint128The amount of shares to add

decreaseShares

Decreases the amount of shares for the given account. Can only be called by the owner.

function decreaseShares(address account, uint128 amount) external override onlyVaultAdmin;

Parameters

NameTypeDescription
accountaddressThe address of the account to decrease shares for
amountuint128The amount of shares to deduct

updateVaultState

Updates the vault state. Can be used in multicall to update state, sync rewards and withdraw them.

function updateVaultState(IKeeperRewards.HarvestParams calldata harvestParams) external override;

Parameters

NameTypeDescription
harvestParamsIKeeperRewards.HarvestParamsThe harvest params to use for updating the vault state

claimVaultTokens

Transfers the vault tokens to the given account. Can only be called for the vault with ERC-20 token.

function claimVaultTokens(uint256 rewards, address receiver) external override;

Parameters

NameTypeDescription
rewardsuint256The amount of vault tokens to transfer
receiveraddressThe address of the account to transfer tokens to

enterExitQueue

Sends the rewards to the exit queue

function enterExitQueue(uint256 rewards, address receiver) external override returns (uint256 positionTicket);

Parameters

NameTypeDescription
rewardsuint256The amount of rewards to send to the exit queue
receiveraddressThe address that will claim exited assets

Returns

NameTypeDescription
positionTicketuint256The position ticket of the exit queue

enterExitQueueOnBehalf

Enters the exit queue on behalf of the shareholder. Can only be called if claim on behalf is enabled.

function enterExitQueueOnBehalf(uint256 rewards, address onBehalf)
external
override
returns (uint256 positionTicket);

Parameters

NameTypeDescription
rewardsuint256The amount of rewards to send to the exit queue
onBehalfaddressThe address of the account on behalf of which the rewards are sent to the exit queue

Returns

NameTypeDescription
positionTicketuint256The position ticket of the exit queue

claimExitedAssetsOnBehalf

Claims the exited assets from the vault.

function claimExitedAssetsOnBehalf(uint256 positionTicket, uint256 timestamp, uint256 exitQueueIndex)
external
override;

Parameters

NameTypeDescription
positionTicketuint256The position ticket in the exit queue
timestampuint256The timestamp when the shares entered the exit queue
exitQueueIndexuint256The exit queue index of the exit request

syncRewards

Syncs the rewards from the vault to the splitter. The vault state must be up-to-date.

function syncRewards() public override;