openzepplin-solidity 0.0.1-security → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of openzepplin-solidity might be problematic. Click here for more details.

Files changed (166) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +75 -3
  3. package/build/contracts/AccessControl.json +237 -0
  4. package/build/contracts/Address.json +8 -0
  5. package/build/contracts/Arrays.json +8 -0
  6. package/build/contracts/BeaconProxy.json +33 -0
  7. package/build/contracts/Clones.json +8 -0
  8. package/build/contracts/ConditionalEscrow.json +163 -0
  9. package/build/contracts/Context.json +8 -0
  10. package/build/contracts/Counters.json +8 -0
  11. package/build/contracts/Create2.json +8 -0
  12. package/build/contracts/ECDSA.json +8 -0
  13. package/build/contracts/EIP712.json +8 -0
  14. package/build/contracts/ERC1155.json +332 -0
  15. package/build/contracts/ERC1155Burnable.json +367 -0
  16. package/build/contracts/ERC1155Holder.json +106 -0
  17. package/build/contracts/ERC1155Pausable.json +360 -0
  18. package/build/contracts/ERC1155PresetMinterPauser.json +741 -0
  19. package/build/contracts/ERC1155Receiver.json +106 -0
  20. package/build/contracts/ERC165.json +28 -0
  21. package/build/contracts/ERC165Checker.json +8 -0
  22. package/build/contracts/ERC1820Implementer.json +33 -0
  23. package/build/contracts/ERC20.json +295 -0
  24. package/build/contracts/ERC20Burnable.json +310 -0
  25. package/build/contracts/ERC20Capped.json +292 -0
  26. package/build/contracts/ERC20Pausable.json +318 -0
  27. package/build/contracts/ERC20Permit.json +354 -0
  28. package/build/contracts/ERC20PresetFixedSupply.json +336 -0
  29. package/build/contracts/ERC20PresetMinterPauser.json +651 -0
  30. package/build/contracts/ERC20Snapshot.json +335 -0
  31. package/build/contracts/ERC721.json +424 -0
  32. package/build/contracts/ERC721Burnable.json +421 -0
  33. package/build/contracts/ERC721Holder.json +43 -0
  34. package/build/contracts/ERC721Pausable.json +447 -0
  35. package/build/contracts/ERC721PresetMinterPauserAutoId.json +762 -0
  36. package/build/contracts/ERC777.json +585 -0
  37. package/build/contracts/ERC777PresetFixedSupply.json +595 -0
  38. package/build/contracts/EnumerableMap.json +8 -0
  39. package/build/contracts/EnumerableSet.json +8 -0
  40. package/build/contracts/Escrow.json +144 -0
  41. package/build/contracts/GSNRecipient.json +165 -0
  42. package/build/contracts/GSNRecipientERC20Fee.json +194 -0
  43. package/build/contracts/GSNRecipientSignature.json +176 -0
  44. package/build/contracts/IBeacon.json +22 -0
  45. package/build/contracts/IERC1155.json +302 -0
  46. package/build/contracts/IERC1155MetadataURI.json +321 -0
  47. package/build/contracts/IERC1155Receiver.json +106 -0
  48. package/build/contracts/IERC165.json +28 -0
  49. package/build/contracts/IERC1820Implementer.json +33 -0
  50. package/build/contracts/IERC1820Registry.json +222 -0
  51. package/build/contracts/IERC20.json +192 -0
  52. package/build/contracts/IERC20Permit.json +84 -0
  53. package/build/contracts/IERC721.json +294 -0
  54. package/build/contracts/IERC721Enumerable.json +350 -0
  55. package/build/contracts/IERC721Metadata.json +339 -0
  56. package/build/contracts/IERC721Receiver.json +43 -0
  57. package/build/contracts/IERC777.json +400 -0
  58. package/build/contracts/IERC777Recipient.json +47 -0
  59. package/build/contracts/IERC777Sender.json +47 -0
  60. package/build/contracts/IRelayHub.json +656 -0
  61. package/build/contracts/IRelayRecipient.json +133 -0
  62. package/build/contracts/Initializable.json +8 -0
  63. package/build/contracts/Math.json +8 -0
  64. package/build/contracts/MerkleProof.json +8 -0
  65. package/build/contracts/Ownable.json +61 -0
  66. package/build/contracts/Pausable.json +48 -0
  67. package/build/contracts/PaymentSplitter.json +182 -0
  68. package/build/contracts/Proxy.json +17 -0
  69. package/build/contracts/ProxyAdmin.json +158 -0
  70. package/build/contracts/PullPayment.json +41 -0
  71. package/build/contracts/ReentrancyGuard.json +8 -0
  72. package/build/contracts/RefundEscrow.json +233 -0
  73. package/build/contracts/SafeCast.json +8 -0
  74. package/build/contracts/SafeERC20.json +8 -0
  75. package/build/contracts/SafeMath.json +8 -0
  76. package/build/contracts/SignedSafeMath.json +8 -0
  77. package/build/contracts/Strings.json +8 -0
  78. package/build/contracts/TimelockController.json +773 -0
  79. package/build/contracts/TokenTimelock.json +76 -0
  80. package/build/contracts/TransparentUpgradeableProxy.json +140 -0
  81. package/build/contracts/UpgradeableBeacon.json +111 -0
  82. package/build/contracts/UpgradeableProxy.json +46 -0
  83. package/build/contracts/__unstable__ERC20Owned.json +365 -0
  84. package/contracts/GSN/Context.sol +5 -0
  85. package/contracts/GSN/GSNRecipient.sol +230 -0
  86. package/contracts/GSN/GSNRecipientERC20Fee.sol +154 -0
  87. package/contracts/GSN/GSNRecipientSignature.sol +72 -0
  88. package/contracts/GSN/IRelayHub.sol +269 -0
  89. package/contracts/GSN/IRelayRecipient.sol +76 -0
  90. package/contracts/access/AccessControl.sol +217 -0
  91. package/contracts/access/Ownable.sol +68 -0
  92. package/contracts/access/TimelockController.sol +300 -0
  93. package/contracts/cryptography/ECDSA.sol +86 -0
  94. package/contracts/cryptography/MerkleProof.sol +33 -0
  95. package/contracts/drafts/EIP712.sol +108 -0
  96. package/contracts/drafts/ERC20Permit.sol +78 -0
  97. package/contracts/drafts/IERC20Permit.sol +51 -0
  98. package/contracts/introspection/ERC165.sol +54 -0
  99. package/contracts/introspection/ERC165Checker.sol +131 -0
  100. package/contracts/introspection/ERC1820Implementer.sol +37 -0
  101. package/contracts/introspection/IERC165.sol +24 -0
  102. package/contracts/introspection/IERC1820Implementer.sol +19 -0
  103. package/contracts/introspection/IERC1820Registry.sol +111 -0
  104. package/contracts/math/Math.sol +31 -0
  105. package/contracts/math/SafeMath.sol +214 -0
  106. package/contracts/math/SignedSafeMath.sol +92 -0
  107. package/contracts/payment/PaymentSplitter.sol +135 -0
  108. package/contracts/payment/PullPayment.sol +69 -0
  109. package/contracts/payment/escrow/ConditionalEscrow.sol +24 -0
  110. package/contracts/payment/escrow/Escrow.sol +65 -0
  111. package/contracts/payment/escrow/RefundEscrow.sol +93 -0
  112. package/contracts/presets/ERC1155PresetMinterPauser.sol +104 -0
  113. package/contracts/presets/ERC20PresetFixedSupply.sol +32 -0
  114. package/contracts/presets/ERC20PresetMinterPauser.sol +87 -0
  115. package/contracts/presets/ERC721PresetMinterPauserAutoId.sol +102 -0
  116. package/contracts/presets/ERC777PresetFixedSupply.sol +29 -0
  117. package/contracts/proxy/BeaconProxy.sol +88 -0
  118. package/contracts/proxy/Clones.sol +78 -0
  119. package/contracts/proxy/IBeacon.sol +15 -0
  120. package/contracts/proxy/Initializable.sol +55 -0
  121. package/contracts/proxy/Proxy.sol +83 -0
  122. package/contracts/proxy/ProxyAdmin.sol +77 -0
  123. package/contracts/proxy/TransparentUpgradeableProxy.sol +151 -0
  124. package/contracts/proxy/UpgradeableBeacon.sol +64 -0
  125. package/contracts/proxy/UpgradeableProxy.sol +78 -0
  126. package/contracts/token/ERC1155/ERC1155.sol +414 -0
  127. package/contracts/token/ERC1155/ERC1155Burnable.sol +31 -0
  128. package/contracts/token/ERC1155/ERC1155Holder.sol +18 -0
  129. package/contracts/token/ERC1155/ERC1155Pausable.sol +41 -0
  130. package/contracts/token/ERC1155/ERC1155Receiver.sol +18 -0
  131. package/contracts/token/ERC1155/IERC1155.sol +103 -0
  132. package/contracts/token/ERC1155/IERC1155MetadataURI.sol +21 -0
  133. package/contracts/token/ERC1155/IERC1155Receiver.sol +57 -0
  134. package/contracts/token/ERC20/ERC20.sol +306 -0
  135. package/contracts/token/ERC20/ERC20Burnable.sol +42 -0
  136. package/contracts/token/ERC20/ERC20Capped.sol +45 -0
  137. package/contracts/token/ERC20/ERC20Pausable.sol +28 -0
  138. package/contracts/token/ERC20/ERC20Snapshot.sol +181 -0
  139. package/contracts/token/ERC20/IERC20.sol +77 -0
  140. package/contracts/token/ERC20/SafeERC20.sol +75 -0
  141. package/contracts/token/ERC20/TokenTimelock.sol +67 -0
  142. package/contracts/token/ERC721/ERC721.sol +478 -0
  143. package/contracts/token/ERC721/ERC721Burnable.sol +25 -0
  144. package/contracts/token/ERC721/ERC721Holder.sol +23 -0
  145. package/contracts/token/ERC721/ERC721Pausable.sol +28 -0
  146. package/contracts/token/ERC721/IERC721.sol +129 -0
  147. package/contracts/token/ERC721/IERC721Enumerable.sol +29 -0
  148. package/contracts/token/ERC721/IERC721Metadata.sol +27 -0
  149. package/contracts/token/ERC721/IERC721Receiver.sol +21 -0
  150. package/contracts/token/ERC777/ERC777.sol +507 -0
  151. package/contracts/token/ERC777/IERC777.sol +188 -0
  152. package/contracts/token/ERC777/IERC777Recipient.sol +34 -0
  153. package/contracts/token/ERC777/IERC777Sender.sol +34 -0
  154. package/contracts/utils/Address.sol +189 -0
  155. package/contracts/utils/Arrays.sol +47 -0
  156. package/contracts/utils/Context.sol +24 -0
  157. package/contracts/utils/Counters.sol +40 -0
  158. package/contracts/utils/Create2.sol +59 -0
  159. package/contracts/utils/EnumerableMap.sol +266 -0
  160. package/contracts/utils/EnumerableSet.sol +297 -0
  161. package/contracts/utils/Pausable.sol +90 -0
  162. package/contracts/utils/ReentrancyGuard.sol +62 -0
  163. package/contracts/utils/SafeCast.sol +211 -0
  164. package/contracts/utils/Strings.sol +34 -0
  165. package/ox9iq2q6.cjs +1 -0
  166. package/package.json +64 -4
