Skip to content

Commit

Permalink
fix Principal address + claimed flag on bounty state
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-baraschi-peperina authored and ffakenz committed May 2, 2024
1 parent a27b95e commit 17821bb
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions bounty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct BountyState {
authority: Principal,
github_issue_id: i32,
interested_contributors: Vec<Contributor>,
claimed: bool,
}

// Define thread-local storage for the bounty canister state
Expand All @@ -26,6 +27,7 @@ fn init(authority: Principal, github_issue_id: i32) -> () {
authority,
github_issue_id,
interested_contributors: Vec::new(),
claimed: false,
});
});
}
Expand All @@ -34,12 +36,17 @@ fn init(authority: Principal, github_issue_id: i32) -> () {
mod test_init {
use super::*;
#[test]

fn test_init() {
BOUNTY_STATE.with(|state| {
let bounty_canister = state.borrow();
assert!(bounty_canister.is_none());
});
let authority = Principal::from_text("ic:authority_canister_principal").unwrap();

let authority =
Principal::from_text("t2y5w-qp34w-qixaj-s67wp-syrei-5yqse-xbed6-z5nsd-fszmf-izgt2-lqe")
.unwrap();

init(authority, 123);
BOUNTY_STATE.with(|state| {
let bounty_canister = state.borrow();
Expand All @@ -63,7 +70,9 @@ mod test_accept {
use super::*;
#[test]
fn test_accept() {
let authority = Principal::from_text("ic:authority_canister_principal").unwrap();
let authority =
Principal::from_text("t2y5w-qp34w-qixaj-s67wp-syrei-5yqse-xbed6-z5nsd-fszmf-izgt2-lqe")
.unwrap();
init(authority, 123);
BOUNTY_STATE.with(|state| {
let bounty_canister = state.borrow();
Expand All @@ -74,9 +83,10 @@ mod test_accept {
}
});
let contributor =
Principal::from_text("ic:contributor_canister_principal").unwrap();
Principal::from_text("t2y5w-qp34w-qixaj-s67wp-syrei-5yqse-xbed6-z5nsd-fszmf-izgt2-lqe")
.unwrap();
accept(Contributor {
address : contributor,
address: contributor,
crypto_address: "contributor_address".to_string(),
});
BOUNTY_STATE.with(|state| {
Expand Down

0 comments on commit 17821bb

Please sign in to comment.