MockBiomapper

Git Source

Inherits: IGenerationChangeEvents, IProveUniquenessEvents, IMockBiomapperControl

Mock contract implementing Biomapper contract interfaces.

Use this contract is your tests and development stages to emulate the behaviour of the Biomapper contract.

When created, the MockBiomapper contract is empty. Use the IMockBiomapperControl interface to drive the mock state as needed. Use getMockBiomapperLogAddress to obtain the address of the corresponding MockBiomapperLog contract.

State Variables

_unique

Mapping account => true for quick access to unique accounts.

mapping(uint256 => mapping(address => bool)) private _unique;

_biotokens

Mapping biotoken => account for storing biotokens.

mapping(uint256 => mapping(bytes32 => address)) private _biotokens;

_currentGeneration

uint256 private _currentGeneration;

_MOCK_BIOMAPPER_LOG

MockBiomapperLog contract instance for logging biomapper events.

MockBiomapperLog private immutable _MOCK_BIOMAPPER_LOG;

Functions

constructor

constructor();

getMockBiomapperLogAddress

Returns the address of the MockBiomapperLog contract instance.

function getMockBiomapperLogAddress() public view returns (address mockBiomapperLogAddress);

initGeneration

Initializes a new generation.

function initGeneration() public;

biomap

Creates a new biomapping for the specified account.

function biomap(address account, bytes32 biotoken) external;

Parameters

NameTypeDescription
accountaddressThe address of the account to biomap.
biotokenbytes32The biotoken to map to the account.

Errors

BiomappingAlreadyExists

Sender account is already mapped to a given biotoken. No further actions required.

error BiomappingAlreadyExists();

AccountHasAnotherBiotokenAttached

Sender account is already mapped to another biotoken. User can try again using another account.

error AccountHasAnotherBiotokenAttached();

BiotokenAlreadyMappedToAnotherAccount

Given biotoken is already mapped to anotherAccount. User can use another biotoken with this account.

error BiotokenAlreadyMappedToAnotherAccount(address anotherAccount);