Smart Contracts for TGE
Install all the dependencies with npm, run the following command
cd DVD_Token
npm installTo test the contract, run the following command
npm run testTo run coverage for the contract, run the following command
npm run coverageTo clean all the temp files from the test, run the following command
npm run cleanCreate a secrets.json file in the root directory and add the following variables
{
"mnemonic": "your-mnemonic",
"infuraKey": "your-infura-key"
}To deploy to a network, run the following command by replacing the NETWORK with one of the following valid values:
- localhost
- ropsten
- rinkeby
- goerli
npx hardhat run --network NETWORK scripts/deploy_upgradable_token.jsSave the deployed contract address as it would be required to upgrade the contract
Create your upgraded contract and save it inside contracts folder and run the following command to compile the new contract
npx hardhat compileNow run the following command
cd scriptsOpen deploy_proxy_token.js file and do the following
- In line 4, change
'TokenV2'at the end of the line to name of your upgraded contract name. For example if your upgraded contract name is DerivedTokenV2, it will be
const TokenV2 = await ethers.getContractFactory('DerivedTokenV2')-
Replace the address in line 8 with your previously deployed contract address
-
Run the following command
cd ..Now run the following command and replace the NETWORK with the network your token is currently deployed
npx hardhat run --network NETWORK scripts/deploy_proxy_token.jsYour contract will be upgraded and the address will remain the same