@superfluid-finance/ethereum-contracts 1.2.3-dev.7365205.0 → 1.2.3-dev.7dc62cd.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 (124) 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 +10 -10
  5. package/build/contracts/AgreementLibrary.json +4 -4
  6. package/build/contracts/BaseRelayRecipient.json +1 -1
  7. package/build/contracts/BatchLiquidator.json +1385 -1242
  8. package/build/contracts/BatchOperation.json +1 -1
  9. package/build/contracts/CFAv1Library.json +3437 -3625
  10. package/build/contracts/CallUtils.json +1 -1
  11. package/build/contracts/ClosingOnUpdateFlowTestApp.json +4440 -4451
  12. package/build/contracts/ConstantFlowAgreementV1.json +5204 -5204
  13. package/build/contracts/Context.json +1 -1
  14. package/build/contracts/ContextDefinitions.json +1 -1
  15. package/build/contracts/Create2.json +1 -1
  16. package/build/contracts/CustomSuperTokenBase.json +2 -2
  17. package/build/contracts/ERC165.json +1 -1
  18. package/build/contracts/ERC1820Implementer.json +79 -79
  19. package/build/contracts/ERC1820RegistryCompiled.json +1 -1
  20. package/build/contracts/ERC20.json +1008 -1008
  21. package/build/contracts/ERC20Burnable.json +1 -1
  22. package/build/contracts/ERC20Pausable.json +1 -1
  23. package/build/contracts/ERC20PresetMinterPauser.json +1816 -1816
  24. package/build/contracts/ERC20WithTokenInfo.json +1 -1
  25. package/build/contracts/ERC777Helper.json +1 -1
  26. package/build/contracts/ERC777RecipientDrainingGas.json +1874 -1874
  27. package/build/contracts/ERC777RecipientReverting.json +1896 -1896
  28. package/build/contracts/EnumerableSet.json +1 -1
  29. package/build/contracts/EventsEmitter.json +414 -0
  30. package/build/contracts/ExclusiveInflowTestApp.json +4468 -4479
  31. package/build/contracts/FixedSizeData.json +405 -405
  32. package/build/contracts/FlowExchangeTestApp.json +4578 -4589
  33. package/build/contracts/FlowOperatorDefinitions.json +1 -1
  34. package/build/contracts/FullUpgradableSuperTokenProxy.json +319 -319
  35. package/build/contracts/IAccessControl.json +1 -1
  36. package/build/contracts/IAccessControlEnumerable.json +1 -1
  37. package/build/contracts/IConstantFlowAgreementV1.json +450 -443
  38. package/build/contracts/IDAv1Library.json +3227 -3403
  39. package/build/contracts/IERC165.json +1 -1
  40. package/build/contracts/IERC1820Implementer.json +1 -1
  41. package/build/contracts/IERC1820Registry.json +1 -1
  42. package/build/contracts/IERC20.json +1 -1
  43. package/build/contracts/IERC20Metadata.json +1 -1
  44. package/build/contracts/IERC777.json +1 -1
  45. package/build/contracts/IERC777Recipient.json +1 -1
  46. package/build/contracts/IERC777Sender.json +1 -1
  47. package/build/contracts/IInstantDistributionAgreementV1.json +569 -558
  48. package/build/contracts/IMaticBridgedNativeSuperToken.json +73 -34
  49. package/build/contracts/IMaticBridgedNativeSuperTokenCustom.json +2 -2
  50. package/build/contracts/IMultiSigWallet.json +1 -1
  51. package/build/contracts/IPureSuperToken.json +73 -34
  52. package/build/contracts/IPureSuperTokenCustom.json +2 -2
  53. package/build/contracts/IRelayRecipient.json +1 -1
  54. package/build/contracts/IResolver.json +1 -1
  55. package/build/contracts/ISETH.json +73 -34
  56. package/build/contracts/ISETHCustom.json +2 -2
  57. package/build/contracts/ISuperAgreement.json +2 -2
  58. package/build/contracts/ISuperApp.json +178 -172
  59. package/build/contracts/ISuperToken.json +524 -485
  60. package/build/contracts/ISuperTokenFactory.json +2 -2
  61. package/build/contracts/ISuperfluid.json +632 -627
  62. package/build/contracts/ISuperfluidGovernance.json +133 -132
  63. package/build/contracts/ISuperfluidToken.json +407 -398
  64. package/build/contracts/ITOGAv1.json +2689 -2739
  65. package/build/contracts/ITOGAv2.json +2689 -2739
  66. package/build/contracts/Initializable.json +1 -1
  67. package/build/contracts/InstantDistributionAgreementV1.json +5388 -5388
  68. package/build/contracts/MaticBridgedNativeSuperTokenProxy.json +971 -971
  69. package/build/contracts/NonClosableOutflowTestApp.json +4343 -4354
  70. package/build/contracts/Ownable.json +1 -1
  71. package/build/contracts/Pausable.json +1 -1
  72. package/build/contracts/Proxy.json +1 -1
  73. package/build/contracts/PureSuperToken.json +694 -694
  74. package/build/contracts/Resolver.json +1058 -1058
  75. package/build/contracts/SETHProxy.json +661 -661
  76. package/build/contracts/SafeCast.json +1 -1
  77. package/build/contracts/SafeERC20.json +1 -1
  78. package/build/contracts/SafeMath.json +1 -1
  79. package/build/contracts/SelfDeletingFlowTestApp.json +4440 -4451
  80. package/build/contracts/SlotsBitmapLibrary.json +1757 -1757
  81. package/build/contracts/Strings.json +1 -1
  82. package/build/contracts/SuperAppBase.json +2 -2
  83. package/build/contracts/SuperAppDefinitions.json +1 -1
  84. package/build/contracts/SuperToken.json +9778 -9536
  85. package/build/contracts/SuperTokenFactory.json +2074 -2074
  86. package/build/contracts/SuperTokenFactoryBase.json +989 -989
  87. package/build/contracts/SuperTokenFactoryHelper.json +1095 -1095
  88. package/build/contracts/SuperUpgrader.json +2495 -2495
  89. package/build/contracts/Superfluid.json +12988 -12988
  90. package/build/contracts/SuperfluidFrameworkDeployer.json +2042 -2042
  91. package/build/contracts/SuperfluidGovernanceBase.json +10 -10
  92. package/build/contracts/SuperfluidGovernanceConfigs.json +1 -1
  93. package/build/contracts/SuperfluidGovernanceII.json +2023 -2023
  94. package/build/contracts/SuperfluidGovernanceIIProxy.json +227 -227
  95. package/build/contracts/SuperfluidLoader.json +752 -752
  96. package/build/contracts/SuperfluidToken.json +3478 -2955
  97. package/build/contracts/TOGA.json +4681 -4731
  98. package/build/contracts/TestGovernance.json +2403 -2403
  99. package/build/contracts/TestToken.json +1267 -1267
  100. package/build/contracts/TokenCustodian.json +903 -903
  101. package/build/contracts/TokenInfo.json +1 -1
  102. package/build/contracts/UUPSProxiable.json +233 -233
  103. package/build/contracts/UUPSProxy.json +257 -257
  104. package/build/contracts/UUPSUtils.json +85 -85
  105. package/build/contracts-sizes.txt +6 -6
  106. package/contracts/apps/CFAv1Library.sol +147 -111
  107. package/contracts/apps/IDAv1Library.sol +133 -101
  108. package/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol +7 -10
  109. package/contracts/interfaces/agreements/IInstantDistributionAgreementV1.sol +11 -18
  110. package/contracts/interfaces/superfluid/ISuperApp.sol +7 -9
  111. package/contracts/interfaces/superfluid/ISuperToken.sol +36 -44
  112. package/contracts/interfaces/superfluid/ISuperfluid.sol +17 -21
  113. package/contracts/interfaces/superfluid/ISuperfluidGovernance.sol +1 -1
  114. package/contracts/interfaces/superfluid/ISuperfluidToken.sol +21 -22
  115. package/contracts/libs/EventsEmitter.sol +16 -0
  116. package/contracts/mocks/CFAAppMocks.sol +52 -36
  117. package/contracts/mocks/CustomSuperTokenMock.sol +11 -4
  118. package/contracts/mocks/IDASuperAppTester.sol +24 -18
  119. package/contracts/mocks/MultiFlowTesterApp.sol +33 -24
  120. package/contracts/mocks/SuperAppMocks.sol +54 -40
  121. package/contracts/superfluid/SuperfluidToken.sol +33 -31
  122. package/contracts/utils/BatchLiquidator.sol +15 -11
  123. package/contracts/utils/TOGA.sol +40 -30
  124. package/package.json +5 -3
@@ -47,9 +47,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
47
47
  * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
48
48
  * called.
49
49
  *
50
- * NOTE: SuperToken always uses 18 decimals.
50
+ * @custom:note SuperToken always uses 18 decimals.
51
51
  *
52
- * Note: This information is only used for _display_ purposes: it in
52
+ * This information is only used for _display_ purposes: it in
53
53
  * no way affects any of the arithmetic of the contract, including
54
54
  * {IERC20-balanceOf} and {IERC20-transfer}.
55
55
  */
@@ -78,7 +78,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
78
78
  *
79
79
  * @return Returns Success a boolean value indicating whether the operation succeeded.
80
80
  *
81
- * Emits a {Transfer} event.
81
+ * @custom:emits a {Transfer} event.
82
82
  */
83
83
  function transfer(address recipient, uint256 amount) external override(IERC20) returns (bool);
84
84
 
@@ -87,7 +87,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
87
87
  * allowed to spend on behalf of `owner` through {transferFrom}. This is
88
88
  * zero by default.
89
89
  *
90
- * This value changes when {approve} or {transferFrom} are called.
90
+ * @notice This value changes when {approve} or {transferFrom} are called.
91
91
  */
92
92
  function allowance(address owner, address spender) external override(IERC20) view returns (uint256);
