aboutsummaryrefslogtreecommitdiff
path: root/zkvms/zkwasm/guest/src/lib.rs
blob: 5bb69f7b993b22d15f4042d608c461843a86ee86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use wasm_bindgen::prelude::wasm_bindgen;
use wrapper_macro::{make_wrapper, read};
// https://github.com/DelphinusLab/zkWasm-rust/blob/main/src/lib.rs
use zkwasm_rust_sdk::{require, wasm_input, wasm_output};

#[cfg(not(no_std))]
use std::collections::*;

fn read_private() -> u64 {
    unsafe { wasm_input(0) }
}

fn read_public() -> u64 {
    unsafe { wasm_input(1) }
}

fn assert(cond: bool) {
    unsafe {
        require(cond);
    }
}

fn write(value: u64) {
    unsafe {
        wasm_output(value);
    }
}

#[wasm_bindgen]
pub fn zkmain() {
    zkp::entrypoint_expr!()
}