@superfluid-finance/ethereum-contracts 1.5.2-dev.a97f248.0 → 1.5.2-dev.fe6f63e.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/build/contracts/AccessControl.json +1 -1
  2. package/build/contracts/AccessControlEnumerable.json +1 -1
  3. package/build/contracts/Address.json +1 -1
  4. package/build/contracts/AgreementBase.json +1 -1
  5. package/build/contracts/AgreementLibrary.json +1 -1
  6. package/build/contracts/BaseRelayRecipient.json +1 -1
  7. package/build/contracts/BatchLiquidator.json +1 -1
  8. package/build/contracts/BatchOperation.json +1 -1
  9. package/build/contracts/CFAv1Forwarder.json +1 -1
  10. package/build/contracts/CFAv1Library.json +1 -1
  11. package/build/contracts/CallUtils.json +1 -1
  12. package/build/contracts/ClosingOnUpdateFlowTestApp.json +1 -1
  13. package/build/contracts/ConstantFlowAgreementV1.json +1 -1
  14. package/build/contracts/Context.json +1 -1
  15. package/build/contracts/ContextDefinitions.json +1 -1
  16. package/build/contracts/CustomSuperTokenBase.json +1 -1
  17. package/build/contracts/ERC165.json +1 -1
  18. package/build/contracts/ERC1820Implementer.json +1 -1
  19. package/build/contracts/ERC1820RegistryCompiled.json +1 -1
  20. package/build/contracts/ERC20.json +1 -1
  21. package/build/contracts/ERC20WithTokenInfo.json +1 -1
  22. package/build/contracts/ERC777Helper.json +1 -1
  23. package/build/contracts/ERC777RecipientDrainingGas.json +1 -1
  24. package/build/contracts/ERC777RecipientReverting.json +1 -1
  25. package/build/contracts/EnumerableSet.json +1 -1
  26. package/build/contracts/EventsEmitter.json +1 -1
  27. package/build/contracts/ExclusiveInflowTestApp.json +1 -1
  28. package/build/contracts/FixedSizeData.json +1 -1
  29. package/build/contracts/FlowExchangeTestApp.json +1 -1
  30. package/build/contracts/FlowOperatorDefinitions.json +1 -1
  31. package/build/contracts/FullUpgradableSuperTokenProxy.json +1 -1
  32. package/build/contracts/IAccessControl.json +1 -1
  33. package/build/contracts/IAccessControlEnumerable.json +1 -1
  34. package/build/contracts/IConstantFlowAgreementHook.json +1 -1
  35. package/build/contracts/IConstantFlowAgreementV1.json +1 -1
  36. package/build/contracts/IDAv1Library.json +1 -1
  37. package/build/contracts/IERC165.json +1 -1
  38. package/build/contracts/IERC1820Implementer.json +1 -1
  39. package/build/contracts/IERC1820Registry.json +1 -1
  40. package/build/contracts/IERC20.json +1 -1
  41. package/build/contracts/IERC20Metadata.json +1 -1
  42. package/build/contracts/IERC20Permit.json +1 -1
  43. package/build/contracts/IERC777.json +1 -1
  44. package/build/contracts/IERC777Recipient.json +1 -1
  45. package/build/contracts/IERC777Sender.json +1 -1
  46. package/build/contracts/IInstantDistributionAgreementV1.json +1 -1
  47. package/build/contracts/IMultiSigWallet.json +1 -1
  48. package/build/contracts/IPureSuperToken.json +1 -1
  49. package/build/contracts/IPureSuperTokenCustom.json +1 -1
  50. package/build/contracts/IRelayRecipient.json +1 -1
  51. package/build/contracts/IResolver.json +1 -1
  52. package/build/contracts/ISETH.json +1 -1
  53. package/build/contracts/ISETHCustom.json +1 -1
  54. package/build/contracts/ISuperAgreement.json +1 -1
  55. package/build/contracts/ISuperApp.json +1 -1
  56. package/build/contracts/ISuperToken.json +1 -1
  57. package/build/contracts/ISuperTokenFactory.json +1 -1
  58. package/build/contracts/ISuperfluid.json +1 -1
  59. package/build/contracts/ISuperfluidGovernance.json +1 -1
  60. package/build/contracts/ISuperfluidToken.json +1 -1
  61. package/build/contracts/ITOGAv1.json +1 -1
  62. package/build/contracts/ITOGAv2.json +1 -1
  63. package/build/contracts/ITOGAv3.json +1 -1
  64. package/build/contracts/Initializable.json +1 -1
  65. package/build/contracts/InstantDistributionAgreementV1.json +1 -1
  66. package/build/contracts/Math.json +1 -1
  67. package/build/contracts/NonClosableOutflowTestApp.json +1 -1
  68. package/build/contracts/Ownable.json +1 -1
  69. package/build/contracts/Proxy.json +1 -1
  70. package/build/contracts/PureSuperToken.json +1 -1
  71. package/build/contracts/Resolver.json +1 -1
  72. package/build/contracts/SETHProxy.json +1 -1
  73. package/build/contracts/SafeCast.json +1 -1
  74. package/build/contracts/SafeERC20.json +1 -1
  75. package/build/contracts/SafeMath.json +1 -1
  76. package/build/contracts/SelfDeletingFlowTestApp.json +1 -1
  77. package/build/contracts/SlotsBitmapLibrary.json +1 -1
  78. package/build/contracts/StreamRedirector.json +1 -1
  79. package/build/contracts/Strings.json +1 -1
  80. package/build/contracts/SuperAppBase.json +1 -1
  81. package/build/contracts/SuperAppDefinitions.json +1 -1
  82. package/build/contracts/SuperToken.json +1 -1
  83. package/build/contracts/SuperTokenDeployerLibrary.json +1 -1
  84. package/build/contracts/SuperTokenFactory.json +1 -1
  85. package/build/contracts/SuperTokenFactoryBase.json +1 -1
  86. package/build/contracts/SuperTokenV1Library.json +1 -1
  87. package/build/contracts/SuperUpgrader.json +1 -1
  88. package/build/contracts/Superfluid.json +1 -1
  89. package/build/contracts/SuperfluidCFAv1DeployerLibrary.json +1 -1
  90. package/build/contracts/SuperfluidFrameworkDeployer.json +1 -1
  91. package/build/contracts/SuperfluidGovDeployerLibrary.json +1 -1
  92. package/build/contracts/SuperfluidGovernanceBase.json +1 -1
  93. package/build/contracts/SuperfluidGovernanceConfigs.json +1 -1
  94. package/build/contracts/SuperfluidGovernanceII.json +1 -1
  95. package/build/contracts/SuperfluidGovernanceIIProxy.json +1 -1
  96. package/build/contracts/SuperfluidHostDeployerLibrary.json +1 -1
  97. package/build/contracts/SuperfluidIDAv1DeployerLibrary.json +1 -1
  98. package/build/contracts/SuperfluidLoader.json +1 -1
  99. package/build/contracts/SuperfluidPeripheryDeployerLibrary.json +1 -1
  100. package/build/contracts/SuperfluidToken.json +1 -1
  101. package/build/contracts/TOGA.json +1 -1
  102. package/build/contracts/TestGovernance.json +1 -1
  103. package/build/contracts/TestResolver.json +1 -1
  104. package/build/contracts/TestToken.json +1 -1
  105. package/build/contracts/TokenInfo.json +1 -1
  106. package/build/contracts/UUPSProxiable.json +1 -1
  107. package/build/contracts/UUPSProxy.json +1 -1
  108. package/build/contracts/UUPSUtils.json +1 -1
  109. package/build/contracts-sizes.txt +9 -9
  110. package/package.json +2 -2
  111. package/contracts/mocks/AgreementMock.sol +0 -375
  112. package/contracts/mocks/CFAAppMocks.sol +0 -361
  113. package/contracts/mocks/CFAHookMocks.sol +0 -148
  114. package/contracts/mocks/CFALibraryMock.sol +0 -213
  115. package/contracts/mocks/CallUtilsMock.sol +0 -79
  116. package/contracts/mocks/CallUtilsTester.sol +0 -14
  117. package/contracts/mocks/CustomSuperTokenMock.sol +0 -104
  118. package/contracts/mocks/ERC777SenderRecipientMock.sol +0 -238
  119. package/contracts/mocks/FakeSuperfluidMock.sol +0 -21
  120. package/contracts/mocks/ForwarderMock.sol +0 -39
  121. package/contracts/mocks/IDASuperAppTester.sol +0 -297
  122. package/contracts/mocks/IDAv1LibraryMock.sol +0 -400
  123. package/contracts/mocks/MockSmartWallet.sol +0 -15
  124. package/contracts/mocks/MultiFlowTesterApp.sol +0 -336
  125. package/contracts/mocks/StreamRedirector.sol +0 -179
  126. package/contracts/mocks/SuperAppMocks.sol +0 -622
  127. package/contracts/mocks/SuperTokenFactoryMock.sol +0 -98
  128. package/contracts/mocks/SuperTokenLibraryV1Mock.sol +0 -583
  129. package/contracts/mocks/SuperTokenMock.sol +0 -113
  130. package/contracts/mocks/SuperfluidDestructorMock.sol +0 -14
  131. package/contracts/mocks/SuperfluidGovernanceIIMock.sol +0 -22
  132. package/contracts/mocks/SuperfluidMock.sol +0 -177
  133. package/contracts/mocks/UUPSProxiableMock.sol +0 -29
