Skip to content

Commit

Permalink
fix: init issue
Browse files Browse the repository at this point in the history
  • Loading branch information
orionstardust committed Mar 21, 2024
1 parent ec12631 commit 03c7e93
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export function handleAuction_Initialized(
statistics.save();

let auction = getOrCreateAuction(event.params._auctionID, event);

log.debug(`ttt:111`, [auction.bidDecimals.toString()]);
if (auction == null) {
auction = new Auction(event.params._auctionID.toString());
}
Expand All @@ -316,6 +316,7 @@ export function handleAuction_Initialized(
"0x0000000000000000000000000000000000000000"
);
auction.cancelled = false;
log.debug(`ttt:222`, [auction.bidDecimals.toString()]);

//Fetch auction info from contract
let contract = Contract.bind(event.address);
Expand All @@ -326,6 +327,7 @@ export function handleAuction_Initialized(
// @todo: seller, createdAt, startsAt, endsAt, claimAt,
// contractId quantity, presetId, cancelled, ercType, bids objects
if (!result.reverted) {
log.debug(`ttt:333`, [auction.bidDecimals.toString()]);
let auctionInfo = result.value;

auction.category = auctionInfo.info.category;
Expand Down Expand Up @@ -356,13 +358,15 @@ export function handleAuction_Initialized(
auction.highestBidder = auctionInfo.highestBidder;
auction.cancellationPeriodDuration = BIGINT_CANCELLATION_PERIOD_IN_SECONDS;

log.debug(`ttt:444`, [auction.bidDecimals.toString()]);
auction = updateProceeds(auction);
}

if (!resultHammerTime.reverted) {
auction.hammerTimeDuration = resultHammerTime.value;
}

log.debug(`ttt:555`, [auction.bidDecimals.toString()]);
auction.save();

let contractEntity = ContractEntity.load(
Expand Down

0 comments on commit 03c7e93

Please sign in to comment.