@paimaexample/evm-contracts 0.3.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.
Files changed (79) hide show
  1. package/README.md +7 -0
  2. package/deno.json +28 -0
  3. package/docs/templates/contract.hbs +144 -0
  4. package/docs/templates/helpers.js +61 -0
  5. package/docs/templates/page.hbs +7 -0
  6. package/docs/templates/properties.js +76 -0
  7. package/hardhat.config.ts +11 -0
  8. package/index.js +1 -0
  9. package/mod.ts +0 -0
  10. package/package.json +13 -0
  11. package/remappings.txt +1 -0
  12. package/src/companions/ERC165Contract.json +21 -0
  13. package/src/companions/ERC165Contract.ts +21 -0
  14. package/src/companions/ERC20Contract.json +222 -0
  15. package/src/companions/ERC20Contract.ts +222 -0
  16. package/src/companions/ERC6551RegistryContract.json +128 -0
  17. package/src/companions/ERC6551RegistryContract.ts +128 -0
  18. package/src/companions/ERC721Contract.json +248 -0
  19. package/src/companions/ERC721Contract.ts +222 -0
  20. package/src/companions/IERC1155Contract.json +295 -0
  21. package/src/companions/IERC1155Contract.ts +295 -0
  22. package/src/companions/OldERC6551RegistryContract.json +133 -0
  23. package/src/companions/OldERC6551RegistryContract.ts +133 -0
  24. package/src/companions/PaimaERC721Contract.json +787 -0
  25. package/src/companions/PaimaERC721Contract.ts +787 -0
  26. package/src/companions/PaimaL2Contract.json +134 -0
  27. package/src/companions/PaimaL2Contract.ts +134 -0
  28. package/src/companions/README.md +5 -0
  29. package/src/contracts/AnnotatedMintNft.sol +171 -0
  30. package/src/contracts/BaseState.sol +16 -0
  31. package/src/contracts/ERC1967.sol +43 -0
  32. package/src/contracts/Erc20NftSale.sol +186 -0
  33. package/src/contracts/GenericPayment.sol +60 -0
  34. package/src/contracts/NativeNftSale.sol +97 -0
  35. package/src/contracts/PaimaL2Contract.sol +54 -0
  36. package/src/contracts/Proxy/Erc20NftSaleProxy.sol +79 -0
  37. package/src/contracts/Proxy/GenericPaymentProxy.sol +64 -0
  38. package/src/contracts/Proxy/NativeNftSaleProxy.sol +72 -0
  39. package/src/contracts/Proxy/OrderbookDexProxy.sol +27 -0
  40. package/src/contracts/README.md +72 -0
  41. package/src/contracts/State.sol +25 -0
  42. package/src/contracts/dev/ERC721Dev.sol +13 -0
  43. package/src/contracts/dev/Erc20Dev.sol +13 -0
  44. package/src/contracts/dev/NativeNftSaleUpgradeDev.sol +9 -0
  45. package/src/contracts/dev/NftSaleUpgradeDev.sol +12 -0
  46. package/src/contracts/dev/NftTypeMapper.sol +38 -0
  47. package/src/contracts/dev/Token.sol +15 -0
  48. package/src/contracts/dev/UpgradeDev.sol +10 -0
  49. package/src/contracts/orderbook/IOrderbookDex.sol +215 -0
  50. package/src/contracts/orderbook/OrderbookDex.sol +435 -0
  51. package/src/contracts/token/IERC4906Agnostic.sol +17 -0
  52. package/src/contracts/token/IInverseAppProjected1155.sol +40 -0
  53. package/src/contracts/token/IInverseAppProjectedNft.sol +38 -0
  54. package/src/contracts/token/IInverseBaseProjected1155.sol +25 -0
  55. package/src/contracts/token/IInverseBaseProjectedNft.sol +29 -0
  56. package/src/contracts/token/IInverseProjected1155.sol +38 -0
  57. package/src/contracts/token/IInverseProjectedNft.sol +41 -0
  58. package/src/contracts/token/ITokenUri.sol +10 -0
  59. package/src/contracts/token/IUri.sol +13 -0
  60. package/src/contracts/token/InverseAppProjected1155.sol +218 -0
  61. package/src/contracts/token/InverseAppProjectedNft.sol +192 -0
  62. package/src/contracts/token/InverseBaseProjected1155.sol +170 -0
  63. package/src/contracts/token/InverseBaseProjectedNft.sol +158 -0
  64. package/src/plugin/common.ts +35 -0
  65. package/src/plugin/deployment.ts +161 -0
  66. package/src/plugin/mod.ts +6 -0
  67. package/src/plugin/paimaL2.ts +202 -0
  68. package/src/recommendedHardhat.ts +86 -0
  69. package/test/lib/StdInvariant.sol +96 -0
  70. package/test/lib/cheatcodes.sol +89 -0
  71. package/test/lib/console.sol +1884 -0
  72. package/test/lib/ctest.sol +678 -0
  73. package/test/src/InverseAppProjected1155.t.sol +207 -0
  74. package/test/src/InverseAppProjectedNft.t.sol +164 -0
  75. package/test/src/InverseBaseProjected1155.t.sol +171 -0
  76. package/test/src/InverseBaseProjectedNft.t.sol +141 -0
  77. package/test/src/OrderbookDex.t.sol +710 -0
  78. package/test/src/OrderbookDexInvariant.t.sol +426 -0
  79. package/test/src/PaimaL2ContractTest.sol +115 -0
