Distributor
This contract manages the distribution of coupon shares to users based on their bond token balances.
State Variables
GOV_ROLE
Role identifier for accounts with governance privileges
pool
Pool address
couponAmountToDistribute
Coupon token total amount to be distributed
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
initialize
Initializes the contract with the governance address and sets up roles. This function is called once during deployment or upgrading to initialize state variables.
Parameters
claim
Allows a user to claim their shares from a specific pool. Calculates the number of shares based on the user's bond token balance and the shares per token. Transfers the calculated shares to the user's address.
allocate
Allocates shares to a pool.
Parameters
grantRole
*Grants role
to account
. If account
had not been already granted role
, emits a {RoleGranted} event. Requirements:
the caller must have
role
's admin role.*
Parameters
revokeRole
*Revokes role
from account
. If account
had been granted role
, emits a {RoleRevoked} event. Requirements:
the caller must have
role
's admin role.*
Parameters
pause
*Pauses all contract functions except for upgrades. Requirements:
the caller must have the
GOV_ROLE
.*
unpause
*Unpauses all contract functions. Requirements:
the caller must have the
GOV_ROLE
.*
Events
ClaimedShares
Event emitted when a user claims their shares
PoolRegistered
Event emitted when a new pool is registered
Errors
NotEnoughSharesBalance
Error thrown when there are not enough shares in the contract's balance
UnsupportedPool
Error thrown when an unsupported pool is accessed
NotEnoughSharesToDistribute
Error thrown when there are not enough shares allocated to distribute
NotEnoughCouponBalance
Error thrown when there are not enough coupon tokens in the contract's balance
PoolAlreadyRegistered
Error thrown when attempting to register an already registered pool
InvalidPoolAddress
Error thrown when the pool has an invalid address
CallerIsNotPool
error thrown when the caller is not the pool
Last updated