Merge Machine and WithRewards (#10071)
This commit is contained in:
committed by
Afri Schoedon
parent
4d66e8d06d
commit
eea3de00c1
@@ -112,6 +112,13 @@ pub trait Machine: for<'a> LocalizedMachine<'a> {
|
||||
|
||||
/// Errors which can occur when querying or interacting with the machine.
|
||||
type Error;
|
||||
|
||||
/// Get the balance, in base units, associated with an account.
|
||||
/// Extracts data from the live block.
|
||||
fn balance(&self, live: &Self::LiveBlock, address: &Address) -> Result<U256, Self::Error>;
|
||||
|
||||
/// Increment the balance of an account in the state of the live block.
|
||||
fn add_balance(&self, live: &mut Self::LiveBlock, address: &Address, amount: &U256) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
/// Machine-related types localized to a specific lifetime.
|
||||
@@ -123,13 +130,3 @@ pub trait LocalizedMachine<'a>: Sync + Send {
|
||||
/// Generally also provides verifiable proofs.
|
||||
type StateContext: ?Sized + 'a;
|
||||
}
|
||||
|
||||
/// A state machine that uses balances.
|
||||
pub trait WithBalances: Machine {
|
||||
/// Get the balance, in base units, associated with an account.
|
||||
/// Extracts data from the live block.
|
||||
fn balance(&self, live: &Self::LiveBlock, address: &Address) -> Result<U256, Self::Error>;
|
||||
|
||||
/// Increment the balance of an account in the state of the live block.
|
||||
fn add_balance(&self, live: &mut Self::LiveBlock, address: &Address, amount: &U256) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user