-
Notifications
You must be signed in to change notification settings - Fork 992
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |