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)

A struct that represents a member of the membership system.

Fields

NameTypeDescription

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)

A struct that represents the subscription status of a member.

Fields

NameTypeDescription

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)

A struct that represents a membership meta.

Fields

NameTypeDescription

metaId

uint16

The ID of the meta.

quota

uint32

The quota of the meta.

Fees (struct)

A struct that represents the fees for a membership meta and fee token.

Fields

NameTypeDescription

feeToken

address

The address of the fee token.

regFee

uint256

The registration fee.

subFee

uint256

The subscription fee.

Functions

_setMembership

Sets the membership details for a specific meta.

Parameters

ParameterTypeDescription

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

Sets the quota for a specific meta.

Parameters

ParameterTypeDescription

self

Member

The Member struct.

metaId_

uint16

The ID of the meta.

quota_

uint32

The quota for the meta.

_setFees

Sets the fees for a specific meta and fee token.

Parameters

ParameterTypeDescription

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

Registers a member for a specific meta using a fee token.

Parameters

ParameterTypeDescription

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

Subscribes a member to a specific meta for a certain number of blocks using a fee token.

Parameters

ParameterTypeDescription

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

Unsubscribes a member from a specific meta.

Parameters

ParameterTypeDescription

self

Member

The Member struct.

uid_

uint32

The UID of the member.

_offerBonus

Offers bonus blocks to a member's subscription.

Parameters

ParameterTypeDescription

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

Returns the balance of a specific member.

Parameters

ParameterTypeDescription

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

Checks if a member with the given UID is subscribed.

Parameters

ParameterTypeDescription

self

Member

The Member struct.

uid_

uint32

The UID of the member.

Returns true if the member is subscribed, otherwise false.

Last updated