@layerzerolabs/onesig-evm 0.0.3 → 0.0.5

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.
Files changed (32) hide show
  1. package/contracts/MultiSig.sol +219 -0
  2. package/contracts/OneSig.sol +258 -0
  3. package/contracts/mocks/MockOApp.sol +13 -0
  4. package/dist/index.d.ts +12 -0
  5. package/dist/index.js +54 -0
  6. package/package.json +7 -12
  7. package/typechain-types/@openzeppelin/contracts/index.ts +5 -0
  8. package/typechain-types/@openzeppelin/contracts/utils/cryptography/ECDSA.ts +55 -0
  9. package/typechain-types/@openzeppelin/contracts/utils/cryptography/MerkleProof.ts +55 -0
  10. package/typechain-types/@openzeppelin/contracts/utils/cryptography/index.ts +5 -0
  11. package/typechain-types/@openzeppelin/contracts/utils/index.ts +5 -0
  12. package/typechain-types/@openzeppelin/index.ts +5 -0
  13. package/typechain-types/common.ts +46 -0
  14. package/typechain-types/contracts/MultiSig.ts +358 -0
  15. package/typechain-types/contracts/OneSig.ts +687 -0
  16. package/typechain-types/contracts/index.ts +7 -0
  17. package/typechain-types/contracts/mocks/MockOApp.ts +144 -0
  18. package/typechain-types/contracts/mocks/index.ts +4 -0
  19. package/typechain-types/factories/@openzeppelin/contracts/index.ts +4 -0
  20. package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.ts +87 -0
  21. package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/MerkleProof__factory.ts +68 -0
  22. package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/index.ts +5 -0
  23. package/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +4 -0
  24. package/typechain-types/factories/@openzeppelin/index.ts +4 -0
  25. package/typechain-types/factories/contracts/MultiSig__factory.ts +275 -0
  26. package/typechain-types/factories/contracts/OneSig__factory.ts +653 -0
  27. package/typechain-types/factories/contracts/index.ts +6 -0
  28. package/typechain-types/factories/contracts/mocks/MockOApp__factory.ts +104 -0
  29. package/typechain-types/factories/contracts/mocks/index.ts +4 -0
  30. package/typechain-types/factories/index.ts +5 -0
  31. package/typechain-types/hardhat.d.ts +78 -0
  32. package/typechain-types/index.ts +18 -0
