@velocitycareerlabs/verification-coupon-contract 1.25.0-dev-build.12642c864
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openzeppelin/unknown-1480.json +2156 -0
- package/.openzeppelin/unknown-1481.json +1704 -0
- package/.openzeppelin/unknown-1482.json +1704 -0
- package/.openzeppelin/unknown-1483.json +927 -0
- package/LICENSE +248 -0
- package/build/contracts/Migrations.json +1109 -0
- package/contracts/Migrations.sol +18 -0
- package/contracts/VerificationCoupon.sol +147 -0
- package/migration-status.js +41 -0
- package/migrations/10_vl-3756-emit-burn-time.js +17 -0
- package/migrations/11_vl-5092-new-permissions.js +21 -0
- package/migrations/12_vl-8185-allow-unknown-types.js +21 -0
- package/migrations/1_initial_migration.js +5 -0
- package/migrations/2_deploy_contract.js +9 -0
- package/migrations/3_deploy_contract_ERC_1155.js +9 -0
- package/migrations/4_set_balances.js +65 -0
- package/migrations/5_remove_tx_origin.js +19 -0
- package/migrations/6_vl-2898-operator_burn.js +17 -0
- package/migrations/7_vl-2898-fix-get-token-id-operator.js +17 -0
- package/migrations/8_vl-4587-get-token-id-expired-behavior.js +17 -0
- package/migrations/9_vl-3994-emit-balance-expiration.js +17 -0
- package/migrations/contracts-v1/metadata-registry.json +29674 -0
- package/migrations/contracts-v1/revocation-registry.json +19060 -0
- package/migrations/contracts-v1/verification-coupon.json +31724 -0
- package/package.json +32 -0
- package/test/verification-coupon.test.js +637 -0
- package/truffle-config.js +25 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
pragma solidity 0.8.4;
|
2
|
+
|
3
|
+
contract Migrations {
|
4
|
+
address public owner = msg.sender;
|
5
|
+
uint public last_completed_migration;
|
6
|
+
|
7
|
+
modifier restricted() {
|
8
|
+
require(
|
9
|
+
msg.sender == owner,
|
10
|
+
"This function is restricted to the contract's owner"
|
11
|
+
);
|
12
|
+
_;
|
13
|
+
}
|
14
|
+
|
15
|
+
function setCompleted(uint completed) public restricted {
|
16
|
+
last_completed_migration = completed;
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,147 @@
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
2
|
+
|
3
|
+
pragma solidity 0.8.4;
|
4
|
+
|
5
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
6
|
+
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
|
7
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
|
8
|
+
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
|
9
|
+
import "@velocitycareerlabs/permissions-contract/contracts/Permissions.sol";
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @dev {ERC721} token, including:
|
13
|
+
*
|
14
|
+
* - ability for holders to burn (destroy) their tokens
|
15
|
+
* - a minter role that allows for token minting (creation)
|
16
|
+
* - a pauser role that allows to stop all token transfers
|
17
|
+
* - token ID and URI autogeneration
|
18
|
+
*
|
19
|
+
* This contract uses {AccessControl} to lock permissioned functions using the
|
20
|
+
* different roles - head to its documentation for details.
|
21
|
+
*
|
22
|
+
* The account that deploys the contract will be granted the minter and pauser
|
23
|
+
* roles, as well as the default admin role, which will let it grant both minter
|
24
|
+
* and pauser roles to other accounts.
|
25
|
+
*/
|
26
|
+
contract VerificationCoupon is Initializable, AccessControlEnumerableUpgradeable, ERC1155Upgradeable {
|
27
|
+
address VNF;
|
28
|
+
using CountersUpgradeable for CountersUpgradeable.Counter;
|
29
|
+
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
30
|
+
|
31
|
+
mapping(uint256 => uint256) private expirationTime;
|
32
|
+
|
33
|
+
mapping(address => uint256[]) private ownerTokens;
|
34
|
+
|
35
|
+
CountersUpgradeable.Counter private _tokenIdTracker;
|
36
|
+
|
37
|
+
string private _tokenName;
|
38
|
+
|
39
|
+
Permissions internal permissions;
|
40
|
+
|
41
|
+
event MintCouponBundle(address owner, uint256 bundleId, uint256 expirationTime, uint256 quantity, string traceId, string ownerDid);
|
42
|
+
|
43
|
+
event BurnCoupon(address owner, uint256 bundleId, string traceId, string caoDid, string burnerDid, uint256 balance, uint256 expirationTime, uint256 burnTime);
|
44
|
+
|
45
|
+
function initialize(string memory tokenName, string memory baseTokenURI) public initializer {
|
46
|
+
ERC1155Upgradeable.__ERC1155_init(baseTokenURI);
|
47
|
+
VNF = msg.sender;
|
48
|
+
_tokenName = tokenName;
|
49
|
+
|
50
|
+
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
|
51
|
+
_setupRole(MINTER_ROLE, msg.sender);
|
52
|
+
}
|
53
|
+
|
54
|
+
function setPermissionsAddress(address _permissions) public {
|
55
|
+
require(msg.sender == VNF, "The caller is not VNF");
|
56
|
+
permissions = Permissions(_permissions);
|
57
|
+
}
|
58
|
+
|
59
|
+
function getVNF() public view returns (address) {
|
60
|
+
return VNF;
|
61
|
+
}
|
62
|
+
|
63
|
+
function isExpired(uint256 tokenId) public view returns (bool) {
|
64
|
+
return block.timestamp >= expirationTime[tokenId];
|
65
|
+
}
|
66
|
+
|
67
|
+
function getTokenId(address operator) public view returns (uint256) {
|
68
|
+
address primary = permissions.checkOperator(operator);
|
69
|
+
uint256 quantity = ownerTokens[primary].length;
|
70
|
+
require(quantity != 0, "No available tokens");
|
71
|
+
|
72
|
+
uint256 lowestTokenId = type(uint256).max;
|
73
|
+
uint256 currentTokenId;
|
74
|
+
for (uint256 i = 0; i < quantity; i++) {
|
75
|
+
currentTokenId = ownerTokens[primary][i];
|
76
|
+
if (!isExpired(currentTokenId) && currentTokenId < lowestTokenId) {
|
77
|
+
lowestTokenId = currentTokenId;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
require(lowestTokenId != type(uint256).max, "No available tokens");
|
81
|
+
return lowestTokenId;
|
82
|
+
}
|
83
|
+
|
84
|
+
function removeTokenId(uint256 tokenId, address burnAddress) private {
|
85
|
+
uint256[] storage tokenList = ownerTokens[burnAddress];
|
86
|
+
for (uint256 i = 0; i < tokenList.length; i++) {
|
87
|
+
if (tokenId == tokenList[i]) {
|
88
|
+
tokenList[i] = tokenList[tokenList.length - 1];
|
89
|
+
return tokenList.pop();
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
function mint(address to, uint256 _expirationTime, uint256 quantity, string memory traceId, string memory ownerDid) public virtual {
|
95
|
+
require(hasRole(MINTER_ROLE, msg.sender), "VerificationCoupon: must have a minter role to mint");
|
96
|
+
require(quantity > 0, "Invalid quantity");
|
97
|
+
|
98
|
+
uint256 tokenId = _tokenIdTracker.current();
|
99
|
+
_mint(to, tokenId, quantity, "");
|
100
|
+
ownerTokens[to].push(tokenId);
|
101
|
+
expirationTime[tokenId] = _expirationTime;
|
102
|
+
_tokenIdTracker.increment();
|
103
|
+
emit MintCouponBundle(to, tokenId, _expirationTime, quantity, traceId, ownerDid);
|
104
|
+
}
|
105
|
+
|
106
|
+
function burn(uint256 tokenId, string memory traceId, string memory caoDid, string memory burnerDid, address operator) public virtual {
|
107
|
+
require(permissions.checkAddressScope(msg.sender, "coupon:burn"), "Burn: caller does not have coupon:burn permission");
|
108
|
+
address primary = permissions.checkOperator(operator);
|
109
|
+
require(balanceOf(primary, tokenId) > 0, "Burn: bundle has no balance");
|
110
|
+
burnExpiredTokens(primary);
|
111
|
+
|
112
|
+
_burn(primary, tokenId, 1);
|
113
|
+
uint256 balance = balanceOf(primary, tokenId);
|
114
|
+
uint256 expiration = expirationTime[tokenId];
|
115
|
+
if (balance == 0) {
|
116
|
+
delete expirationTime[tokenId];
|
117
|
+
removeTokenId(tokenId, primary);
|
118
|
+
}
|
119
|
+
emit BurnCoupon(primary, tokenId, traceId, caoDid, burnerDid, balance, expiration, block.timestamp);
|
120
|
+
}
|
121
|
+
|
122
|
+
function burnExpiredTokens(address burnAddress) private {
|
123
|
+
uint256 quantity = ownerTokens[burnAddress].length;
|
124
|
+
uint256 currentTokenId;
|
125
|
+
uint256 i = 0;
|
126
|
+
while (i < quantity) {
|
127
|
+
currentTokenId = ownerTokens[burnAddress][i];
|
128
|
+
if (isExpired(currentTokenId)) {
|
129
|
+
uint256 balance = balanceOf(burnAddress, currentTokenId);
|
130
|
+
_burn(burnAddress, currentTokenId, balance);
|
131
|
+
delete expirationTime[currentTokenId];
|
132
|
+
removeTokenId(currentTokenId, burnAddress);
|
133
|
+
quantity--;
|
134
|
+
} else {
|
135
|
+
i++;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable) returns (bool) {
|
141
|
+
return super.supportsInterface(interfaceId);
|
142
|
+
}
|
143
|
+
|
144
|
+
function _getTokenName() public view virtual returns (string memory) {
|
145
|
+
return _tokenName;
|
146
|
+
}
|
147
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
const Web3 = require('web3');
|
2
|
+
const Migrations = require('./build/contracts/Migrations.json');
|
3
|
+
const truffleConfig = require('./truffle-config');
|
4
|
+
|
5
|
+
const cmd = process.argv[2] || 'get';
|
6
|
+
const env = process.argv[3] || 'localdocker';
|
7
|
+
const value = process.argv[4] || '1';
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
11
|
+
|
12
|
+
const config = {
|
13
|
+
contractAddress: Migrations.networks[networkId].address,
|
14
|
+
provider: truffleConfig.networks[env].provider,
|
15
|
+
gas: truffleConfig.networks[env].gas,
|
16
|
+
gasPrice: truffleConfig.networks[env].gasPrice,
|
17
|
+
};
|
18
|
+
|
19
|
+
const main = async () => {
|
20
|
+
const web3 = new Web3(config.provider);
|
21
|
+
|
22
|
+
const instance = new web3.eth.Contract(
|
23
|
+
Migrations.abi,
|
24
|
+
config.contractAddress
|
25
|
+
);
|
26
|
+
|
27
|
+
if (cmd === 'set') {
|
28
|
+
await instance.methods.setCompleted(value).send({
|
29
|
+
from: config.provider.addresses[0],
|
30
|
+
gas: config.gas,
|
31
|
+
gasPrice: config.gasPrice,
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
const lastCompletedMigration = await instance.methods
|
36
|
+
.last_completed_migration()
|
37
|
+
.call();
|
38
|
+
console.log('last_completed_migration:', lastCompletedMigration);
|
39
|
+
};
|
40
|
+
|
41
|
+
main();
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const truffleConfig = require('../truffle-config.js');
|
2
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
3
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
4
|
+
|
5
|
+
const env = process.argv[4] || 'localdocker';
|
6
|
+
console.log(process.argv[2])
|
7
|
+
console.log('ENV:', env)
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`).proxies[1].address
|
11
|
+
|
12
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
13
|
+
|
14
|
+
module.exports = async function (deployer) {
|
15
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, { deployer });
|
16
|
+
console.log('Upgraded', instance.address);
|
17
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
2
|
+
const truffleConfig = require('../truffle-config');
|
3
|
+
|
4
|
+
const VerificationCoupon = artifacts.require('VerificationCoupon');
|
5
|
+
|
6
|
+
const env = process.argv[4] || 'localdocker';
|
7
|
+
console.log(process.argv[2]);
|
8
|
+
console.log('ENV:', env);
|
9
|
+
const networkId = truffleConfig.networks[env].network_id;
|
10
|
+
|
11
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`)
|
12
|
+
.proxies[1].address;
|
13
|
+
|
14
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
15
|
+
|
16
|
+
module.exports = async (deployer) => {
|
17
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, {
|
18
|
+
deployer,
|
19
|
+
});
|
20
|
+
console.log('Upgraded', instance.address);
|
21
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
2
|
+
const truffleConfig = require('../truffle-config');
|
3
|
+
|
4
|
+
const VerificationCoupon = artifacts.require('VerificationCoupon');
|
5
|
+
|
6
|
+
const env = process.argv[4] || 'localdocker';
|
7
|
+
console.log(process.argv[2]);
|
8
|
+
console.log('ENV:', env);
|
9
|
+
const networkId = truffleConfig.networks[env].network_id;
|
10
|
+
|
11
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`)
|
12
|
+
.proxies[1].address;
|
13
|
+
|
14
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
15
|
+
|
16
|
+
module.exports = async (deployer) => {
|
17
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, {
|
18
|
+
deployer,
|
19
|
+
});
|
20
|
+
console.log('Upgraded', instance.address);
|
21
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
|
2
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
3
|
+
|
4
|
+
module.exports = async function (deployer) {
|
5
|
+
const name = "Velocity Verification Coupon";
|
6
|
+
const baseTokenURI = "https://www.velocitynetwork.foundation/";
|
7
|
+
const instance = await deployProxy(VerificationCoupon, [name, baseTokenURI], { deployer });
|
8
|
+
console.log('Deployed', instance.address);
|
9
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
|
2
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
3
|
+
|
4
|
+
module.exports = async function (deployer) {
|
5
|
+
const name = "Velocity Verification Coupon";
|
6
|
+
const baseTokenURI = "https://www.velocitynetwork.foundation/";
|
7
|
+
const instance = await deployProxy(VerificationCoupon, [name, baseTokenURI], { deployer });
|
8
|
+
console.log('Deployed', instance.address);
|
9
|
+
};
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const Web3 = require('web3');
|
2
|
+
const fs = require('fs');
|
3
|
+
const VerificationCouponV2 = require("../build/contracts/VerificationCoupon");
|
4
|
+
const VerificationCouponV1 = require('./contracts-v1/verification-coupon.json');
|
5
|
+
const truffleConfig = require('../truffle-config.js');
|
6
|
+
|
7
|
+
const env = process.argv[4] || 'localdocker';
|
8
|
+
console.log('ENV:', env)
|
9
|
+
const networkId = truffleConfig.networks[env].network_id;
|
10
|
+
|
11
|
+
const proxies = require(`../.openzeppelin/unknown-${networkId}.json`).proxies;
|
12
|
+
const config = {
|
13
|
+
contractAddressV1: proxies[0].address,
|
14
|
+
contractAddressV2: proxies[1].address,
|
15
|
+
provider: truffleConfig.networks[env].provider,
|
16
|
+
gas: truffleConfig.networks[env].gas,
|
17
|
+
gasPrice: truffleConfig.networks[env].gasPrice,
|
18
|
+
};
|
19
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`, config);
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
module.exports = async function (deployer) {
|
24
|
+
// const web3 = new Web3(config.provider);
|
25
|
+
// const instanceV1 = new web3.eth.Contract(VerificationCouponV1.abi, config.contractAddressV1);
|
26
|
+
//
|
27
|
+
// const events = await instanceV1.getPastEvents('MintCouponBundle', {
|
28
|
+
// fromBlock: 0,
|
29
|
+
// toBlock: 'latest'
|
30
|
+
// });
|
31
|
+
// fs.writeFileSync(`_${env}-events-mint.json`, JSON.stringify(events))
|
32
|
+
// const balances = events.reduce((acc, { returnValues: { owner, ownerDid } })=> {
|
33
|
+
// acc[owner] = { value:0, ownerDid } ;
|
34
|
+
// return acc;
|
35
|
+
// }, {});
|
36
|
+
// for(let account in balances) {
|
37
|
+
// balances[account].value = await instanceV1.methods.balanceOf(account).call();
|
38
|
+
// }
|
39
|
+
// console.log('Balances:', balances);
|
40
|
+
// fs.writeFileSync(`_${env}-balances.json`, JSON.stringify(balances))
|
41
|
+
//
|
42
|
+
// const expirationTime = Math.floor(Date.now() / 1000) + 3 * 30 * 24 * 60 * 60;
|
43
|
+
// const traceId = 'migration';
|
44
|
+
// const instanceV2 = new web3.eth.Contract(VerificationCouponV2.abi, config.contractAddressV2);
|
45
|
+
// const migratedBalances = {};
|
46
|
+
// for(let account in balances) {
|
47
|
+
// console.log('Minting:', account, balances[account]);
|
48
|
+
// if (Number(balances[account].value) > 0) {
|
49
|
+
// await instanceV2.methods.mint(account, expirationTime, balances[account].value, traceId, balances[account].ownerDid).send({
|
50
|
+
// from: config.provider.addresses[0],
|
51
|
+
// gas: config.gas,
|
52
|
+
// gasPrice: config.gasPrice
|
53
|
+
// });
|
54
|
+
// }
|
55
|
+
// migratedBalances[account] = balances[account];
|
56
|
+
// console.log('Minted:', account, balances[account]);
|
57
|
+
// }
|
58
|
+
// fs.writeFileSync(`_${env}-migrated-balances-v2.json`, JSON.stringify(migratedBalances));
|
59
|
+
// const eventsV2 = await instanceV2.getPastEvents('MintCouponBundle', {
|
60
|
+
// fromBlock: 0,
|
61
|
+
// toBlock: 'latest'
|
62
|
+
// });
|
63
|
+
// fs.writeFileSync(`_${env}-events-mint-v2.json`, JSON.stringify(eventsV2));
|
64
|
+
console.log('Balances migrated!');
|
65
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const truffleConfig = require('../truffle-config.js');
|
2
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
3
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
4
|
+
|
5
|
+
const env = process.argv[4] || 'localdocker';
|
6
|
+
console.log(process.argv[2])
|
7
|
+
console.log('ENV:', env)
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`).proxies[1].address
|
11
|
+
const permissionsContractAddress = require(`../../permissions/.openzeppelin/unknown-${networkId}.json`).proxies[0].address
|
12
|
+
|
13
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
14
|
+
|
15
|
+
module.exports = async function (deployer) {
|
16
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, { deployer });
|
17
|
+
console.log('Upgraded', instance.address);
|
18
|
+
await instance.setPermissionsAddress(permissionsContractAddress)
|
19
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const truffleConfig = require('../truffle-config.js');
|
2
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
3
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
4
|
+
|
5
|
+
const env = process.argv[4] || 'localdocker';
|
6
|
+
console.log(process.argv[2])
|
7
|
+
console.log('ENV:', env)
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`).proxies[1].address
|
11
|
+
|
12
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
13
|
+
|
14
|
+
module.exports = async function (deployer) {
|
15
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, { deployer });
|
16
|
+
console.log('Upgraded', instance.address);
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const truffleConfig = require('../truffle-config.js');
|
2
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
3
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
4
|
+
|
5
|
+
const env = process.argv[4] || 'localdocker';
|
6
|
+
console.log(process.argv[2])
|
7
|
+
console.log('ENV:', env)
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`).proxies[1].address
|
11
|
+
|
12
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
13
|
+
|
14
|
+
module.exports = async function (deployer) {
|
15
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, { deployer });
|
16
|
+
console.log('Upgraded', instance.address);
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const truffleConfig = require('../truffle-config.js');
|
2
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
3
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
4
|
+
|
5
|
+
const env = process.argv[4] || 'localdocker';
|
6
|
+
console.log(process.argv[2])
|
7
|
+
console.log('ENV:', env)
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`).proxies[1].address
|
11
|
+
|
12
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
13
|
+
|
14
|
+
module.exports = async function (deployer) {
|
15
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, { deployer });
|
16
|
+
console.log('Upgraded', instance.address);
|
17
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const truffleConfig = require('../truffle-config.js');
|
2
|
+
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
|
3
|
+
const VerificationCoupon = artifacts.require("VerificationCoupon");
|
4
|
+
|
5
|
+
const env = process.argv[4] || 'localdocker';
|
6
|
+
console.log(process.argv[2])
|
7
|
+
console.log('ENV:', env)
|
8
|
+
const networkId = truffleConfig.networks[env].network_id;
|
9
|
+
|
10
|
+
const contractAddress = require(`../.openzeppelin/unknown-${networkId}.json`).proxies[1].address
|
11
|
+
|
12
|
+
console.log(`ENV: ${env} Network Id: ${networkId}`);
|
13
|
+
|
14
|
+
module.exports = async function (deployer) {
|
15
|
+
const instance = await upgradeProxy(contractAddress, VerificationCoupon, { deployer });
|
16
|
+
console.log('Upgraded', instance.address);
|
17
|
+
};
|