diff --git a/scripts/5-deploy-token.mjs b/scripts/5-deploy-token.mjs new file mode 100644 index 00000000..e7c81917 --- /dev/null +++ b/scripts/5-deploy-token.mjs @@ -0,0 +1,20 @@ +import { AddressZero } from "@ethersproject/constants"; +import sdk from './1-initialize-sdk.mjs'; + +(async () => { + try { + const tokenAddress = await sdk.deployer.deployToken({ + name: "Star Sailors Governance Token", + symbol: "SAILOR", + primary_sale_recipient: AddressZero, + }); + console.log("✅ Successfully deployed token contract. Address: ", tokenAddress,); + } catch (error) { + console.error("Failed to deploy token contract. Error: ", error); + } +})(); + +/* Output +👋 -> SDK Initialised by address: 0x15A4C3b42f3386Cd1A642908525469684Cac7C6d +✅ Successfully deployed token contract. Address: 0x6e4A2c27a080ae51C825e7b08D753D8851F9a455 +*/ \ No newline at end of file diff --git a/scripts/6-print-tokens.mjs b/scripts/6-print-tokens.mjs new file mode 100644 index 00000000..4aea7175 --- /dev/null +++ b/scripts/6-print-tokens.mjs @@ -0,0 +1,13 @@ +import sdk from "./1-initialize-sdk.mjs"; + +(async () => { + try { + const token = await sdk.getContract("0x6e4A2c27a080ae51C825e7b08D753D8851F9a455", 'token'); + const amount = 1_000_000; + await token.mint(amount); + const totalSupply = await token.totalSupply(); + console.log("✅ There now are ", totalSupply.displayValue, " $SAILORS in circulation"); + } catch (error) { + console.error("Failed to print tokens, ", error); + } +})(); \ No newline at end of file diff --git a/scripts/7-airdrop-token.mjs b/scripts/7-airdrop-token.mjs new file mode 100644 index 00000000..04b0a33c --- /dev/null +++ b/scripts/7-airdrop-token.mjs @@ -0,0 +1,42 @@ +import sdk from "./1-initialize-sdk.mjs"; + +(async () => { + try { + // This is the address to our ERC-1155 membership NFT contract. + const editionDrop = await sdk.getContract("0x93FC4ba29c41c059fB9f4727F3903df776771Af8", "edition-drop"); + // This is the address to our ERC-20 token contract. + const token = await sdk.getContract("0x6e4A2c27a080ae51C825e7b08D753D8851F9a455", "token"); + // Grab all the addresses of people who own our membership NFT, which has + // a tokenId of 0. + const walletAddresses = await editionDrop.history.getAllClaimerAddresses(0); + + if (walletAddresses.length === 0) { + console.log( + "No NFTs have been claimed yet, maybe get some friends to claim your free NFTs!", + ); + process.exit(0); + } + + // Loop through the array of addresses. + const airdropTargets = walletAddresses.map((address) => { + // Pick a random # between 1000 and 10000. + const randomAmount = Math.floor(Math.random() * (10000 - 1000 + 1) + 1000); + console.log("✅ Going to airdrop", randomAmount, "tokens to", address); + + // Set up the target. + const airdropTarget = { + toAddress: address, + amount: randomAmount, + }; + + return airdropTarget; + }); + + // Call transferBatch on all our airdrop targets. + console.log("🌈 Starting airdrop..."); + await token.transferBatch(airdropTargets); + console.log("✅ Successfully airdropped tokens to all the holders of the NFT!"); + } catch (err) { + console.error("Failed to airdrop tokens", err); + } +})(); \ No newline at end of file