Skip to content

Commit

Permalink
Update params (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-chf committed Oct 14, 2022
1 parent 6953a81 commit 15175ee
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions apps/src/lib/config/ethereum_bridge/params.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,52 @@
//! 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,
}

#[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,
}

0 comments on commit 15175ee

Please sign in to comment.