@ensuro/core 2.9.0 → 2.9.2

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/js/utils.js CHANGED
@@ -1,182 +1,7 @@
1
- const { findAll } = require("solidity-ast/utils");
2
1
  const ethers = require("ethers");
3
2
  const helpers = require("@nomicfoundation/hardhat-network-helpers");
4
- const { DAY, IMPLEMENTATION_SLOT } = require("./constants");
5
-
6
- const _E = ethers.parseEther;
7
- const WAD = 10n ** 18n; // 1e18
8
- const RAY = 10n ** 27n; // 1e27
9
-
10
- function getAddress(addressable) {
11
- return addressable.address || addressable.target || addressable;
12
- }
13
-
14
- async function getStorageLayout(hre, contractSrc, contractName) {
15
- const buildInfo = await hre.artifacts.getBuildInfo(`${contractSrc}:${contractName}`);
16
- if (buildInfo === undefined) throw new Error(`Contract ${contractSrc}:${contractName} not in artifacts`);
17
-
18
- const solcOutput = buildInfo.output;
19
-
20
- const storageLayouts = {};
21
-
22
- for (const def of findAll("ContractDefinition", solcOutput.sources[contractSrc].ast)) {
23
- storageLayouts[def.name] = solcOutput.contracts[contractSrc][def.name].storageLayout;
24
- }
25
-
26
- return storageLayouts[contractName];
27
- }
28
-
29
- /**
30
- * Creates a fixed-point conversion function for the desired number of decimals
31
- * @param decimals The number of decimals. Must be >= 6.
32
- * @returns The amount function created. The function can receive strings (recommended),
33
- * floats/doubles (not recommended) and integers.
34
- *
35
- * Floats will be rounded to 6 decimal before scaling.
36
- */
37
- function amountFunction(decimals) {
38
- return function (value) {
39
- if (value === undefined) return undefined;
40
-
41
- if (typeof value === "string" || value instanceof String) {
42
- return ethers.parseUnits(value, decimals);
43
- }
44
-
45
- if (!Number.isInteger(value)) {
46
- return BigInt(Math.round(value * 1e6).toString()) * BigInt(Math.pow(10, decimals - 6).toString());
47
- }
48
-
49
- return BigInt(value.toString()) * BigInt("10") ** BigInt(decimals.toString());
50
- };
51
- }
52
-
53
- /** Wad function */
54
- const _W = amountFunction(18);
55
-
56
- /** Ray function */
57
- const _R = amountFunction(27);
58
-
59
- /**
60
- * Returns a role identifier by computing the keccak of the role name.
61
- */
62
- function getRole(role) {
63
- if (role.startsWith("0x")) return role;
64
- return role === "DEFAULT_ADMIN_ROLE" ? ethers.ZeroHash : ethers.keccak256(ethers.toUtf8Bytes(role));
65
- }
66
-
67
- /**
68
- * Builds the component role identifier
69
- *
70
- * Mimics the behaviour of the AccessManager.getComponentRole method
71
- *
72
- * Component roles are roles created doing XOR between the component
73
- * address and the original role.
74
- *
75
- * Example:
76
- * getComponentRole("0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", "ORACLE_ADMIN_ROLE")
77
- * // "0x05e01b185238b49f750d03d945e38a7f6c3be8b54de0ee42d481eb7814f0d3a8"
78
- */
79
- function getComponentRole(componentAddress, role) {
80
- if (!role.startsWith("0x")) role = getRole(role);
81
-
82
- // 32 byte array
83
- const bytesRole = ethers.getBytes(role);
84
-
85
- // 20 byte array
86
- const bytesAddress = ethers.getBytes(componentAddress);
87
-
88
- // xor each byte, padding bytesAddress with zeros at the end
89
- // eslint-disable-next-line no-bitwise
90
- return ethers.hexlify(bytesRole.map((elem, idx) => elem ^ (bytesAddress[idx] || 0)));
91
- }
92
-
93
- async function getDefaultSigner(hre) {
94
- const signers = await hre.ethers.getSigners();
95
- return signers[0];
96
- }
97
-
98
- /**
99
- * Grant a component role to a user.
100
- */
101
- // eslint-disable-next-line no-empty-function
102
- async function grantComponentRole(hre, contract, component, role, user, txOverrides = {}, log = () => {}) {
103
- let userAddress;
104
- if (user === undefined) {
105
- user = await getDefaultSigner(hre);
106
- userAddress = user.address;
107
- } else {
108
- userAddress = user.address === undefined ? user : user.address;
109
- }
110
- const roleHex = getRole(role);
111
- const componentAddress = component.address || component;
112
- const componentRole = await contract.getComponentRole(componentAddress, roleHex);
113
- if (!(await contract.hasRole(componentRole, userAddress))) {
114
- await contract.grantComponentRole(componentAddress, roleHex, userAddress, txOverrides);
115
- log(`Role ${role} (${roleHex}) Component ${componentAddress} granted to ${userAddress}`);
116
- } else {
117
- log(`Role ${role} (${roleHex}) Component ${componentAddress} already granted to ${userAddress}`);
118
- }
119
- }
120
-
121
- /**
122
- * Grant a role to a user
123
- */
124
- // eslint-disable-next-line no-empty-function
125
- async function grantRole(hre, contract, role, user, txOverrides = {}, log = () => {}) {
126
- let userAddress;
127
- if (user === undefined) {
128
- user = await getDefaultSigner(hre);
129
- userAddress = user.address;
130
- } else {
131
- userAddress = user.address === undefined ? user : user.address;
132
- }
133
- const roleHex = getRole(role);
134
- if (!(await contract.hasRole(roleHex, userAddress))) {
135
- await contract.grantRole(roleHex, userAddress, txOverrides);
136
- log(`Role ${role} (${roleHex}) granted to ${userAddress}`);
137
- } else {
138
- log(`Role ${role} (${roleHex}) already granted to ${userAddress}`);
139
- }
140
- }
141
-
142
- /**
143
- * Finds an event in the receipt
144
- * @param {Interface} interface The interface of the contract that contains the requested event
145
- * @param {TransactionReceipt} receipt Transaction receipt containing the events in the logs
146
- * @param {String} eventName The name of the event we are interested in
147
- * @param {Boolean} firstOnly If false, returns all the events matching the name
148
- * @param {String} contractAddress If not null, if returns only those events generated by the specified contract
149
- * @returns {LogDescription}
150
- */
151
- function getTransactionEvent(interface, receipt, eventName, firstOnly = true, contractAddress = null) {
152
- const ret = [];
153
- // for each log in the transaction receipt
154
- for (const log of receipt.logs) {
155
- let parsedLog;
156
- if (contractAddress !== null && contractAddress !== log.address) continue;
157
- try {
158
- parsedLog = interface.parseLog(log);
159
- } catch (error) {
160
- continue;
161
- }
162
- if (parsedLog?.name == eventName) {
163
- if (firstOnly) return parsedLog;
164
- ret.push(parsedLog);
165
- }
166
- }
167
- return firstOnly ? null : ret;
168
- }
169
-
170
- /**
171
- * Builds AccessControl error message for comparison in tests
172
- */
173
- function accessControlMessage(user, component, role) {
174
- const userAddr = getAddress(user);
175
- const compAddr = component !== null ? getAddress(component) : component;
176
- const roleHash = component !== null ? getComponentRole(compAddr, role) : getRole(role);
177
-
178
- return `AccessControl: account ${userAddr.toLowerCase()} is missing role ${roleHash}`;
179
- }
3
+ const { DAY } = require("@ensuro/utils/js/constants");
4
+ const { amountFunction, getAddress, _W } = require("@ensuro/utils/js/utils");
180
5
 
181
6
  /**
182
7
  * Create a policy id by combining the riskmodule address and the internal id.
@@ -339,47 +164,16 @@ function defaultBucketParams({ moc, jrCollRatio, collRatio, ensuroPpFee, ensuroC
339
164
  };
340
165
  }
341
166
 
342
- async function readImplementationAddress(hre, contractAddress) {
343
- const implStorage = await hre.ethers.provider.getStorageAt(contractAddress, IMPLEMENTATION_SLOT);
344
- return ethers.utils.getAddress(ethers.utils.hexDataSlice(implStorage, 12));
345
- }
346
-
347
- /**
348
- * Converts a string value to uint256(keccak(value))
349
- * @param {string} value
350
- * @returns {ethers.BigNumber}
351
- */
352
- function uintKeccak(value) {
353
- return BigInt(ethers.keccak256(ethers.toUtf8Bytes(value)));
354
- }
355
-
356
167
  module.exports = {
357
- _E,
358
- _R,
359
- _W,
360
- accessControlMessage,
361
- amountFunction,
362
168
  defaultPolicyParams,
363
169
  defaultPolicyParamsWithBucket,
364
170
  defaultPolicyParamsWithParams,
365
171
  defaultBucketParams,
366
- getAddress,
367
- getComponentRole,
368
- getDefaultSigner,
369
- getRole,
370
- getStorageLayout,
371
- getTransactionEvent,
372
- grantComponentRole,
373
- grantRole,
374
172
  makeBucketQuoteMessage,
375
173
  makeFullQuoteMessage,
376
174
  paramsAsUint256,
377
175
  makePolicyId,
378
176
  makeQuoteMessage,
379
177
  makeSignedQuote,
380
- RAY,
381
- readImplementationAddress,
382
178
  recoverAddress,
383
- uintKeccak,
384
- WAD,
385
179
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ensuro/core",
3
3
  "description": "Ensuro - Decentralized insurance protocol",
4
- "version": "2.9.0",
4
+ "version": "2.9.2",
5
5
  "files": [
6
6
  "**/*.sol",
7
7
  "/build",
@@ -1,388 +0,0 @@
1
- {
2
- "_format": "hh-sol-artifact-1",
3
- "contractName": "TestNFT",
4
- "sourceName": "contracts/mocks/TestNFT.sol",
5
- "abi": [
6
- {
7
- "inputs": [
8
- {
9
- "internalType": "string",
10
- "name": "name_",
11
- "type": "string"
12
- },
13
- {
14
- "internalType": "string",
15
- "name": "symbol_",
16
- "type": "string"
17
- }
18
- ],
19
- "stateMutability": "nonpayable",
20
- "type": "constructor"
21
- },
22
- {
23
- "anonymous": false,
24
- "inputs": [
25
- {
26
- "indexed": true,
27
- "internalType": "address",
28
- "name": "owner",
29
- "type": "address"
30
- },
31
- {
32
- "indexed": true,
33
- "internalType": "address",
34
- "name": "approved",
35
- "type": "address"
36
- },
37
- {
38
- "indexed": true,
39
- "internalType": "uint256",
40
- "name": "tokenId",
41
- "type": "uint256"
42
- }
43
- ],
44
- "name": "Approval",
45
- "type": "event"
46
- },
47
- {
48
- "anonymous": false,
49
- "inputs": [
50
- {
51
- "indexed": true,
52
- "internalType": "address",
53
- "name": "owner",
54
- "type": "address"
55
- },
56
- {
57
- "indexed": true,
58
- "internalType": "address",
59
- "name": "operator",
60
- "type": "address"
61
- },
62
- {
63
- "indexed": false,
64
- "internalType": "bool",
65
- "name": "approved",
66
- "type": "bool"
67
- }
68
- ],
69
- "name": "ApprovalForAll",
70
- "type": "event"
71
- },
72
- {
73
- "anonymous": false,
74
- "inputs": [
75
- {
76
- "indexed": true,
77
- "internalType": "address",
78
- "name": "from",
79
- "type": "address"
80
- },
81
- {
82
- "indexed": true,
83
- "internalType": "address",
84
- "name": "to",
85
- "type": "address"
86
- },
87
- {
88
- "indexed": true,
89
- "internalType": "uint256",
90
- "name": "tokenId",
91
- "type": "uint256"
92
- }
93
- ],
94
- "name": "Transfer",
95
- "type": "event"
96
- },
97
- {
98
- "inputs": [
99
- {
100
- "internalType": "address",
101
- "name": "to",
102
- "type": "address"
103
- },
104
- {
105
- "internalType": "uint256",
106
- "name": "tokenId",
107
- "type": "uint256"
108
- }
109
- ],
110
- "name": "approve",
111
- "outputs": [],
112
- "stateMutability": "nonpayable",
113
- "type": "function"
114
- },
115
- {
116
- "inputs": [
117
- {
118
- "internalType": "address",
119
- "name": "owner",
120
- "type": "address"
121
- }
122
- ],
123
- "name": "balanceOf",
124
- "outputs": [
125
- {
126
- "internalType": "uint256",
127
- "name": "",
128
- "type": "uint256"
129
- }
130
- ],
131
- "stateMutability": "view",
132
- "type": "function"
133
- },
134
- {
135
- "inputs": [
136
- {
137
- "internalType": "uint256",
138
- "name": "tokenId",
139
- "type": "uint256"
140
- }
141
- ],
142
- "name": "burn",
143
- "outputs": [],
144
- "stateMutability": "nonpayable",
145
- "type": "function"
146
- },
147
- {
148
- "inputs": [
149
- {
150
- "internalType": "uint256",
151
- "name": "tokenId",
152
- "type": "uint256"
153
- }
154
- ],
155
- "name": "getApproved",
156
- "outputs": [
157
- {
158
- "internalType": "address",
159
- "name": "",
160
- "type": "address"
161
- }
162
- ],
163
- "stateMutability": "view",
164
- "type": "function"
165
- },
166
- {
167
- "inputs": [
168
- {
169
- "internalType": "address",
170
- "name": "owner",
171
- "type": "address"
172
- },
173
- {
174
- "internalType": "address",
175
- "name": "operator",
176
- "type": "address"
177
- }
178
- ],
179
- "name": "isApprovedForAll",
180
- "outputs": [
181
- {
182
- "internalType": "bool",
183
- "name": "",
184
- "type": "bool"
185
- }
186
- ],
187
- "stateMutability": "view",
188
- "type": "function"
189
- },
190
- {
191
- "inputs": [
192
- {
193
- "internalType": "address",
194
- "name": "recipient",
195
- "type": "address"
196
- },
197
- {
198
- "internalType": "uint256",
199
- "name": "tokenId",
200
- "type": "uint256"
201
- }
202
- ],
203
- "name": "mint",
204
- "outputs": [],
205
- "stateMutability": "nonpayable",
206
- "type": "function"
207
- },
208
- {
209
- "inputs": [],
210
- "name": "name",
211
- "outputs": [
212
- {
213
- "internalType": "string",
214
- "name": "",
215
- "type": "string"
216
- }
217
- ],
218
- "stateMutability": "view",
219
- "type": "function"
220
- },
221
- {
222
- "inputs": [
223
- {
224
- "internalType": "uint256",
225
- "name": "tokenId",
226
- "type": "uint256"
227
- }
228
- ],
229
- "name": "ownerOf",
230
- "outputs": [
231
- {
232
- "internalType": "address",
233
- "name": "",
234
- "type": "address"
235
- }
236
- ],
237
- "stateMutability": "view",
238
- "type": "function"
239
- },
240
- {
241
- "inputs": [
242
- {
243
- "internalType": "address",
244
- "name": "from",
245
- "type": "address"
246
- },
247
- {
248
- "internalType": "address",
249
- "name": "to",
250
- "type": "address"
251
- },
252
- {
253
- "internalType": "uint256",
254
- "name": "tokenId",
255
- "type": "uint256"
256
- }
257
- ],
258
- "name": "safeTransferFrom",
259
- "outputs": [],
260
- "stateMutability": "nonpayable",
261
- "type": "function"
262
- },
263
- {
264
- "inputs": [
265
- {
266
- "internalType": "address",
267
- "name": "from",
268
- "type": "address"
269
- },
270
- {
271
- "internalType": "address",
272
- "name": "to",
273
- "type": "address"
274
- },
275
- {
276
- "internalType": "uint256",
277
- "name": "tokenId",
278
- "type": "uint256"
279
- },
280
- {
281
- "internalType": "bytes",
282
- "name": "data",
283
- "type": "bytes"
284
- }
285
- ],
286
- "name": "safeTransferFrom",
287
- "outputs": [],
288
- "stateMutability": "nonpayable",
289
- "type": "function"
290
- },
291
- {
292
- "inputs": [
293
- {
294
- "internalType": "address",
295
- "name": "operator",
296
- "type": "address"
297
- },
298
- {
299
- "internalType": "bool",
300
- "name": "approved",
301
- "type": "bool"
302
- }
303
- ],
304
- "name": "setApprovalForAll",
305
- "outputs": [],
306
- "stateMutability": "nonpayable",
307
- "type": "function"
308
- },
309
- {
310
- "inputs": [
311
- {
312
- "internalType": "bytes4",
313
- "name": "interfaceId",
314
- "type": "bytes4"
315
- }
316
- ],
317
- "name": "supportsInterface",
318
- "outputs": [
319
- {
320
- "internalType": "bool",
321
- "name": "",
322
- "type": "bool"
323
- }
324
- ],
325
- "stateMutability": "view",
326
- "type": "function"
327
- },
328
- {
329
- "inputs": [],
330
- "name": "symbol",
331
- "outputs": [
332
- {
333
- "internalType": "string",
334
- "name": "",
335
- "type": "string"
336
- }
337
- ],
338
- "stateMutability": "view",
339
- "type": "function"
340
- },
341
- {
342
- "inputs": [
343
- {
344
- "internalType": "uint256",
345
- "name": "tokenId",
346
- "type": "uint256"
347
- }
348
- ],
349
- "name": "tokenURI",
350
- "outputs": [
351
- {
352
- "internalType": "string",
353
- "name": "",
354
- "type": "string"
355
- }
356
- ],
357
- "stateMutability": "view",
358
- "type": "function"
359
- },
360
- {
361
- "inputs": [
362
- {
363
- "internalType": "address",
364
- "name": "from",
365
- "type": "address"
366
- },
367
- {
368
- "internalType": "address",
369
- "name": "to",
370
- "type": "address"
371
- },
372
- {
373
- "internalType": "uint256",
374
- "name": "tokenId",
375
- "type": "uint256"
376
- }
377
- ],
378
- "name": "transferFrom",
379
- "outputs": [],
380
- "stateMutability": "nonpayable",
381
- "type": "function"
382
- }
383
- ],
384
- "bytecode": "0x608060405234801561000f575f5ffd5b5060405161162938038061162983398101604081905261002e91610102565b81815f61003b83826101eb565b50600161004882826101eb565b5050600680546001600160a01b03191633179055506102a5915050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112610088575f5ffd5b81516001600160401b038111156100a1576100a1610065565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100cf576100cf610065565b6040528181528382016020018510156100e6575f5ffd5b8160208501602083015e5f918101602001919091529392505050565b5f5f60408385031215610113575f5ffd5b82516001600160401b03811115610128575f5ffd5b61013485828601610079565b602085015190935090506001600160401b03811115610151575f5ffd5b61015d85828601610079565b9150509250929050565b600181811c9082168061017b57607f821691505b60208210810361019957634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156101e657805f5260205f20601f840160051c810160208510156101c45750805b601f840160051c820191505b818110156101e3575f81556001016101d0565b50505b505050565b81516001600160401b0381111561020457610204610065565b610218816102128454610167565b8461019f565b6020601f82116001811461024a575f83156102335750848201515b5f19600385901b1c1916600184901b1784556101e3565b5f84815260208120601f198516915b828110156102795787850151825560209485019460019092019101610259565b508482101561029657868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b611377806102b25f395ff3fe608060405234801561000f575f5ffd5b50600436106100f0575f3560e01c806342966c6811610093578063a22cb46511610063578063a22cb465146101f9578063b88d4fde1461020c578063c87b56dd1461021f578063e985e9c514610232575f5ffd5b806342966c68146101aa5780636352211e146101bd57806370a08231146101d057806395d89b41146101f1575f5ffd5b8063095ea7b3116100ce578063095ea7b31461015c57806323b872dd1461017157806340c10f191461018457806342842e0e14610197575f5ffd5b806301ffc9a7146100f457806306fdde031461011c578063081812fc14610131575b5f5ffd5b610107610102366004610f40565b61026d565b60405190151581526020015b60405180910390f35b6101246102be565b6040516101139190610f89565b61014461013f366004610f9b565b61034d565b6040516001600160a01b039091168152602001610113565b61016f61016a366004610fcd565b610372565b005b61016f61017f366004610ff5565b61048b565b61016f610192366004610fcd565b6104bc565b61016f6101a5366004610ff5565b6104ca565b61016f6101b8366004610f9b565b6104e4565b6101446101cb366004610f9b565b61055e565b6101e36101de36600461102f565b6105bd565b604051908152602001610113565b610124610641565b61016f610207366004611048565b610650565b61016f61021a366004611095565b61065b565b61012461022d366004610f9b565b610693565b610107610240366004611172565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b5f6001600160e01b031982166380ac58cd60e01b148061029d57506001600160e01b03198216635b5e139f60e01b145b806102b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60605f80546102cc906111a3565b80601f01602080910402602001604051908101604052809291908181526020018280546102f8906111a3565b80156103435780601f1061031a57610100808354040283529160200191610343565b820191905f5260205f20905b81548152906001019060200180831161032657829003601f168201915b5050505050905090565b5f61035782610703565b505f908152600460205260409020546001600160a01b031690565b5f61037c8261055e565b9050806001600160a01b0316836001600160a01b0316036103ee5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061040a575061040a8133610240565b61047c5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103e5565b6104868383610761565b505050565b61049533826107ce565b6104b15760405162461bcd60e51b81526004016103e5906111db565b61048683838361084b565b6104c682826109ad565b5050565b61048683838360405180602001604052805f81525061065b565b336104ee8261055e565b6001600160a01b0316146105525760405162461bcd60e51b815260206004820152602560248201527f4552433732313a206275726e206f6620746f6b656e2074686174206973206e6f6044820152643a1037bbb760d91b60648201526084016103e5565b61055b81610b35565b50565b5f818152600260205260408120546001600160a01b0316806102b85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f6001600160a01b0382166106265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016103e5565b506001600160a01b03165f9081526003602052604090205490565b6060600180546102cc906111a3565b6104c6338383610bc7565b61066533836107ce565b6106815760405162461bcd60e51b81526004016103e5906111db565b61068d84848484610c94565b50505050565b606061069e82610703565b5f6106b360408051602081019091525f815290565b90505f8151116106d15760405180602001604052805f8152506106fc565b806106db84610cc7565b6040516020016106ec92919061123f565b6040516020818303038152906040525b9392505050565b5f818152600260205260409020546001600160a01b031661055b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f81815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906107958261055e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f5f6107d98361055e565b9050806001600160a01b0316846001600160a01b0316148061081f57506001600160a01b038082165f9081526005602090815260408083209388168352929052205460ff165b806108435750836001600160a01b03166108388461034d565b6001600160a01b0316145b949350505050565b826001600160a01b031661085e8261055e565b6001600160a01b0316146108845760405162461bcd60e51b81526004016103e590611253565b6001600160a01b0382166108e65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103e5565b826001600160a01b03166108f98261055e565b6001600160a01b03161461091f5760405162461bcd60e51b81526004016103e590611253565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610a035760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610a675760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610acb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f610b3f8261055e565b9050610b4a8261055e565b5f83815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080545f190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610c285760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103e5565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610c9f84848461084b565b610cab84848484610d57565b61068d5760405162461bcd60e51b81526004016103e590611298565b60605f610cd383610e54565b60010190505f8167ffffffffffffffff811115610cf257610cf2611081565b6040519080825280601f01601f191660200182016040528015610d1c576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610d2657509392505050565b5f6001600160a01b0384163b15610e4957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610d9a9033908990889088906004016112ea565b6020604051808303815f875af1925050508015610dd4575060408051601f3d908101601f19168201909252610dd191810190611326565b60015b610e2f573d808015610e01576040519150601f19603f3d011682016040523d82523d5f602084013e610e06565b606091505b5080515f03610e275760405162461bcd60e51b81526004016103e590611298565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610843565b506001949350505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610e925772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610ebe576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610edc57662386f26fc10000830492506010015b6305f5e1008310610ef4576305f5e100830492506008015b6127108310610f0857612710830492506004015b60648310610f1a576064830492506002015b600a83106102b85760010192915050565b6001600160e01b03198116811461055b575f5ffd5b5f60208284031215610f50575f5ffd5b81356106fc81610f2b565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6106fc6020830184610f5b565b5f60208284031215610fab575f5ffd5b5035919050565b80356001600160a01b0381168114610fc8575f5ffd5b919050565b5f5f60408385031215610fde575f5ffd5b610fe783610fb2565b946020939093013593505050565b5f5f5f60608486031215611007575f5ffd5b61101084610fb2565b925061101e60208501610fb2565b929592945050506040919091013590565b5f6020828403121561103f575f5ffd5b6106fc82610fb2565b5f5f60408385031215611059575f5ffd5b61106283610fb2565b915060208301358015158114611076575f5ffd5b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f608085870312156110a8575f5ffd5b6110b185610fb2565b93506110bf60208601610fb2565b925060408501359150606085013567ffffffffffffffff8111156110e1575f5ffd5b8501601f810187136110f1575f5ffd5b803567ffffffffffffffff81111561110b5761110b611081565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561113a5761113a611081565b604052818152828201602001891015611151575f5ffd5b816020840160208301375f6020838301015280935050505092959194509250565b5f5f60408385031215611183575f5ffd5b61118c83610fb2565b915061119a60208401610fb2565b90509250929050565b600181811c908216806111b757607f821691505b6020821081036111d557634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b5f81518060208401855e5f93019283525090919050565b5f61084361124d8386611228565b84611228565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f9061131c90830184610f5b565b9695505050505050565b5f60208284031215611336575f5ffd5b81516106fc81610f2b56fea264697066735822122009d08b38a08341b4445cbd1b89b6d087ed617c214c25ba53062a396e4a59618264736f6c634300081c0033",
385
- "deployedBytecode": "0x608060405234801561000f575f5ffd5b50600436106100f0575f3560e01c806342966c6811610093578063a22cb46511610063578063a22cb465146101f9578063b88d4fde1461020c578063c87b56dd1461021f578063e985e9c514610232575f5ffd5b806342966c68146101aa5780636352211e146101bd57806370a08231146101d057806395d89b41146101f1575f5ffd5b8063095ea7b3116100ce578063095ea7b31461015c57806323b872dd1461017157806340c10f191461018457806342842e0e14610197575f5ffd5b806301ffc9a7146100f457806306fdde031461011c578063081812fc14610131575b5f5ffd5b610107610102366004610f40565b61026d565b60405190151581526020015b60405180910390f35b6101246102be565b6040516101139190610f89565b61014461013f366004610f9b565b61034d565b6040516001600160a01b039091168152602001610113565b61016f61016a366004610fcd565b610372565b005b61016f61017f366004610ff5565b61048b565b61016f610192366004610fcd565b6104bc565b61016f6101a5366004610ff5565b6104ca565b61016f6101b8366004610f9b565b6104e4565b6101446101cb366004610f9b565b61055e565b6101e36101de36600461102f565b6105bd565b604051908152602001610113565b610124610641565b61016f610207366004611048565b610650565b61016f61021a366004611095565b61065b565b61012461022d366004610f9b565b610693565b610107610240366004611172565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b5f6001600160e01b031982166380ac58cd60e01b148061029d57506001600160e01b03198216635b5e139f60e01b145b806102b857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60605f80546102cc906111a3565b80601f01602080910402602001604051908101604052809291908181526020018280546102f8906111a3565b80156103435780601f1061031a57610100808354040283529160200191610343565b820191905f5260205f20905b81548152906001019060200180831161032657829003601f168201915b5050505050905090565b5f61035782610703565b505f908152600460205260409020546001600160a01b031690565b5f61037c8261055e565b9050806001600160a01b0316836001600160a01b0316036103ee5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061040a575061040a8133610240565b61047c5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103e5565b6104868383610761565b505050565b61049533826107ce565b6104b15760405162461bcd60e51b81526004016103e5906111db565b61048683838361084b565b6104c682826109ad565b5050565b61048683838360405180602001604052805f81525061065b565b336104ee8261055e565b6001600160a01b0316146105525760405162461bcd60e51b815260206004820152602560248201527f4552433732313a206275726e206f6620746f6b656e2074686174206973206e6f6044820152643a1037bbb760d91b60648201526084016103e5565b61055b81610b35565b50565b5f818152600260205260408120546001600160a01b0316806102b85760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f6001600160a01b0382166106265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016103e5565b506001600160a01b03165f9081526003602052604090205490565b6060600180546102cc906111a3565b6104c6338383610bc7565b61066533836107ce565b6106815760405162461bcd60e51b81526004016103e5906111db565b61068d84848484610c94565b50505050565b606061069e82610703565b5f6106b360408051602081019091525f815290565b90505f8151116106d15760405180602001604052805f8152506106fc565b806106db84610cc7565b6040516020016106ec92919061123f565b6040516020818303038152906040525b9392505050565b5f818152600260205260409020546001600160a01b031661055b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e5565b5f81815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906107958261055e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f5f6107d98361055e565b9050806001600160a01b0316846001600160a01b0316148061081f57506001600160a01b038082165f9081526005602090815260408083209388168352929052205460ff165b806108435750836001600160a01b03166108388461034d565b6001600160a01b0316145b949350505050565b826001600160a01b031661085e8261055e565b6001600160a01b0316146108845760405162461bcd60e51b81526004016103e590611253565b6001600160a01b0382166108e65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103e5565b826001600160a01b03166108f98261055e565b6001600160a01b03161461091f5760405162461bcd60e51b81526004016103e590611253565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610a035760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610a675760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b5f818152600260205260409020546001600160a01b031615610acb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103e5565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f610b3f8261055e565b9050610b4a8261055e565b5f83815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080545f190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610c285760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103e5565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610c9f84848461084b565b610cab84848484610d57565b61068d5760405162461bcd60e51b81526004016103e590611298565b60605f610cd383610e54565b60010190505f8167ffffffffffffffff811115610cf257610cf2611081565b6040519080825280601f01601f191660200182016040528015610d1c576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610d2657509392505050565b5f6001600160a01b0384163b15610e4957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610d9a9033908990889088906004016112ea565b6020604051808303815f875af1925050508015610dd4575060408051601f3d908101601f19168201909252610dd191810190611326565b60015b610e2f573d808015610e01576040519150601f19603f3d011682016040523d82523d5f602084013e610e06565b606091505b5080515f03610e275760405162461bcd60e51b81526004016103e590611298565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610843565b506001949350505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610e925772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610ebe576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610edc57662386f26fc10000830492506010015b6305f5e1008310610ef4576305f5e100830492506008015b6127108310610f0857612710830492506004015b60648310610f1a576064830492506002015b600a83106102b85760010192915050565b6001600160e01b03198116811461055b575f5ffd5b5f60208284031215610f50575f5ffd5b81356106fc81610f2b565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6106fc6020830184610f5b565b5f60208284031215610fab575f5ffd5b5035919050565b80356001600160a01b0381168114610fc8575f5ffd5b919050565b5f5f60408385031215610fde575f5ffd5b610fe783610fb2565b946020939093013593505050565b5f5f5f60608486031215611007575f5ffd5b61101084610fb2565b925061101e60208501610fb2565b929592945050506040919091013590565b5f6020828403121561103f575f5ffd5b6106fc82610fb2565b5f5f60408385031215611059575f5ffd5b61106283610fb2565b915060208301358015158114611076575f5ffd5b809150509250929050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f608085870312156110a8575f5ffd5b6110b185610fb2565b93506110bf60208601610fb2565b925060408501359150606085013567ffffffffffffffff8111156110e1575f5ffd5b8501601f810187136110f1575f5ffd5b803567ffffffffffffffff81111561110b5761110b611081565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561113a5761113a611081565b604052818152828201602001891015611151575f5ffd5b816020840160208301375f6020838301015280935050505092959194509250565b5f5f60408385031215611183575f5ffd5b61118c83610fb2565b915061119a60208401610fb2565b90509250929050565b600181811c908216806111b757607f821691505b6020821081036111d557634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b5f81518060208401855e5f93019283525090919050565b5f61084361124d8386611228565b84611228565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f9061131c90830184610f5b565b9695505050505050565b5f60208284031215611336575f5ffd5b81516106fc81610f2b56fea264697066735822122009d08b38a08341b4445cbd1b89b6d087ed617c214c25ba53062a396e4a59618264736f6c634300081c0033",
386
- "linkReferences": {},
387
- "deployedLinkReferences": {}
388
- }
@@ -1,23 +0,0 @@
1
- //SPDX-License-Identifier: Unlicense
2
- pragma solidity ^0.8.0;
3
- pragma experimental ABIEncoderV2;
4
-
5
- import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
6
-
7
- contract TestNFT is ERC721 {
8
- address private _owner;
9
-
10
- constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {
11
- _owner = msg.sender;
12
- }
13
-
14
- function mint(address recipient, uint256 tokenId) public {
15
- // require(msg.sender == _owner, "Only owner can mint");
16
- return _mint(recipient, tokenId);
17
- }
18
-
19
- function burn(uint256 tokenId) public {
20
- require(ERC721.ownerOf(tokenId) == msg.sender, "ERC721: burn of token that is not own");
21
- return _burn(tokenId);
22
- }
23
- }