BlockAccountant

This Solidity smart contract is a standard Membership Accountant contract that tracks and reports membership points. Let's break down the variables, events, functions, and internal functions present in this contract:

State Variables

NameTypeVisibility

REPORTER_ROLE

bytes32

Public

_accountant

BlockAccountantLib.Storage

Private

Modifiers

onlyRole

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

Functions

constructor

Initializes the BlockAccountant contract with the provided parameters.

Parameters

ParameterTypeDescription

membership

address

The address of the membership contract.

engine

address

The address of the engine contract.

stablecoin

address

The address of the stablecoin contract.

spb_

uint32

The number of blocks per era.

setStablecoin

Sets the address of the stablecoin contract.

Parameters

ParameterTypeDescription

stablecoin

address

The address of the stablecoin contract.

setEngine

Sets the address of the engine contract.

Parameters

ParameterTypeDescription

engine

address

The address of the engine contract.

setMembership

Sets the address of the membership contract.

Parameters

ParameterTypeDescription

membership

address

The address of the membership contract.

setTreasury

Sets the address of the treasury contract.

Parameters

ParameterTypeDescription

treasury

address

The address of the treasury contract.

setReferenceCurrency

Sets the address of the reference currency (stablecoin) contract.

Parameters

ParameterTypeDescription

stablecoin

address

The address of the stablecoin contract.

setSPB

Sets the seconds per block.

Parameters

ParameterTypeDescription

spb_

uint32

The number of blocks per era.

migrate

Migrates membership points from one era and UID to another.

Parameters

ParameterTypeDescription

fromUid_

uint32

The UID to migrate from.

toUid_

uint32

The UID to migrate to.

nthEra_

uint32

The era to migrate.

amount_

uint256

The amount of points to migrate.

report

Reports membership points for a member to update.

Parameters

ParameterTypeDescription

uid

uint32

The member UID.

token

address

The token address.

amount

uint256

The amount of membership points.

isAdd

bool

Flag to indicate whether to add or subtract points.

subtractMP

Subtracts membership points from a specific era and UID.

Parameters

ParameterTypeDescription

uid

uint32

The UID of the member.

nthEra

uint32

The era to subtract points from.

point

uint64

The number of points to subtract.

getTotalPoints

Returns the total membership points for a specific era.

Parameters

ParameterTypeDescription

nthEra

uint32

The era to get the total points for.

fb

Returns the block number at which the BlockAccountant contract was created.

getCurrentEra

Returns the current era number.

getTotalTokens

Returns the total tokens for a specific era and token address.

Parameters

ParameterTypeDescription

nthEra

uint32

The era to get the total tokens for.

token

address

The token address.

Returns the total tokens for the era and token.

pointOf

Returns the membership points for a specific era and UID.

Parameters

ParameterTypeDescription

uid

uint32

The UID of the member.

nthEra

uint32

The era to get the membership points from.

Returns the membership points for the era and UID.

getBfs

Returns the block finalization second.

Last updated