Show the crate…

16 releases

0.1.10 Dec 28, 2023
0.1.9 Dec 23, 2023
0.1.7 Nov 30, 2023
0.1.5 Oct 27, 2023
0.0.1 Jun 28, 2023

#20 in #nova

Download history 19/week @ 2024-03-27 37/week @ 2024-04-03 7/week @ 2024-04-24 72/week @ 2024-05-01

146 downloads per month
Used in zinkup

GPL-3.0-only

68KB
89 lines

Zink

The standard library for zink projects.

//! Addition example.
#![cfg_attr(target_arch = "wasm32", no_std)]
#![cfg_attr(target_arch = "wasm32", no_main)]
extern crate zink;

/// Adds two numbers together.
#[zink::external]
pub fn addition(x: u64, y: u64) -> u64 {
    x + y
}

#[cfg(not(target_arch = "wasm32"))]
fn main() {}

#[test]
fn test() -> anyhow::Result<()> {
    use zint::{Bytes32, Contract};
    let mut contract = Contract::search("addition")?.compile()?;

    let info = contract.execute([
        "addition(u64,u64)".as_bytes(),
        &1u64.to_bytes32(),
        &2u64.to_bytes32(),
    ])?;
    assert_eq!(info.ret, 3u64.to_bytes32());

    Ok(())
}

LICENSE

GPL-3.0


lib.rs:

Zink library for developing smart contracts for blockchains.

Dependencies

~0.4–1MB
~23K SLoC