mirror of
https://github.com/PatrickAlphaC/dungeons-and-dragons-nft.git
synced 2021-05-29 14:48:35 +03:00
updated
This commit is contained in:
@@ -66,6 +66,7 @@ This will give you the overview of your NFT. You'll see `BN` since the call retu
|
|||||||
You can get an [Etherscan API key](https://etherscan.io/apis) for free and interact with the NFTs on chain. Then set `ETHERSCAN_API_KEY ` as an environment variable.
|
You can get an [Etherscan API key](https://etherscan.io/apis) for free and interact with the NFTs on chain. Then set `ETHERSCAN_API_KEY ` as an environment variable.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
npm install truffle-plugin-verify
|
||||||
truffle run verify DungeonsAndDragonsCharacter --network rinkeby --license MIT
|
truffle run verify DungeonsAndDragonsCharacter --network rinkeby --license MIT
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -114,6 +115,6 @@ Then we just run it like:
|
|||||||
truffle exec scripts/set-token-uri.js --network mainnet
|
truffle exec scripts/set-token-uri.js --network mainnet
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, we can get the address of our NFT and head on over to the opensea testnet marketplace to see if we did it correctly. If done correctly, it'll look [something like this](https://testnets.opensea.io/storefront/dungeonsanddragonscharacter-v6).
|
Now, we can get the address of our NFT and head on over to the opensea testnet marketplace to see if we did it correctly. If done correctly, it'll look [something like this](https://testnets.opensea.io/storefront/dungeonsanddragonscharacter-v9).
|
||||||
|
|
||||||
[Here is the link for adding your testnet NFT contract to be viewed on opensea.](https://testnets.opensea.io/get-listed/step-two)
|
[Here is the link for adding your testnet NFT contract to be viewed on opensea.](https://testnets.opensea.io/get-listed/step-two)
|
||||||
File diff suppressed because one or more lines are too long
@@ -1419,8 +1419,8 @@
|
|||||||
"4": {
|
"4": {
|
||||||
"events": {},
|
"events": {},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0xc3e7A50d2Bc7755FeE541AFD9377499baE705E21",
|
"address": "0x58da49E5a7E0314d39B76B7FBDf7bB5171a9E924",
|
||||||
"transactionHash": "0x3dfcd6c004ab0de57ce17f791386654c64427c5eca9ece4cb46ecc849a7120a4"
|
"transactionHash": "0xa4935d72aa5095c4f091916c42070d83d5edc5b37cf05ba518c73b18736e58d3"
|
||||||
},
|
},
|
||||||
"42": {
|
"42": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@@ -1430,7 +1430,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.2.5",
|
"schemaVersion": "3.2.5",
|
||||||
"updatedAt": "2020-11-25T02:35:12.044Z",
|
"updatedAt": "2020-11-25T23:19:25.048Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"methods": {}
|
"methods": {}
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ contract DungeonsAndDragonsCharacter is ERC721, VRFConsumerBase, Ownable {
|
|||||||
return sqrt(characters[tokenId].experience);
|
return sqrt(characters[tokenId].experience);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNumberOfCharacters() public view returns (uint256) {
|
||||||
|
return characters.length;
|
||||||
|
}
|
||||||
|
|
||||||
function getCharacterOverView(uint256 tokenId)
|
function getCharacterOverView(uint256 tokenId)
|
||||||
public
|
public
|
||||||
view
|
view
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "Sergey the Elf",
|
"name": "The Chainlink Elf",
|
||||||
"description": "Inspiring, Based, Mythical, Oracle loving creature. Leading the new world and helping teach about superior digital agreements. Also is good with a bow!",
|
"description": "Inspiring, Based, Mythical, Oracle loving creature. Leading the new world and helping teach about superior digital agreements. Also is good with a bow!",
|
||||||
"image": "https://ipfs.io/ipfs/QmTgqnhFBMkfT9s8PHKcdXBn1f5bG3Q5hmBaR4U6hoTvb1?filename=Chainlink_Elf.png",
|
"image": "https://ipfs.io/ipfs/QmTgqnhFBMkfT9s8PHKcdXBn1f5bG3Q5hmBaR4U6hoTvb1?filename=Chainlink_Elf.png",
|
||||||
"attributes": [
|
"attributes": [
|
||||||
{
|
{
|
||||||
"trait_type": "Strength",
|
"trait_type": "Strength",
|
||||||
"value": 63
|
"value": 84
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Dexterity",
|
"trait_type": "Dexterity",
|
||||||
"value": 10
|
"value": 86
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Constitution",
|
"trait_type": "Constitution",
|
||||||
"value": 7
|
"value": 19
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Intelligence",
|
"trait_type": "Intelligence",
|
||||||
"value": 6
|
"value": 79
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Wisdom",
|
"trait_type": "Wisdom",
|
||||||
"value": 51
|
"value": 93
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Charisma",
|
"trait_type": "Charisma",
|
||||||
"value": 80
|
"value": 53
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Experience",
|
"trait_type": "Experience",
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "Julian the Knight",
|
"name": "The Chainlink Knight",
|
||||||
"description": "Defender against Flash Loan attacks, protector of #Defi protocols. Helping keep the smart contract kingdom secure, reliable, and safe. Also is an amazing artist. ",
|
"description": "Defender against Flash Loan attacks, protector of #Defi protocols. Helping keep the smart contract kingdom secure, reliable, and safe. ",
|
||||||
"image": "https://ipfs.io/ipfs/QmZGQA92ri1jfzSu61JRaNQXYg1bLuM7p8YT83DzFA2KLH?filename=Chainlink_Knight.png",
|
"image": "https://ipfs.io/ipfs/QmZGQA92ri1jfzSu61JRaNQXYg1bLuM7p8YT83DzFA2KLH?filename=Chainlink_Knight.png",
|
||||||
"attributes": [
|
"attributes": [
|
||||||
{
|
{
|
||||||
"trait_type": "Strength",
|
"trait_type": "Strength",
|
||||||
"value": 67
|
"value": 53
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Dexterity",
|
"trait_type": "Dexterity",
|
||||||
"value": 94
|
"value": 54
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Constitution",
|
"trait_type": "Constitution",
|
||||||
"value": 34
|
"value": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Intelligence",
|
"trait_type": "Intelligence",
|
||||||
"value": 81
|
"value": 96
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Wisdom",
|
"trait_type": "Wisdom",
|
||||||
"value": 45
|
"value": 94
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Charisma",
|
"trait_type": "Charisma",
|
||||||
"value": 4
|
"value": 99
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Experience",
|
"trait_type": "Experience",
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "Pepe the Orc",
|
"name": "The Chainlink Orc",
|
||||||
"description": "This green tweeting machine is one of the most exciting and excited creatures on the planet. Don't let his looks fool you, he loves to love new technology and help others get involved. Loves watching 'JSON Parser",
|
"description": "This green tweeting machine is one of the most exciting and excited creatures on the planet. Don't let his looks fool you, he loves to love new technology and help others get involved. Loves watching 'JSON Parser'",
|
||||||
"image": "https://ipfs.io/ipfs/QmW1toapYs7M29rzLXTENn3pbvwe8ioikX1PwzACzjfdHP?filename=Chainlink_Orc.png",
|
"image": "https://ipfs.io/ipfs/QmW1toapYs7M29rzLXTENn3pbvwe8ioikX1PwzACzjfdHP?filename=Chainlink_Orc.png",
|
||||||
"attributes": [
|
"attributes": [
|
||||||
{
|
{
|
||||||
"trait_type": "Strength",
|
"trait_type": "Strength",
|
||||||
"value": 90
|
"value": 46
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Dexterity",
|
"trait_type": "Dexterity",
|
||||||
"value": 16
|
"value": 55
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Constitution",
|
"trait_type": "Constitution",
|
||||||
"value": 76
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trait_type": "Intelligence",
|
|
||||||
"value": 54
|
"value": 54
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Intelligence",
|
||||||
|
"value": 61
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Wisdom",
|
"trait_type": "Wisdom",
|
||||||
"value": 85
|
"value": 93
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Charisma",
|
"trait_type": "Charisma",
|
||||||
"value": 3
|
"value": 21
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Experience",
|
"trait_type": "Experience",
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "Ari the Witch",
|
"name": "The Chainlink Wizard",
|
||||||
"description": "Brilliant spell-slinger and magical with cryptography. Often uses Jewles in his h-index potions. ",
|
"description": "Brilliant spell-slinger and magical with cryptography. Often uses Jewles in her h-index potions. ",
|
||||||
"image": "https://ipfs.io/ipfs/QmPMwQtFpEdKrUjpQJfoTeZS1aVSeuJT6Mof7uV29AcUpF?filename=Chainlink_Witch.png",
|
"image": "https://ipfs.io/ipfs/QmPMwQtFpEdKrUjpQJfoTeZS1aVSeuJT6Mof7uV29AcUpF?filename=Chainlink_Witch.png",
|
||||||
"attributes": [
|
"attributes": [
|
||||||
{
|
{
|
||||||
"trait_type": "Strength",
|
"trait_type": "Strength",
|
||||||
"value": 43
|
"value": 90
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Dexterity",
|
"trait_type": "Dexterity",
|
||||||
"value": 26
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trait_type": "Constitution",
|
|
||||||
"value": 61
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trait_type": "Intelligence",
|
|
||||||
"value": 74
|
"value": 74
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Constitution",
|
||||||
|
"value": 96
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Intelligence",
|
||||||
|
"value": 90
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Wisdom",
|
"trait_type": "Wisdom",
|
||||||
"value": 48
|
"value": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Charisma",
|
"trait_type": "Charisma",
|
||||||
"value": 70
|
"value": 96
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trait_type": "Experience",
|
"trait_type": "Experience",
|
||||||
65
scripts/create-metadata.js
Normal file
65
scripts/create-metadata.js
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
const DungeonsAndDragons = artifacts.require('DungeonsAndDragonsCharacter')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
const metadataTemple = {
|
||||||
|
"name": "",
|
||||||
|
"description": "",
|
||||||
|
"image": "",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"trait_type": "Strength",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Dexterity",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Constitution",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Intelligence",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Wisdom",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Charisma",
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trait_type": "Experience",
|
||||||
|
"value": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
module.exports = async callback => {
|
||||||
|
const dnd = await DungeonsAndDragons.deployed()
|
||||||
|
length = await dnd.getNumberOfCharacters()
|
||||||
|
index = 0
|
||||||
|
while (index < length) {
|
||||||
|
console.log('Let\'s get the overview of your character ' + index + ' of ' + length)
|
||||||
|
let characterMetadata = metadataTemple
|
||||||
|
let characterOverview = await dnd.characters(index)
|
||||||
|
index++
|
||||||
|
characterMetadata['name'] = characterOverview['name']
|
||||||
|
if (fs.existsSync('metadata/' + characterMetadata['name'].toLowerCase().replace(/\s/g, '-') + '.json')) {
|
||||||
|
console.log('test')
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
console.log(characterMetadata['name'])
|
||||||
|
characterMetadata['attributes'][0]['value'] = characterOverview['strength']['words'][0]
|
||||||
|
characterMetadata['attributes'][1]['value'] = characterOverview['dexterity']['words'][0]
|
||||||
|
characterMetadata['attributes'][2]['value'] = characterOverview['constitution']['words'][0]
|
||||||
|
characterMetadata['attributes'][3]['value'] = characterOverview['intelligence']['words'][0]
|
||||||
|
characterMetadata['attributes'][4]['value'] = characterOverview['wisdom']['words'][0]
|
||||||
|
characterMetadata['attributes'][5]['value'] = characterOverview['charisma']['words'][0]
|
||||||
|
filename = 'metadata/' + characterMetadata['name'].toLowerCase().replace(/\s/g, '-')
|
||||||
|
let data = JSON.stringify(characterMetadata)
|
||||||
|
fs.writeFileSync(filename + '.json', data)
|
||||||
|
}
|
||||||
|
callback(dnd)
|
||||||
|
}
|
||||||
@@ -3,9 +3,9 @@ const DungeonsAndDragons = artifacts.require('DungeonsAndDragonsCharacter')
|
|||||||
module.exports = async callback => {
|
module.exports = async callback => {
|
||||||
const dnd = await DungeonsAndDragons.deployed()
|
const dnd = await DungeonsAndDragons.deployed()
|
||||||
console.log('Creating requests on contract:', dnd.address)
|
console.log('Creating requests on contract:', dnd.address)
|
||||||
// const tx = await dnd.requestNewRandomCharacter(77, "Julian the Knight")
|
const tx = await dnd.requestNewRandomCharacter(77, "The Chainlink Knight")
|
||||||
// const tx2 = await dnd.requestNewRandomCharacter(7777777, "Sergey the Elf")
|
const tx2 = await dnd.requestNewRandomCharacter(7777777, "The Chainlink Elf")
|
||||||
const tx3 = await dnd.requestNewRandomCharacter(7, "Ari the Wizard")
|
const tx3 = await dnd.requestNewRandomCharacter(7, "The Chainlink Wizard")
|
||||||
// const tx4 = await dnd.requestNewRandomCharacter(777, "Pepe the Orc")
|
const tx4 = await dnd.requestNewRandomCharacter(777, "The Chainlink Orc")
|
||||||
callback(tx.tx)
|
callback(tx.tx)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ const DungeonsAndDragons = artifacts.require('DungeonsAndDragonsCharacter')
|
|||||||
const TOKENID = 0
|
const TOKENID = 0
|
||||||
module.exports = async callback => {
|
module.exports = async callback => {
|
||||||
const dnd = await DungeonsAndDragons.deployed()
|
const dnd = await DungeonsAndDragons.deployed()
|
||||||
console.log('Let\'s set the tokenURI of your character')
|
console.log('Let\'s set the tokenURI of your characters')
|
||||||
// const tx = await dnd.setTokenURI(0, "https://ipfs.io/ipfs/QmVKfktQ2hLwPEiGaymEajLQGavGGZDSYkwhdo7M17J2z4?filename=knight.json")
|
const tx = await dnd.setTokenURI(0, "https://ipfs.io/ipfs/QmaSED9ZSbdGts5UZqueFJjrJ4oHH3GnmGJdSDrkzpYqRS?filename=the-chainlink-knight.json")
|
||||||
const tx = await dnd.setTokenURI(1, "https://ipfs.io/ipfs/QmTzQzKymQcv2BhGuVNmfLGePoD43rhQEM5eSkxsLFTB9c?filename=elf.json")
|
const tx1 = await dnd.setTokenURI(1, "https://ipfs.io/ipfs/QmTvsVaaHTuMNmwXgbfgkrztFEazAPyzmrb4VSS2PbqLjA?filename=the-chainlink-elf.json")
|
||||||
const tx1 = await dnd.setTokenURI(2, "https://ipfs.io/ipfs/QmREDfvFTT24qC4u7wVXXujtiuP1RfvtHyupwdfGPQDyQi?filename=witch.json")
|
const tx2 = await dnd.setTokenURI(2, "https://ipfs.io/ipfs/QmPZQhiBB6pwcxRgwZe2mx6ZizCPYgq8i4FBMETyWK1V2z?filename=the-chainlink-wizard.json")
|
||||||
const tx2 = await dnd.setTokenURI(3, "https://ipfs.io/ipfs/QmS2u1bPTQdAnDYrXE7qzLxyB6sYx2rN6oo8XkYP6sxbd6?filename=orc.json")
|
const tx3 = await dnd.setTokenURI(3, "https://ipfs.io/ipfs/QmS6aznzxshLMcECPQZjCR94UF22WHu6FMM5HLQvaYL9NP?filename=the-chainlink-orc.json")
|
||||||
console.log(tx)
|
console.log(tx)
|
||||||
callback(tx.tx)
|
callback(tx.tx)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module.exports = {
|
|||||||
networks: {
|
networks: {
|
||||||
rinkeby: {
|
rinkeby: {
|
||||||
provider: () => {
|
provider: () => {
|
||||||
return new HDWalletProvider(process.env.MNEMONIC, process.env.RINKEBY_RPC_URL)
|
return new HDWalletProvider(process.env.MNEMONIC_2, process.env.RINKEBY_RPC_URL)
|
||||||
},
|
},
|
||||||
network_id: '4',
|
network_id: '4',
|
||||||
skipDryRun: true,
|
skipDryRun: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user