12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- // We require the Hardhat Runtime Environment explicitly here. This is optional
- // but useful for running the script in a standalone fashion through `node <script>`.
- //
- // When running the script with `npx hardhat run <script>` you'll find the Hardhat
- // Runtime Environment's members available in the global scope.
- const { ethers, upgrades } = require("hardhat");
- const deployedContracts = {
- mainnet: '',
- ropsten: '',
- bsc_mainnet: '',
- matic_mainnet: '',
- arbitrum: '',
- arbitrum_rinkeby: '0x4B20EbcFD9a74f969a77B9233a881FC5266930E1',
- xdai: '',
- goerli: '',
- fantom: '',
- avalanche: '',
- celo: '',
- optimism: '',
- optimism_kovan: '',
- aurora: '',
- fuse: '',
- boba: '',
- moonriver: '',
- }
- // deploy, we normally do this only once
- const firstDeployed = false;
- async function main() {
- let proxyAddress = deployedContracts['arbitrum_rinkeby']
- console.log("proxyAddress", proxyAddress)
- if (firstDeployed) {
- const HappyRedPacketImpl = await ethers.getContractFactory("HappyRedPacket");
- const HappyRedPacketProxy = await upgrades.deployProxy(HappyRedPacketImpl, []);
- await HappyRedPacketProxy.deployed()
- console.log("HappyRedPacketProxy deployed to:", HappyRedPacketProxy.address);
- } else {
- // upgrade contract
- const HappyRedPacketImpl = await ethers.getContractFactory('HappyRedPacket')
- const instance = await upgrades.upgradeProxy(proxyAddress, HappyRedPacketImpl)
- console.log("HappyRedPacketProxy upgradeProxy deployed to:", proxyAddress);
- }
- }
- // 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);
- });
|