Skip to content

Commit

Permalink
Merge pull request #2 from gryphnft/2.0
Browse files Browse the repository at this point in the history
namespace contract uri
  • Loading branch information
cblanquera authored Mar 8, 2022
2 parents c125283 + 6d18403 commit dbcda6a
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 35 deletions.
4 changes: 3 additions & 1 deletion contracts/Gryph/GryphNamespaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ contract GryphNamespaces is ERC721Base, Ownable, ReentrancyGuard {
/**
* @dev Sets the erc721 required fields
*/
constructor() ERC721Base("Gryph Namespaces", "GNS") {}
constructor(string memory uri) ERC721Base("Gryph Namespaces", "GNS") {
_setContractURI(uri);
}

// ============ Read Methods ============

Expand Down
8 changes: 8 additions & 0 deletions data/GryphNamespaces.contract.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "GRY.PH Namespaces",
"description": "Reserve your collection and profile name on a crosschain NFT marketplace. Get a subdomain at GRY.PH",
"image": "https://gry.ph/images/gryph-8bit-7.png",
"external_link": "https://gry.ph/gns",
"seller_fee_basis_points": 1000,
"fee_recipient": "0x469A288F790998E48C4869360FB60038F4d5fd48"
}
2 changes: 2 additions & 0 deletions data/blacklist.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"luna",
"main",
"meta",
"mint",
"near",
"play",
"sale",
Expand All @@ -36,6 +37,7 @@
"sales",
"stage",
"bitcoin",
"premint",
"sports",
"fashion",
"mainnet",
Expand Down
30 changes: 21 additions & 9 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,35 @@ module.exports = {
localhost: {
url: "http://127.0.0.1:8545",
accounts: [process.env.BLOCKCHAIN_LOCALHOST_PRIVATE_KEY],
contracts: [
process.env.BLOCKCHAIN_LOCALHOST_CONTRACT_ADDRESS
]
contracts: {
namespaces: process.env.BLOCKCHAIN_LOCALHOST_NAMESPACE_ADDRESS,
token: process.env.BLOCKCHAIN_LOCALHOST_TOKEN_ADDRESS,
treasury: process.env.BLOCKCHAIN_LOCALHOST_TREASURY_ADDRESS,
economy: process.env.BLOCKCHAIN_LOCALHOST_ECONOMY_ADDRESS,
vesting: process.env.BLOCKCHAIN_LOCALHOST_VESTING_ADDRESS
}
},
testnet: {
url: "https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
accounts: [process.env.BLOCKCHAIN_TESTNET_PRIVATE_KEY],
contracts: [
process.env.BLOCKCHAIN_TESTNET_CONTRACT_ADDRESS
]
contracts: {
namespaces: process.env.BLOCKCHAIN_TESTNET_NAMESPACE_ADDRESS,
token: process.env.BLOCKCHAIN_TESTNET_TOKEN_ADDRESS,
treasury: process.env.BLOCKCHAIN_TESTNET_TREASURY_ADDRESS,
economy: process.env.BLOCKCHAIN_TESTNET_ECONOMY_ADDRESS,
vesting: process.env.BLOCKCHAIN_TESTNET_VESTING_ADDRESS
}
},
mainnet: {
url: "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
accounts: [process.env.BLOCKCHAIN_MAINNET_PRIVATE_KEY],
contracts: [
process.env.BLOCKCHAIN_MAINNET_CONTRACT_ADDRESS
]
contracts: {
namespaces: process.env.BLOCKCHAIN_MAINNET_NAMESPACE_ADDRESS,
token: process.env.BLOCKCHAIN_MAINNET_TOKEN_ADDRESS,
treasury: process.env.BLOCKCHAIN_MAINNET_TREASURY_ADDRESS,
economy: process.env.BLOCKCHAIN_MAINNET_ECONOMY_ADDRESS,
vesting: process.env.BLOCKCHAIN_MAINNET_VESTING_ADDRESS
}
},
},
solidity: {
Expand Down
55 changes: 55 additions & 0 deletions scripts/blacklist-gns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//to run this on testnet:
// $ npx hardhat run scripts/blacklist-gns.js

const hardhat = require('hardhat')
const blacklist = require('../data/blacklist.json')

async function attach(name, address) {
const Contract = await hardhat.ethers.getContractFactory(name)
return await Contract.attach(address)
}

async function main() {
const network = hardhat.config.networks[hardhat.config.defaultNetwork]
const provider = new hardhat.ethers.providers.JsonRpcProvider(network.url)
const owner = await attach('GryphNamespaces', network.contracts.namespaces)

let buffer = []
for (let i = 0; i < blacklist.length; i++) {
buffer.push(blacklist[i])
if (buffer.length == 10) {
const gasPrice = (await provider.getGasPrice()).mul(30).toString(); //wei
const GgasPrice = Math.ceil(parseInt(gasPrice) / 1000000000)
const gasLimit = Math.floor(GgasPrice * 21000)

console.log('Blacklisting', buffer)

const queue = await owner.blacklist(buffer, { gasPrice, gasLimit })
const tx = await queue.wait()
buffer = []

console.log(tx)
}
}

if (buffer.length) {
const gasPrice = (await provider.getGasPrice()).mul(30).toString(); //wei
const GgasPrice = Math.ceil(parseInt(gasPrice) / 1000000000)
const gasLimit = Math.floor(GgasPrice * 21000)

console.log('Blacklisting', buffer)

const queue = await owner.blacklist(buffer, { gasPrice, gasLimit })
const tx = await queue.wait()
buffer = []

console.log(tx)
}
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().then(() => process.exit(0)).catch(error => {
console.error(error)
process.exit(1)
});
27 changes: 3 additions & 24 deletions scripts/deploy-gns.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,16 @@
// $ npx hardhat run scripts/deploy-gns.js

const hardhat = require('hardhat')
const blacklist = require('../data/blacklist.json')

async function attach(name, address) {
const Contract = await hardhat.ethers.getContractFactory(name)
return await Contract.attach(address)
}
const uri = 'https://ipfs.io/ipfs/bafkreicw32mefimobvabviirb7rao45r3kpy5zdudiputyubcmp2gag4xa'

async function main() {
await hre.run('compile')
const NFT = await hardhat.ethers.getContractFactory('GryphNamespaces')
const nft = await NFT.deploy()
const nft = await NFT.deploy(uri)
await nft.deployed()
console.log('NFT contract deployed to (update .env):', nft.address)
console.log('npx hardhat verify --network', hardhat.config.defaultNetwork, nft.address)

const network = hardhat.config.networks[hardhat.config.defaultNetwork]
const provider = new hardhat.ethers.providers.JsonRpcProvider(network.url)
const owner = await attach('GryphNamespaces', network.contracts[0])

let buffer = []
for (let i = 0; i < blacklist.length; i++) {
buffer.push(blacklist[i])
if (buffer.length == 20) {
const gasPrice = (await provider.getGasPrice()).mul(5).toString(); //wei
const GgasPrice = Math.ceil(parseInt(gasPrice) / 1000000000)
const gasLimit = Math.floor(GgasPrice * 21000)

await owner.blacklist(buffer, { gasPrice, gasLimit })
buffer = []
}
}
}

// We recommend this pattern to be able to use async/await everywhere
Expand All @@ -42,5 +21,5 @@ main().then(() => process.exit(0)).catch(error => {
process.exit(1)
});

//$ npx hardhat verify --network testnet
//$ npx hardhat verify --network testnet 0x5773Fe8CE26FAA9F6d9EeD99283188141C341d4C
//$ npx hardhat verify --network mainnet
2 changes: 1 addition & 1 deletion tests/GryphNamespaces.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('GryphNamespaces Tests', function () {
owner,
holder1,
holder2
] = await getSigners('GryphNamespaces')
] = await getSigners('GryphNamespaces', 'https://ipfs.io/ipfs/bafkreicw32mefimobvabviirb7rao45r3kpy5zdudiputyubcmp2gag4xa')

await owner.withContract.setBaseURI('http://localhost:3000')

Expand Down

0 comments on commit dbcda6a

Please sign in to comment.