@@ -0,0 +1,295 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "balanceOf",
5
+ "inputs": [
6
+ {
7
+ "name": "account",
8
+ "type": "address",
9
+ "internalType": "address"
10
+ },
11
+ {
12
+ "name": "id",
13
+ "type": "uint256",
14
+ "internalType": "uint256"
15
+ }
16
+ ],
17
+ "outputs": [
18
+ {
19
+ "name": "",
20
+ "type": "uint256",
21
+ "internalType": "uint256"
22
+ }
23
+ ],
24
+ "stateMutability": "view"
25
+ },
26
+ {
27
+ "type": "function",
28
+ "name": "balanceOfBatch",
29
+ "inputs": [
30
+ {
31
+ "name": "accounts",
32
+ "type": "address[]",
33
+ "internalType": "address[]"
34
+ },
35
+ {
36
+ "name": "ids",
37
+ "type": "uint256[]",
38
+ "internalType": "uint256[]"
39
+ }
40
+ ],
41
+ "outputs": [
42
+ {
43
+ "name": "",
44
+ "type": "uint256[]",
45
+ "internalType": "uint256[]"
46
+ }
47
+ ],
48
+ "stateMutability": "view"
49
+ },
50
+ {
51
+ "type": "function",
52
+ "name": "isApprovedForAll",
53
+ "inputs": [
54
+ {
55
+ "name": "account",
56
+ "type": "address",
57
+ "internalType": "address"
58
+ },
59
+ {
60
+ "name": "operator",
61
+ "type": "address",
62
+ "internalType": "address"
63
+ }
64
+ ],
65
+ "outputs": [
66
+ {
67
+ "name": "",
68
+ "type": "bool",
69
+ "internalType": "bool"
70
+ }
71
+ ],
72
+ "stateMutability": "view"
73
+ },
74
+ {
75
+ "type": "function",
76
+ "name": "safeBatchTransferFrom",
77
+ "inputs": [
78
+ {
79
+ "name": "from",
80
+ "type": "address",
81
+ "internalType": "address"
82
+ },
83
+ {
84
+ "name": "to",
85
+ "type": "address",
86
+ "internalType": "address"
87
+ },
88
+ {
89
+ "name": "ids",
90
+ "type": "uint256[]",
91
+ "internalType": "uint256[]"
92
+ },
93
+ {
94
+ "name": "values",
95
+ "type": "uint256[]",
96
+ "internalType": "uint256[]"
97
+ },
98
+ {
99
+ "name": "data",
100
+ "type": "bytes",
101
+ "internalType": "bytes"
102
+ }
103
+ ],
104
+ "outputs": [],
105
+ "stateMutability": "nonpayable"
106
+ },
107
+ {
108
+ "type": "function",
109
+ "name": "safeTransferFrom",
110
+ "inputs": [
111
+ {
112
+ "name": "from",
113
+ "type": "address",
114
+ "internalType": "address"
115
+ },
116
+ {
117
+ "name": "to",
118
+ "type": "address",
119
+ "internalType": "address"
120
+ },
121
+ {
122
+ "name": "id",
123
+ "type": "uint256",
124
+ "internalType": "uint256"
125
+ },
126
+ {
127
+ "name": "value",
128
+ "type": "uint256",
129
+ "internalType": "uint256"
130
+ },
131
+ {
132
+ "name": "data",
133
+ "type": "bytes",
134
+ "internalType": "bytes"
135
+ }
136
+ ],
137
+ "outputs": [],
138
+ "stateMutability": "nonpayable"
139
+ },
140
+ {
141
+ "type": "function",
142
+ "name": "setApprovalForAll",
143
+ "inputs": [
144
+ {
145
+ "name": "operator",
146
+ "type": "address",
147
+ "internalType": "address"
148
+ },
149
+ {
150
+ "name": "approved",
151
+ "type": "bool",
152
+ "internalType": "bool"
153
+ }
154
+ ],
155
+ "outputs": [],
156
+ "stateMutability": "nonpayable"
157
+ },
158
+ {
159
+ "type": "function",
160
+ "name": "supportsInterface",
161
+ "inputs": [
162
+ {
163
+ "name": "interfaceId",
164
+ "type": "bytes4",
165
+ "internalType": "bytes4"
166
+ }
167
+ ],
168
+ "outputs": [
169
+ {
170
+ "name": "",
171
+ "type": "bool",
172
+ "internalType": "bool"
173
+ }
174
+ ],
175
+ "stateMutability": "view"
176
+ },
177
+ {
178
+ "type": "event",
179
+ "name": "ApprovalForAll",
180
+ "inputs": [
181
+ {
182
+ "name": "account",
183
+ "type": "address",
184
+ "indexed": true,
185
+ "internalType": "address"
186
+ },
187
+ {
188
+ "name": "operator",
189
+ "type": "address",
190
+ "indexed": true,
191
+ "internalType": "address"
192
+ },
193
+ {
194
+ "name": "approved",
195
+ "type": "bool",
196
+ "indexed": false,
197
+ "internalType": "bool"
198
+ }
199
+ ],
200
+ "anonymous": false
201
+ },
202
+ {
203
+ "type": "event",
204
+ "name": "TransferBatch",
205
+ "inputs": [
206
+ {
207
+ "name": "operator",
208
+ "type": "address",
209
+ "indexed": true,
210
+ "internalType": "address"
211
+ },
212
+ {
213
+ "name": "from",
214
+ "type": "address",
215
+ "indexed": true,
216
+ "internalType": "address"
217
+ },
218
+ {
219
+ "name": "to",
220
+ "type": "address",
221
+ "indexed": true,
222
+ "internalType": "address"
223
+ },
224
+ {
225
+ "name": "ids",
226
+ "type": "uint256[]",
227
+ "indexed": false,
228
+ "internalType": "uint256[]"
229
+ },
230
+ {
231
+ "name": "values",
232
+ "type": "uint256[]",
233
+ "indexed": false,
234
+ "internalType": "uint256[]"
235
+ }
236
+ ],
237
+ "anonymous": false
238
+ },
239
+ {
240
+ "type": "event",
241
+ "name": "TransferSingle",
242
+ "inputs": [
243
+ {
244
+ "name": "operator",
245
+ "type": "address",
246
+ "indexed": true,
247
+ "internalType": "address"
248
+ },
249
+ {
250
+ "name": "from",
251
+ "type": "address",
252
+ "indexed": true,
253
+ "internalType": "address"
254
+ },
255
+ {
256
+ "name": "to",
257
+ "type": "address",
258
+ "indexed": true,
259
+ "internalType": "address"
260
+ },
261
+ {
262
+ "name": "id",
263
+ "type": "uint256",
264
+ "indexed": false,
265
+ "internalType": "uint256"
266
+ },
267
+ {
268
+ "name": "value",
269
+ "type": "uint256",
270
+ "indexed": false,
271
+ "internalType": "uint256"
272
+ }
273
+ ],
274
+ "anonymous": false
275
+ },
276
+ {
277
+ "type": "event",
278
+ "name": "URI",
279
+ "inputs": [
280
+ {
281
+ "name": "value",
282
+ "type": "string",
283
+ "indexed": false,
284
+ "internalType": "string"
285
+ },
286
+ {
287
+ "name": "id",
288
+ "type": "uint256",
289
+ "indexed": true,
290
+ "internalType": "uint256"
291
+ }
292
+ ],
293
+ "anonymous": false
294
+ }
295
+ ]
@@ -0,0 +1,295 @@
1
+ export default [
2
+ {
3
+ type: "function",
4
+ name: "balanceOf",
5
+ inputs: [
6
+ {
7
+ name: "account",
8
+ type: "address",
9
+ internalType: "address",
10
+ },
11
+ {
12
+ name: "id",
13
+ type: "uint256",
14
+ internalType: "uint256",
15
+ },
16
+ ],
17
+ outputs: [
18
+ {
19
+ name: "",
20
+ type: "uint256",
21
+ internalType: "uint256",
22
+ },
23
+ ],
24
+ stateMutability: "view",
25
+ },
26
+ {
27
+ type: "function",
28
+ name: "balanceOfBatch",
29
+ inputs: [
30
+ {
31
+ name: "accounts",
32
+ type: "address[]",
33
+ internalType: "address[]",
34
+ },
35
+ {
36
+ name: "ids",
37
+ type: "uint256[]",
38
+ internalType: "uint256[]",
39
+ },
40
+ ],
41
+ outputs: [
42
+ {
43
+ name: "",
44
+ type: "uint256[]",
45
+ internalType: "uint256[]",
46
+ },
47
+ ],
48
+ stateMutability: "view",
49
+ },
50
+ {
51
+ type: "function",
52
+ name: "isApprovedForAll",
53
+ inputs: [
54
+ {
55
+ name: "account",
56
+ type: "address",
57
+ internalType: "address",
58
+ },
59
+ {
60
+ name: "operator",
61
+ type: "address",
62
+ internalType: "address",
63
+ },
64
+ ],
65
+ outputs: [
66
+ {
67
+ name: "",
68
+ type: "bool",
69
+ internalType: "bool",
70
+ },
71
+ ],
72
+ stateMutability: "view",
73
+ },
74
+ {
75
+ type: "function",
76
+ name: "safeBatchTransferFrom",
77
+ inputs: [
78
+ {
79
+ name: "from",
80
+ type: "address",
81
+ internalType: "address",
82
+ },
83
+ {
84
+ name: "to",
85
+ type: "address",
86
+ internalType: "address",
87
+ },
88
+ {
89
+ name: "ids",
90
+ type: "uint256[]",
91
+ internalType: "uint256[]",
92
+ },
93
+ {
94
+ name: "values",
95
+ type: "uint256[]",
96
+ internalType: "uint256[]",
97
+ },
98
+ {
99
+ name: "data",
100
+ type: "bytes",
101
+ internalType: "bytes",
102
+ },
103
+ ],
104
+ outputs: [],
105
+ stateMutability: "nonpayable",
106
+ },
107
+ {
108
+ type: "function",
109
+ name: "safeTransferFrom",
110
+ inputs: [
111
+ {
112
+ name: "from",
113
+ type: "address",
114
+ internalType: "address",
115
+ },
116
+ {
117
+ name: "to",
118
+ type: "address",
119
+ internalType: "address",
120
+ },
121
+ {
122
+ name: "id",
123
+ type: "uint256",
124
+ internalType: "uint256",
125
+ },
126
+ {
127
+ name: "value",
128
+ type: "uint256",
129
+ internalType: "uint256",
130
+ },
131
+ {
132
+ name: "data",
133
+ type: "bytes",
134
+ internalType: "bytes",
135
+ },
136
+ ],
137
+ outputs: [],
138
+ stateMutability: "nonpayable",
139
+ },
140
+ {
141
+ type: "function",
142
+ name: "setApprovalForAll",
143
+ inputs: [
144
+ {
145
+ name: "operator",
146
+ type: "address",
147
+ internalType: "address",
148
+ },
149
+ {
150
+ name: "approved",
151
+ type: "bool",
152
+ internalType: "bool",
153
+ },
154
+ ],
155
+ outputs: [],
156
+ stateMutability: "nonpayable",
157
+ },
158
+ {
159
+ type: "function",
160
+ name: "supportsInterface",
161
+ inputs: [
162
+ {
163
+ name: "interfaceId",
164
+ type: "bytes4",
165
+ internalType: "bytes4",
166
+ },
167
+ ],
168
+ outputs: [
169
+ {
170
+ name: "",
171
+ type: "bool",
172
+ internalType: "bool",
173
+ },
174
+ ],
175
+ stateMutability: "view",
176
+ },
177
+ {
178
+ type: "event",
179
+ name: "ApprovalForAll",
180
+ inputs: [
181
+ {
182
+ name: "account",
183
+ type: "address",
184
+ indexed: true,
185
+ internalType: "address",
186
+ },
187
+ {
188
+ name: "operator",
189
+ type: "address",
190
+ indexed: true,
191
+ internalType: "address",
192
+ },
193
+ {
194
+ name: "approved",
195
+ type: "bool",
196
+ indexed: false,
197
+ internalType: "bool",
198
+ },
199
+ ],
200
+ anonymous: false,
201
+ },
202
+ {
203
+ type: "event",
204
+ name: "TransferBatch",
205
+ inputs: [
206
+ {
207
+ name: "operator",
208
+ type: "address",
209
+ indexed: true,
210
+ internalType: "address",
211
+ },
212
+ {
213
+ name: "from",
214
+ type: "address",
215
+ indexed: true,
216
+ internalType: "address",
217
+ },
218
+ {
219
+ name: "to",
220
+ type: "address",
221
+ indexed: true,
222
+ internalType: "address",
223
+ },
224
+ {
225
+ name: "ids",
226
+ type: "uint256[]",
227
+ indexed: false,
228
+ internalType: "uint256[]",
229
+ },
230
+ {
231
+ name: "values",
232
+ type: "uint256[]",
233
+ indexed: false,
234
+ internalType: "uint256[]",
235
+ },
236
+ ],
237
+ anonymous: false,
238
+ },
239
+ {
240
+ type: "event",
241
+ name: "TransferSingle",
242
+ inputs: [
243
+ {
244
+ name: "operator",
245
+ type: "address",
246
+ indexed: true,
247
+ internalType: "address",
248
+ },
249
+ {
250
+ name: "from",
251
+ type: "address",
252
+ indexed: true,
253
+ internalType: "address",
254
+ },
255
+ {
256
+ name: "to",
257
+ type: "address",
258
+ indexed: true,
259
+ internalType: "address",
260
+ },
261
+ {
262
+ name: "id",
263
+ type: "uint256",
264
+ indexed: false,
265
+ internalType: "uint256",
266
+ },
267
+ {
268
+ name: "value",
269
+ type: "uint256",
270
+ indexed: false,
271
+ internalType: "uint256",
272
+ },
273
+ ],
274
+ anonymous: false,
275
+ },
276
+ {
277
+ type: "event",
278
+ name: "URI",
279
+ inputs: [
280
+ {
281
+ name: "value",
282
+ type: "string",
283
+ indexed: false,
284
+ internalType: "string",
285
+ },
286
+ {
287
+ name: "id",
288
+ type: "uint256",
289
+ indexed: true,
290
+ internalType: "uint256",
291
+ },
292
+ ],
293
+ anonymous: false,
294
+ },
295
+ ] as const;
@@ -0,0 +1,133 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "name": "InitializationFailed",
5
+ "type": "error"
6
+ },
7
+ {
8
+ "anonymous": false,
9
+ "inputs": [
10
+ {
11
+ "indexed": false,
12
+ "internalType": "address",
13
+ "name": "account",
14
+ "type": "address"
15
+ },
16
+ {
17
+ "indexed": false,
18
+ "internalType": "address",
19
+ "name": "implementation",
20
+ "type": "address"
21
+ },
22
+ {
23
+ "indexed": false,
24
+ "internalType": "uint256",
25
+ "name": "chainId",
26
+ "type": "uint256"
27
+ },
28
+ {
29
+ "indexed": false,
30
+ "internalType": "address",
31
+ "name": "tokenContract",
32
+ "type": "address"
33
+ },
34
+ {
35
+ "indexed": false,
36
+ "internalType": "uint256",
37
+ "name": "tokenId",
38
+ "type": "uint256"
39
+ },
40
+ {
41
+ "indexed": false,
42
+ "internalType": "uint256",
43
+ "name": "salt",
44
+ "type": "uint256"
45
+ }
46
+ ],
47
+ "name": "AccountCreated",
48
+ "type": "event"
49
+ },
50
+ {
51
+ "inputs": [
52
+ {
53
+ "internalType": "address",
54
+ "name": "implementation",
55
+ "type": "address"
56
+ },
57
+ {
58
+ "internalType": "uint256",
59
+ "name": "chainId",
60
+ "type": "uint256"
61
+ },
62
+ {
63
+ "internalType": "address",
64
+ "name": "tokenContract",
65
+ "type": "address"
66
+ },
67
+ {
68
+ "internalType": "uint256",
69
+ "name": "tokenId",
70
+ "type": "uint256"
71
+ },
72
+ {
73
+ "internalType": "uint256",
74
+ "name": "salt",
75
+ "type": "uint256"
76
+ }
77
+ ],
78
+ "name": "account",
79
+ "outputs": [
80
+ {
81
+ "internalType": "address",
82
+ "name": "",
83
+ "type": "address"
84
+ }
85
+ ],
86
+ "stateMutability": "view",
87
+ "type": "function"
88
+ },
89
+ {
90
+ "inputs": [
91
+ {
92
+ "internalType": "address",
93
+ "name": "implementation",
94
+ "type": "address"
95
+ },
96
+ {
97
+ "internalType": "uint256",
98
+ "name": "chainId",
99
+ "type": "uint256"
100
+ },
101
+ {
102
+ "internalType": "address",
103
+ "name": "tokenContract",
104
+ "type": "address"
105
+ },
106
+ {
107
+ "internalType": "uint256",
108
+ "name": "tokenId",
109
+ "type": "uint256"
110
+ },
111
+ {
112
+ "internalType": "uint256",
113
+ "name": "salt",
114
+ "type": "uint256"
115
+ },
116
+ {
117
+ "internalType": "bytes",
118
+ "name": "initData",
119
+ "type": "bytes"
120
+ }
121
+ ],
122
+ "name": "createAccount",
123
+ "outputs": [
124
+ {
125
+ "internalType": "address",
126
+ "name": "",
127
+ "type": "address"
128
+ }
129
+ ],
130
+ "stateMutability": "nonpayable",
131
+ "type": "function"
132
+ }
133
+ ]