From 15175ee4199c35b1e31495e580fc9063b355385d Mon Sep 17 00:00:00 2001 From: James Hiew Date: Fri, 14 Oct 2022 14:10:30 +0100 Subject: [PATCH] Update params (WIP) --- apps/src/lib/config/ethereum_bridge/params.rs | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/apps/src/lib/config/ethereum_bridge/params.rs b/apps/src/lib/config/ethereum_bridge/params.rs index c36ed9773cb..12fd50d28a6 100644 --- a/apps/src/lib/config/ethereum_bridge/params.rs +++ b/apps/src/lib/config/ethereum_bridge/params.rs @@ -1,11 +1,20 @@ //! Blockchain-level parameters for the configuration of the Ethereum bridge. use serde::{Deserialize, Serialize}; +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub struct MinimumConfirmations(u64); + +impl Default for MinimumConfirmations { + fn default() -> Self { + Self(1) + } +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Config { /// Minimum number of confirmations needed to trust an Ethereum branch. /// This must be at least one. - pub min_confirmations: u64, + pub min_confirmations: MinimumConfirmations, /// The addresses of the Ethereum contracts that need to be directly known /// by validators pub contract_addresses: Addresses, @@ -13,10 +22,31 @@ pub struct Config { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Addresses { - /// The Ethereum address of the proxy contract e.g. + /// The Ethereum address of the bridge contract e.g. /// 0x6B175474E89094C44Da98b954EedeAC495271d0F - pub proxy: String, + pub bridge: EthereumContract, + /// The Ethereum address of the governance contract e.g. + /// 0x6B175474E89094C44Da98b954EedeAC495271d0F + pub governance: EthereumContract, /// The Ethereum address of the ERC20 contract that represents this chain's /// native token e.g. 0x6B175474E89094C44Da98b954EedeAC495271d0F pub native_erc20: String, } + +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] +pub struct ContractVersion(u64); + +impl Default for ContractVersion { + fn default() -> Self { + Self(1) + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct EthereumContract { + /// The Ethereum address of the contract e.g. + /// 0x6B175474E89094C44Da98b954EedeAC495271d0F + pub address: String, + /// The version of the contract e.g. 1 + pub version: ContractVersion, +}