Implement balance (#20)

This commit is contained in:
Cyrill Leutwiler
2024-06-03 12:21:49 +02:00
committed by GitHub
parent 1ba806be1f
commit 5ff17da695
6 changed files with 103 additions and 4 deletions
+18
View File
@@ -148,6 +148,12 @@ sol!(
}
);
sol!(
contract Value {
function balance_of(address _address) public view returns (uint ret);
}
);
impl Contract {
/// Execute the contract.
///
@@ -490,6 +496,18 @@ impl Contract {
calldata: Default::default(),
}
}
pub fn value_balance_of(address: Address) -> Self {
let code = include_str!("../contracts/Value.sol");
let name = "Value";
Self {
name,
evm_runtime: crate::compile_evm_bin_runtime(name, code),
pvm_runtime: crate::compile_blob(name, code),
calldata: Value::balance_ofCall::new((address,)).abi_encode(),
}
}
}
#[cfg(test)]