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

NameTypeVisibility

PROMOTER_ROLE

bytes32

Public

_membership

MembershipLib.Member

Private

Modifiers

onlyRole

Restricts the execution of a function to only accounts that have a specific role assigned.

Functions

constructor

Initializes the Membership contract and sets the deployer as the default admin role.

initialize

Initializes the Membership contract with the provided SABT and foundation contract addresses.

Parameters

ParameterTypeDescription

sabt_

address

The address of the SABT contract.

foundation_

address

The address of the foundation contract.

setMembership

Sets fees for registration and subscription and token address.

Parameters

ParameterTypeDescription

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

Sets the address of the foundation contract.

Parameters

ParameterTypeDescription

foundation_

address

The address of the foundation contract.

setQuota

Sets the quota for a specific meta ID.

Parameters

ParameterTypeDescription

metaId_

uint16

The meta ID of the token.

quota_

uint32

The new quota value.

setFees

Sets the fees for a specific meta ID.

Parameters

ParameterTypeDescription

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

Registers as a member.

Parameters

ParameterTypeDescription

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

Subscribes to the membership until a certain block height.

Parameters

ParameterTypeDescription

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

Offers a bonus to a specific ABT holder.

Parameters

ParameterTypeDescription

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

Unsubscribes from the membership.

Parameters

ParameterTypeDescription

uid_

uint32

The UID of the ABT to unsubscribe with.

balanceOf

Returns the balance of a specific member for an ABT.

Parameters

ParameterTypeDescription

who

address

The address of the member.

uid_

uint32

The UID of the ABT.

Returns the balance of the member for the ABT.

getMeta

Returns the meta information of a specific meta ID.

Parameters

ParameterTypeDescription

metaId_

uint16

The meta ID of the token.

Returns the meta information of the token.

isSubscribed

Checks if a specific ABT is subscribed.

Parameters

ParameterTypeDescription

uid_

uint32

The UID of the ABT.

Returns true if the ABT is subscribed; otherwise, false.

isReportable

Checks if a specific ABT is reportable.

Parameters

ParameterTypeDescription

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