tlib.rs - wasm-runtime - A wasm runtime
HTML git clone https://git.parazyd.org/wasm-runtime
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
tlib.rs (586B)
---
1 use borsh::{BorshDeserialize, BorshSerialize};
2 use drk_sdk::{
3 entrypoint,
4 error::{ContractError, ContractResult},
5 msg,
6 };
7 use pasta_curves::pallas;
8
9 #[derive(BorshSerialize, BorshDeserialize)]
10 pub struct Args {
11 pub a: pallas::Base,
12 pub b: pallas::Base,
13 }
14
15 entrypoint!(process_instruction);
16 fn process_instruction(ix: &[u8]) -> ContractResult {
17 let args = Args::try_from_slice(ix)?;
18
19 if args.a < args.b {
20 return Err(ContractError::Custom(69))
21 }
22
23 let sum = args.a + args.b;
24
25 msg!("Hello from the VM runtime! Sum: {:?}", sum);
26
27 Ok(())
28 }