MCPcopy Create free account
hub / github.com/AlmostEfficient/full-stack-solana-dev / increment

Function increment

counter/programs/counter/src/lib.rs:17–23  ·  view source on GitHub ↗
(ctx: Context<Increment>)

Source from the content-addressed store, hash-verified

15 }
16
17 pub fn increment(ctx: Context<Increment>) -> Result<()> {
18 let counter = &mut ctx.accounts.counter;
19 msg!("Previous counter: {}", counter.count);
20 counter.count = counter.count.checked_add(1).unwrap();
21 msg!("Counter incremented! Current count: {}", counter.count);
22 Ok(())
23 }
24}
25
26#[derive(Accounts)]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected