Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix next edition calculation for burned items #1126

Merged
merged 18 commits into from
Jul 12, 2023
Merged

Conversation

samuelvanderwaal
Copy link
Contributor

@samuelvanderwaal samuelvanderwaal commented Jun 26, 2023

Burning an edition decreases the supply, which breaks the way Fixed Price Sale currently calculates the next edition number. this PR uses the passed in edition marker and finds the first available edition on that particular marker. It has to figure out which edition marker is passed in, in order to determine the correct edition number, so must do a loop deriving the edition marker PDAs and comparing them against what is passed in. For large edition numbers this might use up available compute units.

In addition, it adds a buy_v2 that requires passing in the edition marker number in edition to the edition marker PDA. This allows a single derivation to be made to calculate the edition number, but would be a breaking change if applied to buy. Since the accounts are identical you continue to use the Buy account struct and only use the BuyV2 instruction struct for the additional argument. This allows reducing code duplication.

@samuelvanderwaal samuelvanderwaal changed the title calculate next edition from edition marker fix next edition calculation for burned items Jun 26, 2023
@github-actions
Copy link
Contributor

Workflow Verify package library found differences when running yarn api:gen in the JS lib for fixed-price-sale. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5383234704.

@github-actions
Copy link
Contributor

Workflow Verify package library found differences when running yarn api:gen in the JS lib for fixed-price-sale. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5383278683.

@samuelvanderwaal samuelvanderwaal marked this pull request as ready for review June 26, 2023 22:24
@samuelvanderwaal samuelvanderwaal requested a review from a team as a code owner June 26, 2023 22:24
@samuelvanderwaal samuelvanderwaal requested review from lorisleiva and blockiosaurus and removed request for a team June 26, 2023 22:24
@samuelvanderwaal samuelvanderwaal marked this pull request as draft June 26, 2023 22:32
@samuelvanderwaal samuelvanderwaal marked this pull request as ready for review July 5, 2023 21:38
blockiosaurus
blockiosaurus previously approved these changes Jul 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

Workflow Verify package library found differences when running yarn api:gen in the JS lib for fixed-price-sale. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5479272484.

blockiosaurus
blockiosaurus previously approved these changes Jul 10, 2023
@github-actions
Copy link
Contributor

Workflow Verify package library found differences when running yarn api:gen in the JS lib for fixed-price-sale. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5513009983.

@github-actions
Copy link
Contributor

Workflow Verify package library found differences when running yarn api:gen in the JS lib for fixed-price-sale. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5513034908.

@samuelvanderwaal samuelvanderwaal marked this pull request as draft July 10, 2023 21:58
@samuelvanderwaal samuelvanderwaal marked this pull request as ready for review July 10, 2023 23:49
blockiosaurus
blockiosaurus previously approved these changes Jul 10, 2023
@samuelvanderwaal samuelvanderwaal merged commit eb000db into master Jul 12, 2023
50 checks passed
@samuelvanderwaal samuelvanderwaal deleted the fix/next-edition branch July 12, 2023 21:21
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.

3 participants