Skip to content

Commit

Permalink
updated deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
prayagsingh committed Sep 14, 2021
1 parent c5f162f commit 71287be
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 41 deletions.
4 changes: 2 additions & 2 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ module.exports = {
// accounts: [privateKey1, privateKey2, ...]
// }
polygon_test: {
url: `https://rpc-mumbai.maticvigil.com/v1/${POLYGON_TEST_API_KEY}`,
//url: "https://matic-mumbai.chainstacklabs.com/",
//url: `https://rpc-mumbai.maticvigil.com/v1/${POLYGON_TEST_API_KEY}`,
url: "https://matic-mumbai.chainstacklabs.com/",
chainId: 80001,
// The address to use as default sender. If not present the first account of the node is used
//from: ,
Expand Down
32 changes: 0 additions & 32 deletions scripts/deploy-box-script.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ async function main() {
const WALLET_ADDRESS = deployer.address
console.log("WALLET ADDRESS: ", WALLET_ADDRESS);
// change this address accordingly
const CONTRACT_ADDRESS = 'change_this';
const CONTRACT_ADDRESS = '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6';
const box = Box.attach(CONTRACT_ADDRESS);

// Setter
//const result = await box.store(22);
//console.log("Executed Store method and result is:", result.data.toString());

// Getter
const value = await box.retrieve();
console.log('Box value is', value.toString());
const value = await box.A(1,2);
console.log('Box.A() value is', value.toString());

}
main().then(() => process.exit(0)).catch(error => {
Expand Down
31 changes: 31 additions & 0 deletions scripts/execute_boxv2_func.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const hre = require("hardhat");
require('dotenv').config();

async function main() {

const [deployer] = await ethers.getSigners();

console.log("Deploying contracts with the account:", deployer.address);

const BoxV2 = await hre.ethers.getContractFactory("BoxV2");

const WALLET_ADDRESS = deployer.address
console.log("WALLET ADDRESS: ", WALLET_ADDRESS);
// change this address accordingly
const CONTRACT_ADDRESS = '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6';
const boxv2 = await BoxV2.attach(CONTRACT_ADDRESS);

// Setter
//const result = await box.store(22);
//console.log("Executed Store method and result is:", result.data.toString());

// Getter
await boxv2.initializeV2();
const value = await boxv2.B(1);
console.log('BoxV2.B() value is', value.toString());

}
main().then(() => process.exit(0)).catch(error => {
console.error(error);
process.exit(1);
});
6 changes: 3 additions & 3 deletions scripts/upgradeProxy_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ async function main () {

// address generated when deployed deployProxy Box
// the address of our proxy contract from when we deployed our Box contract
const proxyAddress = 'change_this';
const proxyAddress = '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6';

const BoxV2 = await ethers.getContractFactory('BoxV2');
console.log('Upgrading Box...');

await upgrades.upgradeProxy(proxyAddress, BoxV2);
console.log('Box upgraded');
const boxv2 = await upgrades.upgradeProxy(proxyAddress, BoxV2);
console.log('Box upgraded and address is: ', boxv2.address);
}

main().then(() => process.exit(0)).catch(error => {
Expand Down
2 changes: 1 addition & 1 deletion test/boxv2-proxy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('BoxV2 (upgrade-proxy)', function () {

// Test case
it('returns 35 as a result when successful', async function () {

await boxV2.initializeV2();
const result = await boxV2.B(1);
console.log("result in B() is: ", result.toString());
// Test if the returned value is the same one
Expand Down

0 comments on commit 71287be

Please sign in to comment.