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
convert
Returns the converted amount of the base token to the quote token.
Parameters
Parameter | Type | Description |
---|---|---|
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
isSubscribed
Checks if a member with the given UID is subscribed.
Parameters
Parameter | Type | Description |
---|---|---|
uid_ | uint32 | The UID of the member. |
Returns true
if the member is subscribed, otherwise false
.
decimals()
decimals()
Returns the number of decimals of the token.
Returns the number of decimals.
balanceOf
balanceOf
Returns the balance of a specific owner for a given ID.
Parameters
Parameter | Type | Description |
---|---|---|
owner | address | The address of the owner. |
id | uint256 | The ID of the balance. |
Returns the balance of the owner.
subtractMP
subtractMP
Subtracts the membership point from a specific account.
Parameters
Parameter | Type | Description |
---|---|---|
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
_setTotalTokens
Sets the total tokens for a specific token and era.
Parameters
Parameter | Type | Description |
---|---|---|
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
_totalTokens
Returns the total tokens for a specific token and era.
Parameters
Parameter | Type | Description |
---|---|---|
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
_getEra
Returns the current era.
Parameters
Parameter | Type | Description |
---|---|---|
self | Storage | The storage of the BlockAccountantLib. |
Returns the current era.
_report
_report
Reports the membership point of a member.
Parameters
Parameter | Type | Description |
---|---|---|
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
_migrate
Migrates the membership point from one UID to another UID in a specific era.
Parameters
Parameter | Type | Description |
---|---|---|
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
_isSubscribed
Checks if a member with the given UID is subscribed.
Parameters
Parameter | Type | Description |
---|---|---|
self | Storage | The storage of the BlockAccountantLib. |
uid | uint32 | The UID of the member. |
Returns true
if the member is subscribed, otherwise false
.
_subtractMP
_subtractMP
Subtracts the membership point from a specific UID in a specific era.
Parameters
Parameter | Type | Description |
---|---|---|
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
_totalPoints
Returns the total points in a specific era.
Parameters
Parameter | Type | Description |
---|---|---|
self | Storage | The storage of the BlockAccountantLib. |
nthEra | uint32 | The era of the membership point. |
Returns the total points.
_getMP
_getMP
Returns the membership point for a specific UID in a specific era.
Parameters
Parameter | Type | Description |
---|---|---|
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