@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,39 +0,0 @@
1
- // SPDX-License-Identifier: AGPLv3
2
- pragma solidity 0.8.18;
3
-
4
- import { CallUtils } from "../libs/CallUtils.sol";
5
- import { IRelayRecipient } from "../interfaces/utils/IRelayRecipient.sol";
6
-
7
- /**
8
- * @dev A test forwarder that can impersonate any account needed.
9
- *
10
- * It is obviously not secure for any production use.
11
- */
12
- contract ForwarderMock {
13
-
14
- // mocked forward request, we don't emulate the signature flow here
15
- struct ForwardRequest {
16
- address from;
17
- address to;
18
- uint256 value;
19
- uint256 gas;
20
- bytes data;
21
- }
22
-
23
- function execute(
24
- ForwardRequest memory req
25
- )
26
- external payable
27
- {
28
- bool success;
29
- bytes memory ret;
30
- require(
31
- keccak256(abi.encodePacked(IRelayRecipient(req.to).versionRecipient())) ==
32
- keccak256("v1"),
33
- "unknown IRelayRecipient.versionRecipient");
34
- // solhint-disable-next-line avoid-low-level-calls
35
- (success, ret) = req.to.call{gas : req.gas, value : req.value}(abi.encodePacked(req.data, req.from));
36
- if (!success) CallUtils.revertFromReturnedData(ret);
37
- }
38
-
39
- }
@@ -1,297 +0,0 @@
1
- // SPDX-License-Identifier: AGPLv3
2
- pragma solidity 0.8.18;
3
-
4
- import {
5
- ISuperfluid,
6
- ISuperToken,
7
- ISuperApp
8
- } from "../superfluid/Superfluid.sol";
9
- import {
10
- IInstantDistributionAgreementV1
11
- } from "../interfaces/agreements/IInstantDistributionAgreementV1.sol";
12
-
13
-
14
- contract IDASuperAppTester is ISuperApp {
15
-
16
- ISuperfluid private _host;
17
- IInstantDistributionAgreementV1 private _ida;
18
- ISuperToken private _token;
19
- uint32 private _indexId;
20
-
21
- constructor(
22
- ISuperfluid host,
23
- uint256 configWord,
24
- IInstantDistributionAgreementV1 ida,
25
- ISuperToken token,
26
- uint32 indexId)
27
- {
28
- _host = host;
29
- _host.registerAppWithKey(configWord, "");
30
- _ida = ida;
31
- _token = token;
32
- _indexId = indexId;
33
-
34
- _host.callAgreement(
35
- _ida,
36
- abi.encodeCall(
37
- _ida.createIndex,
38
- (
39
- _token,
40
- _indexId,
41
- new bytes(0) // placeholder ctx
42
- )
43
- ),
44
- new bytes(0) // user data
45
- );
46
- }
47
-
48
- function updateSubscription(
49
- address subscriber,
50
- uint128 units
51
- )
52
- external
53
- {
54
- _host.callAgreement(
55
- _ida,
56
- abi.encodeCall(
57
- _ida.updateSubscription,
58
- (
59
- _token,
60
- _indexId,
61
- subscriber,
62
- units,
63
- new bytes(0) // placeholder ctx
64
- )
65
- ),
66
- new bytes(0) // user data
67
- );
68
- }
69
-
70
- function distribute(
71
- uint128 amount
72
- )
73
- external
74
- {
75
- _host.callAgreement(
76
- _ida,
77
- abi.encodeCall(
78
- _ida.distribute,
79
- (
80
- _token,
81
- _indexId,
82
- amount,
83
- new bytes(0) // placeholder ctx
84
- )
85
- ),
86
- new bytes(0) // user data
87
- );
88
- }
89
-
90
- function _expectCallback(
91
- bytes calldata ctx,
92
- bytes32 callbackType,
93
- bytes calldata agreementData
94
- )
95
- private view
96
- {
97
- ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
98
- bytes32 expectedCallbackType;
99
- bytes4 expectedSelector;
100
- bytes memory expectedAgreementData;
101
- (
102
- expectedCallbackType,
103
- expectedSelector,
104
- expectedAgreementData
105
- ) = abi.decode(context.userData, (bytes32, bytes4, bytes));
106
- require(expectedCallbackType == callbackType, "wrong callbackType");
107
- require(expectedSelector == context.agreementSelector, "wrong agreementSelector");
108
- require(keccak256(expectedAgreementData) == keccak256(agreementData), "wrong aAgreementData");
109
- }
110
-
111
- event SubscriptionDataBefore(
112
- address publisher,
113
- uint32 indexId,
114
- bool approved,
115
- uint128 units,
116
- uint256 pendingDistribution);
117
- event SubscriptionDataAfter(
118
- address publisher,
119
- uint32 indexId,
120
- bool approved,
121
- uint128 units,
122
- uint256 pendingDistribution);
123
- function _packSubscriptionData(bytes32 agreementId) private view returns (bytes memory){
124
- address publisher;
125
- uint32 indexId;
126
- bool approved;
127
- uint128 units;
128
- uint256 pendingDistribution;
129
- (
130
- publisher,
131
- indexId,
132
- approved,
133
- units,
134
- pendingDistribution
135
- ) = _ida.getSubscriptionByID(_token, agreementId);
136
- return abi.encode(publisher, indexId, approved, units, pendingDistribution);
137
- }
138
-
139
- bool private _forceGetSubscriptionByID = false;
140
- function setForceGetSubscriptionByID() external {
141
- _forceGetSubscriptionByID = true;
142
- }
143
-
144
- function _emitSubscriptionDataEvents(bytes memory cbdata, bytes32 agreementId, bool deleted)
145
- private
146
- {
147
- address publisher;
148
- uint32 indexId;
149
- bool approved;
150
- uint128 units;
151
- uint256 pendingDistribution;
152
-
153
- if (cbdata.length > 0) {
154
- (
155
- publisher,
156
- indexId,
157
- approved,
158
- units,
159
- pendingDistribution
160
- ) = abi.decode(cbdata, (address, uint32, bool, uint128, uint256));
161
- emit SubscriptionDataBefore(publisher, indexId, approved, units, pendingDistribution);
162
- }
163
-
164
- if (!deleted) {
165
- (
166
- publisher,
167
- indexId,
168
- approved,
169
- units,
170
- pendingDistribution
171
- ) = _ida.getSubscriptionByID(_token, agreementId);
172
- emit SubscriptionDataAfter(publisher, indexId, approved, units, pendingDistribution);
173
- }
174
- }
175
-
176
- function beforeAgreementCreated(
177
- ISuperToken superToken,
178
- address agreementClass,
179
- bytes32 agreementId,
180
- bytes calldata agreementData,
181
- bytes calldata ctx
182
- )
183
- external view
184
- requireValidCtx(ctx)
185
- onlyExpected(superToken, agreementClass)
186
- virtual override
187
- returns (bytes memory cbdata)
188
- {
189
- _expectCallback(ctx, keccak256("created"), agreementData);
190
- if (_forceGetSubscriptionByID) {
191
- _ida.getSubscriptionByID(_token, agreementId);
192
- }
193
- return new bytes(0);
194
- }
195
-
196
- function afterAgreementCreated(
197
- ISuperToken superToken,
198
- address agreementClass,
199
- bytes32 agreementId,
200
- bytes calldata agreementData,
201
- bytes calldata cbdata,
202
- bytes calldata ctx
203
- )
204
- external
205
- requireValidCtx(ctx)
206
- onlyExpected(superToken, agreementClass)
207
- virtual override
208
- returns (bytes memory newCtx)
209
- {
210
- _expectCallback(ctx, keccak256("created"), agreementData);
211
- _emitSubscriptionDataEvents(cbdata, agreementId, false);
212
- return ctx;
213
- }
214
-
215
- function beforeAgreementUpdated(
216
- ISuperToken superToken,
217
- address agreementClass,
218
- bytes32 agreementId,
219
- bytes calldata agreementData,
220
- bytes calldata ctx
221
- )
222
- external view
223
- requireValidCtx(ctx)
224
- onlyExpected(superToken, agreementClass)
225
- virtual override
226
- returns (bytes memory /*cbdata*/)
227
- {
228
- _expectCallback(ctx, keccak256("updated"), agreementData);
229
- return _packSubscriptionData(agreementId);
230
- }
231
-
232
- function afterAgreementUpdated(
233
- ISuperToken superToken,
234
- address agreementClass,
235
- bytes32 agreementId,
236
- bytes calldata agreementData,
237
- bytes calldata cbdata,
238
- bytes calldata ctx
239
- )
240
- external
241
- requireValidCtx(ctx)
242
- onlyExpected(superToken, agreementClass)
243
- virtual override
244
- returns (bytes memory newCtx)
245
- {
246
- _expectCallback(ctx, keccak256("updated"), agreementData);
247
- _emitSubscriptionDataEvents(cbdata, agreementId, false);
248
- return ctx;
249
- }
250
-
251
- function beforeAgreementTerminated(
252
- ISuperToken superToken,
253
- address agreementClass,
254
- bytes32 agreementId,
255
- bytes calldata agreementData,
256
- bytes calldata ctx
257
- )
258
- external view
259
- requireValidCtx(ctx)
260
- onlyExpected(superToken, agreementClass)
261
- virtual override
262
- returns (bytes memory /*cbdata*/)
263
- {
264
- _expectCallback(ctx, keccak256("deleted"), agreementData);
265
- return _packSubscriptionData(agreementId);
266
- }
267
-
268
- function afterAgreementTerminated(
269
- ISuperToken superToken,
270
- address agreementClass,
271
- bytes32 agreementId,
272
- bytes calldata agreementData,
273
- bytes calldata cbdata,
274
- bytes calldata ctx
275
- )
276
- external
277
- requireValidCtx(ctx)
278
- onlyExpected(superToken, agreementClass)
279
- virtual override
280
- returns (bytes memory newCtx)
281
- {
282
- _expectCallback(ctx, keccak256("deleted"), agreementData);
283
- _emitSubscriptionDataEvents(cbdata, agreementId, true);
284
- return ctx;
285
- }
286
-
287
- modifier requireValidCtx(bytes calldata ctx) {
288
- require(ISuperfluid(msg.sender).isCtxValid(ctx), "IDASuperAppTester: ctx not valid before");
289
- _;
290
- }
291
-
292
- modifier onlyExpected(ISuperToken superToken, address agreementClass) {
293
- require(superToken == _token, "not accepted token");
294
- require(agreementClass == address(_ida), "not ida");
295
- _;
296
- }
297
- }