Created
July 20, 2021 21:07
-
-
Save vmunix/f0742531800f067c7696be52ef163314 to your computer and use it in GitHub Desktop.
MeebitsDAO red ticket script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NFT = await hre.ethers.getContractFactory("MeebitsDAOAchievements"); | |
const contract = NFT.attach(CONTRACT_ADDRESS); | |
for (let i = START_FROM; i <= users.length; i++) { | |
const user = users[i]; | |
const metadata = createMetadata(SERIES, current_series_id); | |
const pinataName = `achievement_token_#${current_series_id}_metadata.json`; | |
const uri = await pinToIPFS(pinataName, metadata); | |
const run = async () => { | |
let transaction = {}; | |
try { | |
transaction = await contract["safeMint(address,string)"]( | |
user.address, | |
uri | |
); | |
} catch(e) { | |
console.log(e); | |
await run(); | |
} | |
// console.log(transaction.hash); | |
await waitForTrnx(transaction.hash); | |
console.log( | |
`NFT #${current_series_id} minted for address: ${user.address} | Transaction Hash: ${ | |
transaction.hash | |
} | Metadata: ${uri}` | |
); | |
logger.log( | |
`NFT #${current_series_id} minted for address: ${user.address} | Transaction Hash: ${ | |
transaction.hash | |
} | Metadata: ${uri}` | |
); | |
current_series_id++; | |
return | |
} | |
await run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment