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

#22 in #nova

Download history 156/week @ 2024-09-22 27/week @ 2024-09-29 1/week @ 2024-10-06 93/week @ 2024-12-08

93 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
~21K SLoC