Membership
This Solidity smart contract is a standard Membership registration and subscription contract. Let's break down the variables, events, functions, and internal functions present in this contract:
State Variables
Name | Type | Visibility |
---|---|---|
PROMOTER_ROLE | bytes32 | Public |
_membership | MembershipLib.Member | Private |
Modifiers
onlyRole
onlyRole
Restricts the execution of a function to only accounts that have a specific role assigned.
Functions
constructor
constructor
Initializes the Membership contract and sets the deployer as the default admin role.
initialize
initialize
Initializes the Membership contract with the provided SABT and foundation contract addresses.
Parameters
Parameter | Type | Description |
---|---|---|
sabt_ | address | The address of the SABT contract. |
foundation_ | address | The address of the foundation contract. |
setMembership
setMembership
Sets fees for registration and subscription and token address.
Parameters
Parameter | Type | Description |
---|---|---|
metaId_ | uint16 | The meta ID of the token to pay the fee. |
feeToken_ | address | The address of the token to pay the fee. |
regFee_ | uint32 | The registration fee per block in one token. |
subFee_ | uint32 | The subscription fee per block in one token. |
quotas_ | uint32 | The number of tokens to be issued for registration. |
setFoundation
setFoundation
Sets the address of the foundation contract.
Parameters
Parameter | Type | Description |
---|---|---|
foundation_ | address | The address of the foundation contract. |
setQuota
setQuota
Sets the quota for a specific meta ID.
Parameters
Parameter | Type | Description |
---|---|---|
metaId_ | uint16 | The meta ID of the token. |
quota_ | uint32 | The new quota value. |
setFees
setFees
Sets the fees for a specific meta ID.
Parameters
Parameter | Type | Description |
---|---|---|
metaId_ | uint16 | The meta ID of the token. |
feeToken_ | address | The address of the token to pay the fee. |
regFee_ | uint256 | The new registration fee. |
subFee_ | uint256 | The new subscription fee. |
register
register
Registers as a member.
Parameters
Parameter | Type | Description |
---|---|---|
metaId_ | uint16 | The meta ID of the token. |
feeToken_ | address | The address of the token to pay the fee. |
Returns the UID (unique identifier) of the registered member.
subscribe
subscribe
Subscribes to the membership until a certain block height.
Parameters
Parameter | Type | Description |
---|---|---|
uid_ | uint32 | The UID of the ABT to subscribe with. |
blocks_ | uint64 | The number of blocks to remain subscribed. |
feeToken_ | address | The address of the token to pay the fee. |
offerBonus
offerBonus
Offers a bonus to a specific ABT holder.
Parameters
Parameter | Type | Description |
---|---|---|
uid_ | uint32 | The UID of the ABT. |
holder_ | address | The address of the ABT holder. |
blocks_ | uint256 | The number of blocks for the bonus. |
unsubscribe
unsubscribe
Unsubscribes from the membership.
Parameters
Parameter | Type | Description |
---|---|---|
uid_ | uint32 | The UID of the ABT to unsubscribe with. |
balanceOf
balanceOf
Returns the balance of a specific member for an ABT.
Parameters
Parameter | Type | Description |
---|---|---|
who | address | The address of the member. |
uid_ | uint32 | The UID of the ABT. |
Returns the balance of the member for the ABT.
getMeta
getMeta
Returns the meta information of a specific meta ID.
Parameters
Parameter | Type | Description |
---|---|---|
metaId_ | uint16 | The meta ID of the token. |
Returns the meta information of the token.
isSubscribed
isSubscribed
Checks if a specific ABT is subscribed.
Parameters
Parameter | Type | Description |
---|---|---|
uid_ | uint32 | The UID of the ABT. |
Returns true if the ABT is subscribed; otherwise, false.
isReportable
isReportable
Checks if a specific ABT is reportable.
Parameters
Parameter | Type | Description |
---|---|---|
sender | address | The address of the sender. |
uid_ | uint32 | The UID of the ABT. |
Returns true if the ABT is reportable; otherwise, false.
Last updated