Skip to content

Conversation

@willemneal
Copy link
Member

Added:

  • Errors
  • XLM contract (had to make a work around since you can't unit test easily)
  • Method to add funds
  • More tests

It was very hard to test the auth mocking for the guessing so just skipped it for now.

A future improvement is to use an allowance and have the contract refill funds after a correct guess.

willemneal and others added 2 commits October 24, 2025 20:29
Added:
- Errors
- XLM contract (had to make a work around since you can't unit test easily)
- Method to add funds
- More tests

It was very hard to test the auth mocking for the guessing so just skipped it for now.

A future improvement is to use an allowance and have the contract refill funds after a correct guess.
- Make both constants consistent as references
- Rename `reset_guess` to `reset_number`
- Add private readonly `number` getter
@zachfedor zachfedor force-pushed the feat/final_guess_the_number branch from 1b9e682 to 81ab1d0 Compare October 25, 2025 15:33
@willemneal willemneal merged commit 28f3abe into main Oct 25, 2025
1 check failed
@chadoh
Copy link
Member

chadoh commented Oct 28, 2025

It was very hard to test the auth mocking for the guessing so just skipped it for now.

We already do this in the test? You and I figured it out together, @willemneal. Did this need to change for some reason?

#[test]
fn only_admin_can_reset() {
    let env = &Env::default();
    let (admin, _, client) = init_test(env);
    let user = Address::generate(env);

    set_caller(&client, "reset", &user, ());
    assert!(client.try_reset().is_err());

    set_caller(&client, "reset", &admin, ());
    assert!(client.try_reset().is_ok());
}

@chadoh chadoh deleted the feat/final_guess_the_number branch October 28, 2025 17:33
@willemneal
Copy link
Member Author

willemneal commented Oct 29, 2025

@chadoh It's when adding the transfer that is hard. The cross contract call auth is tricky and I couldn't get it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants