How queue works
Explanation on how NFTNode execution queue works
Each lottery will have a timer, specifically 24 hours interval for daily draw and 7 days interval for weekly draw, nodes will be checking this trough the autospin function which run successfully if its on correct time using current timestamp vs last autospin execution timestamp and if there’s x number of players and y amount in USD in the jackpot (converted by the crypto price) , the function will be executed by these users/nodes via their own script on their servers or via “gelato” servers which is a decentralized network of PCs running functions automatically as a service for end users. In order to receive rewards, you have to first stake the NFT from Luckblocks NFTnodes collection on our platform, this step is needed for the configuration smartcontract to guarantee your ownership, set your NFT on the on-chain queue system and take it out from the market, as you couldn’t sell a activated NFTnode. The payments will be rotative and random for the active nodes , so we will have a active queue (nfts that hasn’t paid yet) and a waiting queue (nfts that is recently configured or already paid on that round).
Lets take this process of staking and round of payment as example:
Bob has staked his NFTs of ID 20 and 34, the contract will config those tokens as Bob Tokens.
and Alice has staked her NFT of ID 11, the contract will config those tokens as Alice Token.
so now they configure the automation to run the function autospin() with this IDs and their wallet, all the 4 lotteries has this function and with same NFT you can run the autospin function on any and all of them, when the function is executed, the Luckblocks contract will activate those nodes to receive rewards on next round, puting them on the waiting queue.
Luckblocks contract do a check if there’s any tokens yet to receive reward on the active queue, if there’s none, it pays a random waiting node execute the draw function and put all tokens from the waiting queue to the active queue.
in that example we have [20,34,11] waiting queue and no active queue.
lets say it paid 34, so Bob receives reward in USDT and contract put all these tokens to the active queue.
then the cycle repeats, on next autospin it chooses a random active node, since we now have tokens there, lets say it now it chose NFT number 20, it will pay Bob reward in USDT and put that paid token to the waiting queue.
The active queue now looks like this [34,11]. and waiting queue like this [20].
Each lottery/game smartcontract has its own queue, so if token 20 executed the BTC auto spin, it will be able to run for CRANNI ,ETH or POL lotteries, if on the active queue for these lotteries.
If there’s NFTs on the active queue where the owners is not executing the autospin function,after 5 minutes the contract will auto resets queue and slash these nft tokens from the list , so the queue doens’t hang up, and so that the active nodes which were on the waiting queue can back up to the active queue and run the function normally.
Last updated