Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Handler to mark offers as expired. #13

Open
vikiival opened this issue Apr 9, 2022 · 4 comments
Open

Handler to mark offers as expired. #13

vikiival opened this issue Apr 9, 2022 · 4 comments

Comments

@vikiival
Copy link
Member

vikiival commented Apr 9, 2022

The task:

  • You need to fetch offers whose expires lower or equal to current block number.
  • Set their status as EXPIRED
  • Save into DB

There are basically two options:

  1. Do it on action of the NFT (LIST, ACCEPT_OFFER, SEND) - per particular NFT

  2. Do it automatically every 100 blocks (// 5 blocks/min, so every 20 min) on all dataset

May @dzhelezov can drop a comment

@vikiival
Copy link
Member Author

I was ahead of time ;D

@vikiival vikiival changed the title Post block handler Handler to mark offers as expired. Aug 3, 2022
@KngZhi
Copy link
Contributor

KngZhi commented Aug 3, 2022

👋

@vikiival
Copy link
Member Author

This can be easily hacked with similar approach as I hacked metadata updater

If you need some SQL magic happy to help

@vikiival
Copy link
Member Author

vikiival commented Aug 17, 2023

Basically this handler should be called every 5 min

Sadly I do not handle expire time in dates as this is very variable thing

const OFFER_STATUS_ID = '2';
const OFFER_DELAY_MIN = 5;

export async function updateOfferStatus(block: bigint, store: Store): Promise<void> {
  
}
UPDATE offer SET status = 'EXPIRED' WHERE expiration <= $1
RETURNING id;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants