Show the crate…

17 releases

0.1.11 Sep 24, 2024
0.1.10 Dec 28, 2023
0.1.7 Nov 30, 2023
0.1.5 Oct 27, 2023
0.0.1 Jun 28, 2023

#20 in #nova

Download history 131/week @ 2024-09-19 44/week @ 2024-09-26 9/week @ 2024-10-03

184 downloads per month
Used in zinkup

GPL-3.0-only

73KB
275 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
~22K SLoC