TreasuryLib
This Solidity library is called TreasuryLib, which contains various functions related to the treasury management. Let's break down the variables, events, functions, and internal functions present in this library:
Variables
Storage (struct)
Storage (struct)
A struct that holds the storage data for the Treasury library.
Fields
accountant
address
The address of the accountant contract.
sabt
address
The address of the SABT contract.
claims
mapping
Mapping of UID to the number of claims.
totalClaim
uint32
The total number of claims.
settlementId
uint32
The ID of the settlement.
Constants
USER_META_ID
USER_META_ID
The ID of the meta representing a user.
INVESTOR_META_ID
INVESTOR_META_ID
The ID of the meta representing an investor.
FOUNDATION_META_ID
FOUNDATION_META_ID
The ID of the meta representing a foundation.
DENOM
DENOM
The denominator used for calculations.
Errors
MembershipNotOwned
MembershipNotOwned
An error that indicates the membership is not owned by the sender.
InvalidMetaId
InvalidMetaId
An error that indicates an invalid meta ID for a given UID.
EraNotPassed
EraNotPassed
An error that indicates the era has not yet passed.
NoTotalMP
NoTotalMP
An error that indicates there is no total membership point for the era.
NoTotalTokens
NoTotalTokens
An error that indicates there are no total tokens for the era.
ShareLimitExceeded
ShareLimitExceeded
An error that indicates the share limit for claims has been exceeded.
Functions
_checkMembership
_checkMembership
Checks if the sender owns the membership with the given UID and meta ID.
Parameters
self
Storage
The Storage struct.
uid_
uint32
The UID of the membership.
metaId_
uint16
The ID of the meta.
_checkEraPassed
_checkEraPassed
Checks if the given era has already passed.
Parameters
self
Storage
The Storage struct.
nthEra_
uint32
The nth era to check.
_exchange
_exchange
Exchanges membership points for rewards.
Parameters
self
Storage
The Storage struct.
token
address
The address of the token to receive as reward.
nthEra
uint32
The nth era of the points to exchange.
uid
uint32
The UID of the member.
point
uint64
The amount of membership points to exchange.
_claim
_claim
Claims rewards for a given era and member.
Parameters
self
Storage
The Storage struct.
token
address
The address of the token to claim.
nthEra
uint32
The nth era of the rewards to claim.
uid
uint32
The UID of the member.
_settle
_settle
Settles the rewards for a given era and member.
Parameters
self
Storage
The Storage struct.
token
address
The address of the token to settle.
nthEra
uint32
The nth era of the rewards to settle.
uid
uint32
The UID of the member.
_setClaim
_setClaim
Sets the number of claims for a given UID.
Parameters
self
Storage
The Storage struct.
uid
uint32
The UID of the member.
num
uint32
The number of claims.
_setSettlement
_setSettlement
Sets the ID of the settlement.
Parameters
self
Storage
The Storage struct.
uid
uint32
The ID of the settlement.
_getReward
_getReward
Calculates the reward amount for a given token, era, and membership point.
Parameters
self
Storage
The Storage struct.
token
address
The address of the reward token.
nthEra
uint32
The nth era of the membership point.
point
uint256
The amount of membership points.
Returns the calculated reward amount.
_getClaim
_getClaim
Calculates the claim amount for a given token, era, and member.
Parameters
self
Storage
The Storage struct.
token
address
The address of the reward token.
uid
uint32
The UID of the member.
nthEra
uint32
The nth era of the claim.
Returns the calculated claim amount.
_getSettlement
_getSettlement
Calculates the settlement amount for a given token and era.
Parameters
self
Storage
The Storage struct.
token
address
The address of the reward token.
nthEra
uint32
The nth era of the settlement.
Returns the calculated settlement amount.
Last updated