MockBridgedBiomapper
Inherits: IBridgedBiomapperRead, IBridgeBiomappingEvents, IMockBridgedBiomapperControl
State Variables
generationsHead
uint256 public generationsHead;
generationsTail
uint256 public generationsTail;
generationsList
mapping(uint256 => Generation) public generationsList;
generationsBridgingTxPointsHead
uint256 public generationsBridgingTxPointsHead;
generationsBridgingTxPointsTail
uint256 public generationsBridgingTxPointsTail;
generationBridgingTxPointsList
mapping(uint256 => GenerationBridgingTxPoint) public generationBridgingTxPointsList;
_biomappingsHeads
mapping(address => uint256) private _biomappingsHeads;
_biomappingsTails
mapping(address => uint256) private _biomappingsTails;
_biomappingsList
mapping(address => mapping(uint256 => Biomapping)) private _biomappingsList;
_biomappingPtrs
mapping(address => mapping(uint256 => uint256)) private _biomappingPtrs;
_biomappingBridgingTxPointsHeads
mapping(address => uint256) private _biomappingBridgingTxPointsHeads;
_biomappingBridgingTxPointsTails
mapping(address => uint256) private _biomappingBridgingTxPointsTails;
_biomappingBridgingTxPointsList
mapping(address => mapping(uint256 => BiomappingBridgingTxPoint)) private _biomappingBridgingTxPointsList;
_biomappingBridgedTxPointPtrs
mapping(address => mapping(uint256 => uint256)) private _biomappingBridgedTxPointPtrs;
testCaseNumber
uint8 public testCaseNumber;
Functions
addTestData
A quick and easy way to add test data to the mock contract, as well as an example of how to add new data.
This function can be executed up to 4 times in different blocks to add test data.
function addTestData() external;
generationsListItem
Returns the generation struct for a given generation pointer.
function generationsListItem(uint256 ptr) external view returns (Generation memory);
Parameters
Name | Type | Description |
---|---|---|
ptr | uint256 | The pointer of the requested generation. |
Returns
Name | Type | Description |
---|---|---|
<none> | Generation | The {Generation} structure. |
generationsBridgingTxPointsListItem
Returns the generation bridging tx point struct for a given pointer.
function generationsBridgingTxPointsListItem(uint256 ptr) external view returns (GenerationBridgingTxPoint memory);
Parameters
Name | Type | Description |
---|---|---|
ptr | uint256 | The pointer of the requested bridging tx point. |
Returns
Name | Type | Description |
---|---|---|
<none> | GenerationBridgingTxPoint | The {GenerationBridgingTxPoint} structure. |
biomappingsHead
Returns the most recent biomapping pointer for a given account address.
function biomappingsHead(address account) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The block number in which the most recent biomap occurred, or 0 if the account was never bridged. |
biomappingsTail
Returns the oldest biomapping pointer for a given account address.
function biomappingsTail(address account) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The block number in which the oldest biomap occurred, or 0 if the account was never bridged. |
biomappingsListItem
Returns the {Biomapping} struct for a given biomapping pointer and account address.
function biomappingsListItem(address account, uint256 ptr) external view returns (Biomapping memory);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
ptr | uint256 | The biomapping pointer of the requested biomapping. |
Returns
Name | Type | Description |
---|---|---|
<none> | Biomapping | The {Biomapping} structure. |
biomappingsBridgingTxPointsHead
Returns the most recent biomapping bridging tx point for a given account address.
function biomappingsBridgingTxPointsHead(address account) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The block number in which the most recent biomap was bridged, or 0 if the account was never bridged. |
biomappingsBridgingTxPointsTail
Returns the oldest biomapping bridging tx point for a given account address.
function biomappingsBridgingTxPointsTail(address account) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The block number in which the oldest biomap was bridged, or 0 if the account was never bridged. |
biomappingsBridgingTxPointsListItem
Returns the {BiomappingBridgingTxPoint} struct for a given pointer and account address.
function biomappingsBridgingTxPointsListItem(address account, uint256 ptr)
external
view
returns (BiomappingBridgingTxPoint memory);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
ptr | uint256 | The pointer of the requested bridging tx point. |
Returns
Name | Type | Description |
---|---|---|
<none> | BiomappingBridgingTxPoint | The {BiomappingBridgingTxPoint} structure. |
lookupBiomappingPtr
Returns the biomapping pointer for a given account address and generation pointer.
Returns non-zero if the account is known to be biomapped in a given generation.
function lookupBiomappingPtr(address account, uint256 generationPtr) external view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
generationPtr | uint256 | The pointer of the requested generation. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The block number in which the requested user was biomapped in the requested generation, or 0 if there was no biomapping. Note: can return zero if biomapped at Humanode chain but the information about it is not bridged yet. |
lookupBiomappingBridgedTxPointPtr
Returns the {BiomappingBridgingTxPoint} ptr for a given account address and generation bridged tx point.
Returns non-zero if the account biomapping was bridged in a given generation.
function lookupBiomappingBridgedTxPointPtr(address account, uint256 generationPtr)
external
view
override
returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
account | address | The address of the requested account. |
generationPtr | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The block number in which the requested user was biomapped in the requested generation, or 0 if there was no biomapping. Note: there is a possibility that the biomapping was bridged as part of a bridge tx where the generation it belonged to is a historical generation, in which case the {Biomapping} will exist, but the BiomappingBridgedTxPoint will be absent. |
updateBiomappings
Bridge the generations and biomappings.
function updateBiomappings(BiomappingData[] memory biomappingsData, address account) public;
Parameters
Name | Type | Description |
---|---|---|
biomappingsData | BiomappingData[] | The info about biomapping events. |
account | address | The address of the requested account. |