EthClient

Git Source

Inherits: IBridgeLightClient, OwnableUpgradeable, UUPSUpgradeable

State Variables

client

BeaconLightClient public client;

ethBridgeAddress

address public ethBridgeAddress;

bridgeRootsMappingPosition

bytes32 public bridgeRootsMappingPosition;

lastEpoch

uint256 public lastEpoch;

bridgeRoots

mapping(uint256 => bytes32) public bridgeRoots;

__gap

gap for upgrade safety <- can be used to add new storage variables(using up to 49 32 byte slots) in new versions of this contract If used, decrease the number of slots in the next contract that inherits this one(ex. uint256[48] __gap;)

uint256[49] __gap;

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor();

initialize

function initialize(BeaconLightClient _client, address _eth_bridge_address) public initializer;

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

setBeaconLightClient

Sets the BeaconLightClient instance.

function setBeaconLightClient(BeaconLightClient _client) external onlyOwner;

Parameters

NameTypeDescription
_clientBeaconLightClientThe address of the new BeaconLightClient contract.

getFinalizedBridgeRoot

Implements the IBridgeLightClient interface method

function getFinalizedBridgeRoot(uint256 epoch) external view returns (bytes32);

Returns

NameTypeDescription
<none>bytes32The finalized bridge root as a bytes32 value.

bridgeRootKeyByEpoch

function bridgeRootKeyByEpoch(uint256 epoch) public view returns (bytes32);

processBridgeRoot

Processes the bridge root by verifying account and storage proofs against state root from the light client.

function processBridgeRoot(bytes[] memory account_proof, bytes[] memory storage_proof) external;

Parameters

NameTypeDescription
account_proofbytes[]The account proofs for the bridge root.
storage_proofbytes[]The storage proofs for the bridge root.

getMerkleRoot

Returns the Merkle root from the light client.

function getMerkleRoot() external view returns (bytes32);

Returns

NameTypeDescription
<none>bytes32The Merkle root as a bytes32 value.

Events

BridgeRootProcessed

Events

event BridgeRootProcessed(bytes32 indexed bridgeRoot);