This package contains two scripts that allow to :
- Fetch the metadata of Luchadores NFT collection.
- Calculate the number of yield tokens available for a given list of luchadores NFT.
To run this script you need Node.js and a package manager yarn or npm
git clone git@github.com:0xPanku/lucha-d-or.git
cd lucha-d-or
yarnnpx ts-node src/fetch.ts
It will retrieve the metadata of each Luchador and save it under data/luchadores to the json format.
It will also create split files, that are simple list of Luchador ID grouped by number of attributes.
As there is 10000 Luchadores the script may take a long time to run (30 min or more). In order to save time, you can find the split files under data/split
The metadata are retrieve from the address provided by the smart contract. You can find it here under the base URI section.
https://etherscan.io/address/0x8b4616926705Fb61E9C4eeAc07cd946a5D4b0760#readContract
You could easily use this script with any NFT collection by removing all the code about the attributes.
npx ts-node src/app.ts
Before to run the script you need to adapt the parameters in src/config.ts
1. Add your provider URL
you can get one on alchemy.com
export const PROVIDER_URL: string = 'https://polygon-mainnet.g.alchemy.com/v2/XXXXX'2. Add the ids of the Luchador you want to scan
There are two ways to do it. You can add specific IDs into the LUCHADOR_IDS array.
export const LUCHADOR_IDS = []Or you can specify a number of attributes. For example, this will check all Luchadores with 0, 6 and 7 attributes.
export const LUCHADOR_ATTRIBUTES = [0,6,7]// Put number of attributes you want to check. ( 0 to 7) export const LUCHADOR_ATTRIBUTES = [0,6,7]
3. adjust the price of the lucha token
export const TOKEN_PRICE_IN_USD = 0.03192477;This script will query the smart contract to find out how many lucha tokens are claimable for a given list of Luchadores NFT.
The results will be available in a json file under data/output.
The result is sorted in descending order.
You can speed up the result by setting FETCH_RATE at false. This will result in half the number of requests but you won't get the yield rate.
export const FETCH_RATE: boolean = false;