93
93
 
@@ -96,14 +96,14 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
96
96
  *
97
97
  * @return Returns Success a boolean value indicating whether the operation succeeded.
98
98
  *
99
- * IMPORTANT: Beware that changing an allowance with this method brings the risk
99
+ * @custom:note Beware that changing an allowance with this method brings the risk
100
100
  * that someone may use both the old and the new allowance by unfortunate
101
101
  * transaction ordering. One possible solution to mitigate this race
102
102
  * condition is to first reduce the spender's allowance to 0 and set the
103
103
  * desired value afterwards:
104
104
  * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
105
105
  *
106
- * Emits an {Approval} event.
106
+ * @custom:emits an {Approval} event.
107
107
  */
108
108
  function approve(address spender, uint256 amount) external override(IERC20) returns (bool);
109
109
 
@@ -114,7 +114,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
114
114
  *
115
115
  * @return Returns Success a boolean value indicating whether the operation succeeded.
116
116
  *
117
- * Emits a {Transfer} event.
117
+ * @custom:emits a {Transfer} event.
118
118
  */
119
119
  function transferFrom(address sender, address recipient, uint256 amount) external override(IERC20) returns (bool);
120
120
 
@@ -124,10 +124,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
124
124
  * This is an alternative to {approve} that can be used as a mitigation for
125
125
  * problems described in {IERC20-approve}.
126
126
  *
127
- * Emits an {Approval} event indicating the updated allowance.
128
- *
129
- * Requirements:
127
+ * @custom:emits an {Approval} event indicating the updated allowance.
130
128
  *
129
+ * @custom:requirements
131
130
  * - `spender` cannot be the zero address.
132
131
  */
133
132
  function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
@@ -138,10 +137,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
138
137
  * This is an alternative to {approve} that can be used as a mitigation for
139
138
  * problems described in {IERC20-approve}.
140
139
  *
141
- * Emits an {Approval} event indicating the updated allowance.
142
- *
143
- * Requirements:
140
+ * @custom:emits an {Approval} event indicating the updated allowance.
144
141
  *
142
+ * @custom:requirements
145
143
  * - `spender` cannot be the zero address.
146
144
  * - `spender` must have allowance for the caller of at least
147
145
  * `subtractedValue`.
@@ -157,7 +155,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
157
155
  * means all token operations (creation, movement and destruction) must have
158
156
  * amounts that are a multiple of this number.
159
157
  *
160
- * For super token contracts, this value is 1 always
158
+ * @custom:note For super token contracts, this value is always 1
161
159
  */
162
160
  function granularity() external view override(IERC777) returns (uint256);
163
161
 
@@ -168,10 +166,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
168
166
  * the corresponding functions will be called with `data` and empty
169
167
  * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.
170
168
  *
171
- * Emits a {Sent} event.
172
- *
173
- * Requirements
169
+ * @custom:emits a {Sent} event.
174
170
  *
171
+ * @custom:requirements
175
172
  * - the caller must have at least `amount` tokens.
176
173
  * - `recipient` cannot be the zero address.
177
174
  * - if `recipient` is a contract, it must implement the {IERC777Recipient}
@@ -186,10 +183,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
186
183
  * If a send hook is registered for the caller, the corresponding function
187
184
  * will be called with `data` and empty `operatorData`. See {IERC777Sender}.
188
185
  *
189
- * Emits a {Burned} event.
190
- *
191
- * Requirements
186
+ * @custom:emits a {Burned} event.
192
187
  *
188
+ * @custom:requirements
193
189
  * - the caller must have at least `amount` tokens.
194
190
  */
195
191
  function burn(uint256 amount, bytes calldata data) external override(IERC777);
@@ -208,10 +204,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
208
204
  *
209
205
  * See {isOperatorFor}.
210
206
  *
211
- * Emits an {AuthorizedOperator} event.
212
- *
213
- * Requirements
207
+ * @custom:emits an {AuthorizedOperator} event.
214
208
  *
209
+ * @custom:requirements
215
210
  * - `operator` cannot be calling address.
216
211
  */
217
212
  function authorizeOperator(address operator) external override(IERC777);
@@ -221,10 +216,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
221
216
  *
222
217
  * See {isOperatorFor} and {defaultOperators}.
223
218
  *
