Skip to main content
Version: v1.2

AccQueueQuinary

This contract defines a Merkle tree where each leaf insertion only updates a subtree. To obtain the main tree root, the contract owner must merge the subtrees together. Merging subtrees requires at least 2 operations: mergeSubRoots(), and merge(). To get around the gas limit, the mergeSubRoots() can be performed in multiple transactions.

This contract is for a quinary tree (5 leaves per node)

constructor

constructor(uint256 _subDepth) internal

Create a new AccQueueQuinary instance

hashLevel

function hashLevel(uint256 _level, uint256 _leaf) internal returns (uint256 hashed)

Hash the contents of the specified level and the specified leaf.

it also frees up storage slots to refund gas.

Parameters

NameTypeDescription
_leveluint256The level to hash.
_leafuint256The leaf include with the level.

Return Values

NameTypeDescription
hasheduint256The hash of the level and leaf.

hashLevelLeaf

function hashLevelLeaf(uint256 _level, uint256 _leaf) public view returns (uint256 hashed)

Hash the contents of the specified level and the specified leaf.

Parameters

NameTypeDescription
_leveluint256The level to hash.
_leafuint256The leaf include with the level.

Return Values

NameTypeDescription
hasheduint256The hash of the level and leaf.

_fill

function _fill(uint256 _level) internal

An internal function which fills a subtree

Parameters

NameTypeDescription
_leveluint256The level at which to fill the subtree