ClaimPlugin

Git Source

Inherits: UUPSUpgradeable, OwnableUpgradeable, ERC165Upgradeable, Claimable

Author: Mure Implements UUPSUpgradeable for upgradeability, OwnableUpgradeable for access control, ERC165Upgradeable for interface support, and Claimable interface for compatibility checks. Facilitates the calculation and execution of reward claims, allowing depositors to receive their entitled rewards along with their shares from the total collected pool funds.

Contract managing reward distribution to users of an application.

Functions

initialize

function initialize(address owner) external initializer;

claim

Sends reward funds from the delegate to depositor.

function claim(ClaimRecord calldata claimRecord) external returns (uint256 depositDelta, uint256 claimDelta);

Parameters

NameTypeDescription
claimRecordClaimRecordstruct containing all information needed to compute and execute a claimRecord. See Claimable.ClaimRecord for more information

deltas

Returns the refund amount, claim amount and fee.

function deltas(ClaimRecord calldata claimRecord)
    public
    pure
    returns (uint256 depositDelta, uint256 claimDelta, uint256 fee);

Parameters

NameTypeDescription
claimRecordClaimRecordstruct containing all information needed to compute and execute a claimRecord. See Claimable.ClaimRecord for more information

Returns

NameTypeDescription
depositDeltauint256amount from the original deposit to be refunded
claimDeltauint256amount from the claim reserves to be claimed
feeuint256fee to be charged from claimDelta

_calculateShare

Calculates the user share amount.

function _calculateShare(uint256 share, uint256 supply, uint256 reserve) private pure returns (uint256);

Parameters

NameTypeDescription
shareuint256share of the user
supplyuint256total supply
reserveuint256current reserve

calculateFee

Calculates the fee to be charged.

function calculateFee(uint256 amount, uint256 feePercentage) private pure returns (uint256);

Parameters

NameTypeDescription
amountuint256total amount
feePercentageuint256fee percentage in basis points

supportsInterface

See IERC165-supportsInterface.

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC165Upgradeable, IERC165)
    returns (bool);

_authorizeUpgrade

required by the OZ UUPS module

function _authorizeUpgrade(address) internal override onlyOwner;