@@ -1,622 +0,0 @@
1
- // SPDX-License-Identifier: AGPLv3
2
- pragma solidity 0.8.18;
3
-
4
- import {
5
- ISuperfluid,
6
- ISuperToken,
7
- ISuperApp,
8
- ISuperAgreement,
9
- SuperAppDefinitions
10
- } from "../superfluid/Superfluid.sol";
11
- import { AgreementMock } from "./AgreementMock.sol";
12
-
13
- contract SuperAppMockAux {
14
-
15
- function actionPingAgreement(ISuperfluid host, AgreementMock agreement, uint256 ping, bytes calldata ctx)
16
- external
17
- {
18
- host.callAgreementWithContext(
19
- agreement,
20
- abi.encodeCall(
21
- agreement.pingMe,
22
- (
23
- address(this), // expectedMsgSender
24
- ping,
25
- new bytes(0)
26
- )
27
- ),
28
- new bytes(0), // user data
29
- ctx);
30
- }
31
-
32
- function actionCallActionNoop(ISuperfluid host, SuperAppMock app, bytes calldata ctx)
33
- external
34
- {
35
- host.callAppActionWithContext(
36
- app,
37
- abi.encodeCall(
38
- app.actionNoop,
39
- (new bytes(0))
40
- ),
41
- ctx);
42
- }
43
- }
44
-
45
- // The default SuperApp mock that does many tricks
46
- contract SuperAppMock is ISuperApp {
47
-
48
- ISuperfluid private _host;
49
- SuperAppMockAux private _aux;
50
-
51
- constructor(ISuperfluid host, uint256 configWord, bool doubleRegistration) {
52
- _host = host;
53
- _host.registerAppWithKey(configWord, "");
54
- if (doubleRegistration) {
55
- _host.registerAppWithKey(configWord, "");
56
- }
57
- _aux = new SuperAppMockAux();
58
- }
59
-
60
- function tryRegisterApp(uint256 configWord) external {
61
- _host.registerApp(configWord);
62
- }
63
-
64
- function allowCompositeApp(ISuperApp target) external {
65
- _host.allowCompositeApp(target);
66
- }
67
-
68
- /*************************************************************************
69
- * Test App Actions
70
- **************************************************************************/
71
-
72
- event NoopEvent(
73
- uint8 appLevel,
74
- uint8 callType,
75
- bytes4 agreementSelector);
76
-
77
- function actionNoop(bytes calldata ctx) external requireValidCtx(ctx) returns (bytes memory newCtx) {
78
- ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
79
- emit NoopEvent(
80
- context.appCallbackLevel,
81
- context.callType,
82
- context.agreementSelector);
83
- return ctx;
84
- }
85
-
86
- function actionExpectMsgSender(address expectedMsgSender, bytes calldata ctx)
87
- external
88
- requireValidCtx(ctx)
89
- returns (bytes memory newCtx)
90
- {
91
- ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
92
- assert(context.msgSender == expectedMsgSender);
93
- emit NoopEvent(
94
- context.appCallbackLevel,
95
- context.callType,
96
- context.agreementSelector);
97
- return ctx;
98
- }
99
-
100
- function actionAssert(bytes calldata ctx) external view requireValidCtx(ctx) {
101
- assert(false);
102
- }
103
-
104
- function actionRevert(bytes calldata ctx) external view requireValidCtx(ctx) {
105
- // solhint-disable-next-line reason-string
106
- revert();
107
- }
108
-
109
- function actionRevertWithReason(string calldata reason, bytes calldata ctx) external view requireValidCtx(ctx) {
110
- revert(reason);
111
- }
112
-
113
- function actionCallAgreementWithoutCtx(bytes calldata ctx) external requireValidCtx(ctx) {
114
- // this should fail, action should call agreement with ctx
115
- _host.callAgreement(ISuperAgreement(address(0)), new bytes(0), new bytes(0));
116
- }
117
-
118
- function actionCallAppActionWithoutCtx(bytes calldata ctx) external requireValidCtx(ctx) {
119
- // this should fail, action should call agreement with ctx
120
- _host.callAppAction(ISuperApp(address(0)), new bytes(0));
121
- }
122
-
123
- function actionAlteringCtx(bytes calldata ctx)
124
- external view
125
- requireValidCtx(ctx)
126
- returns (bytes memory newCtx)
127
- {
128
- return abi.encode(42);
129
- }
130
-
131
- function actionReturnEmptyCtx(bytes calldata ctx)
132
- external view
133
- requireValidCtx(ctx)
134
- // solhint-disable-next-line no-empty-blocks
135
- {
136
- }
137
-
138
- function actionPingAgreementThroughAux(AgreementMock agreement, uint256 ping, bytes calldata ctx)
139
- external
140
- requireValidCtx(ctx)
141
- {
142
- // this should fail
143
- _aux.actionPingAgreement(_host, agreement, ping, ctx);
144
- }
145
-
146
- function actionCallActionNoopThroughAux(bytes calldata ctx)
147
- external
148
- requireValidCtx(ctx)
149
- {
150
- // this should fail
151
- _aux.actionCallActionNoop(_host, this, ctx);
152
- }
153
-
154
- function actionPingAgreement(AgreementMock agreement, uint256 ping, bytes calldata ctx)
155
- external
156
- requireValidCtx(ctx)
157
- returns (bytes memory newCtx)
158
- {
159
- (newCtx, ) = _host.callAgreementWithContext(
160
- agreement,
161
- abi.encodeCall(
162
- agreement.pingMe,
163
- (
164
- address(this), // expectedMsgSender
165
- ping,
166
- new bytes(0)
167
- )
168
- ),
169
- new bytes(0), // user data
170
- ctx);
171
- }
172
-
173
- function actionAgreementRevert(AgreementMock agreement, string calldata reason, bytes calldata ctx)
174
- external
175
- requireValidCtx(ctx)
176
- returns (bytes memory newCtx)
177
- {
178
- (newCtx, ) = _host.callAgreementWithContext(
179
- agreement,
180
- abi.encodeCall(
181
- agreement.doRevert,
182
- (
183
- reason,
184
- new bytes(0)
185
- )
186
- ),
187
- new bytes(0), // user data
188
- ctx);
189
- }
190
-
191
- function actionCallActionNoop(bytes calldata ctx)
192
- external
193
- requireValidCtx(ctx)
194
- returns (bytes memory newCtx)
195
- {
196
- newCtx = _host.callAppActionWithContext(
197
- this,
198
- abi.encodeCall(
199
- this.actionNoop,
200
- (new bytes(0))
201
- ),
202
- ctx);
203
- }
204
-
205
- function actionCallActionRevert(string calldata reason, bytes calldata ctx)
206
- external
207
- requireValidCtx(ctx)
208
- returns (bytes memory newCtx)
209
- {
210
- newCtx = _host.callAppActionWithContext(
211
- this,
212
- abi.encodeCall(
213
- this.actionRevertWithReason,
214
- (
215
- reason,
216
- new bytes(0)
217
- )
218
- ),
219
- ctx);
220
- }
221
-
222
- function actionCallAgreementWithInvalidCtx(AgreementMock agreement, bytes calldata ctx)
223
- external
224
- requireValidCtx(ctx)
225
- returns (bytes memory newCtx)
226
- {
227
- (newCtx, ) = _host.callAgreementWithContext(
228
- agreement,
229
- abi.encodeCall(
230
- agreement.pingMe,
231
- (
232
- address(this), // expectedMsgSender
233
- 42,
234
- new bytes(0)
235
- )
236
- ),
237
- new bytes(0), // user data
238
- abi.encode(42));
239
- }
240
-
241
- function actionCallActionWithInvalidCtx(string calldata reason, bytes calldata ctx)
242
- external
243
- requireValidCtx(ctx)
244
- returns (bytes memory newCtx)
245
- {
246
- newCtx = _host.callAppActionWithContext(
247
- this,
248
- abi.encodeCall(
249
- this.actionRevertWithReason,
250
- (
251
- reason,
252
- new bytes(0)
253
- )
254
- ),
255
- abi.encode(42));
256
- }
257
-
258
- function actionCallBadAction(bytes calldata ctx)
259
- external
260
- requireValidCtx(ctx)
261
- {
262
- _host.callAppActionWithContext(
263
- this,
264
- abi.encodeCall(
265
- this.actionAlteringCtx,
266
- (new bytes(0))
267
- ),
268
- ctx);
269
- assert(false);
270
- }
271
-
272
- /*************************************************************************
273
- * Callbacks
274
- **************************************************************************/
275
-
276
- enum NextCallbackActionType {
277
- Noop, // 0
278
- Assert, // 1
279
- Revert, // 2
280
- RevertWithReason, // 3
281
- AlteringCtx, // 4
282
- BurnGas, // 5
283
- ReturnEmptyCtx // 6
284
- }
285
-
286
- struct NextCallbackAction {
287
- NextCallbackActionType actionType;
288
- bytes data;
289
- }
290
-
291
- NextCallbackAction private _nextCallbackAction;
292
-
293
- function setNextCallbackAction(
294
- NextCallbackActionType actionType,
295
- bytes calldata data)
296
- external
297
- {
298
- _nextCallbackAction.actionType = actionType;
299
- _nextCallbackAction.data = data;
300
- }
301
-
302
- function _executeBeforeCallbackAction()
303
- private view
304
- returns (bytes memory cbdata)
305
- {
306
- if (_nextCallbackAction.actionType == NextCallbackActionType.Noop) {
307
- return "Noop";
308
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.Assert) {
309
- assert(false);
310
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.Revert) {
311
- // solhint-disable-next-line reason-string
312
- revert();
313
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.RevertWithReason) {
314
- revert(abi.decode(_nextCallbackAction.data, (string)));
315
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.BurnGas) {
316
- uint256 gasToBurn = abi.decode(_nextCallbackAction.data, (uint256));
317
- _burnGas(gasToBurn);
318
- } else assert(false);
319
- }
320
-
321
- function _executeAfterCallbackAction(bytes memory ctx)
322
- private
323
- returns (bytes memory newCtx)
324
- {
325
- ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
326
- if (_nextCallbackAction.actionType == NextCallbackActionType.Noop) {
327
- emit NoopEvent(
328
- context.appCallbackLevel,
329
- context.callType,
330
- context.agreementSelector);
331
- return ctx;
332
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.Assert) {
333
- assert(false);
334
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.Revert) {
335
- // solhint-disable-next-line reason-string
336
- revert();
337
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.RevertWithReason) {
338
- revert(abi.decode(_nextCallbackAction.data, (string)));
339
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.AlteringCtx) {
340
- return new bytes(42);
341
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.BurnGas) {
342
- uint256 gasToBurn = abi.decode(_nextCallbackAction.data, (uint256));
343
- _burnGas(gasToBurn);
344
- } else if (_nextCallbackAction.actionType == NextCallbackActionType.ReturnEmptyCtx) {
345
- return new bytes(0);
346
- } else assert(false);
347
- }
348
-
349
- function beforeAgreementCreated(
350
- ISuperToken /*superToken*/,
351
- address /*agreementClass*/,
352
- bytes32 /*agreementId*/,
353
- bytes calldata /*agreementData*/,
354
- bytes calldata ctx
355
- )
356
- external view
357
- requireValidCtx(ctx)
358
- virtual override
359
- returns (bytes memory /*cbdata*/)
360
- {
361
- return _executeBeforeCallbackAction();
362
- }
363
-
364
- function afterAgreementCreated(
365
- ISuperToken /*superToken*/,
366
- address /*agreementClass*/,
367
- bytes32 /*agreementId*/,
368
- bytes calldata /*agreementData*/,
369
- bytes calldata /*cbdata*/,
370
- bytes calldata ctx
371
- )
372
- external
373
- requireValidCtx(ctx)
374
- virtual override
375
- returns (bytes memory newCtx)
376
- {
377
- return _executeAfterCallbackAction(ctx);
378
- }
379
-
380
- function beforeAgreementUpdated(
381
- ISuperToken /*superToken*/,
382
- address /*agreementClass*/,
383
- bytes32 /*agreementId*/,
384
- bytes calldata /*agreementData*/,
385
- bytes calldata ctx
386
- )
387
- external view
388
- requireValidCtx(ctx)
389
- virtual override
390
- returns (bytes memory /*cbdata*/)
391
- {
392
- return _executeBeforeCallbackAction();
393
- }
394
-
395
- function afterAgreementUpdated(
396
- ISuperToken /*superToken*/,
397
- address /*agreementClass*/,
398
- bytes32 /*agreementId*/,
399
- bytes calldata /*agreementData*/,
400
- bytes calldata /*cbdata*/,
401
- bytes calldata ctx
402
- )
403
- external
404
- requireValidCtx(ctx)
405
- virtual override
406
- returns (bytes memory newCtx)
407
- {
408
- return _executeAfterCallbackAction(ctx);
409
- }
410
-
411
- function beforeAgreementTerminated(
412
- ISuperToken /*superToken*/,
413
- address /*agreementClass*/,
414
- bytes32 /*agreementId*/,
415
- bytes calldata /*agreementData*/,
416
- bytes calldata ctx
417
- )
418
- external view
419
- requireValidCtx(ctx)
420
- virtual override
421
- returns (bytes memory /*cbdata*/)
422
- {
423
- return _executeBeforeCallbackAction();
424
- }
425
-
426
- function afterAgreementTerminated(
427
- ISuperToken /*superToken*/,
428
- address /*agreementClass*/,
429
- bytes32 /*agreementId*/,
430
- bytes calldata /*agreementData*/,
431
- bytes calldata /*cbdata*/,
432
- bytes calldata ctx
433
- )
434
- external
435
- requireValidCtx(ctx)
436
- virtual override
437
- returns (bytes memory newCtx)
438
- {
439
- return _executeAfterCallbackAction(ctx);
440
- }
441
-
442
- function _burnGas(uint256 gasToBurn) private view {
443
- uint256 gasStart = gasleft();
444
- uint256 gasNow = gasleft();
445
- while ((gasStart - gasNow) < gasToBurn - 1000 /* some margin for other things*/) {
446
- gasNow = gasleft();
447
- }
448
- }
449
-
450
- modifier requireValidCtx(bytes calldata ctx) {
451
- require(ISuperfluid(msg.sender).isCtxValid(ctx), "AgreementMock: ctx not valid before");
452
- _;
453
- }
454
- }
455
-
456
- // Bad super app! This one returns empty ctx
457
- contract SuperAppMockReturningEmptyCtx {
458
-
459
- ISuperfluid private _host;
460
-
461
- constructor(ISuperfluid host) {
462
- _host = host;
463
- _host.registerAppWithKey(SuperAppDefinitions.APP_LEVEL_FINAL, "");
464
- }
465
-
466
- function beforeAgreementCreated(
467
- ISuperToken /*superToken*/,
468
- address /*agreementClass*/,
469
- bytes32 /*agreementId*/,
470
- bytes calldata /*agreementData*/,
471
- bytes calldata /*ctx*/
472
- )
473
- external pure
474
- // solhint-disable-next-line no-empty-blocks
475
- {
476
- }
477
-
478
- function afterAgreementCreated(
479
- ISuperToken /*superToken*/,
480
- address /*agreementClass*/,
481
- bytes32 /*agreementId*/,
482
- bytes calldata /*agreementData*/,
483
- bytes calldata /*cbdata*/,
484
- bytes calldata /*ctx*/
485
- )
486
- external pure
487
- // solhint-disable-next-line no-empty-blocks
488
- {
489
- }
490
-
491
- function beforeAgreementTerminated(
492
- ISuperToken /*superToken*/,
493
- address /*agreementClass*/,
494
- bytes32 /*agreementId*/,
495
- bytes calldata /*agreementData*/,
496
- bytes calldata /*ctx*/
497
- )
498
- external pure
499
- // solhint-disable-next-line no-empty-blocks
500
- {
501
- }
502
-
503
- function afterAgreementTerminated(
504
- ISuperToken /*superToken*/,
505
- address /*agreementClass*/,
506
- bytes32 /*agreementId*/,
507
- bytes calldata /*agreementData*/,
508
- bytes calldata /*cbdata*/,
509
- bytes calldata /*ctx*/
510
- )
511
- external pure
512
- // solhint-disable-next-line no-empty-blocks
513
- {
514
- }
515
- }
516
-
517
- // Bad super app! This one returns invalid ctx
518
- contract SuperAppMockReturningInvalidCtx {
519
-
520
- ISuperfluid private _host;
521
-
522
- constructor(ISuperfluid host) {
523
- _host = host;
524
- _host.registerAppWithKey(SuperAppDefinitions.APP_LEVEL_FINAL, "");
525
- }
526
-
527
- function afterAgreementCreated(
528
- ISuperToken /*superToken*/,
529
- address /*agreementClass*/,
530
- bytes32 /*agreementId*/,
531
- bytes calldata /*agreementData*/,
532
- bytes calldata /*cbdata*/,
533
- bytes calldata /*ctx*/
534
- )
535
- external pure
536
- returns (uint256)
537
- {
538
- return 42;
539
- }
540
-
541
- function afterAgreementTerminated(
542
- ISuperToken /*superToken*/,
543
- address /*agreementClass*/,
544
- bytes32 /*agreementId*/,
545
- bytes calldata /*agreementData*/,
546
- bytes calldata /*cbdata*/,
547
- bytes calldata /*ctx*/
548
- )
549
- external pure
550
- returns (uint256)
551
- {
552
- return 42;
553
- }
554
- }
555
-
556
- // Bad super app! A second level app that calls other app
557
- contract SuperAppMock2ndLevel {
558
-
559
- ISuperfluid private _host;
560
- SuperAppMock private _app;
561
- AgreementMock private _agreement;
562
-
563
- constructor(ISuperfluid host, SuperAppMock app, AgreementMock agreement) {
564
- _host = host;
565
- _host.registerAppWithKey(SuperAppDefinitions.APP_LEVEL_SECOND, "");
566
- _app = app;
567
- _agreement = agreement;
568
- }
569
-
570
- function allowCompositeApp() external {
571
- _host.allowCompositeApp(_app);
572
- }
573
-
574
- function afterAgreementCreated(
575
- ISuperToken /*superToken*/,
576
- address /*agreementClass*/,
577
- bytes32 /*agreementId*/,
578
- bytes calldata /*agreementData*/,
579
- bytes calldata /*cbdata*/,
580
- bytes calldata ctx
581
- )
582
- external
583
- returns (bytes memory newCtx)
584
- {
585
- (newCtx, ) = _host.callAgreementWithContext(
586
- _agreement,
587
- abi.encodeCall(
588
- _agreement.callAppAfterAgreementCreatedCallback,
589
- (
590
- _app,
591
- new bytes(0)
592
- )
593
- ),
594
- new bytes(0), // user data
595
- ctx);
596
- }
597
- }
598
-
599
- // An Super App that uses registerAppWithKey
600
- contract SuperAppMockWithRegistrationKey {
601
- constructor(ISuperfluid host, uint256 configWord, string memory registrationKey) {
602
- host.registerAppWithKey(configWord, registrationKey);
603
- }
604
- }
605
-
606
- // An Super App that uses registerAppWithKey
607
- contract SuperAppMockUsingDeprecatedRegisterApp {
608
- constructor(ISuperfluid host, uint256 configWord) {
609
- host.registerApp(configWord);
610
- }
611
- }
612
-
613
- // minimal fake SuperApp contract
614
- // solhint-disable-next-line no-empty-blocks
615
- contract SuperAppMockNotSelfRegistering { }
616
-
617
- // Factory which allows anybody to deploy arbitrary contracts as app (do NOT allow this in a real factory!)
618
- contract SuperAppFactoryMock {
619
- function registerAppWithHost(ISuperfluid host, ISuperApp app, uint256 configWord) external {
620
- host.registerAppByFactory(app, configWord);
621
- }
622
- }
@@ -1,98 +0,0 @@
1
- // SPDX-License-Identifier: AGPLv3
2
- pragma solidity 0.8.18;
3
-
4
- import { SuperTokenMock } from "./SuperTokenMock.sol";
5
- import {
6
- ISuperfluid,
7
- ISuperToken,
8
- SuperToken,
9
- SuperTokenFactoryBase
10
- } from "../superfluid/SuperTokenFactory.sol";
11
-
12
- contract SuperTokenFactoryStorageLayoutTester is SuperTokenFactoryBase {
13
- constructor(
14
- ISuperfluid host,
15
- ISuperToken superTokenLogic
16
- )
17
- SuperTokenFactoryBase(host, superTokenLogic)
18
- // solhint-disable-next-line no-empty-blocks
19
- {
20
-
21
- }
22
-
23
- // @dev Make sure the storage layout never change over the course of the development
24
- function validateStorageLayout() external pure {
25
- uint256 slot;
26
- uint256 offset;
27
-
28
- // Initializable bool _initialized and bool _initialized
29
-
30
- assembly { slot:= _superTokenLogicDeprecated.slot offset := _superTokenLogicDeprecated.offset }
31
- require (slot == 0 && offset == 2, "_superTokenLogicDeprecated changed location");
32
-
33
- assembly { slot := _canonicalWrapperSuperTokens.slot offset := _canonicalWrapperSuperTokens.offset }
34
- require(slot == 1 && offset == 0, "_canonicalWrapperSuperTokens changed location");
35
- }
36
-
37
- function createSuperTokenLogic(
38
- ISuperfluid // host
39
- ) external override returns (address) {
40
- return address(_SUPER_TOKEN_LOGIC);
41
- }
42
- }
43
-
44
- contract SuperTokenFactoryUpdateLogicContractsTester is SuperTokenFactoryBase {
45
- uint256 public newVariable;
46
-
47
- constructor(
48
- ISuperfluid host,
49
- ISuperToken superTokenLogic
50
- )
51
- SuperTokenFactoryBase(host, superTokenLogic)
52
- // solhint-disable-next-line no-empty-blocks
53
- {
54
-
55
- }
56
-
57
- function createSuperTokenLogic(
58
- ISuperfluid // host
59
- ) external override returns (address) {
60
- return address(_SUPER_TOKEN_LOGIC);
61
- }
62
- }
63
-
64
- contract SuperTokenFactoryMock is SuperTokenFactoryBase {
65
- constructor(
66
- ISuperfluid host,
67
- ISuperToken superTokenLogic
68
- )
69
- SuperTokenFactoryBase(host, superTokenLogic)
70
- // solhint-disable-next-line no-empty-blocks
71
- {
72
-
73
- }
74
-
75
- function createSuperTokenLogic(
76
- ISuperfluid // host
77
- ) external override returns (address) {
78
- return address(_SUPER_TOKEN_LOGIC);
79
- }
80
- }
81
-
82
- contract SuperTokenFactoryMock42 is SuperTokenFactoryBase {
83
- constructor(
84
- ISuperfluid host,
85
- ISuperToken superTokenLogic
86
- )
87
- SuperTokenFactoryBase(host, superTokenLogic)
88
- // solhint-disable-next-line no-empty-blocks
89
- {
90
-
91
- }
92
-
93
- function createSuperTokenLogic(
94
- ISuperfluid // host
95
- ) external override returns (address) {
96
- return address(_SUPER_TOKEN_LOGIC);
97
- }
98
- }