@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.
- 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 +1 -1
- package/build/contracts/AgreementLibrary.json +1 -1
- package/build/contracts/BaseRelayRecipient.json +1 -1
- package/build/contracts/BatchLiquidator.json +1 -1
- package/build/contracts/BatchOperation.json +1 -1
- package/build/contracts/CFAv1Forwarder.json +1 -1
- package/build/contracts/CFAv1Library.json +1 -1
- package/build/contracts/CallUtils.json +1 -1
- package/build/contracts/ClosingOnUpdateFlowTestApp.json +1 -1
- package/build/contracts/ConstantFlowAgreementV1.json +1 -1
- package/build/contracts/Context.json +1 -1
- package/build/contracts/ContextDefinitions.json +1 -1
- package/build/contracts/CustomSuperTokenBase.json +1 -1
- package/build/contracts/ERC165.json +1 -1
- package/build/contracts/ERC1820Implementer.json +1 -1
- package/build/contracts/ERC1820RegistryCompiled.json +1 -1
- package/build/contracts/ERC20.json +1 -1
- package/build/contracts/ERC20WithTokenInfo.json +1 -1
- package/build/contracts/ERC777Helper.json +1 -1
- package/build/contracts/ERC777RecipientDrainingGas.json +1 -1
- package/build/contracts/ERC777RecipientReverting.json +1 -1
- package/build/contracts/EnumerableSet.json +1 -1
- package/build/contracts/EventsEmitter.json +1 -1
- package/build/contracts/ExclusiveInflowTestApp.json +1 -1
- package/build/contracts/FixedSizeData.json +1 -1
- package/build/contracts/FlowExchangeTestApp.json +1 -1
- package/build/contracts/FlowOperatorDefinitions.json +1 -1
- package/build/contracts/FullUpgradableSuperTokenProxy.json +1 -1
- package/build/contracts/IAccessControl.json +1 -1
- package/build/contracts/IAccessControlEnumerable.json +1 -1
- package/build/contracts/IConstantFlowAgreementHook.json +1 -1
- package/build/contracts/IConstantFlowAgreementV1.json +1 -1
- package/build/contracts/IDAv1Library.json +1 -1
- 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/IERC20Permit.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 +1 -1
- package/build/contracts/IMultiSigWallet.json +1 -1
- package/build/contracts/IPureSuperToken.json +1 -1
- package/build/contracts/IPureSuperTokenCustom.json +1 -1
- package/build/contracts/IRelayRecipient.json +1 -1
- package/build/contracts/IResolver.json +1 -1
- package/build/contracts/ISETH.json +1 -1
- package/build/contracts/ISETHCustom.json +1 -1
- package/build/contracts/ISuperAgreement.json +1 -1
- package/build/contracts/ISuperApp.json +1 -1
- package/build/contracts/ISuperToken.json +1 -1
- package/build/contracts/ISuperTokenFactory.json +1 -1
- package/build/contracts/ISuperfluid.json +1 -1
- package/build/contracts/ISuperfluidGovernance.json +1 -1
- package/build/contracts/ISuperfluidToken.json +1 -1
- package/build/contracts/ITOGAv1.json +1 -1
- package/build/contracts/ITOGAv2.json +1 -1
- package/build/contracts/ITOGAv3.json +1 -1
- package/build/contracts/Initializable.json +1 -1
- package/build/contracts/InstantDistributionAgreementV1.json +1 -1
- package/build/contracts/Math.json +1 -1
- package/build/contracts/NonClosableOutflowTestApp.json +1 -1
- package/build/contracts/Ownable.json +1 -1
- package/build/contracts/Proxy.json +1 -1
- package/build/contracts/PureSuperToken.json +1 -1
- package/build/contracts/Resolver.json +1 -1
- package/build/contracts/SETHProxy.json +1 -1
- 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 +1 -1
- package/build/contracts/SlotsBitmapLibrary.json +1 -1
- package/build/contracts/StreamRedirector.json +1 -1
- package/build/contracts/Strings.json +1 -1
- package/build/contracts/SuperAppBase.json +1 -1
- package/build/contracts/SuperAppDefinitions.json +1 -1
- package/build/contracts/SuperToken.json +1 -1
- package/build/contracts/SuperTokenDeployerLibrary.json +1 -1
- package/build/contracts/SuperTokenFactory.json +1 -1
- package/build/contracts/SuperTokenFactoryBase.json +1 -1
- package/build/contracts/SuperTokenV1Library.json +1 -1
- package/build/contracts/SuperUpgrader.json +1 -1
- package/build/contracts/Superfluid.json +1 -1
- package/build/contracts/SuperfluidCFAv1DeployerLibrary.json +1 -1
- package/build/contracts/SuperfluidFrameworkDeployer.json +1 -1
- package/build/contracts/SuperfluidGovDeployerLibrary.json +1 -1
- package/build/contracts/SuperfluidGovernanceBase.json +1 -1
- package/build/contracts/SuperfluidGovernanceConfigs.json +1 -1
- package/build/contracts/SuperfluidGovernanceII.json +1 -1
- package/build/contracts/SuperfluidGovernanceIIProxy.json +1 -1
- package/build/contracts/SuperfluidHostDeployerLibrary.json +1 -1
- package/build/contracts/SuperfluidIDAv1DeployerLibrary.json +1 -1
- package/build/contracts/SuperfluidLoader.json +1 -1
- package/build/contracts/SuperfluidPeripheryDeployerLibrary.json +1 -1
- package/build/contracts/SuperfluidToken.json +1 -1
- package/build/contracts/TOGA.json +1 -1
- package/build/contracts/TestGovernance.json +1 -1
- package/build/contracts/TestResolver.json +1 -1
- package/build/contracts/TestToken.json +1 -1
- package/build/contracts/TokenInfo.json +1 -1
- package/build/contracts/UUPSProxiable.json +1 -1
- package/build/contracts/UUPSProxy.json +1 -1
- package/build/contracts/UUPSUtils.json +1 -1
- package/build/contracts-sizes.txt +9 -9
- package/package.json +2 -2
- package/contracts/mocks/AgreementMock.sol +0 -375
- package/contracts/mocks/CFAAppMocks.sol +0 -361
- package/contracts/mocks/CFAHookMocks.sol +0 -148
- package/contracts/mocks/CFALibraryMock.sol +0 -213
- package/contracts/mocks/CallUtilsMock.sol +0 -79
- package/contracts/mocks/CallUtilsTester.sol +0 -14
- package/contracts/mocks/CustomSuperTokenMock.sol +0 -104
- package/contracts/mocks/ERC777SenderRecipientMock.sol +0 -238
- package/contracts/mocks/FakeSuperfluidMock.sol +0 -21
- package/contracts/mocks/ForwarderMock.sol +0 -39
- package/contracts/mocks/IDASuperAppTester.sol +0 -297
- package/contracts/mocks/IDAv1LibraryMock.sol +0 -400
- package/contracts/mocks/MockSmartWallet.sol +0 -15
- package/contracts/mocks/MultiFlowTesterApp.sol +0 -336
- package/contracts/mocks/StreamRedirector.sol +0 -179
- package/contracts/mocks/SuperAppMocks.sol +0 -622
- package/contracts/mocks/SuperTokenFactoryMock.sol +0 -98
- package/contracts/mocks/SuperTokenLibraryV1Mock.sol +0 -583
- package/contracts/mocks/SuperTokenMock.sol +0 -113
- package/contracts/mocks/SuperfluidDestructorMock.sol +0 -14
- package/contracts/mocks/SuperfluidGovernanceIIMock.sol +0 -22
- package/contracts/mocks/SuperfluidMock.sol +0 -177
- package/contracts/mocks/UUPSProxiableMock.sol +0 -29
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPLv3
|
|
2
|
-
pragma solidity 0.8.18;
|
|
3
|
-
pragma experimental ABIEncoderV2;
|
|
4
|
-
|
|
5
|
-
import {ISuperfluid, ISuperfluidToken, ISuperToken} from "../interfaces/superfluid/ISuperfluid.sol";
|
|
6
|
-
|
|
7
|
-
import {SuperAppBase, SuperAppDefinitions} from "../apps/SuperAppBase.sol";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
IInstantDistributionAgreementV1
|
|
11
|
-
} from "../interfaces/agreements/IInstantDistributionAgreementV1.sol";
|
|
12
|
-
|
|
13
|
-
import {IDAv1Library} from "../apps/IDAv1Library.sol";
|
|
14
|
-
|
|
15
|
-
contract IDAv1LibraryMock {
|
|
16
|
-
using IDAv1Library for IDAv1Library.InitData;
|
|
17
|
-
|
|
18
|
-
IDAv1Library.InitData internal _idaLib;
|
|
19
|
-
|
|
20
|
-
bytes32 internal constant _IDAV1_HASH = keccak256(
|
|
21
|
-
"org.superfluid-finance.agreements.InstantDistributionAgreement.v1"
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
constructor(ISuperfluid host) {
|
|
25
|
-
_idaLib = IDAv1Library.InitData(
|
|
26
|
-
host,
|
|
27
|
-
IInstantDistributionAgreementV1(
|
|
28
|
-
address(host.getAgreementClass(_IDAV1_HASH))
|
|
29
|
-
)
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**************************************************************************
|
|
34
|
-
* View Functions
|
|
35
|
-
*************************************************************************/
|
|
36
|
-
|
|
37
|
-
function getIndexTest(ISuperfluidToken token, address publisher, uint32 indexId)
|
|
38
|
-
external
|
|
39
|
-
view
|
|
40
|
-
returns (
|
|
41
|
-
bool exist,
|
|
42
|
-
uint128 indexValue,
|
|
43
|
-
uint128 totalUnitsApproved,
|
|
44
|
-
uint128 totalUnitsPending
|
|
45
|
-
)
|
|
46
|
-
{
|
|
47
|
-
return _idaLib.getIndex(token, publisher, indexId);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function calculateDistributionTest(
|
|
51
|
-
ISuperfluidToken token,
|
|
52
|
-
address publisher,
|
|
53
|
-
uint32 indexId,
|
|
54
|
-
uint256 amount
|
|
55
|
-
)
|
|
56
|
-
external
|
|
57
|
-
view
|
|
58
|
-
returns (
|
|
59
|
-
uint256 actualAmount,
|
|
60
|
-
uint128 newIndexValue
|
|
61
|
-
)
|
|
62
|
-
{
|
|
63
|
-
return _idaLib.calculateDistribution(token, publisher, indexId, amount);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function listSubscriptionsTest(ISuperfluidToken token, address subscriber)
|
|
67
|
-
external
|
|
68
|
-
view
|
|
69
|
-
returns (
|
|
70
|
-
address[] memory publishers,
|
|
71
|
-
uint32[] memory indexIds,
|
|
72
|
-
uint128[] memory unitsList
|
|
73
|
-
)
|
|
74
|
-
{
|
|
75
|
-
return _idaLib.listSubscriptions(token, subscriber);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function getSubscriptionTest(
|
|
79
|
-
ISuperfluidToken token,
|
|
80
|
-
address publisher,
|
|
81
|
-
uint32 indexId,
|
|
82
|
-
address subscriber
|
|
83
|
-
)
|
|
84
|
-
external
|
|
85
|
-
view
|
|
86
|
-
returns (
|
|
87
|
-
bool exist,
|
|
88
|
-
bool approved,
|
|
89
|
-
uint128 units,
|
|
90
|
-
uint256 pendingDistribution
|
|
91
|
-
)
|
|
92
|
-
{
|
|
93
|
-
return _idaLib.getSubscription(token, publisher, indexId, subscriber);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/// @dev agreementId == keccak256(abi.encodePacked("subscription", subscriber, indexId));
|
|
97
|
-
function getSubscriptionByIDTest(ISuperfluidToken token, bytes32 agreementId)
|
|
98
|
-
external
|
|
99
|
-
view
|
|
100
|
-
returns (
|
|
101
|
-
address publisher,
|
|
102
|
-
uint32 indexId,
|
|
103
|
-
bool approved,
|
|
104
|
-
uint128 units,
|
|
105
|
-
uint256 pendingDistribution
|
|
106
|
-
)
|
|
107
|
-
{
|
|
108
|
-
return _idaLib.getSubscriptionByID(token, agreementId);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**************************************************************************
|
|
112
|
-
* Index Operations
|
|
113
|
-
*************************************************************************/
|
|
114
|
-
|
|
115
|
-
function createIndexTest(ISuperfluidToken token, uint32 indexId) external {
|
|
116
|
-
_idaLib.createIndex(token, indexId);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function createIndexWithUserDataTest(
|
|
120
|
-
ISuperfluidToken token,
|
|
121
|
-
uint32 indexId,
|
|
122
|
-
bytes memory userData
|
|
123
|
-
) external {
|
|
124
|
-
_idaLib.createIndex(token, indexId, userData);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function updateIndexValueTest(
|
|
128
|
-
ISuperfluidToken token,
|
|
129
|
-
uint32 indexId,
|
|
130
|
-
uint128 indexValue
|
|
131
|
-
) external {
|
|
132
|
-
_idaLib.updateIndexValue(token, indexId, indexValue);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function updateIndexValueWithUserDataTest(
|
|
136
|
-
ISuperfluidToken token,
|
|
137
|
-
uint32 indexId,
|
|
138
|
-
uint128 indexValue,
|
|
139
|
-
bytes memory userData
|
|
140
|
-
) external {
|
|
141
|
-
_idaLib.updateIndexValue(token, indexId, indexValue, userData);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function distributeTest(ISuperfluidToken token, uint32 indexId, uint256 amount) external {
|
|
145
|
-
_idaLib.distribute(token, indexId, amount);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function distributeWithUserDataTest(
|
|
149
|
-
ISuperfluidToken token,
|
|
150
|
-
uint32 indexId,
|
|
151
|
-
uint256 amount,
|
|
152
|
-
bytes memory userData
|
|
153
|
-
) external {
|
|
154
|
-
_idaLib.distribute(token, indexId, amount, userData);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**************************************************************************
|
|
158
|
-
* Subscription Operations
|
|
159
|
-
*************************************************************************/
|
|
160
|
-
|
|
161
|
-
function approveSubscriptionTest(
|
|
162
|
-
ISuperfluidToken token,
|
|
163
|
-
address publisher,
|
|
164
|
-
uint32 indexId
|
|
165
|
-
) external {
|
|
166
|
-
_idaLib.approveSubscription(token, publisher, indexId);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function approveSubscriptionWithUserDataTest(
|
|
170
|
-
ISuperfluidToken token,
|
|
171
|
-
address publisher,
|
|
172
|
-
uint32 indexId,
|
|
173
|
-
bytes memory userData
|
|
174
|
-
) external {
|
|
175
|
-
_idaLib.approveSubscription(token, publisher, indexId, userData);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function revokeSubscriptionTest(
|
|
179
|
-
ISuperfluidToken token,
|
|
180
|
-
address publisher,
|
|
181
|
-
uint32 indexId
|
|
182
|
-
) external {
|
|
183
|
-
_idaLib.revokeSubscription(token, publisher, indexId);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function revokeSubscriptionWithUserDataTest(
|
|
187
|
-
ISuperfluidToken token,
|
|
188
|
-
address publisher,
|
|
189
|
-
uint32 indexId,
|
|
190
|
-
bytes memory userData
|
|
191
|
-
) external {
|
|
192
|
-
_idaLib.revokeSubscription(token, publisher, indexId, userData);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function updateSubscriptionUnitsTest(
|
|
196
|
-
ISuperfluidToken token,
|
|
197
|
-
uint32 indexId,
|
|
198
|
-
address subscriber,
|
|
199
|
-
uint128 units
|
|
200
|
-
) external {
|
|
201
|
-
_idaLib.updateSubscriptionUnits(token, indexId, subscriber, units);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function updateSubscriptionUnitsWithUserDataTest(
|
|
205
|
-
ISuperfluidToken token,
|
|
206
|
-
uint32 indexId,
|
|
207
|
-
address subscriber,
|
|
208
|
-
uint128 units,
|
|
209
|
-
bytes memory userData
|
|
210
|
-
) external {
|
|
211
|
-
_idaLib.updateSubscriptionUnits(token, indexId, subscriber, units, userData);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function deleteSubscriptionTest(
|
|
215
|
-
ISuperfluidToken token,
|
|
216
|
-
address publisher,
|
|
217
|
-
uint32 indexId,
|
|
218
|
-
address subscriber
|
|
219
|
-
) external {
|
|
220
|
-
_idaLib.deleteSubscription(token, publisher, indexId, subscriber);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function deleteSubscriptionWithUserDataTest(
|
|
224
|
-
ISuperfluidToken token,
|
|
225
|
-
address publisher,
|
|
226
|
-
uint32 indexId,
|
|
227
|
-
address subscriber,
|
|
228
|
-
bytes memory userData
|
|
229
|
-
) external {
|
|
230
|
-
_idaLib.deleteSubscription(token, publisher, indexId, subscriber, userData);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function claimTest(
|
|
234
|
-
ISuperfluidToken token,
|
|
235
|
-
address publisher,
|
|
236
|
-
uint32 indexId,
|
|
237
|
-
address subscriber
|
|
238
|
-
) external {
|
|
239
|
-
_idaLib.claim(token, publisher, indexId, subscriber);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function claimWithUserDataTest(
|
|
243
|
-
ISuperfluidToken token,
|
|
244
|
-
address publisher,
|
|
245
|
-
uint32 indexId,
|
|
246
|
-
address subscriber,
|
|
247
|
-
bytes memory userData
|
|
248
|
-
) external {
|
|
249
|
-
_idaLib.claim(token, publisher, indexId, subscriber, userData);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// IDA LIBRARY SUPER APP CALLBACK MOCK
|
|
254
|
-
contract IDAv1LibrarySuperAppMock is IDAv1LibraryMock, SuperAppBase {
|
|
255
|
-
using IDAv1Library for IDAv1Library.InitData;
|
|
256
|
-
|
|
257
|
-
bytes internal constant _MOCK_USER_DATA = abi.encode("oh hello");
|
|
258
|
-
|
|
259
|
-
constructor(ISuperfluid host) IDAv1LibraryMock(host) {
|
|
260
|
-
uint256 configWord = SuperAppDefinitions.APP_LEVEL_FINAL |
|
|
261
|
-
SuperAppDefinitions.BEFORE_AGREEMENT_CREATED_NOOP |
|
|
262
|
-
// SuperAppDefinitions.AFTER_AGREEMENT_CREATED_NOOP |
|
|
263
|
-
SuperAppDefinitions.BEFORE_AGREEMENT_UPDATED_NOOP |
|
|
264
|
-
// SuperAppDefinitions.AFTER_AGREEMENT_UPDATED_NOOP |
|
|
265
|
-
SuperAppDefinitions.BEFORE_AGREEMENT_TERMINATED_NOOP |
|
|
266
|
-
SuperAppDefinitions.AFTER_AGREEMENT_TERMINATED_NOOP;
|
|
267
|
-
|
|
268
|
-
host.registerAppWithKey(configWord, "");
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function afterAgreementCreated(
|
|
272
|
-
ISuperToken token,
|
|
273
|
-
address,
|
|
274
|
-
bytes32,
|
|
275
|
-
bytes calldata,
|
|
276
|
-
bytes calldata,
|
|
277
|
-
bytes calldata ctx
|
|
278
|
-
) external override returns (bytes memory newCtx) {
|
|
279
|
-
return _callbackTest(token, ctx);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function afterAgreementUpdated(
|
|
283
|
-
ISuperToken token,
|
|
284
|
-
address,
|
|
285
|
-
bytes32,
|
|
286
|
-
bytes calldata,
|
|
287
|
-
bytes calldata,
|
|
288
|
-
bytes calldata ctx
|
|
289
|
-
) external override returns (bytes memory newCtx) {
|
|
290
|
-
return _callbackTest(token, ctx);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
enum FunctionIndex {
|
|
294
|
-
CREATE_INDEX,
|
|
295
|
-
CREATE_INDEX_USER_DATA,
|
|
296
|
-
UPDATE_INDEX,
|
|
297
|
-
UPDATE_INDEX_USER_DATA,
|
|
298
|
-
DISTRIBUTE,
|
|
299
|
-
DISTRIBUTE_USER_DATA,
|
|
300
|
-
APROVE_SUBSCRIPTION,
|
|
301
|
-
APROVE_SUBSCRIPTION_USER_DATA,
|
|
302
|
-
REVOKE_SUBSCRIPTION,
|
|
303
|
-
REVOKE_SUBSCRIPTION_USER_DATA,
|
|
304
|
-
UPDATE_SUBSCRIPTION,
|
|
305
|
-
UPDATE_SUBSCRIPTION_USER_DATA,
|
|
306
|
-
DELETE_SUBSCRIPTION,
|
|
307
|
-
DELETE_SUBSCRIPTION_USER_DATA,
|
|
308
|
-
CLAIM,
|
|
309
|
-
CLAIM_USER_DATA
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/// @dev extracts some user data to test out all callback library functions
|
|
313
|
-
/// @param token super token
|
|
314
|
-
/// @param ctx Context string
|
|
315
|
-
/// @return New Context
|
|
316
|
-
function _callbackTest(
|
|
317
|
-
ISuperToken token,
|
|
318
|
-
bytes memory ctx
|
|
319
|
-
) internal returns (bytes memory) {
|
|
320
|
-
|
|
321
|
-
// extract userData, then decode everything else
|
|
322
|
-
bytes memory userData = _idaLib.host.decodeCtx(ctx).userData;
|
|
323
|
-
(
|
|
324
|
-
uint8 functionIndex,
|
|
325
|
-
uint32 indexId,
|
|
326
|
-
address publisher,
|
|
327
|
-
address subscriber,
|
|
328
|
-
uint128 units
|
|
329
|
-
) = abi.decode(userData, (uint8, uint32, address, address, uint128));
|
|
330
|
-
|
|
331
|
-
if (functionIndex == uint8(FunctionIndex.CREATE_INDEX)) {
|
|
332
|
-
return _idaLib.createIndexWithCtx(ctx, token, indexId);
|
|
333
|
-
} else if (functionIndex == uint8(FunctionIndex.CREATE_INDEX_USER_DATA)) {
|
|
334
|
-
return _idaLib.createIndexWithCtx(ctx, token, indexId, _MOCK_USER_DATA);
|
|
335
|
-
} else if (functionIndex == uint8(FunctionIndex.UPDATE_INDEX)) {
|
|
336
|
-
return _idaLib.updateIndexValueWithCtx(ctx, token, indexId, units);
|
|
337
|
-
} else if (functionIndex == uint8(FunctionIndex.UPDATE_INDEX_USER_DATA)) {
|
|
338
|
-
return _idaLib.updateIndexValueWithCtx(ctx, token, indexId, units, _MOCK_USER_DATA);
|
|
339
|
-
} else if (functionIndex == uint8(FunctionIndex.DISTRIBUTE)) {
|
|
340
|
-
return _idaLib.distributeWithCtx(ctx, token, indexId, units);
|
|
341
|
-
} else if (functionIndex == uint8(FunctionIndex.DISTRIBUTE_USER_DATA)) {
|
|
342
|
-
return _idaLib.distributeWithCtx(ctx, token, indexId, units, _MOCK_USER_DATA);
|
|
343
|
-
} else if (functionIndex == uint8(FunctionIndex.APROVE_SUBSCRIPTION)) {
|
|
344
|
-
return _idaLib.approveSubscriptionWithCtx(ctx, token, publisher, indexId);
|
|
345
|
-
} else if (functionIndex == uint8(FunctionIndex.APROVE_SUBSCRIPTION_USER_DATA)) {
|
|
346
|
-
return _idaLib.approveSubscriptionWithCtx(
|
|
347
|
-
ctx,
|
|
348
|
-
token,
|
|
349
|
-
publisher,
|
|
350
|
-
indexId,
|
|
351
|
-
_MOCK_USER_DATA
|
|
352
|
-
);
|
|
353
|
-
} else if (functionIndex == uint8(FunctionIndex.REVOKE_SUBSCRIPTION)) {
|
|
354
|
-
return _idaLib.revokeSubscriptionWithCtx(ctx, token, publisher, indexId);
|
|
355
|
-
} else if (functionIndex == uint8(FunctionIndex.REVOKE_SUBSCRIPTION_USER_DATA)) {
|
|
356
|
-
return _idaLib.revokeSubscriptionWithCtx(
|
|
357
|
-
ctx,
|
|
358
|
-
token,
|
|
359
|
-
publisher,
|
|
360
|
-
indexId,
|
|
361
|
-
_MOCK_USER_DATA
|
|
362
|
-
);
|
|
363
|
-
} else if (functionIndex == uint8(FunctionIndex.UPDATE_SUBSCRIPTION)) {
|
|
364
|
-
return _idaLib.updateSubscriptionUnitsWithCtx(ctx, token, indexId, subscriber, units);
|
|
365
|
-
} else if (functionIndex == uint8(FunctionIndex.UPDATE_SUBSCRIPTION_USER_DATA)) {
|
|
366
|
-
return _idaLib.updateSubscriptionUnitsWithCtx(
|
|
367
|
-
ctx,
|
|
368
|
-
token,
|
|
369
|
-
indexId,
|
|
370
|
-
subscriber,
|
|
371
|
-
units,
|
|
372
|
-
_MOCK_USER_DATA
|
|
373
|
-
);
|
|
374
|
-
} else if (functionIndex == uint8(FunctionIndex.DELETE_SUBSCRIPTION)) {
|
|
375
|
-
return _idaLib.deleteSubscriptionWithCtx(ctx, token, publisher, indexId, subscriber);
|
|
376
|
-
} else if (functionIndex == uint8(FunctionIndex.DELETE_SUBSCRIPTION_USER_DATA)) {
|
|
377
|
-
return _idaLib.deleteSubscriptionWithCtx(
|
|
378
|
-
ctx,
|
|
379
|
-
token,
|
|
380
|
-
publisher,
|
|
381
|
-
indexId,
|
|
382
|
-
subscriber,
|
|
383
|
-
_MOCK_USER_DATA
|
|
384
|
-
);
|
|
385
|
-
} else if (functionIndex == uint8(FunctionIndex.CLAIM)) {
|
|
386
|
-
return _idaLib.claimWithCtx(ctx, token, publisher, indexId, subscriber);
|
|
387
|
-
} else if (functionIndex == uint8(FunctionIndex.CLAIM_USER_DATA)) {
|
|
388
|
-
return _idaLib.claimWithCtx(
|
|
389
|
-
ctx,
|
|
390
|
-
token,
|
|
391
|
-
publisher,
|
|
392
|
-
indexId,
|
|
393
|
-
subscriber,
|
|
394
|
-
_MOCK_USER_DATA
|
|
395
|
-
);
|
|
396
|
-
} else {
|
|
397
|
-
revert("invalid function index");
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPLv3
|
|
2
|
-
pragma solidity 0.8.18;
|
|
3
|
-
|
|
4
|
-
import { ISuperToken, IERC20 } from "../superfluid/Superfluid.sol";
|
|
5
|
-
|
|
6
|
-
contract MockSmartWallet {
|
|
7
|
-
|
|
8
|
-
function approveTest(IERC20 token, address spender, uint256 amount) external {
|
|
9
|
-
token.approve(spender, amount);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function upgradeToTest(ISuperToken superToken, address to, uint256 amount, bytes calldata data) external {
|
|
13
|
-
superToken.upgradeTo(to, amount, data);
|
|
14
|
-
}
|
|
15
|
-
}
|