Skip to content

Commit

Permalink
apply the change to the erc721 burn event too
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Apr 15, 2024
1 parent c5f82b4 commit 3d9cbf6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/engine/paima-sm/src/cde-erc721-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { SQLUpdate } from '@paima/db';
export default async function processErc721Datum(
readonlyDBConn: PoolClient,
cdeDatum: CdeErc721TransferDatum,
isPresync: boolean
inPresync: boolean
): Promise<SQLUpdate[]> {
const cdeId = cdeDatum.cdeId;
const { to, tokenId } = cdeDatum.payload;
Expand All @@ -32,9 +32,12 @@ export default async function processErc721Datum(
const newOwnerData = { cde_id: cdeId, token_id: tokenId, nft_owner: toAddr };
if (ownerRow.length > 0) {
if (isBurn) {
if (cdeDatum.burnScheduledPrefix && !isPresync) {
if (cdeDatum.burnScheduledPrefix) {
const scheduledInputData = `${cdeDatum.burnScheduledPrefix}|${ownerRow[0].nft_owner}|${tokenId}`;
const scheduledBlockHeight = cdeDatum.blockNumber;

const scheduledBlockHeight = inPresync
? ENV.SM_START_BLOCKHEIGHT + 1
: cdeDatum.blockNumber;

updateList.push(createScheduledData(scheduledInputData, scheduledBlockHeight));
}
Expand Down

0 comments on commit 3d9cbf6

Please sign in to comment.