Skip to content

Commit e2d486f

Browse files
author
-
committed
Changed variable names;
Improved output to user.
1 parent 4efd99a commit e2d486f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

scripts/keyless-deploy-functions.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ const deployKeylessly = async (contractName, bytecodeWithArgs, gasLimit, wallet,
146146

147147
// const txHash = await ethers.provider.send(`eth_sendRawTransaction`, [txSignedSerialized])
148148
const txResponse = await ethers.provider.broadcastTransaction(txSignedSerialized)
149-
await txResponse.wait()
149+
console.log(`txResponse: ${JSON.stringify(txResponse, null, 2)}`)
150+
const txReceipt = await txResponse.wait()
151+
console.log(`txReceipt: ${JSON.stringify(txReceipt, null, 2)}`)
150152

151153
if (await ethers.provider.getCode(addressExpected) !== `0x`) console.log(`${contractName} contract was successfully deployed to ${addressExpected} in transaction ${txResponse.hash}`)
152154
else console.error(`${contractName} contract was not found at ${addressExpected}`)

scripts/upgrade-TESTERC20UG.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,33 @@ async function main() {
55
const [wallet, wallet2] = await ethers.getSigners()
66
console.log(`Using network: ${network.name} (${network.config.chainId}), account: ${wallet.address} having ${await printNativeCurrencyBalance(wallet.address)} of native currency, RPC url: ${network.config.url}`)
77

8-
const tokenContractName = `TESTERC20UGv1`
8+
const implContractName = `TESTERC20UGv1`
99
const contractAddress = `0x18Fb2C4870cC1B9f9440CB0D87c41b25D486A062` // ERC1967Proxy address
1010

11-
const contract = await ethers.getContractAt(tokenContractName, contractAddress)
11+
const contract = await ethers.getContractAt(implContractName, contractAddress)
1212

1313
// await contract.initialize(...constructorArgsOfToken) // 'Initializable: contract is already initialized'
1414

1515
console.log(`V: ${await contract.getV()}`)
1616

1717
// Upgrading
18-
const tokenContractNameV2 = `TESTERC20UGv2`
19-
const cfTokenV2 = await ethers.getContractFactory(tokenContractNameV2)
20-
21-
await upgrades.validateUpgrade(contract, cfTokenV2)
18+
const implContractNameV2 = `TESTERC20UGv2`
19+
const cfTokenV2 = await ethers.getContractFactory(implContractNameV2)
2220

2321
let implAddress = await upgrades.erc1967.getImplementationAddress(contractAddress)
2422
console.log(`Old implementation address: ${implAddress}`)
2523

24+
await upgrades.validateUpgrade(contract, cfTokenV2)
25+
console.log(`validation of upgrade to ${implContractNameV2} was successful. Now upgrading...`)
26+
2627
const upgraded = await upgrades.upgradeProxy(contractAddress, cfTokenV2)
2728
console.log(`Upgraded V: ${await upgraded.getV()}`)
2829

2930
implAddress = await upgrades.erc1967.getImplementationAddress(contractAddress)
3031
console.log(`New implementation address: ${implAddress}`)
3132

33+
console.log(`Continue to use the proxy address ${contractAddress} to operate with your contract`)
34+
3235

3336
// VERIFY ON BLOCKCHAIN EXPLORER
3437
if (![`hardhat`, `localhost`].includes(network.name)) {

0 commit comments

Comments
 (0)