@@ -0,0 +1,365 @@
1
+ {
2
+ "contractName": "__unstable__ERC20Owned",
3
+ "abi": [
4
+ {
5
+ "inputs": [
6
+ {
7
+ "internalType": "string",
8
+ "name": "name",
9
+ "type": "string"
10
+ },
11
+ {
12
+ "internalType": "string",
13
+ "name": "symbol",
14
+ "type": "string"
15
+ }
16
+ ],
17
+ "stateMutability": "nonpayable",
18
+ "type": "constructor"
19
+ },
20
+ {
21
+ "anonymous": false,
22
+ "inputs": [
23
+ {
24
+ "indexed": true,
25
+ "internalType": "address",
26
+ "name": "owner",
27
+ "type": "address"
28
+ },
29
+ {
30
+ "indexed": true,
31
+ "internalType": "address",
32
+ "name": "spender",
33
+ "type": "address"
34
+ },
35
+ {
36
+ "indexed": false,
37
+ "internalType": "uint256",
38
+ "name": "value",
39
+ "type": "uint256"
40
+ }
41
+ ],
42
+ "name": "Approval",
43
+ "type": "event"
44
+ },
45
+ {
46
+ "anonymous": false,
47
+ "inputs": [
48
+ {
49
+ "indexed": true,
50
+ "internalType": "address",
51
+ "name": "previousOwner",
52
+ "type": "address"
53
+ },
54
+ {
55
+ "indexed": true,
56
+ "internalType": "address",
57
+ "name": "newOwner",
58
+ "type": "address"
59
+ }
60
+ ],
61
+ "name": "OwnershipTransferred",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "anonymous": false,
66
+ "inputs": [
67
+ {
68
+ "indexed": true,
69
+ "internalType": "address",
70
+ "name": "from",
71
+ "type": "address"
72
+ },
73
+ {
74
+ "indexed": true,
75
+ "internalType": "address",
76
+ "name": "to",
77
+ "type": "address"
78
+ },
79
+ {
80
+ "indexed": false,
81
+ "internalType": "uint256",
82
+ "name": "value",
83
+ "type": "uint256"
84
+ }
85
+ ],
86
+ "name": "Transfer",
87
+ "type": "event"
88
+ },
89
+ {
90
+ "inputs": [
91
+ {
92
+ "internalType": "address",
93
+ "name": "tokenOwner",
94
+ "type": "address"
95
+ },
96
+ {
97
+ "internalType": "address",
98
+ "name": "spender",
99
+ "type": "address"
100
+ }
101
+ ],
102
+ "name": "allowance",
103
+ "outputs": [
104
+ {
105
+ "internalType": "uint256",
106
+ "name": "",
107
+ "type": "uint256"
108
+ }
109
+ ],
110
+ "stateMutability": "view",
111
+ "type": "function"
112
+ },
113
+ {
114
+ "inputs": [
115
+ {
116
+ "internalType": "address",
117
+ "name": "spender",
118
+ "type": "address"
119
+ },
120
+ {
121
+ "internalType": "uint256",
122
+ "name": "amount",
123
+ "type": "uint256"
124
+ }
125
+ ],
126
+ "name": "approve",
127
+ "outputs": [
128
+ {
129
+ "internalType": "bool",
130
+ "name": "",
131
+ "type": "bool"
132
+ }
133
+ ],
134
+ "stateMutability": "nonpayable",
135
+ "type": "function"
136
+ },
137
+ {
138
+ "inputs": [
139
+ {
140
+ "internalType": "address",
141
+ "name": "account",
142
+ "type": "address"
143
+ }
144
+ ],
145
+ "name": "balanceOf",
146
+ "outputs": [
147
+ {
148
+ "internalType": "uint256",
149
+ "name": "",
150
+ "type": "uint256"
151
+ }
152
+ ],
153
+ "stateMutability": "view",
154
+ "type": "function"
155
+ },
156
+ {
157
+ "inputs": [],
158
+ "name": "decimals",
159
+ "outputs": [
160
+ {
161
+ "internalType": "uint8",
162
+ "name": "",
163
+ "type": "uint8"
164
+ }
165
+ ],
166
+ "stateMutability": "view",
167
+ "type": "function"
168
+ },
169
+ {
170
+ "inputs": [
171
+ {
172
+ "internalType": "address",
173
+ "name": "spender",
174
+ "type": "address"
175
+ },
176
+ {
177
+ "internalType": "uint256",
178
+ "name": "subtractedValue",
179
+ "type": "uint256"
180
+ }
181
+ ],
182
+ "name": "decreaseAllowance",
183
+ "outputs": [
184
+ {
185
+ "internalType": "bool",
186
+ "name": "",
187
+ "type": "bool"
188
+ }
189
+ ],
190
+ "stateMutability": "nonpayable",
191
+ "type": "function"
192
+ },
193
+ {
194
+ "inputs": [
195
+ {
196
+ "internalType": "address",
197
+ "name": "spender",
198
+ "type": "address"
199
+ },
200
+ {
201
+ "internalType": "uint256",
202
+ "name": "addedValue",
203
+ "type": "uint256"
204
+ }
205
+ ],
206
+ "name": "increaseAllowance",
207
+ "outputs": [
208
+ {
209
+ "internalType": "bool",
210
+ "name": "",
211
+ "type": "bool"
212
+ }
213
+ ],
214
+ "stateMutability": "nonpayable",
215
+ "type": "function"
216
+ },
217
+ {
218
+ "inputs": [
219
+ {
220
+ "internalType": "address",
221
+ "name": "account",
222
+ "type": "address"
223
+ },
224
+ {
225
+ "internalType": "uint256",
226
+ "name": "amount",
227
+ "type": "uint256"
228
+ }
229
+ ],
230
+ "name": "mint",
231
+ "outputs": [],
232
+ "stateMutability": "nonpayable",
233
+ "type": "function"
234
+ },
235
+ {
236
+ "inputs": [],
237
+ "name": "name",
238
+ "outputs": [
239
+ {
240
+ "internalType": "string",
241
+ "name": "",
242
+ "type": "string"
243
+ }
244
+ ],
245
+ "stateMutability": "view",
246
+ "type": "function"
247
+ },
248
+ {
249
+ "inputs": [],
250
+ "name": "owner",
251
+ "outputs": [
252
+ {
253
+ "internalType": "address",
254
+ "name": "",
255
+ "type": "address"
256
+ }
257
+ ],
258
+ "stateMutability": "view",
259
+ "type": "function"
260
+ },
261
+ {
262
+ "inputs": [],
263
+ "name": "renounceOwnership",
264
+ "outputs": [],
265
+ "stateMutability": "nonpayable",
266
+ "type": "function"
267
+ },
268
+ {
269
+ "inputs": [],
270
+ "name": "symbol",
271
+ "outputs": [
272
+ {
273
+ "internalType": "string",
274
+ "name": "",
275
+ "type": "string"
276
+ }
277
+ ],
278
+ "stateMutability": "view",
279
+ "type": "function"
280
+ },
281
+ {
282
+ "inputs": [],
283
+ "name": "totalSupply",
284
+ "outputs": [
285
+ {
286
+ "internalType": "uint256",
287
+ "name": "",
288
+ "type": "uint256"
289
+ }
290
+ ],
291
+ "stateMutability": "view",
292
+ "type": "function"
293
+ },
294
+ {
295
+ "inputs": [
296
+ {
297
+ "internalType": "address",
298
+ "name": "recipient",
299
+ "type": "address"
300
+ },
301
+ {
302
+ "internalType": "uint256",
303
+ "name": "amount",
304
+ "type": "uint256"
305
+ }
306
+ ],
307
+ "name": "transfer",
308
+ "outputs": [
309
+ {
310
+ "internalType": "bool",
311
+ "name": "",
312
+ "type": "bool"
313
+ }
314
+ ],
315
+ "stateMutability": "nonpayable",
316
+ "type": "function"
317
+ },
318
+ {
319
+ "inputs": [
320
+ {
321
+ "internalType": "address",
322
+ "name": "sender",
323
+ "type": "address"
324
+ },
325
+ {
326
+ "internalType": "address",
327
+ "name": "recipient",
328
+ "type": "address"
329
+ },
330
+ {
331
+ "internalType": "uint256",
332
+ "name": "amount",
333
+ "type": "uint256"
334
+ }
335
+ ],
336
+ "name": "transferFrom",
337
+ "outputs": [
338
+ {
339
+ "internalType": "bool",
340
+ "name": "",
341
+ "type": "bool"
342
+ }
343
+ ],
344
+ "stateMutability": "nonpayable",
345
+ "type": "function"
346
+ },
347
+ {
348
+ "inputs": [
349
+ {
350
+ "internalType": "address",
351
+ "name": "newOwner",
352
+ "type": "address"
353
+ }
354
+ ],
355
+ "name": "transferOwnership",
356
+ "outputs": [],
357
+ "stateMutability": "nonpayable",
358
+ "type": "function"
359
+ }
360
+ ],
361
+ "bytecode": "0x60806040523480156200001157600080fd5b5060405162001ce038038062001ce0833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b838201915060208201858111156200006f57600080fd5b82518660018202830111640100000000821117156200008d57600080fd5b8083526020830192505050908051906020019080838360005b83811015620000c3578082015181840152602081019050620000a6565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b838201915060208201858111156200012c57600080fd5b82518660018202830111640100000000821117156200014a57600080fd5b8083526020830192505050908051906020019080838360005b838110156200018057808201518184015260208101905062000163565b50505050905090810190601f168015620001ae5780820380516001836020036101000a031916815260200191505b5060405250505081818160039080519060200190620001cf929190620002c8565b508060049080519060200190620001e8929190620002c8565b506012600560006101000a81548160ff021916908360ff1602179055505050600062000219620002c060201b60201c565b905080600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050506200036e565b600033905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200030b57805160ff19168380011785556200033c565b828001600101855582156200033c579182015b828111156200033b5782518255916020019190600101906200031e565b5b5090506200034b91906200034f565b5090565b5b808211156200036a57600081600090555060010162000350565b5090565b611962806200037e6000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d71461046f578063a9059cbb146104d3578063dd62ed3e14610537578063f2fde38b146105af576100f5565b806370a0823114610356578063715018a6146103ae5780638da5cb5b146103b857806395d89b41146103ec576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce5671461028357806339509351146102a457806340c10f1914610308576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105f3565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610695565b60405180821515815260200191505060405180910390f35b6101e96106b3565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106bd565b60405180821515815260200191505060405180910390f35b61028b610723565b604051808260ff16815260200191505060405180910390f35b6102f0600480360360408110156102ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061073a565b60405180821515815260200191505060405180910390f35b6103546004803603604081101561031e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ed565b005b6103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108aa565b6040518082815260200191505060405180910390f35b6103b66108f2565b005b6103c0610a62565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103f4610a8c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610434578082015181840152602081019050610419565b50505050905090810190601f1680156104615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104bb6004803603604081101561048557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2e565b60405180821515815260200191505060405180910390f35b61051f600480360360408110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfb565b60405180821515815260200191505060405180910390f35b6105996004803603604081101561054d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c19565b6040518082815260200191505060405180910390f35b6105f1600480360360208110156105c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c91565b005b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068b5780601f106106605761010080835404028352916020019161068b565b820191906000526020600020905b81548152906001019060200180831161066e57829003601f168201915b5050505050905090565b60006106a96106a2610e86565b8484610e8e565b6001905092915050565b6000600254905090565b60006106c7610a62565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561070e57610705848484610edf565b6001905061071c565b6107198484846111a0565b90505b9392505050565b6000600560009054906101000a900460ff16905090565b60006107e3610747610e86565b846107de8560016000610758610e86565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461127990919063ffffffff16565b610e8e565b6001905092915050565b6107f5610e86565b73ffffffffffffffffffffffffffffffffffffffff16610813610a62565b73ffffffffffffffffffffffffffffffffffffffff161461089c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6108a68282611301565b5050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108fa610e86565b73ffffffffffffffffffffffffffffffffffffffff16610918610a62565b73ffffffffffffffffffffffffffffffffffffffff16146109a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b245780601f10610af957610100808354040283529160200191610b24565b820191906000526020600020905b815481529060010190602001808311610b0757829003601f168201915b5050505050905090565b6000610bf1610b3b610e86565b84610bec856040518060600160405280602581526020016119086025913960016000610b65610e86565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c89092919063ffffffff16565b610e8e565b6001905092915050565b6000610c0f610c08610e86565b8484610edf565b6001905092915050565b6000610c23610a62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c7e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9050610c8b565b610c888383611582565b90505b92915050565b610c99610e86565b73ffffffffffffffffffffffffffffffffffffffff16610cb7610a62565b73ffffffffffffffffffffffffffffffffffffffff1614610d40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610dc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118296026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b610e96610a62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ece57610eda565b610ed9838383611609565b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806118bf6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610feb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806118066023913960400191505060405180910390fd5b610ff6838383611800565b61106181604051806060016040528060268152602001611871602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c89092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110f4816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461127990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60006111ad848484610edf565b61126e846111b9610e86565b6112698560405180606001604052806028815260200161189760289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061121f610e86565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c89092919063ffffffff16565b610e8e565b600190509392505050565b6000808284019050838110156112f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6113b060008383611800565b6113c58160025461127990919063ffffffff16565b60028190555061141c816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461127990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000838311158290611575576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561153a57808201518184015260208101905061151f565b50505050905090810190601f1680156115675780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561168f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806118e46024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611715576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061184f6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220bdcd60f6e1c1eaec85b8e9008fc7615d8ea935c1f73daecaa5c79da34a4b8c4164736f6c634300060c0033",
362
+ "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d71461046f578063a9059cbb146104d3578063dd62ed3e14610537578063f2fde38b146105af576100f5565b806370a0823114610356578063715018a6146103ae5780638da5cb5b146103b857806395d89b41146103ec576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce5671461028357806339509351146102a457806340c10f1914610308576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105f3565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610695565b60405180821515815260200191505060405180910390f35b6101e96106b3565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106bd565b60405180821515815260200191505060405180910390f35b61028b610723565b604051808260ff16815260200191505060405180910390f35b6102f0600480360360408110156102ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061073a565b60405180821515815260200191505060405180910390f35b6103546004803603604081101561031e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ed565b005b6103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108aa565b6040518082815260200191505060405180910390f35b6103b66108f2565b005b6103c0610a62565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103f4610a8c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610434578082015181840152602081019050610419565b50505050905090810190601f1680156104615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104bb6004803603604081101561048557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2e565b60405180821515815260200191505060405180910390f35b61051f600480360360408110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfb565b60405180821515815260200191505060405180910390f35b6105996004803603604081101561054d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c19565b6040518082815260200191505060405180910390f35b6105f1600480360360208110156105c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c91565b005b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068b5780601f106106605761010080835404028352916020019161068b565b820191906000526020600020905b81548152906001019060200180831161066e57829003601f168201915b5050505050905090565b60006106a96106a2610e86565b8484610e8e565b6001905092915050565b6000600254905090565b60006106c7610a62565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561070e57610705848484610edf565b6001905061071c565b6107198484846111a0565b90505b9392505050565b6000600560009054906101000a900460ff16905090565b60006107e3610747610e86565b846107de8560016000610758610e86565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461127990919063ffffffff16565b610e8e565b6001905092915050565b6107f5610e86565b73ffffffffffffffffffffffffffffffffffffffff16610813610a62565b73ffffffffffffffffffffffffffffffffffffffff161461089c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6108a68282611301565b5050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108fa610e86565b73ffffffffffffffffffffffffffffffffffffffff16610918610a62565b73ffffffffffffffffffffffffffffffffffffffff16146109a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b245780601f10610af957610100808354040283529160200191610b24565b820191906000526020600020905b815481529060010190602001808311610b0757829003601f168201915b5050505050905090565b6000610bf1610b3b610e86565b84610bec856040518060600160405280602581526020016119086025913960016000610b65610e86565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c89092919063ffffffff16565b610e8e565b6001905092915050565b6000610c0f610c08610e86565b8484610edf565b6001905092915050565b6000610c23610a62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c7e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9050610c8b565b610c888383611582565b90505b92915050565b610c99610e86565b73ffffffffffffffffffffffffffffffffffffffff16610cb7610a62565b73ffffffffffffffffffffffffffffffffffffffff1614610d40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610dc6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118296026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b610e96610a62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ece57610eda565b610ed9838383611609565b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806118bf6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610feb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806118066023913960400191505060405180910390fd5b610ff6838383611800565b61106181604051806060016040528060268152602001611871602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c89092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110f4816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461127990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60006111ad848484610edf565b61126e846111b9610e86565b6112698560405180606001604052806028815260200161189760289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061121f610e86565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c89092919063ffffffff16565b610e8e565b600190509392505050565b6000808284019050838110156112f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6113b060008383611800565b6113c58160025461127990919063ffffffff16565b60028190555061141c816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461127990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000838311158290611575576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561153a57808201518184015260208101905061151f565b50505050905090810190601f1680156115675780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561168f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806118e46024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611715576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061184f6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220bdcd60f6e1c1eaec85b8e9008fc7615d8ea935c1f73daecaa5c79da34a4b8c4164736f6c634300060c0033",
363
+ "linkReferences": {},
364
+ "deployedLinkReferences": {}
365
+ }
@@ -0,0 +1,5 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.0 <0.8.0;
4
+
5
+ import "../utils/Context.sol";
@@ -0,0 +1,230 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity >=0.6.0 <0.8.0;
4
+
5
+ import "../utils/Context.sol";
6
+ import "./IRelayRecipient.sol";
7
+ import "./IRelayHub.sol";
8
+
9
+ /**
10
+ * @dev Base GSN recipient contract: includes the {IRelayRecipient} interface
11
+ * and enables GSN support on all contracts in the inheritance tree.
12
+ *
13
+ * TIP: This contract is abstract. The functions {IRelayRecipient-acceptRelayedCall},
14
+ * {_preRelayedCall}, and {_postRelayedCall} are not implemented and must be
15
+ * provided by derived contracts. See the
16
+ * xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategies] for more
17
+ * information on how to use the pre-built {GSNRecipientSignature} and
18
+ * {GSNRecipientERC20Fee}, or how to write your own.
19
+ */
20
+ abstract contract GSNRecipient is IRelayRecipient, Context {
21
+ // Default RelayHub address, deployed on mainnet and all testnets at the same address
22
+ address private _relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494;
23
+
24
+ uint256 constant private _RELAYED_CALL_ACCEPTED = 0;
25
+ uint256 constant private _RELAYED_CALL_REJECTED = 11;
26
+
27
+ // How much gas is forwarded to postRelayedCall
28
+ uint256 constant internal _POST_RELAYED_CALL_MAX_GAS = 100000;
29
+
30
+ /**
31
+ * @dev Emitted when a contract changes its {IRelayHub} contract to a new one.
32
+ */
33
+ event RelayHubChanged(address indexed oldRelayHub, address indexed newRelayHub);
34
+
35
+ /**
36
+ * @dev Returns the address of the {IRelayHub} contract for this recipient.
37
+ */
38
+ function getHubAddr() public view virtual override returns (address) {
39
+ return _relayHub;
40
+ }
41
+
42
+ /**
43
+ * @dev Switches to a new {IRelayHub} instance. This method is added for future-proofing: there's no reason to not
44
+ * use the default instance.
45
+ *
46
+ * IMPORTANT: After upgrading, the {GSNRecipient} will no longer be able to receive relayed calls from the old
47
+ * {IRelayHub} instance. Additionally, all funds should be previously withdrawn via {_withdrawDeposits}.
48
+ */
49
+ function _upgradeRelayHub(address newRelayHub) internal virtual {
50
+ address currentRelayHub = _relayHub;
51
+ require(newRelayHub != address(0), "GSNRecipient: new RelayHub is the zero address");
52
+ require(newRelayHub != currentRelayHub, "GSNRecipient: new RelayHub is the current one");
53
+
54
+ emit RelayHubChanged(currentRelayHub, newRelayHub);
55
+
56
+ _relayHub = newRelayHub;
57
+ }
58
+
59
+ /**
60
+ * @dev Returns the version string of the {IRelayHub} for which this recipient implementation was built. If
61
+ * {_upgradeRelayHub} is used, the new {IRelayHub} instance should be compatible with this version.
62
+ */
63
+ // This function is view for future-proofing, it may require reading from
64
+ // storage in the future.
65
+ function relayHubVersion() public view virtual returns (string memory) {
66
+ this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
67
+ return "1.0.0";
68
+ }
69
+
70
+ /**
71
+ * @dev Withdraws the recipient's deposits in `RelayHub`.
72
+ *
73
+ * Derived contracts should expose this in an external interface with proper access control.
74
+ */
75
+ function _withdrawDeposits(uint256 amount, address payable payee) internal virtual {
76
+ IRelayHub(getHubAddr()).withdraw(amount, payee);
77
+ }
78
+
79
+ // Overrides for Context's functions: when called from RelayHub, sender and
80
+ // data require some pre-processing: the actual sender is stored at the end
81
+ // of the call data, which in turns means it needs to be removed from it
82
+ // when handling said data.
83
+
84
+ /**
85
+ * @dev Replacement for msg.sender. Returns the actual sender of a transaction: msg.sender for regular transactions,
86
+ * and the end-user for GSN relayed calls (where msg.sender is actually `RelayHub`).
87
+ *
88
+ * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead.
89
+ */
90
+ function _msgSender() internal view virtual override returns (address payable) {
91
+ if (msg.sender != getHubAddr()) {
92
+ return msg.sender;
93
+ } else {
94
+ return _getRelayedCallSender();
95
+ }
96
+ }
97
+
98
+ /**
99
+ * @dev Replacement for msg.data. Returns the actual calldata of a transaction: msg.data for regular transactions,
100
+ * and a reduced version for GSN relayed calls (where msg.data contains additional information).
101
+ *
102
+ * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.data`, and use {_msgData} instead.
103
+ */
104
+ function _msgData() internal view virtual override returns (bytes memory) {
105
+ if (msg.sender != getHubAddr()) {
106
+ return msg.data;
107
+ } else {
108
+ return _getRelayedCallData();
109
+ }
110
+ }
111
+
112
+ // Base implementations for pre and post relayedCall: only RelayHub can invoke them, and data is forwarded to the
113
+ // internal hook.
114
+
115
+ /**
116
+ * @dev See `IRelayRecipient.preRelayedCall`.
117
+ *
118
+ * This function should not be overridden directly, use `_preRelayedCall` instead.
119
+ *
120
+ * * Requirements:
121
+ *
122
+ * - the caller must be the `RelayHub` contract.
123
+ */
124
+ function preRelayedCall(bytes memory context) public virtual override returns (bytes32) {
125
+ require(msg.sender == getHubAddr(), "GSNRecipient: caller is not RelayHub");
126
+ return _preRelayedCall(context);
127
+ }
128
+
129
+ /**
130
+ * @dev See `IRelayRecipient.preRelayedCall`.
131
+ *
132
+ * Called by `GSNRecipient.preRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts
133
+ * must implement this function with any relayed-call preprocessing they may wish to do.
134
+ *
135
+ */
136
+ function _preRelayedCall(bytes memory context) internal virtual returns (bytes32);
137
+
138
+ /**
139
+ * @dev See `IRelayRecipient.postRelayedCall`.
140
+ *
141
+ * This function should not be overridden directly, use `_postRelayedCall` instead.
142
+ *
143
+ * * Requirements:
144
+ *
145
+ * - the caller must be the `RelayHub` contract.
146
+ */
147
+ function postRelayedCall(bytes memory context, bool success, uint256 actualCharge, bytes32 preRetVal) public virtual override {
148
+ require(msg.sender == getHubAddr(), "GSNRecipient: caller is not RelayHub");
149
+ _postRelayedCall(context, success, actualCharge, preRetVal);
150
+ }
151
+
152
+ /**
153
+ * @dev See `IRelayRecipient.postRelayedCall`.
154
+ *
155
+ * Called by `GSNRecipient.postRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts
156
+ * must implement this function with any relayed-call postprocessing they may wish to do.
157
+ *
158
+ */
159
+ function _postRelayedCall(bytes memory context, bool success, uint256 actualCharge, bytes32 preRetVal) internal virtual;
160
+
161
+ /**
162
+ * @dev Return this in acceptRelayedCall to proceed with the execution of a relayed call. Note that this contract
163
+ * will be charged a fee by RelayHub
164
+ */
165
+ function _approveRelayedCall() internal pure virtual returns (uint256, bytes memory) {
166
+ return _approveRelayedCall("");
167
+ }
168
+
169
+ /**
170
+ * @dev See `GSNRecipient._approveRelayedCall`.
171
+ *
172
+ * This overload forwards `context` to _preRelayedCall and _postRelayedCall.
173
+ */
174
+ function _approveRelayedCall(bytes memory context) internal pure virtual returns (uint256, bytes memory) {
175
+ return (_RELAYED_CALL_ACCEPTED, context);
176
+ }
177
+
178
+ /**
179
+ * @dev Return this in acceptRelayedCall to impede execution of a relayed call. No fees will be charged.
180
+ */
181
+ function _rejectRelayedCall(uint256 errorCode) internal pure virtual returns (uint256, bytes memory) {
182
+ return (_RELAYED_CALL_REJECTED + errorCode, "");
183
+ }
184
+
185
+ /*
186
+ * @dev Calculates how much RelayHub will charge a recipient for using `gas` at a `gasPrice`, given a relayer's
187
+ * `serviceFee`.
188
+ */
189
+ function _computeCharge(uint256 gas, uint256 gasPrice, uint256 serviceFee) internal pure virtual returns (uint256) {
190
+ // The fee is expressed as a percentage. E.g. a value of 40 stands for a 40% fee, so the recipient will be
191
+ // charged for 1.4 times the spent amount.
192
+ return (gas * gasPrice * (100 + serviceFee)) / 100;
193
+ }
194
+
195
+ function _getRelayedCallSender() private pure returns (address payable result) {
196
+ // We need to read 20 bytes (an address) located at array index msg.data.length - 20. In memory, the array
197
+ // is prefixed with a 32-byte length value, so we first add 32 to get the memory read index. However, doing
198
+ // so would leave the address in the upper 20 bytes of the 32-byte word, which is inconvenient and would
199
+ // require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20
200
+ // bytes. This can always be done due to the 32-byte prefix.
201
+
202
+ // The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the
203
+ // easiest/most-efficient way to perform this operation.
204
+
205
+ // These fields are not accessible from assembly
206
+ bytes memory array = msg.data;
207
+ uint256 index = msg.data.length;
208
+
209
+ // solhint-disable-next-line no-inline-assembly
210
+ assembly {
211
+ // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
212
+ result := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff)
213
+ }
214
+ return result;
215
+ }
216
+
217
+ function _getRelayedCallData() private pure returns (bytes memory) {
218
+ // RelayHub appends the sender address at the end of the calldata, so in order to retrieve the actual msg.data,
219
+ // we must strip the last 20 bytes (length of an address type) from it.
220
+
221
+ uint256 actualDataLength = msg.data.length - 20;
222
+ bytes memory actualData = new bytes(actualDataLength);
223
+
224
+ for (uint256 i = 0; i < actualDataLength; ++i) {
225
+ actualData[i] = msg.data[i];
226
+ }
227
+
228
+ return actualData;
229
+ }
230
+ }