MockBridgedBiomapper

Git Source

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

NameTypeDescription
ptruint256The pointer of the requested generation.

Returns

NameTypeDescription
<none>GenerationThe {Generation} structure.

generationsBridgingTxPointsListItem

Returns the generation bridging tx point struct for a given pointer.

function generationsBridgingTxPointsListItem(uint256 ptr) external view returns (GenerationBridgingTxPoint memory);

Parameters

NameTypeDescription
ptruint256The pointer of the requested bridging tx point.

Returns

NameTypeDescription
<none>GenerationBridgingTxPointThe {GenerationBridgingTxPoint} structure.

biomappingsHead

Returns the most recent biomapping pointer for a given account address.

function biomappingsHead(address account) external view returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address of the requested account.

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
accountaddressThe address of the requested account.

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
accountaddressThe address of the requested account.
ptruint256The biomapping pointer of the requested biomapping.

Returns

NameTypeDescription
<none>BiomappingThe {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

NameTypeDescription
accountaddressThe address of the requested account.

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
accountaddressThe address of the requested account.

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
accountaddressThe address of the requested account.
ptruint256The pointer of the requested bridging tx point.

Returns

NameTypeDescription
<none>BiomappingBridgingTxPointThe {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

NameTypeDescription
accountaddressThe address of the requested account.
generationPtruint256The pointer of the requested generation.

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
accountaddressThe address of the requested account.
generationPtruint256

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
biomappingsDataBiomappingData[]The info about biomapping events.
accountaddressThe address of the requested account.