EthClient
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
Name | Type | Description |
---|---|---|
_client | BeaconLightClient | The address of the new BeaconLightClient contract. |
getFinalizedBridgeRoot
Implements the IBridgeLightClient interface method
function getFinalizedBridgeRoot(uint256 epoch) external view returns (bytes32);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | The 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
Name | Type | Description |
---|---|---|
account_proof | bytes[] | The account proofs for the bridge root. |
storage_proof | bytes[] | The storage proofs for the bridge root. |
getMerkleRoot
Returns the Merkle root from the light client.
function getMerkleRoot() external view returns (bytes32);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | The Merkle root as a bytes32 value. |
Events
BridgeRootProcessed
Events
event BridgeRootProcessed(bytes32 indexed bridgeRoot);