ToolszkEVMArchitectureHigh levelSmart contractsApiLib

DepositContractBase.sol

This contract is a helper for all functions related to the sparse Merkle tree. And it is based on the implementation of the deposit eth2.0 contract https://gith

This contract is a helper for all functions related to the sparse Merkle tree. And it is based on the implementation of the deposit eth2.0 contract https://github.com/ethereum/consensus-specs/blob/dev/solidity_deposit_contract/deposit_contract.sol.

Functions

getRoot

Computes and returns the Merkle root.

  function getRoot(
  ) public returns (bytes32)

_addLeaf

Adds a new leaf to the merkle tree.

  function _addLeaf(
    bytes32 leaf
  ) internal
Parameters
NameTypeDescription
leafbytes32Leaf

verifyMerkleProof

Verifies a Merkle proof.

  function verifyMerkleProof(
    bytes32 leafHash,
    bytes32[32] smtProof,
    uint32 index,
    bytes32 root
  ) public returns (bool)
Parameters
NameTypeDescription
leafHashbytes32Leaf hash.
smtProofbytes32[32]Smt proof.
indexuint32Index of the leaf.
rootbytes32Merkle root.

calculateRoot

Calculates root via a Merkle proof.

  function calculateRoot(
    bytes32 leafHash,
    bytes32[32] smtProof,
    uint32 index
  ) public returns (bytes32)
Parameters
NameTypeDescription
leafHashbytes32Leaf hash.
smtProofbytes32[32]Smt proof.
indexuint32Index of the leaf.
Edit on GitHub

Last updated on