MockBiomapperLog

Git Source

Inherits: IBiomapperLogRead, IMockBiomapperLogWrite

Mock contract implementing BiomapperLog contract interfaces.

It is constructed as part of the MockBiomapper, but it is also possible to construct and use the MockBiomapperLog independently.

When used in conjunction with MockBiomapper, the interactions with the corresponding MockBiomapper will drive the MockBiomapperLog state accordingly, so there is no need to separately control the MockBiomapperLog state.

When deployed independently, use the IMockBiomapperLogWrite interface to drive the state.

State Variables

generationsHead

uint256 public generationsHead;

generationsTail

uint256 public generationsTail;

generationsList

mapping(uint256 => Generation) public generationsList;

biomappingsHeads

mapping(address => uint256) public biomappingsHeads;

biomappingsTails

mapping(address => uint256) public biomappingsTails;

biomappingsLists

mapping(address => mapping(uint256 => Biomapping)) public biomappingsLists;

generationBiomappings

mapping(address => mapping(uint256 => uint256)) public generationBiomappings;

Functions

biomappingsHead

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

function biomappingsHead(address account) external view override 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 biomapped.

biomappingsTail

Returns the oldest biomapping pointer for a given account address.

function biomappingsTail(address account) external view override 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 biomapped.

biomappingsListItem

Returns the {Biomapping} struct for a given biomapping pointer and account address.

function biomappingsListItem(address account, uint256 ptr) external view override returns (Biomapping memory);

Parameters

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

Returns

NameTypeDescription
<none>BiomappingThe {Biomapping} structure.

generationsListItem

Returns the generation struct for a given generation pointer.

function generationsListItem(uint256 ptr) external view override returns (Generation memory);

Parameters

NameTypeDescription
ptruint256The pointer of the requested generation.

Returns

NameTypeDescription
<none>GenerationThe {Generation} structure.

generationBiomapping

Returns the biomapping pointer for a given account address and generation pointer.

function generationBiomapping(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.

initGeneration

Initializes a new generation.

function initGeneration(bytes32 generation) external;

Parameters

NameTypeDescription
generationbytes32Arbitrarty bytes to represent the generation.

biomap

Creates a new biomapping for the specified account.

function biomap(address account) external;

Parameters

NameTypeDescription
accountaddressThe address of the account to biomap.