2026-03-25 16:56:04 -03:00
|
|
|
use nssa_core::program::{AccountPostState, ProgramInput, ProgramOutput, read_nssa_inputs};
|
2025-08-10 11:58:25 -03:00
|
|
|
|
2025-08-10 18:59:29 -03:00
|
|
|
type Instruction = ();
|
2025-08-10 18:51:55 -03:00
|
|
|
|
2025-08-10 11:58:25 -03:00
|
|
|
fn main() {
|
2026-04-03 01:17:42 +02:00
|
|
|
let (
|
|
|
|
|
ProgramInput {
|
|
|
|
|
self_program_id,
|
2026-04-07 17:54:59 +02:00
|
|
|
caller_program_id,
|
2026-04-03 01:17:42 +02:00
|
|
|
pre_states,
|
|
|
|
|
..
|
|
|
|
|
},
|
|
|
|
|
instruction_words,
|
|
|
|
|
) = read_nssa_inputs::<Instruction>();
|
2025-08-10 11:58:25 -03:00
|
|
|
|
2026-03-03 23:21:08 +03:00
|
|
|
let Ok([pre]) = <[_; 1]>::try_from(pre_states) else {
|
|
|
|
|
return;
|
2025-08-10 11:58:25 -03:00
|
|
|
};
|
|
|
|
|
|
2025-08-14 14:09:04 -03:00
|
|
|
let account_pre = &pre.account;
|
2025-08-10 11:58:25 -03:00
|
|
|
let mut account_post = account_pre.clone();
|
2026-03-04 18:42:33 +03:00
|
|
|
account_post.balance = account_post
|
|
|
|
|
.balance
|
|
|
|
|
.checked_add(1)
|
|
|
|
|
.expect("Balance overflow");
|
2025-08-10 11:58:25 -03:00
|
|
|
|
2026-03-25 17:32:11 -03:00
|
|
|
ProgramOutput::new(
|
2026-04-02 00:41:55 +02:00
|
|
|
self_program_id,
|
2026-04-07 17:54:59 +02:00
|
|
|
caller_program_id,
|
2026-03-25 17:32:11 -03:00
|
|
|
instruction_words,
|
|
|
|
|
vec![pre],
|
|
|
|
|
vec![AccountPostState::new(account_post)],
|
|
|
|
|
)
|
|
|
|
|
.write();
|
2025-08-10 11:58:25 -03:00
|
|
|
}
|