@@ -0,0 +1,144 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import type {
5
+ BaseContract,
6
+ BigNumber,
7
+ BigNumberish,
8
+ BytesLike,
9
+ CallOverrides,
10
+ ContractTransaction,
11
+ Overrides,
12
+ PopulatedTransaction,
13
+ Signer,
14
+ utils,
15
+ } from "ethers";
16
+ import type { FunctionFragment, Result } from "@ethersproject/abi";
17
+ import type { Listener, Provider } from "@ethersproject/providers";
18
+ import type {
19
+ TypedEventFilter,
20
+ TypedEvent,
21
+ TypedListener,
22
+ OnEvent,
23
+ PromiseOrValue,
24
+ } from "../../common";
25
+
26
+ export interface MockOAppInterface extends utils.Interface {
27
+ functions: {
28
+ "bytesMapping(uint32)": FunctionFragment;
29
+ "setBytes(uint32,bytes)": FunctionFragment;
30
+ };
31
+
32
+ getFunction(
33
+ nameOrSignatureOrTopic: "bytesMapping" | "setBytes"
34
+ ): FunctionFragment;
35
+
36
+ encodeFunctionData(
37
+ functionFragment: "bytesMapping",
38
+ values: [PromiseOrValue<BigNumberish>]
39
+ ): string;
40
+ encodeFunctionData(
41
+ functionFragment: "setBytes",
42
+ values: [PromiseOrValue<BigNumberish>, PromiseOrValue<BytesLike>]
43
+ ): string;
44
+
45
+ decodeFunctionResult(
46
+ functionFragment: "bytesMapping",
47
+ data: BytesLike
48
+ ): Result;
49
+ decodeFunctionResult(functionFragment: "setBytes", data: BytesLike): Result;
50
+
51
+ events: {};
52
+ }
53
+
54
+ export interface MockOApp extends BaseContract {
55
+ connect(signerOrProvider: Signer | Provider | string): this;
56
+ attach(addressOrName: string): this;
57
+ deployed(): Promise<this>;
58
+
59
+ interface: MockOAppInterface;
60
+
61
+ queryFilter<TEvent extends TypedEvent>(
62
+ event: TypedEventFilter<TEvent>,
63
+ fromBlockOrBlockhash?: string | number | undefined,
64
+ toBlock?: string | number | undefined
65
+ ): Promise<Array<TEvent>>;
66
+
67
+ listeners<TEvent extends TypedEvent>(
68
+ eventFilter?: TypedEventFilter<TEvent>
69
+ ): Array<TypedListener<TEvent>>;
70
+ listeners(eventName?: string): Array<Listener>;
71
+ removeAllListeners<TEvent extends TypedEvent>(
72
+ eventFilter: TypedEventFilter<TEvent>
73
+ ): this;
74
+ removeAllListeners(eventName?: string): this;
75
+ off: OnEvent<this>;
76
+ on: OnEvent<this>;
77
+ once: OnEvent<this>;
78
+ removeListener: OnEvent<this>;
79
+
80
+ functions: {
81
+ bytesMapping(
82
+ arg0: PromiseOrValue<BigNumberish>,
83
+ overrides?: CallOverrides
84
+ ): Promise<[string]>;
85
+
86
+ setBytes(
87
+ _dstEid: PromiseOrValue<BigNumberish>,
88
+ _bytes: PromiseOrValue<BytesLike>,
89
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
90
+ ): Promise<ContractTransaction>;
91
+ };
92
+
93
+ bytesMapping(
94
+ arg0: PromiseOrValue<BigNumberish>,
95
+ overrides?: CallOverrides
96
+ ): Promise<string>;
97
+
98
+ setBytes(
99
+ _dstEid: PromiseOrValue<BigNumberish>,
100
+ _bytes: PromiseOrValue<BytesLike>,
101
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
102
+ ): Promise<ContractTransaction>;
103
+
104
+ callStatic: {
105
+ bytesMapping(
106
+ arg0: PromiseOrValue<BigNumberish>,
107
+ overrides?: CallOverrides
108
+ ): Promise<string>;
109
+
110
+ setBytes(
111
+ _dstEid: PromiseOrValue<BigNumberish>,
112
+ _bytes: PromiseOrValue<BytesLike>,
113
+ overrides?: CallOverrides
114
+ ): Promise<void>;
115
+ };
116
+
117
+ filters: {};
118
+
119
+ estimateGas: {
120
+ bytesMapping(
121
+ arg0: PromiseOrValue<BigNumberish>,
122
+ overrides?: CallOverrides
123
+ ): Promise<BigNumber>;
124
+
125
+ setBytes(
126
+ _dstEid: PromiseOrValue<BigNumberish>,
127
+ _bytes: PromiseOrValue<BytesLike>,
128
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
129
+ ): Promise<BigNumber>;
130
+ };
131
+
132
+ populateTransaction: {
133
+ bytesMapping(
134
+ arg0: PromiseOrValue<BigNumberish>,
135
+ overrides?: CallOverrides
136
+ ): Promise<PopulatedTransaction>;
137
+
138
+ setBytes(
139
+ _dstEid: PromiseOrValue<BigNumberish>,
140
+ _bytes: PromiseOrValue<BytesLike>,
141
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
142
+ ): Promise<PopulatedTransaction>;
143
+ };
144
+ }
@@ -0,0 +1,4 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export type { MockOApp } from "./MockOApp";
@@ -0,0 +1,4 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * as utils from "./utils";
@@ -0,0 +1,87 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers";
5
+ import type { Provider, TransactionRequest } from "@ethersproject/providers";
6
+ import type { PromiseOrValue } from "../../../../../common";
7
+ import type {
8
+ ECDSA,
9
+ ECDSAInterface,
10
+ } from "../../../../../@openzeppelin/contracts/utils/cryptography/ECDSA";
11
+
12
+ const _abi = [
13
+ {
14
+ inputs: [],
15
+ name: "ECDSAInvalidSignature",
16
+ type: "error",
17
+ },
18
+ {
19
+ inputs: [
20
+ {
21
+ internalType: "uint256",
22
+ name: "length",
23
+ type: "uint256",
24
+ },
25
+ ],
26
+ name: "ECDSAInvalidSignatureLength",
27
+ type: "error",
28
+ },
29
+ {
30
+ inputs: [
31
+ {
32
+ internalType: "bytes32",
33
+ name: "s",
34
+ type: "bytes32",
35
+ },
36
+ ],
37
+ name: "ECDSAInvalidSignatureS",
38
+ type: "error",
39
+ },
40
+ ] as const;
41
+
42
+ const _bytecode =
43
+ "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212200c93ed5abf2325f94c3504b99d7060b82f85abe7c01b4413d9c4819389ff224964736f6c63430008160033";
44
+
45
+ type ECDSAConstructorParams =
46
+ | [signer?: Signer]
47
+ | ConstructorParameters<typeof ContractFactory>;
48
+
49
+ const isSuperArgs = (
50
+ xs: ECDSAConstructorParams
51
+ ): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
52
+
53
+ export class ECDSA__factory extends ContractFactory {
54
+ constructor(...args: ECDSAConstructorParams) {
55
+ if (isSuperArgs(args)) {
56
+ super(...args);
57
+ } else {
58
+ super(_abi, _bytecode, args[0]);
59
+ }
60
+ }
61
+
62
+ override deploy(
63
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
64
+ ): Promise<ECDSA> {
65
+ return super.deploy(overrides || {}) as Promise<ECDSA>;
66
+ }
67
+ override getDeployTransaction(
68
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
69
+ ): TransactionRequest {
70
+ return super.getDeployTransaction(overrides || {});
71
+ }
72
+ override attach(address: string): ECDSA {
73
+ return super.attach(address) as ECDSA;
74
+ }
75
+ override connect(signer: Signer): ECDSA__factory {
76
+ return super.connect(signer) as ECDSA__factory;
77
+ }
78
+
79
+ static readonly bytecode = _bytecode;
80
+ static readonly abi = _abi;
81
+ static createInterface(): ECDSAInterface {
82
+ return new utils.Interface(_abi) as ECDSAInterface;
83
+ }
84
+ static connect(address: string, signerOrProvider: Signer | Provider): ECDSA {
85
+ return new Contract(address, _abi, signerOrProvider) as ECDSA;
86
+ }
87
+ }
@@ -0,0 +1,68 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers";
5
+ import type { Provider, TransactionRequest } from "@ethersproject/providers";
6
+ import type { PromiseOrValue } from "../../../../../common";
7
+ import type {
8
+ MerkleProof,
9
+ MerkleProofInterface,
10
+ } from "../../../../../@openzeppelin/contracts/utils/cryptography/MerkleProof";
11
+
12
+ const _abi = [
13
+ {
14
+ inputs: [],
15
+ name: "MerkleProofInvalidMultiproof",
16
+ type: "error",
17
+ },
18
+ ] as const;
19
+
20
+ const _bytecode =
21
+ "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c3e6ccaf907053ef203198733a335286632baf79076b691735cb2a3cde23cf3d64736f6c63430008160033";
22
+
23
+ type MerkleProofConstructorParams =
24
+ | [signer?: Signer]
25
+ | ConstructorParameters<typeof ContractFactory>;
26
+
27
+ const isSuperArgs = (
28
+ xs: MerkleProofConstructorParams
29
+ ): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
30
+
31
+ export class MerkleProof__factory extends ContractFactory {
32
+ constructor(...args: MerkleProofConstructorParams) {
33
+ if (isSuperArgs(args)) {
34
+ super(...args);
35
+ } else {
36
+ super(_abi, _bytecode, args[0]);
37
+ }
38
+ }
39
+
40
+ override deploy(
41
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
42
+ ): Promise<MerkleProof> {
43
+ return super.deploy(overrides || {}) as Promise<MerkleProof>;
44
+ }
45
+ override getDeployTransaction(
46
+ overrides?: Overrides & { from?: PromiseOrValue<string> }
47
+ ): TransactionRequest {
48
+ return super.getDeployTransaction(overrides || {});
49
+ }
50
+ override attach(address: string): MerkleProof {
51
+ return super.attach(address) as MerkleProof;
52
+ }
53
+ override connect(signer: Signer): MerkleProof__factory {
54
+ return super.connect(signer) as MerkleProof__factory;
55
+ }
56
+
57
+ static readonly bytecode = _bytecode;
58
+ static readonly abi = _abi;
59
+ static createInterface(): MerkleProofInterface {
60
+ return new utils.Interface(_abi) as MerkleProofInterface;
61
+ }
62
+ static connect(
63
+ address: string,
64
+ signerOrProvider: Signer | Provider
65
+ ): MerkleProof {
66
+ return new Contract(address, _abi, signerOrProvider) as MerkleProof;
67
+ }
68
+ }
@@ -0,0 +1,5 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export { ECDSA__factory } from "./ECDSA__factory";
5
+ export { MerkleProof__factory } from "./MerkleProof__factory";
@@ -0,0 +1,4 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * as cryptography from "./cryptography";
@@ -0,0 +1,4 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * as contracts from "./contracts";
@@ -0,0 +1,275 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, Signer, utils } from "ethers";
6
+ import type { Provider } from "@ethersproject/providers";
7
+ import type { MultiSig, MultiSigInterface } from "../../contracts/MultiSig";
8
+
9
+ const _abi = [
10
+ {
11
+ inputs: [],
12
+ name: "ECDSAInvalidSignature",
13
+ type: "error",
14
+ },
15
+ {
16
+ inputs: [
17
+ {
18
+ internalType: "uint256",
19
+ name: "length",
20
+ type: "uint256",
21
+ },
22
+ ],
23
+ name: "ECDSAInvalidSignatureLength",
24
+ type: "error",
25
+ },
26
+ {
27
+ inputs: [
28
+ {
29
+ internalType: "bytes32",
30
+ name: "s",
31
+ type: "bytes32",
32
+ },
33
+ ],
34
+ name: "ECDSAInvalidSignatureS",
35
+ type: "error",
36
+ },
37
+ {
38
+ inputs: [],
39
+ name: "InvalidSigner",
40
+ type: "error",
41
+ },
42
+ {
43
+ inputs: [],
44
+ name: "OnlyMultiSig",
45
+ type: "error",
46
+ },
47
+ {
48
+ inputs: [],
49
+ name: "SignatureError",
50
+ type: "error",
51
+ },
52
+ {
53
+ inputs: [
54
+ {
55
+ internalType: "address",
56
+ name: "signer",
57
+ type: "address",
58
+ },
59
+ ],
60
+ name: "SignerAlreadyAdded",
61
+ type: "error",
62
+ },
63
+ {
64
+ inputs: [
65
+ {
66
+ internalType: "address",
67
+ name: "signer",
68
+ type: "address",
69
+ },
70
+ ],
71
+ name: "SignerNotFound",
72
+ type: "error",
73
+ },
74
+ {
75
+ inputs: [
76
+ {
77
+ internalType: "uint256",
78
+ name: "totalSigners",
79
+ type: "uint256",
80
+ },
81
+ {
82
+ internalType: "uint256",
83
+ name: "threshold",
84
+ type: "uint256",
85
+ },
86
+ ],
87
+ name: "TotalSignersLessThanThreshold",
88
+ type: "error",
89
+ },
90
+ {
91
+ inputs: [],
92
+ name: "UnsortedSigners",
93
+ type: "error",
94
+ },
95
+ {
96
+ inputs: [],
97
+ name: "ZeroThreshold",
98
+ type: "error",
99
+ },
100
+ {
101
+ anonymous: false,
102
+ inputs: [
103
+ {
104
+ indexed: false,
105
+ internalType: "address",
106
+ name: "signer",
107
+ type: "address",
108
+ },
109
+ {
110
+ indexed: false,
111
+ internalType: "bool",
112
+ name: "active",
113
+ type: "bool",
114
+ },
115
+ ],
116
+ name: "SignerSet",
117
+ type: "event",
118
+ },
119
+ {
120
+ anonymous: false,
121
+ inputs: [
122
+ {
123
+ indexed: false,
124
+ internalType: "uint256",
125
+ name: "threshold",
126
+ type: "uint256",
127
+ },
128
+ ],
129
+ name: "ThresholdSet",
130
+ type: "event",
131
+ },
132
+ {
133
+ inputs: [],
134
+ name: "getSigners",
135
+ outputs: [
136
+ {
137
+ internalType: "address[]",
138
+ name: "",
139
+ type: "address[]",
140
+ },
141
+ ],
142
+ stateMutability: "view",
143
+ type: "function",
144
+ },
145
+ {
146
+ inputs: [
147
+ {
148
+ internalType: "address",
149
+ name: "_signer",
150
+ type: "address",
151
+ },
152
+ ],
153
+ name: "isSigner",
154
+ outputs: [
155
+ {
156
+ internalType: "bool",
157
+ name: "",
158
+ type: "bool",
159
+ },
160
+ ],
161
+ stateMutability: "view",
162
+ type: "function",
163
+ },
164
+ {
165
+ inputs: [
166
+ {
167
+ internalType: "address",
168
+ name: "_signer",
169
+ type: "address",
170
+ },
171
+ {
172
+ internalType: "bool",
173
+ name: "_active",
174
+ type: "bool",
175
+ },
176
+ ],
177
+ name: "setSigner",
178
+ outputs: [],
179
+ stateMutability: "nonpayable",
180
+ type: "function",
181
+ },
182
+ {
183
+ inputs: [
184
+ {
185
+ internalType: "uint256",
186
+ name: "_threshold",
187
+ type: "uint256",
188
+ },
189
+ ],
190
+ name: "setThreshold",
191
+ outputs: [],
192
+ stateMutability: "nonpayable",
193
+ type: "function",
194
+ },
195
+ {
196
+ inputs: [],
197
+ name: "threshold",
198
+ outputs: [
199
+ {
200
+ internalType: "uint256",
201
+ name: "",
202
+ type: "uint256",
203
+ },
204
+ ],
205
+ stateMutability: "view",
206
+ type: "function",
207
+ },
208
+ {
209
+ inputs: [],
210
+ name: "totalSigners",
211
+ outputs: [
212
+ {
213
+ internalType: "uint256",
214
+ name: "",
215
+ type: "uint256",
216
+ },
217
+ ],
218
+ stateMutability: "view",
219
+ type: "function",
220
+ },
221
+ {
222
+ inputs: [
223
+ {
224
+ internalType: "bytes32",
225
+ name: "_digest",
226
+ type: "bytes32",
227
+ },
228
+ {
229
+ internalType: "bytes",
230
+ name: "_signatures",
231
+ type: "bytes",
232
+ },
233
+ {
234
+ internalType: "uint256",
235
+ name: "_threshold",
236
+ type: "uint256",
237
+ },
238
+ ],
239
+ name: "verifyNSignatures",
240
+ outputs: [],
241
+ stateMutability: "view",
242
+ type: "function",
243
+ },
244
+ {
245
+ inputs: [
246
+ {
247
+ internalType: "bytes32",
248
+ name: "_digest",
249
+ type: "bytes32",
250
+ },
251
+ {
252
+ internalType: "bytes",
253
+ name: "_signatures",
254
+ type: "bytes",
255
+ },
256
+ ],
257
+ name: "verifySignatures",
258
+ outputs: [],
259
+ stateMutability: "view",
260
+ type: "function",
261
+ },
262
+ ] as const;
263
+
264
+ export class MultiSig__factory {
265
+ static readonly abi = _abi;
266
+ static createInterface(): MultiSigInterface {
267
+ return new utils.Interface(_abi) as MultiSigInterface;
268
+ }
269
+ static connect(
270
+ address: string,
271
+ signerOrProvider: Signer | Provider
272
+ ): MultiSig {
273
+ return new Contract(address, _abi, signerOrProvider) as MultiSig;
274
+ }
275
+ }