BlockAccountantLib

This Solidity smart contract is a library called BlockAccountantLib, which provides functions for reporting membership points and managing accounting related operations. Let's break down the variables, events, functions, and internal functions present in this library:

Functions

convert

Returns the converted amount of the base token to the quote token.

Parameters

ParameterTypeDescription

base

address

The address of the base token.

quote

address

The address of the quote token.

amount

uint256

The amount of the base token to convert.

isBid

bool

Flag indicating the direction of conversion.

Returns the converted amount.

isSubscribed

Checks if a member with the given UID is subscribed.

Parameters

ParameterTypeDescription

uid_

uint32

The UID of the member.

Returns true if the member is subscribed, otherwise false.

decimals()

Returns the number of decimals of the token.

Returns the number of decimals.

balanceOf

Returns the balance of a specific owner for a given ID.

Parameters

ParameterTypeDescription

owner

address

The address of the owner.

id

uint256

The ID of the balance.

Returns the balance of the owner.

subtractMP

Subtracts the membership point from a specific account.

Parameters

ParameterTypeDescription

account

address

The address of the account.

nthEra

uint256

The era of the membership point.

amount

uint256

The amount of the membership point to subtract.

_setTotalTokens

Sets the total tokens for a specific token and era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

token

address

The address of the token.

era

uint32

The era of the tokens.

amount

uint256

The amount of the tokens.

isAdd

bool

Flag indicating if the tokens should be added.

_totalTokens

Returns the total tokens for a specific token and era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

token

address

The address of the token.

era

uint32

The era of the tokens.

Returns the total tokens.

_getEra

Returns the current era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

Returns the current era.

_report

Reports the membership point of a member.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

uid

uint32

The UID of the member.

token

address

The token address.

amount

uint256

The amount of the membership point.

isAdd

bool

Flag indicating if the point should be added.

_migrate

Migrates the membership point from one UID to another UID in a specific era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

sender

address

The address of the sender.

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 the point to migrate.

_isSubscribed

Checks if a member with the given UID is subscribed.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

uid

uint32

The UID of the member.

Returns true if the member is subscribed, otherwise false.

_subtractMP

Subtracts the membership point from a specific UID in a specific era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

uid

uint32

The UID of the member.

nthEra

uint32

The era of the membership point.

point

uint64

The amount of the membership point to subtract.

_totalPoints

Returns the total points in a specific era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

nthEra

uint32

The era of the membership point.

Returns the total points.

_getMP

Returns the membership point for a specific UID in a specific era.

Parameters

ParameterTypeDescription

self

Storage

The storage of the BlockAccountantLib.

uid

uint32

The UID of the member.

nthEra

uint32

The era of the membership point.

Returns the membership points.

Last updated