Skip to content

Commit

Permalink
Merge pull request #47 from proyecto26/46-add-contributors-to-the-con…
Browse files Browse the repository at this point in the history
…cert-account

46 add contributors to the concert account
  • Loading branch information
loganrudd authored Dec 18, 2024
2 parents 840c5a1 + da2ef0a commit 9091545
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions anchor/programs/concert-x/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub mod concert_x {
concert.ticket_price = ticket_price;
concert.start_date = start_date;
concert.end_date = end_date;
concert.status = 0;
concert.status = 0;
Ok(())
}

Expand Down Expand Up @@ -72,6 +72,7 @@ pub mod concert_x {

//Update the current amount
ctx.accounts.concert.current_amount += amount;
ctx.accounts.concert.contributors.push(*ctx.accounts.backer.key);

Ok(())
}
Expand Down Expand Up @@ -146,7 +147,10 @@ pub struct Concert {
/// Unix timestamps when the campaign ends
pub end_date: i64,
/// 0 = active, 1 = completed, 2 = cancelled
pub status: u8,
pub status: u8,
/// Concert contributors
#[max_len(100)]
pub contributors: Vec<Pubkey>,
}

/// Size of the account discriminator
Expand Down
1 change: 1 addition & 0 deletions anchor/tests/concert-x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe("concert-x", () => {

const updatedConcertAccount = await program.account.concert.fetch(concertXPda);
expect(updatedConcertAccount.currentAmount.toNumber()).to.equal(contributionAmount);
expect(updatedConcertAccount.contributors.length).greaterThan(0);



Expand Down

0 comments on commit 9091545

Please sign in to comment.