|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 | 3 | const { Contracts } = require('zos-lib')
|
4 |
| -const MyContract_v0 = Contracts.getFromLocal('MyContract_v0'); |
5 |
| -const MyContract_v1 = Contracts.getFromLocal('MyContract_v1'); |
| 4 | +const MyContractV0 = Contracts.getFromLocal('MyContractV0'); |
| 5 | +const MyContractV1 = Contracts.getFromLocal('MyContractV1'); |
6 | 6 | const AdminUpgradeabilityProxy = Contracts.getFromNodeModules('zos-lib', 'AdminUpgradeabilityProxy');
|
7 | 7 |
|
8 | 8 | module.exports = async function() {
|
9 | 9 | console.log('Deploying MyContract v0...');
|
10 |
| - const myContract_v0 = await MyContract_v0.new(); |
| 10 | + const myContractV0 = await MyContractV0.new(); |
11 | 11 |
|
12 | 12 | console.log('Deploying a proxy pointing to v0...');
|
13 |
| - const proxy = await AdminUpgradeabilityProxy.new(myContract_v0.address); |
| 13 | + const proxy = await AdminUpgradeabilityProxy.new(myContractV0.address); |
14 | 14 |
|
15 | 15 | console.log('Calling initialize(42) on proxy...');
|
16 |
| - let myContract = await MyContract_v0.at(proxy.address); |
| 16 | + let myContract = await MyContractV0.at(proxy.address); |
17 | 17 | const value = 42;
|
18 | 18 | await myContract.initialize(value);
|
19 | 19 | console.log('Proxy\'s storage value: ' + (await myContract.value()).toString());
|
20 | 20 |
|
21 | 21 | console.log('Deploying MyContract v1...');
|
22 |
| - const myContract_v1 = await MyContract_v1.new(); |
| 22 | + const myContractV1 = await MyContractV1.new(); |
23 | 23 |
|
24 | 24 | console.log('Upgrading proxy to v1...');
|
25 |
| - await proxy.upgradeTo(myContract_v1.address); |
26 |
| - myContract = await MyContract_v1.at(proxy.address); |
| 25 | + await proxy.upgradeTo(myContractV1.address); |
| 26 | + myContract = await MyContractV1.at(proxy.address); |
27 | 27 |
|
28 | 28 | await myContract.add(1);
|
29 | 29 | console.log('Proxy\'s storage new value: ' + (await myContract.value()).toString());
|
|
0 commit comments