Add a balance assertion test step

This commit is contained in:
Omar Abdulla
2025-08-11 14:31:06 +03:00
parent 22e46e0762
commit 71a05c3f47
6 changed files with 122 additions and 1 deletions
+16
View File
@@ -26,6 +26,8 @@ use crate::{metadata::ContractInstance, traits::ResolutionContext};
pub enum Step {
/// A function call or an invocation to some function on some smart contract.
FunctionCall(Input),
/// A step for performing a balance assertion on some account or contract.
BalanceAssertion(BalanceAssertion),
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
@@ -44,6 +46,20 @@ pub struct Input {
pub variable_assignments: Option<VariableAssignments>,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
pub struct BalanceAssertion {
/// The address that the balance assertion should be done on.
///
/// This is a string which will be resolved into an address when being processed. Therefore,
/// this could be a normal hex address, a variable such as `Test.address`, or perhaps even a
/// full on variable like `$VARIABLE:Uniswap`. It follows the same resolution rules that are
/// followed in the calldata.
pub address: String,
/// The amount of balance to assert that the account or contract has.
pub amount: U256,
}
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(untagged)]
pub enum Expected {