@openzeppelin/upgrades-core 1.10.0 → 1.11.0
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/LICENSE +22 -0
- package/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol/BeaconProxy.json +80 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +4 -0
- package/artifacts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +113 -0
- package/artifacts/AdminUpgradeabilityProxy.json +2 -2
- package/artifacts/contracts/proxy/AdminUpgradeabilityProxy.sol/AdminUpgradeabilityProxy.json +2 -2
- package/dist/beacon.d.ts +8 -0
- package/dist/beacon.d.ts.map +1 -0
- package/dist/beacon.js +25 -0
- package/dist/beacon.js.map +1 -0
- package/dist/eip-1967-type.d.ts +4 -0
- package/dist/eip-1967-type.d.ts.map +1 -0
- package/dist/eip-1967-type.js +37 -0
- package/dist/eip-1967-type.js.map +1 -0
- package/dist/eip-1967.d.ts +5 -0
- package/dist/eip-1967.d.ts.map +1 -1
- package/dist/eip-1967.js +19 -12
- package/dist/eip-1967.js.map +1 -1
- package/dist/impl-address.d.ts +19 -0
- package/dist/impl-address.d.ts.map +1 -0
- package/dist/impl-address.js +67 -0
- package/dist/impl-address.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +11 -1
- package/dist/provider.js.map +1 -1
- package/dist/proxy-kind.d.ts +12 -0
- package/dist/proxy-kind.d.ts.map +1 -0
- package/dist/proxy-kind.js +50 -0
- package/dist/proxy-kind.js.map +1 -0
- package/dist/usage-error.d.ts +21 -0
- package/dist/usage-error.d.ts.map +1 -0
- package/dist/usage-error.js +51 -0
- package/dist/usage-error.js.map +1 -0
- package/dist/utils/address.d.ts +8 -0
- package/dist/utils/address.d.ts.map +1 -0
- package/dist/utils/address.js +20 -0
- package/dist/utils/address.js.map +1 -0
- package/dist/validate/overrides.js +1 -1
- package/dist/validate/overrides.js.map +1 -1
- package/package.json +6 -3
- package/src/beacon.ts +20 -0
- package/src/eip-1967-type.ts +35 -0
- package/src/eip-1967.ts +16 -12
- package/src/impl-address.ts +76 -0
- package/src/index.ts +16 -1
- package/src/manifest.ts +1 -1
- package/src/provider.ts +16 -0
- package/src/proxy-kind.ts +59 -0
- package/src/usage-error.ts +68 -0
- package/src/utils/address.ts +16 -0
- package/src/validate/overrides.ts +1 -1
- package/CHANGELOG.md +0 -120
- package/dist/set-proxy-kind.d.ts +0 -5
- package/dist/set-proxy-kind.d.ts.map +0 -1
- package/dist/set-proxy-kind.js +0 -25
- package/dist/set-proxy-kind.js.map +0 -1
- package/src/set-proxy-kind.ts +0 -27
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { keccak256 } from 'ethereumjs-util';
|
|
2
|
+
import {
|
|
3
|
+
call,
|
|
4
|
+
EIP1967BeaconNotFound,
|
|
5
|
+
EIP1967ImplementationNotFound,
|
|
6
|
+
getBeaconAddress,
|
|
7
|
+
getImplementationAddress,
|
|
8
|
+
UpgradesError,
|
|
9
|
+
} from '.';
|
|
10
|
+
|
|
11
|
+
import { EthereumProvider } from './provider';
|
|
12
|
+
import { parseAddress } from './utils/address';
|
|
13
|
+
|
|
14
|
+
export class InvalidBeacon extends UpgradesError {}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gets the implementation address from the beacon using its implementation() function.
|
|
18
|
+
* @param provider
|
|
19
|
+
* @param beaconAddress
|
|
20
|
+
* @returns The implementation address.
|
|
21
|
+
* @throws {InvalidBeacon} If the implementation() function could not be called or does not return an address.
|
|
22
|
+
*/
|
|
23
|
+
export async function getImplementationAddressFromBeacon(
|
|
24
|
+
provider: EthereumProvider,
|
|
25
|
+
beaconAddress: string,
|
|
26
|
+
): Promise<string> {
|
|
27
|
+
const implementationFunction = '0x' + keccak256(Buffer.from('implementation()')).toString('hex').slice(0, 8);
|
|
28
|
+
let result: string | undefined;
|
|
29
|
+
try {
|
|
30
|
+
const implAddress = await call(provider, beaconAddress, implementationFunction);
|
|
31
|
+
result = parseAddress(implAddress);
|
|
32
|
+
} catch (e: any) {
|
|
33
|
+
if (
|
|
34
|
+
!(
|
|
35
|
+
e.message.includes('function selector was not recognized') ||
|
|
36
|
+
e.message.includes('invalid opcode') ||
|
|
37
|
+
e.message.includes('Transaction reverted')
|
|
38
|
+
)
|
|
39
|
+
) {
|
|
40
|
+
throw e;
|
|
41
|
+
} // otherwise fall through with no result
|
|
42
|
+
}
|
|
43
|
+
if (result === undefined) {
|
|
44
|
+
throw new InvalidBeacon(`Contract at ${beaconAddress} doesn't look like a beacon`);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gets the implementation address from a UUPS/Transparent/Beacon proxy.
|
|
51
|
+
*
|
|
52
|
+
* @returns a Promise with the implementation address, or undefined if a UUPS/Transparent/Beacon proxy is not located at the address.
|
|
53
|
+
*/
|
|
54
|
+
export async function getImplementationAddressFromProxy(
|
|
55
|
+
provider: EthereumProvider,
|
|
56
|
+
proxyAddress: string,
|
|
57
|
+
): Promise<string | undefined> {
|
|
58
|
+
try {
|
|
59
|
+
return await getImplementationAddress(provider, proxyAddress);
|
|
60
|
+
} catch (e: any) {
|
|
61
|
+
if (e instanceof EIP1967ImplementationNotFound) {
|
|
62
|
+
try {
|
|
63
|
+
const beaconAddress = await getBeaconAddress(provider, proxyAddress);
|
|
64
|
+
return await getImplementationAddressFromBeacon(provider, beaconAddress);
|
|
65
|
+
} catch (e: any) {
|
|
66
|
+
if (e instanceof EIP1967BeaconNotFound) {
|
|
67
|
+
return undefined;
|
|
68
|
+
} else {
|
|
69
|
+
throw e;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
throw e;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,12 +9,27 @@ export * from './src-decoder';
|
|
|
9
9
|
export * from './solc-api';
|
|
10
10
|
export * from './deployment';
|
|
11
11
|
export * from './link-refs';
|
|
12
|
+
export * from './error';
|
|
12
13
|
|
|
13
14
|
export { getStorageLayoutForAddress } from './manifest-storage-layout';
|
|
14
15
|
|
|
15
16
|
export * from './scripts/migrate-oz-cli-project';
|
|
16
17
|
|
|
17
18
|
export { logWarning } from './utils/log';
|
|
18
|
-
export { setProxyKind } from './
|
|
19
|
+
export { setProxyKind, processProxyKind } from './proxy-kind';
|
|
19
20
|
|
|
20
21
|
export { UpgradeableContract } from './standalone';
|
|
22
|
+
|
|
23
|
+
export { isTransparentOrUUPSProxy, isBeaconProxy } from './eip-1967-type';
|
|
24
|
+
export { getImplementationAddressFromBeacon, getImplementationAddressFromProxy } from './impl-address';
|
|
25
|
+
export { isBeacon } from './beacon';
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
BeaconProxyUnsupportedError,
|
|
29
|
+
LoadProxyUnsupportedError,
|
|
30
|
+
PrepareUpgradeUnsupportedError,
|
|
31
|
+
DeployBeaconProxyUnsupportedError,
|
|
32
|
+
DeployBeaconProxyImplUnknownError,
|
|
33
|
+
DeployBeaconProxyKindError,
|
|
34
|
+
assertNotProxy,
|
|
35
|
+
} from './usage-error';
|
package/src/manifest.ts
CHANGED
package/src/provider.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface EthereumProvider {
|
|
|
5
5
|
send(method: 'net_version', params: []): Promise<string>;
|
|
6
6
|
send(method: 'eth_chainId', params: []): Promise<string>;
|
|
7
7
|
send(method: 'eth_getCode', params: [string, string]): Promise<string>;
|
|
8
|
+
send(method: 'eth_call', params: unknown[]): Promise<string>;
|
|
8
9
|
send(method: 'eth_getStorageAt', params: [string, string, string]): Promise<string>;
|
|
9
10
|
send(method: 'eth_getTransactionByHash', params: [string]): Promise<null | EthereumTransaction>;
|
|
10
11
|
send(method: 'eth_getTransactionReceipt', params: [string]): Promise<null | EthereumTransactionReceipt>;
|
|
@@ -53,6 +54,21 @@ export async function getCode(provider: EthereumProvider, address: string, block
|
|
|
53
54
|
return provider.send('eth_getCode', [address, block]);
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
export async function call(
|
|
58
|
+
provider: EthereumProvider,
|
|
59
|
+
address: string,
|
|
60
|
+
data: string,
|
|
61
|
+
block = 'latest',
|
|
62
|
+
): Promise<string> {
|
|
63
|
+
return provider.send('eth_call', [
|
|
64
|
+
{
|
|
65
|
+
to: address,
|
|
66
|
+
data: data,
|
|
67
|
+
},
|
|
68
|
+
block,
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
export async function hasCode(provider: EthereumProvider, address: string, block?: string): Promise<boolean> {
|
|
57
73
|
const code = await getCode(provider, address, block);
|
|
58
74
|
return code !== '0x';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EthereumProvider } from './provider';
|
|
2
|
+
import { inferProxyKind, ValidationData, ValidationOptions } from './validate';
|
|
3
|
+
import { Manifest, DeploymentNotFound, ProxyDeployment } from './manifest';
|
|
4
|
+
import { isBeaconProxy } from './eip-1967-type';
|
|
5
|
+
import { Version } from './version';
|
|
6
|
+
import { BeaconProxyUnsupportedError } from './usage-error';
|
|
7
|
+
|
|
8
|
+
export async function setProxyKind(
|
|
9
|
+
provider: EthereumProvider,
|
|
10
|
+
proxyAddress: string,
|
|
11
|
+
opts: ValidationOptions,
|
|
12
|
+
): Promise<ProxyDeployment['kind']> {
|
|
13
|
+
const manifest = await Manifest.forNetwork(provider);
|
|
14
|
+
|
|
15
|
+
const manifestDeployment = await manifest.getProxyFromAddress(proxyAddress).catch(e => {
|
|
16
|
+
if (e instanceof DeploymentNotFound) {
|
|
17
|
+
return undefined;
|
|
18
|
+
} else {
|
|
19
|
+
throw e;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (opts.kind === undefined) {
|
|
24
|
+
opts.kind = manifestDeployment?.kind ?? 'transparent';
|
|
25
|
+
} else if (manifestDeployment && opts.kind !== manifestDeployment.kind) {
|
|
26
|
+
throw new Error(`Requested an upgrade of kind ${opts.kind} but proxy is ${manifestDeployment.kind}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return opts.kind;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Processes opts.kind when deploying the implementation for a UUPS or Transparent proxy.
|
|
34
|
+
*
|
|
35
|
+
* @throws {BeaconProxyUnsupportedError} If this function is called for a Beacon proxy.
|
|
36
|
+
*/
|
|
37
|
+
export async function processProxyKind(
|
|
38
|
+
provider: EthereumProvider,
|
|
39
|
+
proxyAddress: string | undefined,
|
|
40
|
+
opts: ValidationOptions,
|
|
41
|
+
data: ValidationData,
|
|
42
|
+
version: Version,
|
|
43
|
+
) {
|
|
44
|
+
if (opts.kind === undefined) {
|
|
45
|
+
if (proxyAddress !== undefined && (await isBeaconProxy(provider, proxyAddress))) {
|
|
46
|
+
opts.kind = 'beacon';
|
|
47
|
+
} else {
|
|
48
|
+
opts.kind = inferProxyKind(data, version);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (proxyAddress !== undefined) {
|
|
53
|
+
await setProxyKind(provider, proxyAddress, opts);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (opts.kind === 'beacon') {
|
|
57
|
+
throw new BeaconProxyUnsupportedError();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { EthereumProvider, getBeaconAddress, isBeaconProxy, isTransparentOrUUPSProxy, UpgradesError } from '.';
|
|
2
|
+
|
|
3
|
+
export class BeaconProxyUnsupportedError extends UpgradesError {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(
|
|
6
|
+
'Beacon proxies are not supported with the current function.',
|
|
7
|
+
() => 'Use deployBeacon(), deployBeaconProxy(), or upgradeBeacon() instead.',
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class DeployBeaconProxyKindError extends UpgradesError {
|
|
13
|
+
constructor(kind: string) {
|
|
14
|
+
super(
|
|
15
|
+
`Unsupported proxy kind '${kind}'`,
|
|
16
|
+
() => `deployBeaconProxy() is only supported with proxy kind undefined or 'beacon'`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class DeployBeaconProxyUnsupportedError extends UpgradesError {
|
|
22
|
+
constructor(beaconAddress: string) {
|
|
23
|
+
super(`Contract at ${beaconAddress} doesn't look like a beacon`, () => 'Deploy a beacon using deployBeacon().');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class DeployBeaconProxyImplUnknownError extends UpgradesError {
|
|
28
|
+
constructor(implAddress: string) {
|
|
29
|
+
super(
|
|
30
|
+
`Beacon's current implementation at ${implAddress} is unknown`,
|
|
31
|
+
() => `Call deployBeaconProxy() with the implementation option providing the beacon's current implementation.`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class LoadProxyUnsupportedError extends UpgradesError {
|
|
37
|
+
constructor(proxyAddress: string) {
|
|
38
|
+
super(
|
|
39
|
+
`Contract at ${proxyAddress} doesn't look like a supported proxy`,
|
|
40
|
+
() => 'Only transparent, UUPS, or beacon proxies can be loaded with the loadProxy() function.',
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class PrepareUpgradeUnsupportedError extends UpgradesError {
|
|
46
|
+
constructor(proxyOrBeaconAddress: string) {
|
|
47
|
+
super(
|
|
48
|
+
`Contract at address ${proxyOrBeaconAddress} doesn't look like a supported proxy or beacon`,
|
|
49
|
+
() => `Only transparent, UUPS, or beacon proxies or beacons can be used with the prepareUpgrade() function.`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function assertNotProxy(provider: EthereumProvider, address: string) {
|
|
55
|
+
if (await isTransparentOrUUPSProxy(provider, address)) {
|
|
56
|
+
throw new UpgradesError(
|
|
57
|
+
'Address is a transparent or UUPS proxy which cannot be upgraded using upgradeBeacon().',
|
|
58
|
+
() => 'Use upgradeProxy() instead.',
|
|
59
|
+
);
|
|
60
|
+
} else if (await isBeaconProxy(provider, address)) {
|
|
61
|
+
const beaconAddress = await getBeaconAddress(provider, address);
|
|
62
|
+
throw new UpgradesError(
|
|
63
|
+
'Address is a beacon proxy which cannot be upgraded directly.',
|
|
64
|
+
() =>
|
|
65
|
+
`upgradeBeacon() must be called with a beacon address, not a beacon proxy address. Call upgradeBeacon() on the beacon address ${beaconAddress} instead.`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { toChecksumAddress } from 'ethereumjs-util';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parses an address from a hex string which may come from storage or a returned address via eth_call.
|
|
5
|
+
*
|
|
6
|
+
* @param addressString The address hex string.
|
|
7
|
+
* @returns The parsed checksum address, or undefined if the input string is not an address.
|
|
8
|
+
*/
|
|
9
|
+
export function parseAddress(addressString: string): string | undefined {
|
|
10
|
+
const buf = Buffer.from(addressString.replace(/^0x/, ''), 'hex');
|
|
11
|
+
if (!buf.slice(0, 12).equals(Buffer.alloc(12, 0))) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const address = '0x' + buf.toString('hex', 12, 32); // grab the last 20 bytes
|
|
15
|
+
return toChecksumAddress(address);
|
|
16
|
+
}
|
|
@@ -69,7 +69,7 @@ export function processExceptions(
|
|
|
69
69
|
): ValidationError[] {
|
|
70
70
|
const { unsafeAllow } = withValidationDefaults(opts);
|
|
71
71
|
|
|
72
|
-
if (opts.kind === 'transparent') {
|
|
72
|
+
if (opts.kind === 'transparent' || opts.kind === 'beacon') {
|
|
73
73
|
errors = errors.filter(error => error.kind !== 'missing-public-upgradeto');
|
|
74
74
|
}
|
|
75
75
|
|
package/CHANGELOG.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 1.10.0 (2021-10-22)
|
|
4
|
-
|
|
5
|
-
- Infer whether a proxy should be UUPS or Transparent. ([#441](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/441))
|
|
6
|
-
- Add a standalone interface to the core. ([#442](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/442))
|
|
7
|
-
- Add implementation constructor arguments to initialize immutable variables. ([#433](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/433))
|
|
8
|
-
|
|
9
|
-
## 1.9.2 (2021-09-17)
|
|
10
|
-
|
|
11
|
-
- Fix a bug where libraries used transitively were not considered for safety checks.
|
|
12
|
-
|
|
13
|
-
## 1.9.1 (2021-09-15)
|
|
14
|
-
|
|
15
|
-
- Silence all warnings when using `silenceWarnings`.
|
|
16
|
-
|
|
17
|
-
## 1.9.0 (2021-08-25)
|
|
18
|
-
|
|
19
|
-
- Add `getBeaconAddress`. ([#413](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/413))
|
|
20
|
-
|
|
21
|
-
## 1.8.1 (2021-08-06)
|
|
22
|
-
|
|
23
|
-
- Add support for function types.
|
|
24
|
-
|
|
25
|
-
## 1.8.0 (2021-06-29)
|
|
26
|
-
|
|
27
|
-
- Add option `unsafeAllowRenames` to configure storage layout check to allow variable renaming.
|
|
28
|
-
|
|
29
|
-
## 1.7.6 (2021-05-25)
|
|
30
|
-
|
|
31
|
-
- Fix recognition of value types in storage layouts.
|
|
32
|
-
|
|
33
|
-
## 1.7.5 (2021-05-22)
|
|
34
|
-
|
|
35
|
-
- Fix exception when upgrading mapping key to enum.
|
|
36
|
-
|
|
37
|
-
## 1.7.4 (2021-05-22)
|
|
38
|
-
|
|
39
|
-
- Fix handling of functions with struct or mapping storage pointer arguments.
|
|
40
|
-
|
|
41
|
-
## 1.7.3 (2021-05-13)
|
|
42
|
-
|
|
43
|
-
- Simplify clean up of manifest data before storing to disk.
|
|
44
|
-
|
|
45
|
-
## 1.7.2 (2021-05-13)
|
|
46
|
-
|
|
47
|
-
- Fix bug when the project uses external libraries.
|
|
48
|
-
|
|
49
|
-
## 1.7.1 (2021-05-03)
|
|
50
|
-
|
|
51
|
-
- Use `web3_clientVersion` to better detect development networks.
|
|
52
|
-
|
|
53
|
-
## 1.7.0 (2021-04-29)
|
|
54
|
-
|
|
55
|
-
- Add support for UUPS proxies. ([#315](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/315))
|
|
56
|
-
- Fix parsing of NatSpec `@custom:oz-upgrades-unsafe-allow` when included in a `/**`-style comment.
|
|
57
|
-
|
|
58
|
-
## 1.6.0 (2021-04-14)
|
|
59
|
-
- Add `unsafeAllow` as a new field in `ValidationOptions`, which can be used as a manual override to silence any type of validation error. For example, `opts = { unsafeAllow: ['external-library-linking', 'delegatecall'] }` will silence the corresponding checks. ([#320](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/320))
|
|
60
|
-
- Custom NatSpec comments can disable error checks directly from the Solidity code. See `core/contracts/test/ValidationNatspec.sol` for example usage of these NatSpec comments. Note: this requires Solidity >=0.8.2. ([#320](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/320))
|
|
61
|
-
- Fix a bug with library placeholders when hashing contract source code. ([#320](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/320))
|
|
62
|
-
|
|
63
|
-
## 1.5.1 (2021-02-24)
|
|
64
|
-
|
|
65
|
-
- Add support for enum keys in mappings. ([#301](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/301))
|
|
66
|
-
|
|
67
|
-
## 1.5.0 (2021-01-27)
|
|
68
|
-
|
|
69
|
-
- Add support for structs and enums. ([#261](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/261))
|
|
70
|
-
- Enable optimizations when compiling proxies.
|
|
71
|
-
|
|
72
|
-
## 1.4.4 (2021-01-14)
|
|
73
|
-
|
|
74
|
-
- Fix `InvalidDeployment` error on some networks. ([#282](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/282))
|
|
75
|
-
|
|
76
|
-
## 1.4.3 (2020-12-21)
|
|
77
|
-
|
|
78
|
-
- Fix a type error caused by duplicate contract names in Truffle.
|
|
79
|
-
|
|
80
|
-
## 1.4.2 (2020-12-16)
|
|
81
|
-
|
|
82
|
-
- Fix an error in the `unsafeAllowCustomTypes` flag that would cause other storage layout incompatibilities to be ignored. ([#259](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/259))
|
|
83
|
-
|
|
84
|
-
Users of this flag are advised to update to this version.
|
|
85
|
-
|
|
86
|
-
## 1.4.1 (2020-11-30)
|
|
87
|
-
|
|
88
|
-
- Fix a problem in deployment logic when used with Hyperledger Besu. ([#244](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/244))
|
|
89
|
-
|
|
90
|
-
## 1.4.0 (2020-11-24)
|
|
91
|
-
|
|
92
|
-
- Add `silenceWarnings` to emit a single warning and silence all subsequent ones. ([#228](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/228))
|
|
93
|
-
|
|
94
|
-
## 1.3.1 (2020-11-13)
|
|
95
|
-
|
|
96
|
-
- Add missing artifact files in the package.
|
|
97
|
-
|
|
98
|
-
## 1.3.0 (2020-11-13)
|
|
99
|
-
|
|
100
|
-
- Support Hardhat. ([#214](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/214))
|
|
101
|
-
|
|
102
|
-
## 1.2.0 (2020-10-16)
|
|
103
|
-
|
|
104
|
-
- Support new flag `unsafeAllowLinkedLibraries` to allow deployment of contracts with linked libraries. ([#182](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/182))
|
|
105
|
-
|
|
106
|
-
## 1.1.1 (2020-10-08)
|
|
107
|
-
|
|
108
|
-
- Fix OpenZeppelin CLI migration for projects that were initialized with ZeppelinOS. ([#193](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/193))
|
|
109
|
-
|
|
110
|
-
## 1.1.0 (2020-09-18)
|
|
111
|
-
|
|
112
|
-
- Add ability to migrate from OpenZeppelin CLI. ([#143](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/143))
|
|
113
|
-
|
|
114
|
-
## 1.0.2 (2020-09-16)
|
|
115
|
-
|
|
116
|
-
- Fix false positive variable initialization check in Solidity 0.7.1. ([#171](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/171))
|
|
117
|
-
|
|
118
|
-
## 1.0.1 (2020-09-01)
|
|
119
|
-
|
|
120
|
-
- Include `src` directory in npm packages. ([#150](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/150))
|
package/dist/set-proxy-kind.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EthereumProvider } from './provider';
|
|
2
|
-
import { ValidationOptions } from './validate';
|
|
3
|
-
import { ProxyDeployment } from './manifest';
|
|
4
|
-
export declare function setProxyKind(provider: EthereumProvider, proxyAddress: string, opts: ValidationOptions): Promise<ProxyDeployment['kind']>;
|
|
5
|
-
//# sourceMappingURL=set-proxy-kind.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-proxy-kind.d.ts","sourceRoot":"","sources":["../src/set-proxy-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAgC,eAAe,EAAE,MAAM,YAAY,CAAC;AAE3E,wBAAsB,YAAY,CAChC,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAkBlC"}
|
package/dist/set-proxy-kind.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setProxyKind = void 0;
|
|
4
|
-
const manifest_1 = require("./manifest");
|
|
5
|
-
async function setProxyKind(provider, proxyAddress, opts) {
|
|
6
|
-
var _a;
|
|
7
|
-
const manifest = await manifest_1.Manifest.forNetwork(provider);
|
|
8
|
-
const manifestDeployment = await manifest.getProxyFromAddress(proxyAddress).catch(e => {
|
|
9
|
-
if (e instanceof manifest_1.DeploymentNotFound) {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
throw e;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
if (opts.kind === undefined) {
|
|
17
|
-
opts.kind = (_a = manifestDeployment === null || manifestDeployment === void 0 ? void 0 : manifestDeployment.kind) !== null && _a !== void 0 ? _a : 'transparent';
|
|
18
|
-
}
|
|
19
|
-
else if (manifestDeployment && opts.kind !== manifestDeployment.kind) {
|
|
20
|
-
throw new Error(`Requested an upgrade of kind ${opts.kind} but proxy is ${manifestDeployment.kind}`);
|
|
21
|
-
}
|
|
22
|
-
return opts.kind;
|
|
23
|
-
}
|
|
24
|
-
exports.setProxyKind = setProxyKind;
|
|
25
|
-
//# sourceMappingURL=set-proxy-kind.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-proxy-kind.js","sourceRoot":"","sources":["../src/set-proxy-kind.ts"],"names":[],"mappings":";;;AAEA,yCAA2E;AAEpE,KAAK,UAAU,YAAY,CAChC,QAA0B,EAC1B,YAAoB,EACpB,IAAuB;;IAEvB,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAErD,MAAM,kBAAkB,GAAG,MAAM,QAAQ,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACpF,IAAI,CAAC,YAAY,6BAAkB,EAAE;YACnC,OAAO,SAAS,CAAC;SAClB;aAAM;YACL,MAAM,CAAC,CAAC;SACT;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;QAC3B,IAAI,CAAC,IAAI,GAAG,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,IAAI,mCAAI,aAAa,CAAC;KACvD;SAAM,IAAI,kBAAkB,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,EAAE;QACtE,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,iBAAiB,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;KACtG;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAtBD,oCAsBC"}
|
package/src/set-proxy-kind.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EthereumProvider } from './provider';
|
|
2
|
-
import { ValidationOptions } from './validate';
|
|
3
|
-
import { Manifest, DeploymentNotFound, ProxyDeployment } from './manifest';
|
|
4
|
-
|
|
5
|
-
export async function setProxyKind(
|
|
6
|
-
provider: EthereumProvider,
|
|
7
|
-
proxyAddress: string,
|
|
8
|
-
opts: ValidationOptions,
|
|
9
|
-
): Promise<ProxyDeployment['kind']> {
|
|
10
|
-
const manifest = await Manifest.forNetwork(provider);
|
|
11
|
-
|
|
12
|
-
const manifestDeployment = await manifest.getProxyFromAddress(proxyAddress).catch(e => {
|
|
13
|
-
if (e instanceof DeploymentNotFound) {
|
|
14
|
-
return undefined;
|
|
15
|
-
} else {
|
|
16
|
-
throw e;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (opts.kind === undefined) {
|
|
21
|
-
opts.kind = manifestDeployment?.kind ?? 'transparent';
|
|
22
|
-
} else if (manifestDeployment && opts.kind !== manifestDeployment.kind) {
|
|
23
|
-
throw new Error(`Requested an upgrade of kind ${opts.kind} but proxy is ${manifestDeployment.kind}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return opts.kind;
|
|
27
|
-
}
|