add specific network/coin/balance types (#619)

* add specific network/coin/balance types

* misc fixes

* fix clippy

* misc fixes

* fix pr comments

* Make halting for external networks

* fix encode/decode
This commit is contained in:
akildemir
2024-10-07 05:16:11 +03:00
committed by GitHub
parent d7ecab605e
commit 435f1d9ae1
91 changed files with 1536 additions and 1055 deletions

View File

@@ -3,7 +3,7 @@ use std::io;
use ciphersuite::Ciphersuite;
use serai_client::primitives::{NetworkId, Balance};
use serai_client::primitives::{ExternalBalance, ExternalNetworkId};
use crate::{networks::Network, Db, Payment, Plan};
@@ -34,18 +34,18 @@ pub trait Scheduler<N: Network>: Sized + Clone + PartialEq + Debug {
fn new<D: Db>(
txn: &mut D::Transaction<'_>,
key: <N::Curve as Ciphersuite>::G,
network: NetworkId,
network: ExternalNetworkId,
) -> Self;
/// Load a Scheduler from the DB.
fn from_db<D: Db>(
db: &D,
key: <N::Curve as Ciphersuite>::G,
network: NetworkId,
network: ExternalNetworkId,
) -> io::Result<Self>;
/// Check if a branch is usable.
fn can_use_branch(&self, balance: Balance) -> bool;
fn can_use_branch(&self, balance: ExternalBalance) -> bool;
/// Schedule a series of outputs/payments.
fn schedule<D: Db>(