mirror of
https://github.com/logos-blockchain/lssa-zkvm-testing.git
synced 2026-01-05 23:03:09 +00:00
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
use core::account::Account;
|
|
use risc0_zkvm::{default_executor, ExecutorEnv};
|
|
|
|
use nssa;
|
|
|
|
use nssa::program::TransferMultipleProgram;
|
|
|
|
/// A public execution.
|
|
/// This would be executed by the runtime after checking that
|
|
/// the initiating transaction includes the sender's signature.
|
|
pub fn main() {
|
|
// Account fetched from the chain state with 150 in its balance.
|
|
let sender = Account::new([5; 8], 150);
|
|
|
|
// Account fetched from the chain state with 900 in its balance.
|
|
let receiver_1 = Account::new([6; 8], 900);
|
|
|
|
// Account fetched from the chain state with 500 in its balance.
|
|
let receiver_2 = Account::new([6; 8], 500);
|
|
|
|
let balance_to_move = vec![10, 20];
|
|
|
|
let inputs_outputs = nssa::execute::<TransferMultipleProgram>(
|
|
&[sender, receiver_1, receiver_2],
|
|
balance_to_move,
|
|
)
|
|
.unwrap();
|
|
|
|
println!(
|
|
"sender_before: {:?}, sender_after: {:?}",
|
|
inputs_outputs[0], inputs_outputs[3]
|
|
);
|
|
println!(
|
|
"receiver_1_before: {:?}, receiver_1_after: {:?}",
|
|
inputs_outputs[1], inputs_outputs[4],
|
|
);
|
|
println!(
|
|
"receiver_2_before: {:?}, receiver_2_after: {:?}",
|
|
inputs_outputs[2], inputs_outputs[5],
|
|
);
|
|
}
|