224
- * Emits a {RevokedOperator} event.
225
- *
226
- * Requirements
219
+ * @custom:emits a {RevokedOperator} event.
227
220
  *
221
+ * @custom:requirements
228
222
  * - `operator` cannot be calling address.
229
223
  */
230
224
  function revokeOperator(address operator) external override(IERC777);
@@ -247,10 +241,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
247
241
  * the corresponding functions will be called with `data` and
248
242
  * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.
249
243
  *
250
- * Emits a {Sent} event.
251
- *
252
- * Requirements
244
+ * @custom:emits a {Sent} event.
253
245
  *
246
+ * @custom:requirements
254
247
  * - `sender` cannot be the zero address.
255
248
  * - `sender` must have at least `amount` tokens.
256
249
  * - the caller must be an operator for `sender`.
@@ -273,10 +266,9 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
273
266
  * If a send hook is registered for `account`, the corresponding function
274
267
  * will be called with `data` and `operatorData`. See {IERC777Sender}.
275
268
  *
276
- * Emits a {Burned} event.
277
- *
278
- * Requirements
269
+ * @custom:emits a {Burned} event.
279
270
  *
271
+ * @custom:requirements
280
272
  * - `account` cannot be the zero address.
281
273
  * - `account` must have at least `amount` tokens.
282
274
  * - the caller must be an operator for `account`.
@@ -295,7 +287,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
295
287
  /**
296
288
  * @dev Mint new tokens for the account
297
289
  *
298
- * Modifiers:
290
+ * @custom:modifiers
299
291
  * - onlySelf
300
292
  */
