Skip to content

Commit

Permalink
update event
Browse files Browse the repository at this point in the history
  • Loading branch information
justraman committed Oct 7, 2024
1 parent d778607 commit 1da5a41
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mappings/marketplace/events/counter_offer_answered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export async function counterOfferAnswered(
assert(listing.state.listingType === ListingType.Offer, 'Listing is not an offer')
listing.updatedAt = new Date(block.timestamp ?? 0)

const counterOffer = await ctx.store.findOneByOrFail(CounterOffer, { id: `${listing.id}-${account.id}` })

if (data.response.__kind === 'Counter') {
const counterOffer = await ctx.store.findOneByOrFail(CounterOffer, { id: `${listing.id}-${account.id}` })
counterOffer.buyerPrice = data.response.value

await ctx.store.save(counterOffer)
Expand All @@ -127,6 +128,8 @@ export async function counterOfferAnswered(
type: listing.type.toString(),
takeAssetId: listing.takeAssetId.id,
},
buyerPrice: counterOffer.buyerPrice?.toString(),
counterOfferCreator: { id: counterOffer.account.id },
response: data.response.__kind,
account: { id: account.id },
extrinsic: item.extrinsic.id,
Expand Down

0 comments on commit 1da5a41

Please sign in to comment.