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
Name | Type | Visibility |
---|---|---|
REPORTER_ROLE | bytes32 | Public |
_accountant | BlockAccountantLib.Storage | Private |
Modifiers
onlyRole
onlyRole
Restricts the execution of a function to only accounts that have a specific role assigned.
Functions
constructor
constructor
Initializes the BlockAccountant contract with the provided parameters.
Parameters
Parameter | Type | Description |
---|---|---|
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
setStablecoin
Sets the address of the stablecoin contract.
Parameters
Parameter | Type | Description |
---|---|---|
stablecoin | address | The address of the stablecoin contract. |
setEngine
setEngine
Sets the address of the engine contract.
Parameters
Parameter | Type | Description |
---|---|---|
engine | address | The address of the engine contract. |
setMembership
setMembership
Sets the address of the membership contract.
Parameters
Parameter | Type | Description |
---|---|---|
membership | address | The address of the membership contract. |
setTreasury
setTreasury
Sets the address of the treasury contract.
Parameters
Parameter | Type | Description |
---|---|---|
treasury | address | The address of the treasury contract. |
setReferenceCurrency
setReferenceCurrency
Sets the address of the reference currency (stablecoin) contract.
Parameters
Parameter | Type | Description |
---|---|---|
stablecoin | address | The address of the stablecoin contract. |
setSPB
setSPB
Sets the seconds per block.
Parameters
Parameter | Type | Description |
---|---|---|
spb_ | uint32 | The number of blocks per era. |
migrate
migrate
Migrates membership points from one era and UID to another.
Parameters
Parameter | Type | Description |
---|---|---|
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
report
Reports membership points for a member to update.
Parameters
Parameter | Type | Description |
---|---|---|
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
subtractMP
Subtracts membership points from a specific era and UID.
Parameters
Parameter | Type | Description |
---|---|---|
uid | uint32 | The UID of the member. |
nthEra | uint32 | The era to subtract points from. |
point | uint64 | The number of points to subtract. |
getTotalPoints
getTotalPoints
Returns the total membership points for a specific era.
Parameters
Parameter | Type | Description |
---|---|---|
nthEra | uint32 | The era to get the total points for. |
fb
fb
Returns the block number at which the BlockAccountant contract was created.
getCurrentEra
getCurrentEra
Returns the current era number.
getTotalTokens
getTotalTokens
Returns the total tokens for a specific era and token address.
Parameters
Parameter | Type | Description |
---|---|---|
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
pointOf
Returns the membership points for a specific era and UID.
Parameters
Parameter | Type | Description |
---|---|---|
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
getBfs
Returns the block finalization second.
Last updated