Skip to content

Commit

Permalink
upgrade deps (york-blockchain#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvinparikh committed Mar 23, 2021
1 parent 28f3fc7 commit fef77dc
Show file tree
Hide file tree
Showing 9 changed files with 4,546 additions and 4,168 deletions.
7 changes: 0 additions & 7 deletions .env.sample

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ module.exports = {
"rules": {
"semi": ["error", "never"]
}
};
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
.env*
*.DS_Store
.env.private
.env
1 change: 0 additions & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
8.11.2
4,119 changes: 0 additions & 4,119 deletions package-lock.json

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"license": "ISC",
"dependencies": {
"@openzeppelin/contracts": "^2.4.0",
"@truffle/hdwallet-provider": "^1.2.1",
"dotenv": "^8.2.0",
"ethers": "^5.0.0-beta.191",
"truffle": "^5.1.9",
"truffle-flattener": "^1.4.2",
"truffle-hdwallet-provider": "^1.0.17"
"ethers": "^5.0.26",
"truffle": "^5.1.63",
"truffle-flattener": "^1.5.0"
}
}
16 changes: 10 additions & 6 deletions scripts/mint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const NETWORK = process.env.NETWORK;
const NUM_CREATURES = 1;

if (!PRIVATE_KEY || !OWNER_ADDRESS || !NETWORK) {
console.error("Please set a private key, owner, network, and contract address, see .env.sample");
console.error(
"Please set a private key, owner, network, and contract address, see .env.sample"
);
return;
}

Expand Down Expand Up @@ -56,18 +58,20 @@ async function main() {
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);

if (NFT_CONTRACT_ADDRESS) {
const nftContract = new ethers.Contract(NFT_CONTRACT_ADDRESS, NFT_ABI, wallet);
const nftContract = new ethers.Contract(
NFT_CONTRACT_ADDRESS,
NFT_ABI,
wallet
);
// Creatures issued directly to the owner.
let mints = [];

for (var i = 0; i < NUM_CREATURES; i++) {
mints.push(nftContract.mintTo(OWNER_ADDRESS));
mints.push(nftContract.mintTo(OWNER_ADDRESS,{gasLimit:10000000}));
}

Promise.all(mints)
.then( (result) => {
console.log("Minted Creature. Transaction:", result)
})
.then((result) => console.log("Minted Creature. Transaction:", result))
.catch((err) => console.log(err));
}
}
Expand Down
69 changes: 39 additions & 30 deletions truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* phrase from a file you've .gitignored so it doesn't accidentally become public.
*
*/
require('dotenv').config("./env")
const ethers = require('ethers');
const HDWalletProvider = require('truffle-hdwallet-provider');
require("dotenv").config("./env");
// const ethers = require("ethers");
const HDWalletProvider = require("@truffle/hdwallet-provider");
// const infuraKey = "fj4jll3k.....";
//
// const fs = require('fs');
// const mnemonic = fs.readFileSync(".secret").toString().trim();
const privateKey = process.env.PRIVATE_KEY;
// const privateKey = process.env.PRIVATE_KEY;

module.exports = {
/**
Expand Down Expand Up @@ -52,40 +52,49 @@ module.exports = {

// Another network with more advanced options...
// advanced: {
// port: 8777, // Custom port
// network_id: 1342, // Custom network
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
// from: <address>, // Account to send txs from (default: accounts[0])
// websockets: true // Enable EventEmitter interface for web3 (default: false)
// port: 8777, // Custom port
// network_id: 1342, // Custom network
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
// from: <address>, // Account to send txs from (default: accounts[0])
// websockets: true // Enable EventEmitter interface for web3 (default: false)
// },

// Useful for deploying to a public network.
// NB: It's important to wrap the provider as a function.
ropsten: {
provider: () => new HDWalletProvider(privateKey, (new ethers.providers.InfuraProvider("ropsten")).connection.url),
network_id: 3, // Ropsten's id
from: process.env.OWNER_ADDRESS,
gas: 5500000, // Ropsten has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
provider: () =>
new HDWalletProvider({
mnemonic: {
phrase: `${process.env.MNEMONIC}`,
},
providerOrUrl: `https://ropsten.infura.io/v3/${process.env.INFURA_KEY}`,
numberOfAddresses: 1,
shareNonce: true,
derivationPath: "m/44’/60’/0’/0",
}),
network_id: 3, // Ropsten's id
},
rinkeby: {
provider: () => new HDWalletProvider(privateKey, (new ethers.providers.InfuraProvider("rinkeby")).connection.url),
network_id: 4, // Rinkeby's id
from: process.env.OWNER_ADDRESS,
gas: 5500000, // Ropsten has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
provider: () =>
new HDWalletProvider({
mnemonic: {
phrase: `${process.env.MNEMONIC}`,
},
providerOrUrl: `https://rinkeby.infura.io/v3/${process.env.INFURA_KEY}`,
numberOfAddresses: 1,
shareNonce: true,
derivationPath: "m/44'/60'/0'/0/",
pollingInterval: 8000
}),
network_id: 4, // Rinkeby's id
},

// Useful for private networks
// private: {
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// }
},

Expand All @@ -106,6 +115,6 @@ module.exports = {
// },
// evmVersion: "byzantium"
// }
}
}
}
},
},
};
Loading

0 comments on commit fef77dc

Please sign in to comment.