Skip to content

Commit

Permalink
Merge pull request #8736 from reservoirprotocol/zora-issue
Browse files Browse the repository at this point in the history
Zora issue
  • Loading branch information
georgeroman authored May 15, 2024
2 parents 9db4925 + 36710c8 commit e4e1277
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/indexer/src/orderbook/mints/calldata/detector/zora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@ export const extractByCollectionERC1155 = async (
baseProvider
);

let mintFee = bn(0);
try {
mintFee = await c.mintFee();
} catch {
// Skip errors
mintFee = bn("700000000000000");
totalRewards = bn("700000000000000");
}

const contractName = await s.contractName();
if (contractName === "Fixed Price Sale Strategy") {
const fixedSale = new Contract(
Expand All @@ -349,14 +358,8 @@ export const extractByCollectionERC1155 = async (
c.getTokenInfo(tokenId),
]);

let mintFee = bn(0);
try {
mintFee = await c.mintFee();
} catch {
// Skip errors
}

const price = saleConfig.pricePerToken.add(mintFee).toString();

results.push({
collection,
contract: collection,
Expand Down Expand Up @@ -448,10 +451,9 @@ export const extractByCollectionERC1155 = async (
baseProvider
);

const [saleConfig, tokenInfo, mintFee] = await Promise.all([
const [saleConfig, tokenInfo] = await Promise.all([
merkleSale.sale(collection, tokenId),
c.getTokenInfo(tokenId),
c.mintFee(),
]);

const merkleRoot = merkleSale.merkleRoot;
Expand Down
22 changes: 22 additions & 0 deletions packages/indexer/src/tests/mints/zora.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,26 @@ describe("Mints - Zora", () => {
}
expect(collectionMints[0]?.details.tx.data.signature).toBe("0xf54f216a");
});

it("mint-detect-issue", async () => {
// Optimism
const collection = `0x0a7695F65733cC8a3531babfD9e1E60cbE23f178`;
const transcation = await utils.fetchTransaction(
"0x166f4fa322577a52b5a984a2224873d56ec87349b80d699dddab6723b5b963e8"
);
const collectionMints = await extractByTx(collection, transcation);
// expect(collectionMints.length).not.toBe(0);
// expect(infos[0]?.details.tx.data.signature).toBe("0x9dbb844d");
for (const collectionMint of collectionMints) {
const data = await generateCollectionMintTxData(
collectionMint,
"0x0000000000000000000000000000000000000001",
1
);
// console.log("data", data);
expect(data.txData.data.includes("0x9dbb844d")).toBe(true);
// const result = await simulateCollectionMint(collectionMint);
// expect(result).toBe(true);
}
});
});

0 comments on commit e4e1277

Please sign in to comment.