301
293
  function selfMint(
@@ -307,7 +299,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
307
299
  /**
308
300
  * @dev Burn existing tokens for the account
309
301
  *
310
- * Modifiers:
302
+ * @custom:modifiers
311
303
  * - onlySelf
312
304
  */
313
305
  function selfBurn(
@@ -321,7 +313,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
321
313
  * If `spender` isn't the same as `sender`, checks if `spender` has allowance to
322
314
  * spend tokens of `sender`.
323
315
  *
324
- * Modifiers:
316
+ * @custom:modifiers
325
317
  * - onlySelf
326
318
  */
327
319
  function selfTransferFrom(
@@ -335,7 +327,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
335
327
  * @dev Give `spender`, `amount` allowance to spend the tokens of
336
328
  * `account`.
337
329
  *
338
- * Modifiers:
330
+ * @custom:modifiers
339
331
  * - onlySelf
340
332
  */
341
333
  function selfApproveFor(
@@ -367,8 +359,8 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
367
359
  * @dev Upgrade ERC20 to SuperToken.
368
360
  * @param amount Number of tokens to be upgraded (in 18 decimals)
369
361
  *
370
- * NOTE: It will use ´transferFrom´ to get tokens. Before calling this
371
- * function you should ´approve´ this contract
362
+ * @custom:note It will use `transferFrom` to get tokens. Before calling this
363
+ * function you should `approve` this contract
372
364
  */
373
365
  function upgrade(uint256 amount) external;
374
366
 
@@ -378,8 +370,8 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
378
370
  * @param amount Number of tokens to be upgraded (in 18 decimals)
379
371
  * @param data User data for the TokensRecipient callback
380
372
  *
381
- * NOTE: It will use ´transferFrom´ to get tokens. Before calling this
382
- * function you should ´approve´ this contract
373
+ * @custom:note It will use `transferFrom` to get tokens. Before calling this
374
+ * function you should `approve` this contract
383
375
  */
384
376
  function upgradeTo(address to, uint256 amount, bytes calldata data) external;
385
377
 
@@ -420,7 +412,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
420
412
  * @param spender The spender of account owner's funds.
421
413
  * @param amount Number of tokens to be approved.
422
414
  *
423
- * Modifiers:
415
+ * @custom:modifiers
424
416
  * - onlyHost
425
417
  */
426
418
  function operationApprove(
@@ -436,7 +428,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
436
428
  * @param recipient The recipient of thefunds.
437
429
  * @param amount Number of tokens to be transferred.
438
430
  *
439
- * Modifiers:
431
+ * @custom:modifiers
440
432
  * - onlyHost
441
433
  */
442
434
  function operationTransferFrom(
@@ -451,7 +443,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
451
443
  * @param account The account to be changed.
452
444
  * @param amount Number of tokens to be upgraded (in 18 decimals)
453
445
  *
454
- * Modifiers:
446
+ * @custom:modifiers
455
447
  * - onlyHost
456
448
  */
457
449
  function operationUpgrade(address account, uint256 amount) external;
@@ -461,7 +453,7 @@ interface ISuperToken is ISuperfluidToken, TokenInfo, IERC20, IERC777 {
461
453
  * @param account The account to be changed.
462
454
  * @param amount Number of tokens to be downgraded (in 18 decimals)
463
455
  *
464
- * Modifiers:
456
+ * @custom:modifiers
465
457
  * - onlyHost
466
458
  */
467
459
  function operationDowngrade(address account, uint256 amount) external;
@@ -21,8 +21,7 @@ import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol";
21
21
  /**
22
22
  * @title Host interface
23
23
  * @author Superfluid
24
- * NOTE:
25
- * This is the central contract of the system where super agreement, super app
24
+ * @notice This is the central contract of the system where super agreement, super app
26
25
  * and super token features are connected.
27
26
  *
28
27
  * The Superfluid host contract is also the entry point for the protocol users,
@@ -70,8 +69,8 @@ interface ISuperfluid {
70
69
  * @dev Register a new agreement class to the system
71
70
  * @param agreementClassLogic Initial agreement class code
72
71
  *
73
- * Modifiers:
74
- * - onlyGovernance
72
+ * @custom:modifiers
73
+ * - onlyGovernance
75
74
  */
76
75
  function registerAgreementClass(ISuperAgreement agreementClassLogic) external;
77
76
  /**
@@ -86,7 +85,7 @@ interface ISuperfluid {
86
85
  * @dev Update code of an agreement class
87
86
  * @param agreementClassLogic New code for the agreement class
88
87
  *
89
- * Modifiers:
88
+ * @custom:modifiers
90
89
  * - onlyGovernance
91
90
  */
92
91
  function updateAgreementClass(ISuperAgreement agreementClassLogic) external;
@@ -199,21 +198,18 @@ interface ISuperfluid {
199
198
 
200
199
  /**
201
200
  * @dev Message sender declares itself as a super app.
202
- * @param configWord The super app manifest configuration, flags are defined in
203
- * `SuperAppDefinitions`
204
- * @param registrationKey The registration key issued by the governance, needed to
205
- * register on a mainnet.
206
- * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide
201
+ * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`
202
+ * @param registrationKey The registration key issued by the governance, needed to register on a mainnet.
203
+ * @notice See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide
207
204
  * On testnets or in dev environment, a placeholder (e.g. empty string) can be used.
208
- * @notice While the message sender must be the super app itself, the transaction sender (tx.origin)
205
+ * While the message sender must be the super app itself, the transaction sender (tx.origin)
209
206
  * must be the deployer account the registration key was issued for.
210
207
  */
211
208
  function registerAppWithKey(uint256 configWord, string calldata registrationKey) external;
212
209
 
213
210
  /**
214
211
  * @dev Message sender (must be a contract) declares app as a super app
215
- * @param configWord The super app manifest configuration, flags are defined in
216
- * `SuperAppDefinitions`
212
+ * @param configWord The super app manifest configuration, flags are defined in `SuperAppDefinitions`
217
213
  * @notice On mainnet deployments, only factory contracts pre-authorized by governance can use this.
218
214
  * See https://github.com/superfluid-finance/protocol-monorepo/wiki/Super-App-White-listing-Guide
219
215
  */
@@ -303,7 +299,7 @@ interface ISuperfluid {
303
299
  * @param callData The call data sending to the super app.
304
300
  * @param isTermination Is it a termination callback?
305
301
  * @param ctx Current ctx, it will be validated.
306
- * @return newCtx
302
+ * @return newCtx The current context of the transaction.
307
303
  */
308
304
  function callAppAfterCallback(
309
305
  ISuperApp app,
@@ -322,7 +318,7 @@ interface ISuperfluid {
322
318
  * @param app The super app.
323
319
  * @param appAllowanceGranted App allowance granted so far.
324
320
  * @param appAllowanceUsed App allowance used so far.
325
- * @return newCtx
321
+ * @return newCtx The current context of the transaction.
326
322
  */
327
323
  function appCallbackPush(
328
324
  bytes calldata ctx,
@@ -340,9 +336,9 @@ interface ISuperfluid {
340
336
  * @dev (For agreements) Pop from the current app callback stack
341
337
  * @param ctx The ctx that was pushed before the callback stack.
342
338
  * @param appAllowanceUsedDelta App allowance used by the app.
343
- * @return newCtx
339
+ * @return newCtx The current context of the transaction.
344
340
  *
345
- * [SECURITY] NOTE:
341
+ * @custom:security
346
342
  * - Here we cannot do assertValidCtx(ctx), since we do not really save the stack in memory.
347
343
  * - Hence there is still implicit trust that the agreement handles the callback push/pop pair correctly.
348
344
  */
@@ -359,7 +355,7 @@ interface ISuperfluid {
359
355
  * @param ctx The current ctx, it will be validated.
360
356
  * @param appAllowanceWantedMore See app allowance for more details.
361
357
  * @param appAllowanceUsedDelta See app allowance for more details.
362
- * @return newCtx
358
+ * @return newCtx The current context of the transaction.
363
359
  */
364
360
  function ctxUseAllowance(
365
361
  bytes calldata ctx,
@@ -375,7 +371,7 @@ interface ISuperfluid {
375
371
  * @dev (For agreements) Jail the app.
376
372
  * @param app The super app.
377
373
  * @param reason Jail reason code.
378
- * @return newCtx
374
+ * @return newCtx The current context of the transaction.
379
375
  */
380
376
  function jailApp(
381
377
  bytes calldata ctx,
@@ -427,7 +423,7 @@ interface ISuperfluid {
427
423
  * @dev Main use case is calling app action in a batch call via the host
428
424
  * @param callData The contextual call data
429
425
  *
430
- * NOTE: See "Contextless Call Proxies" above for more about contextual call data.
426
+ * @custom:note See "Contextless Call Proxies" above for more about contextual call data.
431
427
  */
432
428
  function callAppAction(
433
429
  ISuperApp app,
@@ -453,7 +449,7 @@ interface ISuperfluid {
453
449
  /**
454
450
  * @dev Context Struct
455
451
  *
456
- * NOTE on backward compatibility:
452
+ * @custom:note on backward compatibility:
457
453
  * - Non-dynamic fields are padded to 32bytes and packed
458
454
  * - Dynamic fields are referenced through a 32bytes offset to their "parents" field (or root)
459
455
  * - The order of the fields hence should not be rearranged in order to be backward compatible:
@@ -30,7 +30,7 @@ interface ISuperfluidGovernance {
30
30
  /**
31
31
  * @dev Update logics of the contracts
32
32
  *
33
- * NOTE:
33
+ * @custom:note
34
34
  * - Because they might have inter-dependencies, it is good to have one single function to update them all
35
35
  */
36
36
  function updateContracts(
@@ -22,7 +22,7 @@ interface ISuperfluidToken {
22
22
  /**
23
23
  * @dev Encoded liquidation type data mainly used for handling stack to deep errors
24
24
  *
25
- * Note:
25
+ * @custom:note
26
26
  * - version: 1
27
27
  * - liquidationType key:
28
28
  * - 0 = reward account receives reward (PIC period)
@@ -105,7 +105,7 @@ interface ISuperfluidToken {
105
105
  * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance
106
106
  * @param account The account to check
107
107
  * @param timestamp The time we'd like to check if the account is solvent (should use future)
108
- * @return isSolvent
108
+ * @return isSolvent True if the account is solvent, false otherwise
109
109
  */
110
110
  function isAccountSolvent(
111
111
  address account,
@@ -118,7 +118,7 @@ interface ISuperfluidToken {
118
118
  * @notice Check if account is solvent now
119
119
  * @dev An account is insolvent when the sum of deposits for a token can't cover the negative availableBalance
120
120
  * @param account The account to check
121
- * @return isSolvent
121
+ * @return isSolvent True if the account is solvent, false otherwise
122
122
  */
123
123
  function isAccountSolventNow(
124
124
  address account
@@ -222,7 +222,7 @@ interface ISuperfluidToken {
222
222
  * @dev Update agreement state slot
223
223
  * @param account Account to be updated
224
224
  *
225
- * NOTE
225
+ * @custom:note
226
226
  * - To clear the storage out, provide zero-ed array of intended length
227
227
  */
228
228
  function updateAgreementStateSlot(
@@ -265,7 +265,7 @@ interface ISuperfluidToken {
265
265
  * @param account Account to query.
266
266
  * @param delta Amount of balance delta to be settled
267
267
  *
268
- * Modifiers:
268
+ * @custom:modifiers
269
269
  * - onlyAgreement
270
270
  */
271
271
  function settleBalance(
@@ -280,10 +280,11 @@ interface ISuperfluidToken {
280
280
  * @param liquidationTypeData Data regarding the version of the liquidation schema and the type
281
281
  * @param liquidatorAccount Address of the executor of the liquidation
282
282
  * @param useDefaultRewardAccount Whether or not the default reward account receives the rewardAmount
283
- * @param targetAccount Account of the stream sender
284
- * @param rewardAmount The amount the reward recepient account will receive
285
- * @param targetAccountBalanceDelta The amount the sender account balance should change by
283
+ * @param targetAccount Account to be liquidated
284
+ * @param rewardAmount The amount the rewarded account will receive
285
+ * @param targetAccountBalanceDelta The delta amount the target account balance should change by
286
286
  *
287
+ * @custom:note
287
288
  * - If a bailout is required (bailoutAmount > 0)
288
289
  * - the actual reward (single deposit) goes to the executor,
289
290
  * - while the reward account becomes the bailout account
@@ -293,7 +294,7 @@ interface ISuperfluidToken {
293
294
  * - the targetAccount will pay the rewardAmount
294
295
  * - the liquidator (reward account in PIC period) will receive the rewardAmount
295
296
  *
296
- * Modifiers:
297
+ * @custom:modifiers
297
298
  * - onlyAgreement
298
299
  */
299
300
  function makeLiquidationPayoutsV2
@@ -312,22 +313,22 @@ interface ISuperfluidToken {
312
313
  * @param id Agreement ID
313
314
  * @param liquidatorAccount Address of the executor of the liquidation
314
315
  * @param targetAccount Account of the stream sender
315
- * @param rewardAccount Account that collects the reward or bails out insolvent accounts
316
+ * @param rewardAmountReceiver Account that collects the reward or bails out insolvent accounts
316
317
  * @param rewardAmount The amount the reward recipient account balance should change by
317
318
  * @param targetAccountBalanceDelta The amount the sender account balance should change by
318
319
  * @param liquidationTypeData The encoded liquidation type data including the version (how to decode)
319
320
  *
320
- * NOTE:
321
+ * @custom:note
321
322
  * Reward account rule:
322
323
  * - if the agreement is liquidated during the PIC period
323
- * - the rewardAccount will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount
324
+ * - the rewardAmountReceiver will get the rewardAmount (remaining deposit), regardless of the liquidatorAccount
324
325
  * - the targetAccount will pay for the rewardAmount
325
326
  * - if the agreement is liquidated after the PIC period AND the targetAccount is solvent
326
- * - the liquidatorAccount will get the rewardAmount (remaining deposit)
327
+ * - the rewardAmountReceiver will get the rewardAmount (remaining deposit)
327
328
  * - the targetAccount will pay for the rewardAmount
328
329
  * - if the targetAccount is insolvent
329
330
  * - the liquidatorAccount will get the rewardAmount (single deposit)
330
- * - the rewardAccount will pay for both the rewardAmount and bailoutAmount
331
+ * - the default reward account (governance) will pay for both the rewardAmount and bailoutAmount
331
332
  * - the targetAccount will receive the bailoutAmount
332
333
  */
333
334
  event AgreementLiquidatedV2(
@@ -335,7 +336,7 @@ interface ISuperfluidToken {
335
336
  bytes32 id,
336
337
  address indexed liquidatorAccount,
337
338
  address indexed targetAccount,
338
- address rewardAccount,
339
+ address rewardAmountReceiver,
339
340
  uint256 rewardAmount,
340
341
  int256 targetAccountBalanceDelta,
341
342
  bytes liquidationTypeData
@@ -368,9 +369,7 @@ interface ISuperfluidToken {
368
369
  * @param rewardAccount Account that collect the reward
369
370
  * @param rewardAmount Amount of liquidation reward
370
371
  *
371
- * NOTE:
372
- *
373
- * [DEPRECATED] Use AgreementLiquidatedV2 instead
372
+ * @custom:deprecated Use AgreementLiquidatedV2 instead
374
373
  */
375
374
  event AgreementLiquidated(
376
375
  address indexed agreementClass,
@@ -385,9 +384,7 @@ interface ISuperfluidToken {
385
384
  * @param bailoutAccount Account that bailout the penalty account
386
385
  * @param bailoutAmount Amount of account bailout
387
386
  *
388
- * NOTE:
389
- *
390
- * [DEPRECATED] Use AgreementLiquidatedV2 instead
387
+ * @custom:deprecated Use AgreementLiquidatedV2 instead
391
388
  */
392
389
  event Bailout(
393
390
  address indexed bailoutAccount,
@@ -404,7 +401,9 @@ interface ISuperfluidToken {
404
401
  * @param rewardAmount Amount of liquidation reward
405
402
  * @param bailoutAmount Amount of liquidation bailouot
406
403
  *
407
- * NOTE:
404
+ * @custom:deprecated Use AgreementLiquidatedV2 instead
405
+ *
406
+ * @custom:note
408
407
  * Reward account rule:
409
408
  * - if bailout is equal to 0, then
410
409
  * - the bondAccount will get the rewardAmount,
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: AGPLv3
2
+ pragma solidity 0.8.13;
3
+
4
+ /**
5
+ * @title Events Emitter Library
6
+ * @author Superfluid
7
+ * @dev A library used for emitting missing and unaccessable events.
8
+ *
9
+ */
10
+ library EventsEmitter {
11
+ event Transfer(address indexed from, address indexed to, uint256 value);
12
+
13
+ function emitTransfer(address from, address to, uint256 value) internal {
14
+ emit Transfer(from, to, value);
15
+ }
16
+ }
@@ -53,12 +53,14 @@ contract ExclusiveInflowTestApp is SuperAppBase {
53
53
  newCtx = ctx;
54
54
  ISuperfluid.Context memory context = _host.decodeCtx(ctx);
55
55
  if (_currentSender != address(0)) {
56
- bytes memory callData = abi.encodeWithSelector(
57
- _cfa.deleteFlow.selector,
58
- superToken,
59
- _currentSender,
60
- address(this),
61
- new bytes(0)
56
+ bytes memory callData = abi.encodeCall(
57
+ _cfa.deleteFlow,
58
+ (
59
+ superToken,
60
+ _currentSender,
61
+ address(this),
62
+ new bytes(0)
63
+ )
62
64
  );
63
65
  (newCtx, ) = _host.callAgreementWithContext(
64
66
  _cfa,
@@ -133,12 +135,14 @@ contract NonClosableOutflowTestApp is SuperAppBase {
133
135
  _flowRate = flowRate;
134
136
  _host.callAgreement(
135
137
  _cfa,
136
- abi.encodeWithSelector(
137
- _cfa.createFlow.selector,
138
- superToken,
139
- receiver,
140
- flowRate,
141
- new bytes(0)
138
+ abi.encodeCall(
139
+ _cfa.createFlow,
140
+ (
141
+ superToken,
142
+ receiver,
143
+ flowRate,
144
+ new bytes(0)
145
+ )
142
146
  ),
143
147
  new bytes(0) // user data
144
148
  );
@@ -158,16 +162,22 @@ contract NonClosableOutflowTestApp is SuperAppBase {
158
162
  (address flowSender, address flowReceiver) = abi.decode(agreementData, (address, address));
159
163
  assert(flowSender == address(this));
160
164
  assert(flowReceiver == _receiver);
161
- // recreate the flow
162
- (newCtx, ) = _host.callAgreementWithContext(
163
- _cfa,
164
- abi.encodeWithSelector(
165
- _cfa.createFlow.selector,
165
+
166
+ // moved out to avoid stack too deep error
167
+ bytes memory callData = abi.encodeCall(
168
+ _cfa.createFlow,
169
+ (
166
170
  superToken,
167
171
  flowReceiver,
168
172
  _flowRate,
169
173
  new bytes(0)
170
- ),
174
+ )
175
+ );
176
+
177
+ // recreate the flow
178
+ (newCtx, ) = _host.callAgreementWithContext(
179
+ _cfa,
180
+ callData,
171
181
  "0x",
172
182
  ctx
173
183
  );
@@ -218,12 +228,14 @@ contract SelfDeletingFlowTestApp is SuperAppBase {
218
228
  ISuperfluid.Context memory context = _host.decodeCtx(ctx);
219
229
  (newCtx, ) = _host.callAgreementWithContext(
220
230
  _cfa,
221
- abi.encodeWithSelector(
222
- _cfa.deleteFlow.selector,
223
- superToken,
224
- context.msgSender,
225
- address(this),
226
- new bytes(0)
231
+ abi.encodeCall(
232
+ _cfa.deleteFlow,
233
+ (
234
+ superToken,
235
+ context.msgSender,
236
+ address(this),
237
+ new bytes(0)
238
+ )
227
239
  ),
228
240
  new bytes(0), // user data
229
241
  newCtx
@@ -273,12 +285,14 @@ contract ClosingOnUpdateFlowTestApp is SuperAppBase {
273
285
  ISuperfluid.Context memory context = _host.decodeCtx(ctx);
274
286
  (newCtx, ) = _host.callAgreementWithContext(
275
287
  _cfa,
276
- abi.encodeWithSelector(
277
- _cfa.deleteFlow.selector,
278
- superToken,
279
- context.msgSender,
280
- address(this),
281
- new bytes(0)
288
+ abi.encodeCall(
289
+ _cfa.deleteFlow,
290
+ (
291
+ superToken,
292
+ context.msgSender,
293
+ address(this),
294
+ new bytes(0)
295
+ )
282
296
  ),
283
297
  new bytes(0), // user data
284
298
  newCtx
@@ -331,12 +345,14 @@ contract FlowExchangeTestApp is SuperAppBase {
331
345
  (,int96 flowRate,,) = _cfa.getFlow(superToken, context.msgSender, address(this));
332
346
  (newCtx, ) = _host.callAgreementWithContext(
333
347
  _cfa,
334
- abi.encodeWithSelector(
335
- _cfa.createFlow.selector,
336
- _targetToken,
337
- context.msgSender,
338
- flowRate,
339
- new bytes(0)
348
+ abi.encodeCall(
349
+ _cfa.createFlow,
350
+ (
351
+ _targetToken,
352
+ context.msgSender,
353
+ flowRate,
354
+ new bytes(0)
355
+ )
340
356
  ),
341
357
  new bytes(0), // user data
342
358
  newCtx