Skip to content

Commit

Permalink
Merge pull request solana-labs#147 from jarry-xiao/creator-shares-fix
Browse files Browse the repository at this point in the history
Fix Creators to Sum to 100 [Bubblegum, Gumball Machine, Sugar Shack]
  • Loading branch information
samwise2 authored Jul 19, 2022
2 parents 77316d3 + 11f8e0c commit 34c9ccd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/tests/bubblegum-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
TOKEN_PROGRAM_ID,
Token,
} from "@solana/spl-token";
import { bufferToArray, execute } from "./utils";
import { bufferToArray, execute, num16ToBuffer } from "./utils";
import { TokenProgramVersion, Version } from "../sdk/bubblegum/src/generated";
import { CANDY_WRAPPER_PROGRAM_ID } from "../sdk/utils";
import { getBubblegumAuthorityPDA, getCreateTreeIxs, getNonceCount, getVoucherPDA } from "../sdk/bubblegum/src/convenience";
Expand Down Expand Up @@ -168,8 +168,12 @@ describe("bubblegum", () => {
commitment: "confirmed",
}
);
const metadataArgsBuffer = mintIx.data.slice(8)
const metadataArgsHash = keccak_256.digest(metadataArgsBuffer);
const sellerFeeBasisPointsNumberArray = bufferToArray(num16ToBuffer(metadata.sellerFeeBasisPoints))
const allDataToHash = metadataArgsHash.concat(sellerFeeBasisPointsNumberArray)
const dataHash = bufferToArray(
Buffer.from(keccak_256.digest(mintIx.data.slice(8)))
Buffer.from(keccak_256.digest(allDataToHash))
);
const creatorHash = bufferToArray(Buffer.from(keccak_256.digest([])));
let onChainRoot = await getRootOfOnChainMerkleRoot(connection, merkleRollKeypair.publicKey);
Expand Down

0 comments on commit 34c9ccd

Please sign in to comment.