Skip to content

Commit

Permalink
update claimant balance on claim
Browse files Browse the repository at this point in the history
  • Loading branch information
hawthorne-abendsen committed Jul 31, 2024
1 parent db187b4 commit 2dd9d82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ impl DAOContract {
}
// transfer tokens to the destination address
token(&e).transfer(&e.current_contract_address(), &to, &amount);

// update available balance
update_available_balance(&e, &claimant, &(-amount));
}

/// Create a new ballot
Expand Down
10 changes: 10 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,14 @@ fn test() {
let balance = env.get_available_balance(&operators.first().unwrap());
assert!(balance > 0);
});

let available = client.available(&developer);
assert!(available > 0);

client.claim(&developer, &developer, &available);

env.as_contract(&client.address, || {
let balance = env.get_available_balance(&developer);
assert_eq!(balance, 0);
});
}

0 comments on commit 2dd9d82

Please sign in to comment.