filer out illegal ROcketers

This commit is contained in:
Mentor 2022-06-14 10:52:02 +02:00
parent 39af318d67
commit 3fda0c9cb1

View File

@ -212,9 +212,13 @@ exports.notify_holders_of_changing_room_updates = async context => {
// Get all Rocketeers with outfits available // Get all Rocketeers with outfits available
const network = dev ? `rinkeby` : `mainnet` const network = dev ? `rinkeby` : `mainnet`
const limit = dev ? 50 : 5000 // max supply 3475 const limit = dev ? 50 : 5000 // max supply 3475
log( `Getting ${ limit } rocketeers on ${ network }` ) console.log( `Getting ${ limit } rocketeers on ${ network }` )
const all_rocketeers = await db.collection( `${ network }Rocketeers` ).limit( limit ).get().then( dataFromSnap ) let all_rocketeers = await db.collection( `${ network }Rocketeers` ).limit( limit ).get().then( dataFromSnap )
log( `Got ${ all_rocketeers.length } Rocketeers` ) console.log( `Got ${ all_rocketeers.length } Rocketeers` )
// FIlter out API abuse rocketeers
all_rocketeers = all_rocketeers.filter( ( {uid} ) => uid > 0 && uid <= 3475 )
console.log( `Proceeding with ${ all_rocketeers.length } valid Rocketeers` )
// Check which rocketeers have outfits available // Check which rocketeers have outfits available
const has_outfit_available = all_rocketeers.filter( rocketeer => { const has_outfit_available = all_rocketeers.filter( rocketeer => {
@ -229,6 +233,8 @@ exports.notify_holders_of_changing_room_updates = async context => {
} ) } )
// Get the owning wallets of available outfits // Get the owning wallets of available outfits
const owners = await Promise.all( has_outfit_available.map( async ( { uid } ) => { const owners = await Promise.all( has_outfit_available.map( async ( { uid } ) => {
log( `Getting owner of `, uid ) log( `Getting owner of `, uid )