Skip to content

Commit

Permalink
Fix issue stellar#1406: Update lib.rs to see the expected output when…
Browse files Browse the repository at this point in the history
… deploying the Increment contract
  • Loading branch information
Yoshihiro Kawamoto authored and Yoshihiro Kawamoto committed Dec 13, 2024
1 parent 13f16d4 commit b96a6a9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions soroban-hello-world/contracts/increment/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#![no_std]
use soroban_sdk::{contract, contractimpl, log, symbol_short, Env, Symbol};

const COUNTER: Symbol = symbol_short!("COUNTER");

#[contract]
pub struct Contract;

#[contractimpl]
impl Contract {
pub fn increment(env: Env) -> u32 {
let mut count: u32 = env.storage().instance().get(&COUNTER).unwrap_or(0);

count += 1;

log!(&env, "count: {}", count);

env.storage().instance().set(&COUNTER, &count);

env.storage().instance().extend_tt1(100, 100);

count
}
}

mod test;

0 comments on commit b96a6a9

Please sign in to comment.