Ensure economic security on validator sets (#459)

* add price oracle

* tidy up

* add todo

* bug fixes

* fix pr comments

* Use spot price, tweak some formulas

Also cleans nits.

---------

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
akildemir
2023-12-05 16:52:50 +03:00
committed by GitHub
parent 746bf5c6ad
commit 4ebfae0b63
9 changed files with 211 additions and 6 deletions

View File

@@ -25,6 +25,16 @@ pub enum NetworkId {
Ethereum,
Monero,
}
impl NetworkId {
pub fn coins(&self) -> &'static [Coin] {
match self {
Self::Serai => &[Coin::Serai],
Self::Bitcoin => &[Coin::Bitcoin],
Self::Ethereum => &[Coin::Ether, Coin::Dai],
Self::Monero => &[Coin::Monero],
}
}
}
pub const NETWORKS: [NetworkId; 4] =
[NetworkId::Serai, NetworkId::Bitcoin, NetworkId::Ethereum, NetworkId::Monero];