diff --git a/contracts/host/src/lib.rs b/contracts/host/src/lib.rs index dd85f6e9..07fdefc9 100644 --- a/contracts/host/src/lib.rs +++ b/contracts/host/src/lib.rs @@ -45,6 +45,12 @@ impl Hoster { false => String::from("PROOF IS INVALID"), } } + + /// Call 'get_counter' function available from the host, and return the + /// result + pub fn host_get_counter(&self) -> i64 { + uplink::host_query("get_counter", ()) + } } /// Expose `Hoster::host_hash()` to the host @@ -60,3 +66,9 @@ unsafe fn host_verify(arg_len: u32) -> u32 { STATE.host_verify(proof, public_inputs) }) } + +/// Expose `Hoster::host_counter()` to the host +#[no_mangle] +unsafe fn host_get_counter(arg_len: u32) -> u32 { + uplink::wrap_call(arg_len, |()| STATE.host_get_counter()) +}