MembershipLib
This Solidity library is called MembershipLib, which contains various functions for managing membership-related operations. Let's break down the variables, events, functions, and internal functions present in this library:
Variables
Member (struct)
Member (struct)
A struct that represents a member of the membership system.
Fields
Name | Type | Description |
---|---|---|
subscriptions | mapping | Mapping of member ID to subscription status. |
metas | mapping | Mapping of meta ID to register fee status. |
fees | mapping | Mapping of meta ID to mapping of fee token to fees. |
sabt | address | Address of the SABT contract. |
foundation | address | Address of the foundation contract. |
SubStatus (struct)
SubStatus (struct)
A struct that represents the subscription status of a member.
Fields
Name | Type | Description |
---|---|---|
at | uint256 | Block number when the subscription started. |
until | uint256 | Block number when the subscription expires. |
bonus | uint256 | Bonus blocks added to the subscription. |
with | address | Address of the token used for the subscription. |
Meta (struct)
Meta (struct)
A struct that represents a membership meta.
Fields
Name | Type | Description |
---|---|---|
metaId | uint16 | The ID of the meta. |
quota | uint32 | The quota of the meta. |
Fees (struct)
Fees (struct)
A struct that represents the fees for a membership meta and fee token.
Fields
Name | Type | Description |
---|---|---|
feeToken | address | The address of the fee token. |
regFee | uint256 | The registration fee. |
subFee | uint256 | The subscription fee. |
Functions
_setMembership
_setMembership
Sets the membership details for a specific meta.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
metaId_ | uint16 | The ID of the meta. |
feeToken_ | address | The address of the fee token. |
regFee_ | uint32 | The registration fee. |
subFee_ | uint32 | The subscription fee. |
quota_ | uint32 | The quota for the meta. |
_setQuota
_setQuota
Sets the quota for a specific meta.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
metaId_ | uint16 | The ID of the meta. |
quota_ | uint32 | The quota for the meta. |
_setFees
_setFees
Sets the fees for a specific meta and fee token.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
metaId_ | uint16 | The ID of the meta. |
feeToken_ | address | The address of the fee token. |
regFee_ | uint256 | The registration fee. |
subFee_ | uint256 | The subscription fee. |
_register
_register
Registers a member for a specific meta using a fee token.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
metaId_ | uint16 | The ID of the meta. |
feeToken_ | address | The address of the fee token. |
Returns the UID of the registered member.
_subscribe
_subscribe
Subscribes a member to a specific meta for a certain number of blocks using a fee token.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
uid_ | uint32 | The UID of the member. |
blocks_ | uint64 | The number of blocks to subscribe. |
feeToken_ | address | The address of the fee token. |
_unsubscribe
_unsubscribe
Unsubscribes a member from a specific meta.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
uid_ | uint32 | The UID of the member. |
_offerBonus
_offerBonus
Offers bonus blocks to a member's subscription.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
uid_ | uint32 | The UID of the member. |
holder_ | address | The address of the member. |
blocks_ | uint256 | The number of bonus blocks to offer. |
_balanceOf
_balanceOf
Returns the balance of a specific member.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
owner_ | address | The address of the member. |
uid_ | uint32 | The UID of the member. |
Returns the balance of the member.
_isSubscribed
_isSubscribed
Checks if a member with the given UID is subscribed.
Parameters
Parameter | Type | Description |
---|---|---|
self | Member | The Member struct. |
uid_ | uint32 | The UID of the member. |
Returns true
if the member is subscribed, otherwise false
.
Last updated