refactor: util script to get contract using hardhat defined network
This commit is contained in:
parent
e63a9e765a
commit
ca177a0ffe
|
|
@ -1,7 +1,7 @@
|
|||
// npx hardhat run scripts/mint.js --network mumbai
|
||||
const { getContract } = require('./util');
|
||||
|
||||
// TODO: make this arguments
|
||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
||||
const params = [
|
||||
'0x7ED735b7095C05d78dF169F991f2b7f1A1F1A049', // to
|
||||
'Fleek App', // name
|
||||
|
|
@ -15,10 +15,7 @@ const params = [
|
|||
];
|
||||
|
||||
(async () => {
|
||||
const contract = await hre.ethers.getContractAt(
|
||||
'FleekERC721',
|
||||
contractAddress
|
||||
);
|
||||
const contract = getContract('FleekERC721');
|
||||
|
||||
const transaction = await contract.mint(...params);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
// npx hardhat run scripts/tokenURI.js --network mumbai
|
||||
const { getContract } = require('./util');
|
||||
|
||||
// TODO: make this arguments
|
||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
||||
const tokenId = 3;
|
||||
const tokenId = 1;
|
||||
|
||||
(async () => {
|
||||
const contract = await hre.ethers.getContractAt(
|
||||
'FleekERC721',
|
||||
contractAddress
|
||||
);
|
||||
const contract = await getContract('FleekERC721');
|
||||
|
||||
const transaction = await contract.tokenURI(tokenId);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
// npx hardhat run scripts/upgrade.js --network mumbai
|
||||
const { getContract } = require('./util');
|
||||
|
||||
// TODO: make this arguments
|
||||
const contractAddress = '0x91A425C1CA320A99a09BE1bee114Fce5d30153d9';
|
||||
const params = [
|
||||
3, // tokenId
|
||||
1, // tokenId
|
||||
'97e7908f70f0862d753c66689ff09e70caa43df2', // commit hash
|
||||
'https://github.com/org/new-repo', // repo
|
||||
'new-author', // author
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const contract = await hre.ethers.getContractAt(
|
||||
'FleekERC721',
|
||||
contractAddress
|
||||
);
|
||||
const contract = await getContract('FleekERC721');
|
||||
|
||||
const transaction = await contract.setTokenBuild(...params);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
module.exports.getContract = async function (contractName) {
|
||||
const {
|
||||
address,
|
||||
} = require(`../deployments/${hre.network.name}/${contractName}.json`);
|
||||
|
||||
return hre.ethers.getContractAt(contractName, address);
|
||||
};
|
||||
Loading…
Reference in New Issue