Skip to content

Commit

Permalink
chore(erc20): test decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop committed Oct 4, 2024
1 parent d7fd397 commit f03746e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn init(name: u32, symbol: u32) {
/// Get value from the storage.
#[zink::external]
pub fn decimals() -> u32 {
2
8
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -79,5 +79,11 @@ fn deploy() -> anyhow::Result<()> {
.call(address)?;
assert_eq!(info.ret, 42u64.to_bytes32());

// 4. check decimals
let info = evm
.calldata(&contract.encode(&[b"decimals()".to_vec()])?)
.call(address)?;
assert_eq!(info.ret, 8u64.to_bytes32());

Ok(())
}

0 comments on commit f03746e

Please sign in to comment.