@superfluid-finance/ethereum-contracts 1.2.3-dev.3df6de8.0 → 1.2.3-dev.4eebafa.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.
- package/build/contracts/AccessControl.json +1 -1
- package/build/contracts/AccessControlEnumerable.json +1 -1
- package/build/contracts/Address.json +1 -1
- package/build/contracts/AgreementBase.json +10 -10
- package/build/contracts/AgreementLibrary.json +4 -4
- package/build/contracts/BaseRelayRecipient.json +1 -1
- package/build/contracts/BatchLiquidator.json +1385 -1242
- package/build/contracts/BatchOperation.json +1 -1
- package/build/contracts/CFAv1Library.json +3437 -3625
- package/build/contracts/CallUtils.json +1 -1
- package/build/contracts/ClosingOnUpdateFlowTestApp.json +4440 -4451
- package/build/contracts/ConstantFlowAgreementV1.json +5204 -5204
- package/build/contracts/Context.json +1 -1
- package/build/contracts/ContextDefinitions.json +1 -1
- package/build/contracts/Create2.json +1 -1
- package/build/contracts/CustomSuperTokenBase.json +2 -2
- package/build/contracts/ERC165.json +1 -1
- package/build/contracts/ERC1820Implementer.json +79 -79
- package/build/contracts/ERC1820RegistryCompiled.json +1 -1
- package/build/contracts/ERC20.json +1008 -1008
- package/build/contracts/ERC20Burnable.json +1 -1
- package/build/contracts/ERC20Pausable.json +1 -1
- package/build/contracts/ERC20PresetMinterPauser.json +1816 -1816
- package/build/contracts/ERC20WithTokenInfo.json +1 -1
- package/build/contracts/ERC777Helper.json +1 -1
- package/build/contracts/ERC777RecipientDrainingGas.json +1874 -1874
- package/build/contracts/ERC777RecipientReverting.json +1896 -1896
- package/build/contracts/EnumerableSet.json +1 -1
- package/build/contracts/EventsEmitter.json +414 -0
- package/build/contracts/ExclusiveInflowTestApp.json +4468 -4479
- package/build/contracts/FixedSizeData.json +405 -405
- package/build/contracts/FlowExchangeTestApp.json +4578 -4589
- package/build/contracts/FlowOperatorDefinitions.json +1 -1
- package/build/contracts/FullUpgradableSuperTokenProxy.json +319 -319
- package/build/contracts/IAccessControl.json +1 -1
- package/build/contracts/IAccessControlEnumerable.json +1 -1
- package/build/contracts/IConstantFlowAgreementV1.json +2 -2
- package/build/contracts/IDAv1Library.json +3227 -3403
- package/build/contracts/IERC165.json +1 -1
- package/build/contracts/IERC1820Implementer.json +1 -1
- package/build/contracts/IERC1820Registry.json +1 -1
- package/build/contracts/IERC20.json +1 -1
- package/build/contracts/IERC20Metadata.json +1 -1
- package/build/contracts/IERC777.json +1 -1
- package/build/contracts/IERC777Recipient.json +1 -1
- package/build/contracts/IERC777Sender.json +1 -1
- package/build/contracts/IInstantDistributionAgreementV1.json +2 -2
- package/build/contracts/IMaticBridgedNativeSuperToken.json +6 -6
- package/build/contracts/IMaticBridgedNativeSuperTokenCustom.json +2 -2
- package/build/contracts/IMultiSigWallet.json +1 -1
- package/build/contracts/IPureSuperToken.json +6 -6
- package/build/contracts/IPureSuperTokenCustom.json +2 -2
- package/build/contracts/IRelayRecipient.json +1 -1
- package/build/contracts/IResolver.json +1 -1
- package/build/contracts/ISETH.json +6 -6
- package/build/contracts/ISETHCustom.json +2 -2
- package/build/contracts/ISuperAgreement.json +2 -2
- package/build/contracts/ISuperApp.json +2 -2
- package/build/contracts/ISuperToken.json +6 -6
- package/build/contracts/ISuperTokenFactory.json +2 -2
- package/build/contracts/ISuperfluid.json +2 -2
- package/build/contracts/ISuperfluidGovernance.json +2 -2
- package/build/contracts/ISuperfluidToken.json +122 -122
- package/build/contracts/ITOGAv1.json +2689 -2739
- package/build/contracts/ITOGAv2.json +2689 -2739
- package/build/contracts/Initializable.json +1 -1
- package/build/contracts/InstantDistributionAgreementV1.json +5387 -5387
- package/build/contracts/MaticBridgedNativeSuperTokenProxy.json +971 -971
- package/build/contracts/NonClosableOutflowTestApp.json +4343 -4354
- package/build/contracts/Ownable.json +1 -1
- package/build/contracts/Pausable.json +1 -1
- package/build/contracts/Proxy.json +1 -1
- package/build/contracts/PureSuperToken.json +694 -694
- package/build/contracts/Resolver.json +1058 -1058
- package/build/contracts/SETHProxy.json +661 -661
- package/build/contracts/SafeCast.json +1 -1
- package/build/contracts/SafeERC20.json +1 -1
- package/build/contracts/SafeMath.json +1 -1
- package/build/contracts/SelfDeletingFlowTestApp.json +4440 -4451
- package/build/contracts/SlotsBitmapLibrary.json +1757 -1757
- package/build/contracts/Strings.json +1 -1
- package/build/contracts/SuperAppBase.json +2 -2
- package/build/contracts/SuperAppDefinitions.json +1 -1
- package/build/contracts/SuperToken.json +9757 -9515
- package/build/contracts/SuperTokenFactory.json +2074 -2074
- package/build/contracts/SuperTokenFactoryBase.json +989 -989
- package/build/contracts/SuperTokenFactoryHelper.json +1095 -1095
- package/build/contracts/SuperUpgrader.json +2495 -2495
- package/build/contracts/Superfluid.json +12978 -12978
- package/build/contracts/SuperfluidFrameworkDeployer.json +2042 -2042
- package/build/contracts/SuperfluidGovernanceBase.json +9 -9
- package/build/contracts/SuperfluidGovernanceConfigs.json +1 -1
- package/build/contracts/SuperfluidGovernanceII.json +2022 -2022
- package/build/contracts/SuperfluidGovernanceIIProxy.json +227 -227
- package/build/contracts/SuperfluidLoader.json +752 -752
- package/build/contracts/SuperfluidToken.json +3476 -2953
- package/build/contracts/TOGA.json +4681 -4731
- package/build/contracts/TestGovernance.json +2402 -2402
- package/build/contracts/TestToken.json +1267 -1267
- package/build/contracts/TokenCustodian.json +903 -903
- package/build/contracts/TokenInfo.json +1 -1
- package/build/contracts/UUPSProxiable.json +233 -233
- package/build/contracts/UUPSProxy.json +257 -257
- package/build/contracts/UUPSUtils.json +85 -85
- package/build/contracts-sizes.txt +6 -6
- package/contracts/apps/CFAv1Library.sol +147 -111
- package/contracts/apps/IDAv1Library.sol +133 -101
- package/contracts/interfaces/superfluid/ISuperfluidToken.sol +8 -8
- package/contracts/libs/EventsEmitter.sol +16 -0
- package/contracts/mocks/CFAAppMocks.sol +52 -36
- package/contracts/mocks/CustomSuperTokenMock.sol +11 -4
- package/contracts/mocks/IDASuperAppTester.sol +24 -18
- package/contracts/mocks/MultiFlowTesterApp.sol +33 -24
- package/contracts/mocks/SuperAppMocks.sol +54 -40
- package/contracts/superfluid/SuperfluidToken.sol +33 -31
- package/contracts/utils/BatchLiquidator.sol +15 -11
- package/contracts/utils/TOGA.sol +40 -30
- package/package.json +2 -2
|
@@ -131,12 +131,15 @@ contract MultiFlowTesterApp is SuperAppBase {
|
|
|
131
131
|
external
|
|
132
132
|
returns (bytes memory newCtx)
|
|
133
133
|
{
|
|
134
|
-
bytes memory callData = abi.
|
|
135
|
-
_cfa.createFlow
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
bytes memory callData = abi.encodeCall(
|
|
135
|
+
_cfa.createFlow,
|
|
136
|
+
(
|
|
137
|
+
superToken,
|
|
138
|
+
receiver,
|
|
139
|
+
flowRate,
|
|
140
|
+
new bytes(0)
|
|
141
|
+
)
|
|
142
|
+
);
|
|
140
143
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
141
144
|
_cfa,
|
|
142
145
|
callData,
|
|
@@ -269,12 +272,14 @@ contract MultiFlowTesterApp is SuperAppBase {
|
|
|
269
272
|
newCtx = ctx;
|
|
270
273
|
if (vars.flowReceiver == address(this)) {
|
|
271
274
|
for(uint256 i = 0; i < vars.configuration.receivers.length; i++) {
|
|
272
|
-
callData = abi.
|
|
273
|
-
_cfa.deleteFlow
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
callData = abi.encodeCall(
|
|
276
|
+
_cfa.deleteFlow,
|
|
277
|
+
(
|
|
278
|
+
superToken,
|
|
279
|
+
address(this),
|
|
280
|
+
vars.configuration.receivers[i].to,
|
|
281
|
+
new bytes(0) //placeholder ctx
|
|
282
|
+
)
|
|
278
283
|
);
|
|
279
284
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
280
285
|
_cfa,
|
|
@@ -288,12 +293,14 @@ contract MultiFlowTesterApp is SuperAppBase {
|
|
|
288
293
|
// skip current closed flow
|
|
289
294
|
if (vars.configuration.receivers[i].to == vars.flowReceiver) continue;
|
|
290
295
|
// close the rest of the mfa receiver flows
|
|
291
|
-
callData = abi.
|
|
292
|
-
_cfa.deleteFlow
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
296
|
+
callData = abi.encodeCall(
|
|
297
|
+
_cfa.deleteFlow,
|
|
298
|
+
(
|
|
299
|
+
superToken,
|
|
300
|
+
address(this),
|
|
301
|
+
vars.configuration.receivers[i].to,
|
|
302
|
+
new bytes(0) //placeholder ctx
|
|
303
|
+
)
|
|
297
304
|
);
|
|
298
305
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
299
306
|
_cfa,
|
|
@@ -303,12 +310,14 @@ contract MultiFlowTesterApp is SuperAppBase {
|
|
|
303
310
|
);
|
|
304
311
|
}
|
|
305
312
|
// close the mfa sender flow
|
|
306
|
-
callData = abi.
|
|
307
|
-
_cfa.deleteFlow
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
callData = abi.encodeCall(
|
|
314
|
+
_cfa.deleteFlow,
|
|
315
|
+
(
|
|
316
|
+
superToken,
|
|
317
|
+
vars.mfaSender,
|
|
318
|
+
address(this),
|
|
319
|
+
new bytes(0) //placeholder ctx
|
|
320
|
+
)
|
|
312
321
|
);
|
|
313
322
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
314
323
|
_cfa,
|
|
@@ -18,11 +18,13 @@ contract SuperAppMockAux {
|
|
|
18
18
|
{
|
|
19
19
|
host.callAgreementWithContext(
|
|
20
20
|
agreement,
|
|
21
|
-
abi.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
abi.encodeCall(
|
|
22
|
+
agreement.pingMe,
|
|
23
|
+
(
|
|
24
|
+
address(this), // expectedMsgSender
|
|
25
|
+
ping,
|
|
26
|
+
new bytes(0)
|
|
27
|
+
)
|
|
26
28
|
),
|
|
27
29
|
new bytes(0), // user data
|
|
28
30
|
ctx);
|
|
@@ -33,9 +35,9 @@ contract SuperAppMockAux {
|
|
|
33
35
|
{
|
|
34
36
|
host.callAppActionWithContext(
|
|
35
37
|
app,
|
|
36
|
-
abi.
|
|
37
|
-
|
|
38
|
-
new bytes(0)
|
|
38
|
+
abi.encodeCall(
|
|
39
|
+
app.actionNoop,
|
|
40
|
+
(new bytes(0))
|
|
39
41
|
),
|
|
40
42
|
ctx);
|
|
41
43
|
}
|
|
@@ -157,11 +159,13 @@ contract SuperAppMock is ISuperApp {
|
|
|
157
159
|
{
|
|
158
160
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
159
161
|
agreement,
|
|
160
|
-
abi.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
abi.encodeCall(
|
|
163
|
+
agreement.pingMe,
|
|
164
|
+
(
|
|
165
|
+
address(this), // expectedMsgSender
|
|
166
|
+
ping,
|
|
167
|
+
new bytes(0)
|
|
168
|
+
)
|
|
165
169
|
),
|
|
166
170
|
new bytes(0), // user data
|
|
167
171
|
ctx);
|
|
@@ -174,10 +178,12 @@ contract SuperAppMock is ISuperApp {
|
|
|
174
178
|
{
|
|
175
179
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
176
180
|
agreement,
|
|
177
|
-
abi.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
abi.encodeCall(
|
|
182
|
+
agreement.doRevert,
|
|
183
|
+
(
|
|
184
|
+
reason,
|
|
185
|
+
new bytes(0)
|
|
186
|
+
)
|
|
181
187
|
),
|
|
182
188
|
new bytes(0), // user data
|
|
183
189
|
ctx);
|
|
@@ -190,9 +196,9 @@ contract SuperAppMock is ISuperApp {
|
|
|
190
196
|
{
|
|
191
197
|
newCtx = _host.callAppActionWithContext(
|
|
192
198
|
this,
|
|
193
|
-
abi.
|
|
194
|
-
|
|
195
|
-
new bytes(0)
|
|
199
|
+
abi.encodeCall(
|
|
200
|
+
this.actionNoop,
|
|
201
|
+
(new bytes(0))
|
|
196
202
|
),
|
|
197
203
|
ctx);
|
|
198
204
|
}
|
|
@@ -204,10 +210,12 @@ contract SuperAppMock is ISuperApp {
|
|
|
204
210
|
{
|
|
205
211
|
newCtx = _host.callAppActionWithContext(
|
|
206
212
|
this,
|
|
207
|
-
abi.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
abi.encodeCall(
|
|
214
|
+
this.actionRevertWithReason,
|
|
215
|
+
(
|
|
216
|
+
reason,
|
|
217
|
+
new bytes(0)
|
|
218
|
+
)
|
|
211
219
|
),
|
|
212
220
|
ctx);
|
|
213
221
|
}
|
|
@@ -219,11 +227,13 @@ contract SuperAppMock is ISuperApp {
|
|
|
219
227
|
{
|
|
220
228
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
221
229
|
agreement,
|
|
222
|
-
abi.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
abi.encodeCall(
|
|
231
|
+
agreement.pingMe,
|
|
232
|
+
(
|
|
233
|
+
address(this), // expectedMsgSender
|
|
234
|
+
42,
|
|
235
|
+
new bytes(0)
|
|
236
|
+
)
|
|
227
237
|
),
|
|
228
238
|
new bytes(0), // user data
|
|
229
239
|
abi.encode(42));
|
|
@@ -236,10 +246,12 @@ contract SuperAppMock is ISuperApp {
|
|
|
236
246
|
{
|
|
237
247
|
newCtx = _host.callAppActionWithContext(
|
|
238
248
|
this,
|
|
239
|
-
abi.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
249
|
+
abi.encodeCall(
|
|
250
|
+
this.actionRevertWithReason,
|
|
251
|
+
(
|
|
252
|
+
reason,
|
|
253
|
+
new bytes(0)
|
|
254
|
+
)
|
|
243
255
|
),
|
|
244
256
|
abi.encode(42));
|
|
245
257
|
}
|
|
@@ -250,9 +262,9 @@ contract SuperAppMock is ISuperApp {
|
|
|
250
262
|
{
|
|
251
263
|
_host.callAppActionWithContext(
|
|
252
264
|
this,
|
|
253
|
-
abi.
|
|
254
|
-
|
|
255
|
-
new bytes(0)
|
|
265
|
+
abi.encodeCall(
|
|
266
|
+
this.actionAlteringCtx,
|
|
267
|
+
(new bytes(0))
|
|
256
268
|
),
|
|
257
269
|
ctx);
|
|
258
270
|
assert(false);
|
|
@@ -573,10 +585,12 @@ contract SuperAppMock2ndLevel {
|
|
|
573
585
|
{
|
|
574
586
|
(newCtx, ) = _host.callAgreementWithContext(
|
|
575
587
|
_agreement,
|
|
576
|
-
abi.
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
588
|
+
abi.encodeCall(
|
|
589
|
+
_agreement.callAppAfterAgreementCreatedCallback,
|
|
590
|
+
(
|
|
591
|
+
_app,
|
|
592
|
+
new bytes(0)
|
|
593
|
+
)
|
|
580
594
|
),
|
|
581
595
|
new bytes(0), // user data
|
|
582
596
|
ctx);
|
|
@@ -7,6 +7,7 @@ import { ISuperfluidGovernance } from "../interfaces/superfluid/ISuperfluidGover
|
|
|
7
7
|
import { ISuperfluidToken } from "../interfaces/superfluid/ISuperfluidToken.sol";
|
|
8
8
|
|
|
9
9
|
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
|
|
10
|
+
import { EventsEmitter } from "../libs/EventsEmitter.sol";
|
|
10
11
|
import { FixedSizeData } from "../libs/FixedSizeData.sol";
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -213,6 +214,11 @@ abstract contract SuperfluidToken is ISuperfluidToken
|
|
|
213
214
|
_balances[to] = _balances[to] + amount;
|
|
214
215
|
}
|
|
215
216
|
|
|
217
|
+
function _getRewardAccount() internal view returns (address rewardAccount) {
|
|
218
|
+
ISuperfluidGovernance gov = _host.getGovernance();
|
|
219
|
+
rewardAccount = gov.getConfigAsAddress(_host, this, _REWARD_ADDRESS_CONFIG_KEY);
|
|
220
|
+
}
|
|
221
|
+
|
|
216
222
|
/**************************************************************************
|
|
217
223
|
* Super Agreement hosting functions
|
|
218
224
|
*************************************************************************/
|
|
@@ -313,56 +319,52 @@ abstract contract SuperfluidToken is ISuperfluidToken
|
|
|
313
319
|
bytes32 id,
|
|
314
320
|
bytes memory liquidationTypeData,
|
|
315
321
|
address liquidatorAccount, // the address executing the liquidation
|
|
316
|
-
bool useDefaultRewardAccount,
|
|
317
|
-
address targetAccount, //
|
|
318
|
-
uint256 rewardAmount,
|
|
319
|
-
int256 targetAccountBalanceDelta
|
|
322
|
+
bool useDefaultRewardAccount, // Whether or not the default reward account receives the rewardAmount
|
|
323
|
+
address targetAccount, // Account to be liquidated
|
|
324
|
+
uint256 rewardAmount, // The amount the rewarded account will receive
|
|
325
|
+
int256 targetAccountBalanceDelta // The delta amount the target account balance should change by
|
|
320
326
|
) external override onlyAgreement {
|
|
321
|
-
address rewardAccount;
|
|
322
|
-
address defaultRewardAccount;
|
|
323
|
-
|
|
324
|
-
{
|
|
325
|
-
ISuperfluidGovernance gov = _host.getGovernance();
|
|
326
|
-
defaultRewardAccount = gov.getConfigAsAddress(_host, this, _REWARD_ADDRESS_CONFIG_KEY);
|
|
327
|
-
rewardAccount = defaultRewardAccount;
|
|
328
|
-
}
|
|
327
|
+
address rewardAccount = _getRewardAccount();
|
|
329
328
|
|
|
330
329
|
// we set the rewardAccount to the user who executed the liquidation if
|
|
331
|
-
// no rewardAccount is set (ANARCHY MODE - should not occur in reality, for testing purposes)
|
|
332
|
-
if (
|
|
330
|
+
// no rewardAccount is set (aka. ANARCHY MODE - should not occur in reality, for testing purposes)
|
|
331
|
+
if (rewardAccount == address(0)) {
|
|
333
332
|
rewardAccount = liquidatorAccount;
|
|
334
333
|
}
|
|
335
334
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
335
|
+
address rewardAmountReceiver = useDefaultRewardAccount ? rewardAccount : liquidatorAccount;
|
|
336
|
+
|
|
337
|
+
if (targetAccountBalanceDelta <= 0) {
|
|
338
|
+
// LIKELY BRANCH: target account pays penalty to rewarded account
|
|
339
|
+
assert(rewardAmount.toInt256() == -targetAccountBalanceDelta);
|
|
340
|
+
|
|
341
|
+
_balances[rewardAmountReceiver] += rewardAmount.toInt256();
|
|
342
|
+
_balances[targetAccount] += targetAccountBalanceDelta;
|
|
343
|
+
EventsEmitter.emitTransfer(targetAccount, rewardAmountReceiver, rewardAmount);
|
|
339
344
|
} else {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
_balances[
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
// LESS LIKELY BRANCH: target account is bailed out
|
|
346
|
+
// NOTE: useDefaultRewardAccount being true is undefined behavior
|
|
347
|
+
// because the default reward account isn't receiving the rewardAmount by default
|
|
348
|
+
assert(!useDefaultRewardAccount);
|
|
349
|
+
_balances[rewardAccount] -= (rewardAmount.toInt256() + targetAccountBalanceDelta);
|
|
350
|
+
_balances[liquidatorAccount] += rewardAmount.toInt256();
|
|
351
|
+
_balances[targetAccount] += targetAccountBalanceDelta;
|
|
352
|
+
EventsEmitter.emitTransfer(rewardAccount, liquidatorAccount, rewardAmount);
|
|
353
|
+
EventsEmitter.emitTransfer(rewardAccount, targetAccount, uint256(targetAccountBalanceDelta));
|
|
349
354
|
}
|
|
350
355
|
|
|
351
|
-
// if targetAccountBalanceDelta > 0, it is a bailout, else a solvent liquidation
|
|
352
|
-
_balances[targetAccount] = _balances[targetAccount]
|
|
353
|
-
+ targetAccountBalanceDelta;
|
|
354
|
-
|
|
355
356
|
emit AgreementLiquidatedV2(
|
|
356
357
|
msg.sender,
|
|
357
358
|
id,
|
|
358
359
|
liquidatorAccount,
|
|
359
360
|
targetAccount,
|
|
360
|
-
|
|
361
|
+
rewardAmountReceiver,
|
|
361
362
|
rewardAmount,
|
|
362
363
|
targetAccountBalanceDelta,
|
|
363
364
|
liquidationTypeData
|
|
364
365
|
);
|
|
365
366
|
}
|
|
367
|
+
|
|
366
368
|
/**************************************************************************
|
|
367
369
|
* Modifiers
|
|
368
370
|
*************************************************************************/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPLv3
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
-
import { ISuperfluid, ISuperAgreement } from "../interfaces/superfluid/ISuperfluid.sol";
|
|
4
|
+
import { ISuperfluid, ISuperAgreement, ISuperToken } from "../interfaces/superfluid/ISuperfluid.sol";
|
|
5
5
|
import { IConstantFlowAgreementV1 } from "../interfaces/agreements/IConstantFlowAgreementV1.sol";
|
|
6
6
|
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
7
7
|
|
|
@@ -33,17 +33,21 @@ contract BatchLiquidator {
|
|
|
33
33
|
// It could be due to flow had been liquidated by others.
|
|
34
34
|
// solhint-disable-next-line avoid-low-level-calls
|
|
35
35
|
(success, ) = address(host).call(
|
|
36
|
-
abi.
|
|
37
|
-
ISuperfluid.callAgreement
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
abi.encodeCall(
|
|
37
|
+
ISuperfluid(host).callAgreement,
|
|
38
|
+
(
|
|
39
|
+
ISuperAgreement(cfa),
|
|
40
|
+
abi.encodeCall(
|
|
41
|
+
IConstantFlowAgreementV1(cfa).deleteFlow,
|
|
42
|
+
(
|
|
43
|
+
ISuperToken(superToken),
|
|
44
|
+
senders[i],
|
|
45
|
+
receivers[i],
|
|
46
|
+
new bytes(0)
|
|
47
|
+
)
|
|
48
|
+
),
|
|
44
49
|
new bytes(0)
|
|
45
|
-
)
|
|
46
|
-
new bytes(0)
|
|
50
|
+
)
|
|
47
51
|
)
|
|
48
52
|
);
|
|
49
53
|
}
|
package/contracts/utils/TOGA.sol
CHANGED
|
@@ -197,12 +197,14 @@ contract TOGA is ITOGAv2, IERC777Recipient {
|
|
|
197
197
|
// need to update existing flow
|
|
198
198
|
_host.callAgreement(
|
|
199
199
|
_cfa,
|
|
200
|
-
abi.
|
|
201
|
-
_cfa.updateFlow
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
abi.encodeCall(
|
|
201
|
+
_cfa.updateFlow,
|
|
202
|
+
(
|
|
203
|
+
token,
|
|
204
|
+
currentPICAddr,
|
|
205
|
+
newExitRate,
|
|
206
|
+
new bytes(0)
|
|
207
|
+
)
|
|
206
208
|
),
|
|
207
209
|
"0x"
|
|
208
210
|
);
|
|
@@ -210,12 +212,14 @@ contract TOGA is ITOGAv2, IERC777Recipient {
|
|
|
210
212
|
// no pre-existing flow, need to create
|
|
211
213
|
_host.callAgreement(
|
|
212
214
|
_cfa,
|
|
213
|
-
abi.
|
|
214
|
-
_cfa.createFlow
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
abi.encodeCall(
|
|
216
|
+
_cfa.createFlow,
|
|
217
|
+
(
|
|
218
|
+
token,
|
|
219
|
+
currentPICAddr,
|
|
220
|
+
newExitRate,
|
|
221
|
+
new bytes(0)
|
|
222
|
+
)
|
|
219
223
|
),
|
|
220
224
|
"0x"
|
|
221
225
|
);
|
|
@@ -223,12 +227,14 @@ contract TOGA is ITOGAv2, IERC777Recipient {
|
|
|
223
227
|
// need to close existing flow
|
|
224
228
|
_host.callAgreement(
|
|
225
229
|
_cfa,
|
|
226
|
-
abi.
|
|
227
|
-
_cfa.deleteFlow
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
abi.encodeCall(
|
|
231
|
+
_cfa.deleteFlow,
|
|
232
|
+
(
|
|
233
|
+
token,
|
|
234
|
+
address(this),
|
|
235
|
+
currentPICAddr,
|
|
236
|
+
new bytes(0)
|
|
237
|
+
)
|
|
232
238
|
),
|
|
233
239
|
"0x"
|
|
234
240
|
);
|
|
@@ -267,12 +273,14 @@ contract TOGA is ITOGAv2, IERC777Recipient {
|
|
|
267
273
|
if (curFlowRate > 0) {
|
|
268
274
|
_host.callAgreement(
|
|
269
275
|
_cfa,
|
|
270
|
-
abi.
|
|
271
|
-
_cfa.deleteFlow
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
+
abi.encodeCall(
|
|
277
|
+
_cfa.deleteFlow,
|
|
278
|
+
(
|
|
279
|
+
token,
|
|
280
|
+
address(this),
|
|
281
|
+
currentPICAddr,
|
|
282
|
+
new bytes(0)
|
|
283
|
+
)
|
|
276
284
|
),
|
|
277
285
|
"0x"
|
|
278
286
|
);
|
|
@@ -300,12 +308,14 @@ contract TOGA is ITOGAv2, IERC777Recipient {
|
|
|
300
308
|
if (exitRate > 0) {
|
|
301
309
|
_host.callAgreement(
|
|
302
310
|
_cfa,
|
|
303
|
-
abi.
|
|
304
|
-
_cfa.createFlow
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
311
|
+
abi.encodeCall(
|
|
312
|
+
_cfa.createFlow,
|
|
313
|
+
(
|
|
314
|
+
token,
|
|
315
|
+
newPIC,
|
|
316
|
+
exitRate,
|
|
317
|
+
new bytes(0)
|
|
318
|
+
)
|
|
309
319
|
),
|
|
310
320
|
"0x"
|
|
311
321
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superfluid-finance/ethereum-contracts",
|
|
3
|
-
"version": "1.2.3-dev.
|
|
3
|
+
"version": "1.2.3-dev.4eebafa.0",
|
|
4
4
|
"description": " Ethereum contracts implementation for the Superfluid Protocol",
|
|
5
5
|
"homepage": "https://github.com/superfluid-finance/protocol-monorepo/tree/dev/packages/ethereum-contracts#readme",
|
|
6
6
|
"repository": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@decentral.ee/web3-helpers": "0.5.3",
|
|
58
58
|
"@openzeppelin/contracts": "4.5.0",
|
|
59
|
-
"@superfluid-finance/js-sdk": "^0.6.2-dev.
|
|
59
|
+
"@superfluid-finance/js-sdk": "^0.6.2-dev.4eebafa.0",
|
|
60
60
|
"@truffle/contract": "4.5.5",
|
|
61
61
|
"ethereumjs-tx": "2.1.2",
|
|
62
62
|
"ethereumjs-util": "7.1.4",
|