Skip to content

Commit

Permalink
update for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
sdmg15 committed Jun 1, 2023
1 parent 05e77d5 commit f7321e9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 41 deletions.
6 changes: 2 additions & 4 deletions contracts/WGhost.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

contract WGhost is Initializable, ERC20Upgradeable, OwnableUpgradeable, UUPSUpgradeable {
contract WGhostV1 is Initializable, ERC20Upgradeable, OwnableUpgradeable, UUPSUpgradeable {
using ECDSA for bytes32;

address public contractOwner;
Expand All @@ -25,9 +25,7 @@ contract WGhost is Initializable, ERC20Upgradeable, OwnableUpgradeable, UUPSUpgr
}

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
constructor() initializer {}

function initialize() initializer public {
__ERC20_init("Wrapped Ghost", "WGhost");
Expand Down
11 changes: 7 additions & 4 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const WGhost = artifacts.require("WGhost");
const { deployProxy } = require('@openzeppelin/truffle-upgrades');

module.exports = function(deployer) {
deployer.deploy(WGhost);
};
const WGhost = artifacts.require('WGhostV1');

module.exports = async function (deployer) {
const instance = await deployProxy(WGhost, { deployer, kind: 'uups'});
console.log('Deployed', instance.address);
};
12 changes: 12 additions & 0 deletions migrations/3_deploy_upgreadable.js.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Example to use while doing upgrades

const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');

const WGhost = artifacts.require('WGhost');
const WGhostV2 = artifacts.require('WGhostV2');

module.exports = async function (deployer) {
const existing = await WGhost.deployed();
const instance = await upgradeProxy(existing.address, WGhostV2, { deployer });
console.log("Upgraded", instance.address);
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"yargs": "^12.0.2"
},
"devDependencies": {
"@openzeppelin/truffle-upgrades": "^1.18.0",
"@openzeppelin/truffle-upgrades": "^1.19.0",
"truffle-hdwallet-provider-privkey": "^0.3.0"
}
}
32 changes: 0 additions & 32 deletions truffle-config.js

This file was deleted.

0 comments on commit f7321e9

Please sign in to comment.