@0xsequence/catapult 1.3.2 → 1.3.4
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/CONCEPT.md +24 -0
- package/README.md +16 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +4 -2
- package/dist/commands/run.js.map +1 -1
- package/dist/lib/__tests__/deployer.spec.js +71 -1
- package/dist/lib/__tests__/deployer.spec.js.map +1 -1
- package/dist/lib/core/__tests__/engine.spec.js +270 -0
- package/dist/lib/core/__tests__/engine.spec.js.map +1 -1
- package/dist/lib/core/__tests__/resolver.spec.js +132 -0
- package/dist/lib/core/__tests__/resolver.spec.js.map +1 -1
- package/dist/lib/core/engine.d.ts +13 -0
- package/dist/lib/core/engine.d.ts.map +1 -1
- package/dist/lib/core/engine.js +148 -15
- package/dist/lib/core/engine.js.map +1 -1
- package/dist/lib/core/resolver.d.ts +1 -0
- package/dist/lib/core/resolver.d.ts.map +1 -1
- package/dist/lib/core/resolver.js +24 -7
- package/dist/lib/core/resolver.js.map +1 -1
- package/dist/lib/deployer.d.ts +2 -0
- package/dist/lib/deployer.d.ts.map +1 -1
- package/dist/lib/deployer.js +18 -1
- package/dist/lib/deployer.js.map +1 -1
- package/dist/lib/events/__tests__/event-system.spec.js +30 -0
- package/dist/lib/events/__tests__/event-system.spec.js.map +1 -1
- package/dist/lib/events/cli-adapter.d.ts.map +1 -1
- package/dist/lib/events/cli-adapter.js +25 -1
- package/dist/lib/events/cli-adapter.js.map +1 -1
- package/dist/lib/events/types.d.ts +26 -2
- package/dist/lib/events/types.d.ts.map +1 -1
- package/dist/lib/std/templates/assured-deployment.yaml +4 -3
- package/dist/lib/std/templates/era-evm-predeploy.yaml +35 -0
- package/dist/lib/std/templates/erc-2470.yaml +3 -0
- package/dist/lib/std/templates/min-balance.yaml +3 -0
- package/dist/lib/std/templates/nano-universal-deployer.yaml +2 -0
- package/dist/lib/std/templates/raw-erc-2470.yaml +3 -0
- package/dist/lib/std/templates/raw-nano-universal-deployer.yaml +3 -0
- package/dist/lib/std/templates/raw-sequence-universal-deployer-2.yaml +4 -0
- package/dist/lib/std/templates/sequence-universal-deployer-2.yaml +4 -0
- package/dist/lib/types/values.d.ts +8 -1
- package/dist/lib/types/values.d.ts.map +1 -1
- package/dist/lib/utils/assertion.d.ts +4 -0
- package/dist/lib/utils/assertion.d.ts.map +1 -0
- package/dist/lib/utils/assertion.js +27 -0
- package/dist/lib/utils/assertion.js.map +1 -0
- package/package.json +12 -13
- package/src/commands/run.ts +4 -1
- package/src/lib/__tests__/deployer.spec.ts +108 -1
- package/src/lib/core/__tests__/engine.spec.ts +321 -0
- package/src/lib/core/__tests__/resolver.spec.ts +150 -1
- package/src/lib/core/engine.ts +188 -17
- package/src/lib/core/resolver.ts +29 -8
- package/src/lib/deployer.ts +28 -1
- package/src/lib/events/__tests__/event-system.spec.ts +51 -2
- package/src/lib/events/cli-adapter.ts +32 -4
- package/src/lib/events/types.ts +30 -2
- package/src/lib/std/templates/assured-deployment.yaml +4 -3
- package/src/lib/std/templates/era-evm-predeploy.yaml +35 -0
- package/src/lib/std/templates/erc-2470.yaml +3 -0
- package/src/lib/std/templates/min-balance.yaml +3 -0
- package/src/lib/std/templates/nano-universal-deployer.yaml +2 -0
- package/src/lib/std/templates/raw-erc-2470.yaml +3 -0
- package/src/lib/std/templates/raw-nano-universal-deployer.yaml +3 -0
- package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +4 -0
- package/src/lib/std/templates/sequence-universal-deployer-2.yaml +4 -0
- package/src/lib/types/values.ts +10 -1
- package/src/lib/utils/assertion.ts +24 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Calls the EVM predeploy manager to deploy preapproved contracts to ZK Era chains.
|
|
2
|
+
# The ZKSync Era predeploy manager is 0x0000000000000000000000000000000000008014.
|
|
3
|
+
# https://github.com/matter-labs/era-contracts/blob/540762151e3b030cac8ea274284b249f549e2c2a/system-contracts/contracts/EvmPredeploysManager.sol
|
|
4
|
+
name: "era-evm-predeploy"
|
|
5
|
+
type: "template"
|
|
6
|
+
description: "Deploy an approved predeployed contract to the EVM"
|
|
7
|
+
|
|
8
|
+
arguments:
|
|
9
|
+
evmPredeployManager:
|
|
10
|
+
type: "address"
|
|
11
|
+
description: "The address of the EVM predeploy manager"
|
|
12
|
+
address:
|
|
13
|
+
type: "address"
|
|
14
|
+
description: "The address of the predeployed contract to deploy"
|
|
15
|
+
bytecode:
|
|
16
|
+
type: "bytes"
|
|
17
|
+
description: "The deployment bytecode of the predeployed contract to deploy"
|
|
18
|
+
|
|
19
|
+
skip_condition:
|
|
20
|
+
- type: "contract-exists"
|
|
21
|
+
arguments:
|
|
22
|
+
address: "{{address}}"
|
|
23
|
+
|
|
24
|
+
actions:
|
|
25
|
+
- name: "deploy"
|
|
26
|
+
type: "send-transaction"
|
|
27
|
+
arguments:
|
|
28
|
+
to: "{{evmPredeployManager}}"
|
|
29
|
+
data:
|
|
30
|
+
type: "abi-encode"
|
|
31
|
+
arguments:
|
|
32
|
+
signature: "deployPredeployedContract(address,bytes)"
|
|
33
|
+
values:
|
|
34
|
+
- "{{address}}"
|
|
35
|
+
- "{{bytecode}}"
|
|
@@ -7,12 +7,15 @@ type: "template"
|
|
|
7
7
|
arguments:
|
|
8
8
|
creationCode:
|
|
9
9
|
type: "bytes"
|
|
10
|
+
description: "The creation code of the contract to deploy"
|
|
10
11
|
salt:
|
|
11
12
|
type: "bytes32"
|
|
13
|
+
description: "The salt for deployment"
|
|
12
14
|
|
|
13
15
|
returns:
|
|
14
16
|
address:
|
|
15
17
|
type: "address"
|
|
18
|
+
description: "The address of the deployed contract"
|
|
16
19
|
|
|
17
20
|
setup:
|
|
18
21
|
skip_condition:
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
name: "min-balance"
|
|
2
2
|
type: "template"
|
|
3
|
+
description: "Ensures a minimum balance for any given address"
|
|
3
4
|
|
|
4
5
|
arguments:
|
|
5
6
|
address:
|
|
6
7
|
type: "address"
|
|
8
|
+
description: "The address to check the balance of"
|
|
7
9
|
balance:
|
|
8
10
|
type: "uint256"
|
|
11
|
+
description: "The minimum balance required"
|
|
9
12
|
|
|
10
13
|
actions:
|
|
11
14
|
- type: "send-transaction"
|
|
@@ -7,10 +7,12 @@ type: "template"
|
|
|
7
7
|
arguments:
|
|
8
8
|
creationCode:
|
|
9
9
|
type: "bytes"
|
|
10
|
+
description: "The creation code of the contract to deploy"
|
|
10
11
|
|
|
11
12
|
returns:
|
|
12
13
|
address:
|
|
13
14
|
type: "address"
|
|
15
|
+
description: "The address of the deployed contract"
|
|
14
16
|
|
|
15
17
|
setup:
|
|
16
18
|
skip_condition:
|
|
@@ -4,12 +4,15 @@ type: "template"
|
|
|
4
4
|
arguments:
|
|
5
5
|
creationCode:
|
|
6
6
|
type: "bytes"
|
|
7
|
+
description: "The creation code of the contract to deploy"
|
|
7
8
|
salt:
|
|
8
9
|
type: "bytes32"
|
|
10
|
+
description: "The salt for deployment"
|
|
9
11
|
|
|
10
12
|
returns:
|
|
11
13
|
address:
|
|
12
14
|
type: "address"
|
|
15
|
+
description: "The address of the deployed contract"
|
|
13
16
|
|
|
14
17
|
setup:
|
|
15
18
|
skip_condition:
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
name: "raw-nano-universal-deployer"
|
|
2
2
|
type: "template"
|
|
3
|
+
description: "Deploy a contract using the Nano Universal Deployer"
|
|
3
4
|
|
|
4
5
|
arguments:
|
|
5
6
|
creationCode:
|
|
6
7
|
type: "bytes"
|
|
8
|
+
description: "The creation code of the contract to deploy"
|
|
7
9
|
|
|
8
10
|
returns:
|
|
9
11
|
address:
|
|
10
12
|
type: "address"
|
|
13
|
+
description: "The address of the deployed contract"
|
|
11
14
|
|
|
12
15
|
setup:
|
|
13
16
|
skip_condition:
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
name: "raw-sequence-universal-deployer-2"
|
|
2
2
|
type: "template"
|
|
3
|
+
description: "Deploy a contract using the Sequence Universal Deployer v2"
|
|
3
4
|
|
|
4
5
|
arguments:
|
|
5
6
|
creationCode:
|
|
6
7
|
type: "bytes"
|
|
8
|
+
description: "The creation code of the contract to deploy"
|
|
7
9
|
salt:
|
|
8
10
|
type: "bytes32"
|
|
11
|
+
description: "The salt for deployment"
|
|
9
12
|
|
|
10
13
|
returns:
|
|
11
14
|
address:
|
|
12
15
|
type: "address"
|
|
16
|
+
description: "The address of the deployed contract"
|
|
13
17
|
|
|
14
18
|
setup:
|
|
15
19
|
- type: "nano-universal-deployer"
|
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
# fails to deploy. This ensures that the gas estimation is accurate and the transaction won't silently fail with out of gas.
|
|
4
4
|
name: "sequence-universal-deployer-2"
|
|
5
5
|
type: "template"
|
|
6
|
+
description: "Deploy a contract using the Sequence Universal Deployer v2"
|
|
6
7
|
|
|
7
8
|
arguments:
|
|
8
9
|
creationCode:
|
|
9
10
|
type: "bytes"
|
|
11
|
+
description: "The creation code of the contract to deploy"
|
|
10
12
|
salt:
|
|
11
13
|
type: "bytes32"
|
|
14
|
+
description: "The salt for deployment"
|
|
12
15
|
|
|
13
16
|
returns:
|
|
14
17
|
address:
|
|
15
18
|
type: "address"
|
|
19
|
+
description: "The address of the deployed contract"
|
|
16
20
|
|
|
17
21
|
setup:
|
|
18
22
|
- type: "nano-universal-deployer"
|
package/src/lib/types/values.ts
CHANGED
|
@@ -32,6 +32,14 @@ export interface ConstructorEncodeValue {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export interface ComputeCreateValue {
|
|
36
|
+
type: 'compute-create';
|
|
37
|
+
arguments: {
|
|
38
|
+
deployerAddress: AddressValue;
|
|
39
|
+
nonce: Uint256Value;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
export interface ComputeCreate2Value {
|
|
36
44
|
type: 'compute-create2';
|
|
37
45
|
arguments: {
|
|
@@ -94,6 +102,7 @@ export type ValueResolver =
|
|
|
94
102
|
| AbiEncodeValue
|
|
95
103
|
| AbiPackValue
|
|
96
104
|
| ConstructorEncodeValue
|
|
105
|
+
| ComputeCreateValue
|
|
97
106
|
| ComputeCreate2Value
|
|
98
107
|
| ReadBalanceValue
|
|
99
108
|
| BasicArithmeticValue
|
|
@@ -113,4 +122,4 @@ export type Value<T = string | number | boolean> = T | Reference | ValueResolver
|
|
|
113
122
|
export type BytesValue = Value<string>;
|
|
114
123
|
export type AddressValue = Value<string>;
|
|
115
124
|
export type Uint256Value = Value<string | number>;
|
|
116
|
-
export type BooleanValue = Value<boolean>;
|
|
125
|
+
export type BooleanValue = Value<boolean>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
|
|
3
|
+
export function isAddress(value: unknown): value is string {
|
|
4
|
+
return ethers.isAddress(value)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isBytesLike(value: unknown): value is string {
|
|
8
|
+
return ethers.isBytesLike(value)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isBigNumberish(value: unknown): value is string | number | bigint {
|
|
12
|
+
try {
|
|
13
|
+
switch (typeof(value)) {
|
|
14
|
+
case "bigint":
|
|
15
|
+
case "number":
|
|
16
|
+
case "string":
|
|
17
|
+
ethers.toBigInt(value)
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
|
+
} catch (error) {
|
|
21
|
+
// Fail out
|
|
22
|
+
}
|
|
23
|
+
return false
|
|
24
|
+
}
|