-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
cfca156
commit 16cff8f
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
*/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
})(); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
})(); |