@superfluid-finance/ethereum-contracts 1.2.2-dev.6a8632e.0 → 1.2.2-dev.a4c583c.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 +18 -18
- package/build/contracts/AgreementLibrary.json +450 -243
- package/build/contracts/BaseRelayRecipient.json +112 -112
- package/build/contracts/BatchLiquidator.json +178 -178
- package/build/contracts/BatchOperation.json +1138 -1138
- package/build/contracts/CFAv1Library.json +2531 -2531
- package/build/contracts/CallUtils.json +478 -478
- package/build/contracts/ClosingOnUpdateFlowTestApp.json +1521 -1521
- package/build/contracts/ConstantFlowAgreementV1.json +19318 -18338
- package/build/contracts/Context.json +1 -1
- package/build/contracts/ContextDefinitions.json +1138 -1138
- package/build/contracts/Create2.json +1 -1
- package/build/contracts/CustomSuperTokenBase.json +31 -31
- package/build/contracts/ERC165.json +1 -1
- package/build/contracts/ERC1820Implementer.json +1 -1
- package/build/contracts/ERC20.json +1 -1
- package/build/contracts/ERC20Burnable.json +1 -1
- package/build/contracts/ERC20Pausable.json +1 -1
- package/build/contracts/ERC20PresetMinterPauser.json +1 -1
- package/build/contracts/ERC20WithTokenInfo.json +36 -36
- package/build/contracts/ERC721.json +1 -1
- package/build/contracts/ERC777Helper.json +660 -660
- package/build/contracts/ERC777RecipientDrainingGas.json +855 -855
- package/build/contracts/ERC777RecipientReverting.json +855 -855
- package/build/contracts/EnumerableSet.json +1 -1
- package/build/contracts/ExclusiveInflowTestApp.json +1521 -1521
- package/build/contracts/FixedSizeData.json +405 -405
- package/build/contracts/FlowExchangeTestApp.json +1522 -1522
- package/build/contracts/FlowOperatorDefinitions.json +1138 -1138
- package/build/contracts/FullUpgradableSuperTokenProxy.json +113 -113
- package/build/contracts/IAccessControl.json +1 -1
- package/build/contracts/IAccessControlEnumerable.json +1 -1
- package/build/contracts/IConstantFlowAgreementV1.json +1036 -1036
- package/build/contracts/IDAv1Library.json +4183 -4183
- 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/IERC721.json +1 -1
- package/build/contracts/IERC721Metadata.json +1 -1
- package/build/contracts/IERC721Receiver.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 +1182 -1182
- package/build/contracts/IMaticBridgedNativeSuperToken.json +110 -110
- package/build/contracts/IMaticBridgedNativeSuperTokenCustom.json +110 -110
- package/build/contracts/IMultiSigWallet.json +45 -45
- package/build/contracts/IPureSuperToken.json +69 -69
- package/build/contracts/IPureSuperTokenCustom.json +69 -69
- package/build/contracts/IRelayRecipient.json +49 -49
- package/build/contracts/IResolver.json +73 -73
- package/build/contracts/ISETH.json +79 -79
- package/build/contracts/ISETHCustom.json +79 -79
- package/build/contracts/ISuperAgreement.json +88 -88
- package/build/contracts/ISuperApp.json +351 -351
- package/build/contracts/ISuperToken.json +1008 -1008
- package/build/contracts/ISuperTokenFactory.json +280 -280
- package/build/contracts/ISuperfluid.json +1466 -1466
- package/build/contracts/ISuperfluidGovernance.json +404 -404
- package/build/contracts/ISuperfluidToken.json +774 -774
- package/build/contracts/ITOGAv1.json +1431 -1431
- package/build/contracts/ITOGAv2.json +1431 -1431
- package/build/contracts/Initializable.json +1 -1
- package/build/contracts/InstantDistributionAgreementV1.json +9343 -9343
- package/build/contracts/Int96SafeMath.json +504 -504
- package/build/contracts/MaticBridgedNativeSuperTokenProxy.json +228 -228
- package/build/contracts/NonClosableOutflowTestApp.json +1522 -1522
- 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 +106 -106
- package/build/contracts/Resolver.json +98 -98
- package/build/contracts/SETHProxy.json +224 -224
- 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 +1521 -1521
- package/build/contracts/SlotsBitmapLibrary.json +794 -794
- package/build/contracts/Strings.json +1 -1
- package/build/contracts/SuperAppBase.json +394 -394
- package/build/contracts/SuperAppDefinitions.json +1138 -1138
- package/build/contracts/SuperToken.json +2351 -2351
- package/build/contracts/SuperTokenFactory.json +731 -731
- package/build/contracts/SuperTokenFactoryBase.json +721 -721
- package/build/contracts/SuperTokenFactoryHelper.json +724 -724
- package/build/contracts/SuperUpgrader.json +437 -437
- package/build/contracts/Superfluid.json +4936 -4936
- package/build/contracts/SuperfluidFrameworkDeployer.json +535 -535
- package/build/contracts/SuperfluidGovernanceBase.json +3535 -3535
- package/build/contracts/SuperfluidGovernanceConfigs.json +1138 -1138
- package/build/contracts/SuperfluidGovernanceII.json +230 -230
- package/build/contracts/SuperfluidGovernanceIIProxy.json +211 -211
- package/build/contracts/SuperfluidLoader.json +207 -207
- package/build/contracts/SuperfluidToken.json +1345 -1345
- package/build/contracts/TOGA.json +1448 -1448
- package/build/contracts/TestGovernance.json +247 -247
- package/build/contracts/TestToken.json +94 -94
- package/build/contracts/TokenCustodian.json +214 -214
- package/build/contracts/TokenInfo.json +58 -58
- package/build/contracts/UInt128SafeMath.json +97 -97
- package/build/contracts/UUPSProxiable.json +132 -132
- package/build/contracts/UUPSProxy.json +81 -81
- package/build/contracts/UUPSUtils.json +37 -37
- package/build/contracts-sizes.txt +1 -2
- package/contracts/agreements/AgreementLibrary.sol +1 -0
- package/contracts/agreements/ConstantFlowAgreementV1.sol +71 -35
- package/contracts/agreements/InstantDistributionAgreementV1.sol +3 -2
- package/contracts/{agreements → libs}/SlotsBitmapLibrary.sol +1 -3
- package/package.json +2 -1
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"absolutePath": "project:/contracts/upgradability/UUPSUtils.sol",
|
|
16
16
|
"exportedSymbols": {
|
|
17
17
|
"UUPSUtils": [
|
|
18
|
-
|
|
18
|
+
36434
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
|
-
"id":
|
|
21
|
+
"id": 36435,
|
|
22
22
|
"license": "AGPLv3",
|
|
23
23
|
"nodeType": "SourceUnit",
|
|
24
24
|
"nodes": [
|
|
25
25
|
{
|
|
26
|
-
"id":
|
|
26
|
+
"id": 36412,
|
|
27
27
|
"literals": [
|
|
28
28
|
"solidity",
|
|
29
29
|
"0.8",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"contractDependencies": [],
|
|
40
40
|
"contractKind": "library",
|
|
41
41
|
"documentation": {
|
|
42
|
-
"id":
|
|
42
|
+
"id": 36413,
|
|
43
43
|
"nodeType": "StructuredDocumentation",
|
|
44
44
|
"src": "60:76:100",
|
|
45
45
|
"text": " @title UUPS (Universal Upgradeable Proxy Standard) Shared Library"
|
|
46
46
|
},
|
|
47
47
|
"fullyImplemented": true,
|
|
48
|
-
"id":
|
|
48
|
+
"id": 36434,
|
|
49
49
|
"linearizedBaseContracts": [
|
|
50
|
-
|
|
50
|
+
36434
|
|
51
51
|
],
|
|
52
52
|
"name": "UUPSUtils",
|
|
53
53
|
"nameLocation": "145:9:100",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
{
|
|
57
57
|
"constant": true,
|
|
58
58
|
"documentation": {
|
|
59
|
-
"id":
|
|
59
|
+
"id": 36414,
|
|
60
60
|
"nodeType": "StructuredDocumentation",
|
|
61
61
|
"src": "162:288:100",
|
|
62
62
|
"text": " @dev Implementation slot constant.\n Using https://eips.ethereum.org/EIPS/eip-1967 standard\n Storage slot 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\n (obtained as bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1))."
|
|
63
63
|
},
|
|
64
|
-
"id":
|
|
64
|
+
"id": 36417,
|
|
65
65
|
"mutability": "constant",
|
|
66
66
|
"name": "_IMPLEMENTATION_SLOT",
|
|
67
67
|
"nameLocation": "481:20:100",
|
|
68
68
|
"nodeType": "VariableDeclaration",
|
|
69
|
-
"scope":
|
|
69
|
+
"scope": 36434,
|
|
70
70
|
"src": "455:115:100",
|
|
71
71
|
"stateVariable": true,
|
|
72
72
|
"storageLocation": "default",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typeString": "bytes32"
|
|
76
76
|
},
|
|
77
77
|
"typeName": {
|
|
78
|
-
"id":
|
|
78
|
+
"id": 36415,
|
|
79
79
|
"name": "bytes32",
|
|
80
80
|
"nodeType": "ElementaryTypeName",
|
|
81
81
|
"src": "455:7:100",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"value": {
|
|
88
88
|
"hexValue": "307833363038393461313362613161333231303636376338323834393264623938646361336532303736636333373335613932306133636135303564333832626263",
|
|
89
|
-
"id":
|
|
89
|
+
"id": 36416,
|
|
90
90
|
"isConstant": false,
|
|
91
91
|
"isLValue": false,
|
|
92
92
|
"isPure": true,
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"body": {
|
|
107
|
-
"id":
|
|
107
|
+
"id": 36424,
|
|
108
108
|
"nodeType": "Block",
|
|
109
109
|
"src": "681:107:100",
|
|
110
110
|
"statements": [
|
|
@@ -145,33 +145,33 @@
|
|
|
145
145
|
"evmVersion": "london",
|
|
146
146
|
"externalReferences": [
|
|
147
147
|
{
|
|
148
|
-
"declaration":
|
|
148
|
+
"declaration": 36417,
|
|
149
149
|
"isOffset": false,
|
|
150
150
|
"isSlot": false,
|
|
151
151
|
"src": "751:20:100",
|
|
152
152
|
"valueSize": 1
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
|
-
"declaration":
|
|
155
|
+
"declaration": 36421,
|
|
156
156
|
"isOffset": false,
|
|
157
157
|
"isSlot": false,
|
|
158
158
|
"src": "737:4:100",
|
|
159
159
|
"valueSize": 1
|
|
160
160
|
}
|
|
161
161
|
],
|
|
162
|
-
"id":
|
|
162
|
+
"id": 36423,
|
|
163
163
|
"nodeType": "InlineAssembly",
|
|
164
164
|
"src": "691:91:100"
|
|
165
165
|
}
|
|
166
166
|
]
|
|
167
167
|
},
|
|
168
168
|
"documentation": {
|
|
169
|
-
"id":
|
|
169
|
+
"id": 36418,
|
|
170
170
|
"nodeType": "StructuredDocumentation",
|
|
171
171
|
"src": "577:36:100",
|
|
172
172
|
"text": "@dev Get implementation address."
|
|
173
173
|
},
|
|
174
|
-
"id":
|
|
174
|
+
"id": 36425,
|
|
175
175
|
"implemented": true,
|
|
176
176
|
"kind": "function",
|
|
177
177
|
"modifiers": [],
|
|
@@ -179,23 +179,23 @@
|
|
|
179
179
|
"nameLocation": "627:14:100",
|
|
180
180
|
"nodeType": "FunctionDefinition",
|
|
181
181
|
"parameters": {
|
|
182
|
-
"id":
|
|
182
|
+
"id": 36419,
|
|
183
183
|
"nodeType": "ParameterList",
|
|
184
184
|
"parameters": [],
|
|
185
185
|
"src": "641:2:100"
|
|
186
186
|
},
|
|
187
187
|
"returnParameters": {
|
|
188
|
-
"id":
|
|
188
|
+
"id": 36422,
|
|
189
189
|
"nodeType": "ParameterList",
|
|
190
190
|
"parameters": [
|
|
191
191
|
{
|
|
192
192
|
"constant": false,
|
|
193
|
-
"id":
|
|
193
|
+
"id": 36421,
|
|
194
194
|
"mutability": "mutable",
|
|
195
195
|
"name": "impl",
|
|
196
196
|
"nameLocation": "675:4:100",
|
|
197
197
|
"nodeType": "VariableDeclaration",
|
|
198
|
-
"scope":
|
|
198
|
+
"scope": 36425,
|
|
199
199
|
"src": "667:12:100",
|
|
200
200
|
"stateVariable": false,
|
|
201
201
|
"storageLocation": "default",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"typeString": "address"
|
|
205
205
|
},
|
|
206
206
|
"typeName": {
|
|
207
|
-
"id":
|
|
207
|
+
"id": 36420,
|
|
208
208
|
"name": "address",
|
|
209
209
|
"nodeType": "ElementaryTypeName",
|
|
210
210
|
"src": "667:7:100",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
],
|
|
220
220
|
"src": "666:14:100"
|
|
221
221
|
},
|
|
222
|
-
"scope":
|
|
222
|
+
"scope": 36434,
|
|
223
223
|
"src": "618:170:100",
|
|
224
224
|
"stateMutability": "view",
|
|
225
225
|
"virtual": false,
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
"body": {
|
|
230
|
-
"id":
|
|
230
|
+
"id": 36432,
|
|
231
231
|
"nodeType": "Block",
|
|
232
232
|
"src": "896:171:100",
|
|
233
233
|
"statements": [
|
|
@@ -266,33 +266,33 @@
|
|
|
266
266
|
"evmVersion": "london",
|
|
267
267
|
"externalReferences": [
|
|
268
268
|
{
|
|
269
|
-
"declaration":
|
|
269
|
+
"declaration": 36417,
|
|
270
270
|
"isOffset": false,
|
|
271
271
|
"isSlot": false,
|
|
272
272
|
"src": "988:20:100",
|
|
273
273
|
"valueSize": 1
|
|
274
274
|
},
|
|
275
275
|
{
|
|
276
|
-
"declaration":
|
|
276
|
+
"declaration": 36428,
|
|
277
277
|
"isOffset": false,
|
|
278
278
|
"isSlot": false,
|
|
279
279
|
"src": "1026:11:100",
|
|
280
280
|
"valueSize": 1
|
|
281
281
|
}
|
|
282
282
|
],
|
|
283
|
-
"id":
|
|
283
|
+
"id": 36431,
|
|
284
284
|
"nodeType": "InlineAssembly",
|
|
285
285
|
"src": "906:155:100"
|
|
286
286
|
}
|
|
287
287
|
]
|
|
288
288
|
},
|
|
289
289
|
"documentation": {
|
|
290
|
-
"id":
|
|
290
|
+
"id": 36426,
|
|
291
291
|
"nodeType": "StructuredDocumentation",
|
|
292
292
|
"src": "794:40:100",
|
|
293
293
|
"text": "@dev Set new implementation address."
|
|
294
294
|
},
|
|
295
|
-
"id":
|
|
295
|
+
"id": 36433,
|
|
296
296
|
"implemented": true,
|
|
297
297
|
"kind": "function",
|
|
298
298
|
"modifiers": [],
|
|
@@ -300,17 +300,17 @@
|
|
|
300
300
|
"nameLocation": "848:17:100",
|
|
301
301
|
"nodeType": "FunctionDefinition",
|
|
302
302
|
"parameters": {
|
|
303
|
-
"id":
|
|
303
|
+
"id": 36429,
|
|
304
304
|
"nodeType": "ParameterList",
|
|
305
305
|
"parameters": [
|
|
306
306
|
{
|
|
307
307
|
"constant": false,
|
|
308
|
-
"id":
|
|
308
|
+
"id": 36428,
|
|
309
309
|
"mutability": "mutable",
|
|
310
310
|
"name": "codeAddress",
|
|
311
311
|
"nameLocation": "874:11:100",
|
|
312
312
|
"nodeType": "VariableDeclaration",
|
|
313
|
-
"scope":
|
|
313
|
+
"scope": 36433,
|
|
314
314
|
"src": "866:19:100",
|
|
315
315
|
"stateVariable": false,
|
|
316
316
|
"storageLocation": "default",
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
"typeString": "address"
|
|
320
320
|
},
|
|
321
321
|
"typeName": {
|
|
322
|
-
"id":
|
|
322
|
+
"id": 36427,
|
|
323
323
|
"name": "address",
|
|
324
324
|
"nodeType": "ElementaryTypeName",
|
|
325
325
|
"src": "866:7:100",
|
|
@@ -335,19 +335,19 @@
|
|
|
335
335
|
"src": "865:21:100"
|
|
336
336
|
},
|
|
337
337
|
"returnParameters": {
|
|
338
|
-
"id":
|
|
338
|
+
"id": 36430,
|
|
339
339
|
"nodeType": "ParameterList",
|
|
340
340
|
"parameters": [],
|
|
341
341
|
"src": "896:0:100"
|
|
342
342
|
},
|
|
343
|
-
"scope":
|
|
343
|
+
"scope": 36434,
|
|
344
344
|
"src": "839:228:100",
|
|
345
345
|
"stateMutability": "nonpayable",
|
|
346
346
|
"virtual": false,
|
|
347
347
|
"visibility": "internal"
|
|
348
348
|
}
|
|
349
349
|
],
|
|
350
|
-
"scope":
|
|
350
|
+
"scope": 36435,
|
|
351
351
|
"src": "137:933:100",
|
|
352
352
|
"usedErrors": []
|
|
353
353
|
}
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
},
|
|
361
361
|
"networks": {},
|
|
362
362
|
"schemaVersion": "3.4.7",
|
|
363
|
-
"updatedAt": "2022-05-
|
|
363
|
+
"updatedAt": "2022-05-05T13:57:31.654Z",
|
|
364
364
|
"devdoc": {
|
|
365
365
|
"kind": "dev",
|
|
366
366
|
"methods": {},
|
|
@@ -4,9 +4,8 @@ SuperfluidToken.sol : 2 (24574)
|
|
|
4
4
|
SuperTokenFactory.sol : 4997 (19579)
|
|
5
5
|
SuperToken.sol : 18673 (5903)
|
|
6
6
|
InstantDistributionAgreementV1.sol : 21970 (2606)
|
|
7
|
-
SlotsBitmapLibrary.sol : 2724 (21852)
|
|
8
7
|
AgreementLibrary.sol : 143 (24433)
|
|
9
8
|
AgreementBase.sol : 2 (24574)
|
|
10
|
-
ConstantFlowAgreementV1.sol :
|
|
9
|
+
ConstantFlowAgreementV1.sol : 21777 (2799)
|
|
11
10
|
SuperfluidGovernanceBase.sol : 2 (24574)
|
|
12
11
|
SuperfluidGovernanceII.sol : 6919 (17657)
|
|
@@ -203,6 +203,7 @@ library AgreementLibrary {
|
|
|
203
203
|
*************************************************************************/
|
|
204
204
|
|
|
205
205
|
function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; }
|
|
206
|
+
function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; }
|
|
206
207
|
|
|
207
208
|
function min(int256 a, int256 b) internal pure returns (int256) { return a > b ? b : a; }
|
|
208
209
|
}
|
|
@@ -44,6 +44,21 @@ contract ConstantFlowAgreementV1 is
|
|
|
44
44
|
* E_NO_NEGATIVE_ALLOWANCE - sender cannot set a negative allowance
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @dev Default minimum deposit value
|
|
49
|
+
*
|
|
50
|
+
* NOTE:
|
|
51
|
+
* - It may come as a surprise that it is not 0, this is the minimum friction we have in the system for the
|
|
52
|
+
* imperfect blockchain system we live in.
|
|
53
|
+
* - It is related to deposit clipping, and it is always rounded-up when clipping.
|
|
54
|
+
*/
|
|
55
|
+
uint256 public constant DEFAULT_MINIMUM_DEPOSIT = uint256(uint96(1 << 32));
|
|
56
|
+
/// @dev Maximum deposit value
|
|
57
|
+
uint256 public constant MAXIMUM_DEPOSIT = uint256(uint96(type(int96).max));
|
|
58
|
+
|
|
59
|
+
/// @dev Maximum flow rate
|
|
60
|
+
uint256 public constant MAXIMUM_FLOW_RATE = uint256(uint96(type(int96).max));
|
|
61
|
+
|
|
47
62
|
bytes32 private constant CFAV1_PPP_CONFIG_KEY =
|
|
48
63
|
keccak256("org.superfluid-finance.agreements.ConstantFlowAgreement.v1.PPPConfiguration");
|
|
49
64
|
|
|
@@ -105,40 +120,61 @@ contract ConstantFlowAgreementV1 is
|
|
|
105
120
|
* IConstantFlowAgreementV1 interface
|
|
106
121
|
*************************************************************************/
|
|
107
122
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
function _getMaximumFlowRateFromDepositPure(
|
|
124
|
+
uint256 liquidationPeriod,
|
|
125
|
+
uint256 deposit)
|
|
126
|
+
internal pure
|
|
127
|
+
returns (int96 flowRate)
|
|
128
|
+
{
|
|
129
|
+
require(deposit <= MAXIMUM_DEPOSIT, "CFA: deposit number too big");
|
|
130
|
+
deposit = _clipDepositNumberRoundingDown(deposit);
|
|
131
|
+
|
|
132
|
+
uint256 flowrate1 = deposit / liquidationPeriod;
|
|
133
|
+
|
|
134
|
+
// NOTE downcasting is safe as we constrain deposit to less than
|
|
135
|
+
// 2 ** 95 (MAXIMUM_DEPOSIT) so the resulting value flowRate1 will fit into int96
|
|
136
|
+
return int96(int256(flowrate1));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function _getDepositRequiredForFlowRatePure(
|
|
140
|
+
uint256 minimumDeposit,
|
|
141
|
+
uint256 liquidationPeriod,
|
|
142
|
+
int96 flowRate)
|
|
143
|
+
internal pure
|
|
144
|
+
returns (uint256 deposit)
|
|
145
|
+
{
|
|
146
|
+
require(flowRate > 0, "CFA: not for non-positive flow rate");
|
|
147
|
+
require(uint256(int256(flowRate)) * liquidationPeriod <= uint256(int256(type(int96).max)),
|
|
148
|
+
"CFA: flow rate too big");
|
|
149
|
+
uint256 calculatedDeposit = _calculateDeposit(flowRate, liquidationPeriod);
|
|
150
|
+
return AgreementLibrary.max(minimumDeposit, calculatedDeposit);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/// @dev IConstantFlowAgreementV1.getMaximumFlowRateFromDeposit implementation
|
|
154
|
+
function getMaximumFlowRateFromDeposit(
|
|
155
|
+
ISuperfluidToken token,
|
|
156
|
+
uint256 deposit)
|
|
157
|
+
external view override
|
|
158
|
+
returns (int96 flowRate)
|
|
159
|
+
{
|
|
160
|
+
(uint256 liquidationPeriod, ) = _decode3PsData(token);
|
|
161
|
+
flowRate = _getMaximumFlowRateFromDepositPure(liquidationPeriod, deposit);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// @dev IConstantFlowAgreementV1.getDepositRequiredForFlowRate implementation
|
|
165
|
+
function getDepositRequiredForFlowRate(
|
|
166
|
+
ISuperfluidToken token,
|
|
167
|
+
int96 flowRate)
|
|
168
|
+
external view override
|
|
169
|
+
returns (uint256 deposit)
|
|
170
|
+
{
|
|
171
|
+
ISuperfluid host = ISuperfluid(token.getHost());
|
|
172
|
+
ISuperfluidGovernance gov = ISuperfluidGovernance(host.getGovernance());
|
|
173
|
+
uint256 minimumDeposit = gov.getConfigAsUint256(host, token, SUPERTOKEN_MINIMUM_DEPOSIT_KEY);
|
|
174
|
+
uint256 pppConfig = gov.getConfigAsUint256(host, token, CFAV1_PPP_CONFIG_KEY);
|
|
175
|
+
(uint256 liquidationPeriod, ) = SuperfluidGovernanceConfigs.decodePPPConfig(pppConfig);
|
|
176
|
+
return _getDepositRequiredForFlowRatePure(minimumDeposit, liquidationPeriod, flowRate);
|
|
177
|
+
}
|
|
142
178
|
|
|
143
179
|
function isPatricianPeriodNow(
|
|
144
180
|
ISuperfluidToken token,
|
|
@@ -682,7 +718,7 @@ contract ConstantFlowAgreementV1 is
|
|
|
682
718
|
newCtx = ctx;
|
|
683
719
|
require(FlowOperatorDefinitions.isPermissionsClean(permissions), "CFA: Unclean permissions");
|
|
684
720
|
ISuperfluid.Context memory currentContext = AgreementLibrary.authorizeTokenAccess(token, ctx);
|
|
685
|
-
// [SECURITY] NOTE: we are holding the assumption here that ctx is correct and we validate it with
|
|
721
|
+
// [SECURITY] NOTE: we are holding the assumption here that ctx is correct and we validate it with
|
|
686
722
|
// authorizeTokenAccess:
|
|
687
723
|
require(currentContext.msgSender != flowOperator, "CFA: E_NO_SENDER_FLOW_OPERATOR");
|
|
688
724
|
require(flowRateAllowance >= 0, "CFA: E_NO_NEGATIVE_ALLOWANCE");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPLv3
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
+
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
|
|
5
|
+
|
|
4
6
|
import {
|
|
5
7
|
IInstantDistributionAgreementV1,
|
|
6
8
|
ISuperfluidToken
|
|
@@ -14,10 +16,9 @@ import {
|
|
|
14
16
|
from "../interfaces/superfluid/ISuperfluid.sol";
|
|
15
17
|
import { AgreementBase } from "./AgreementBase.sol";
|
|
16
18
|
|
|
17
|
-
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
|
|
18
19
|
import { UInt128SafeMath } from "../libs/UInt128SafeMath.sol";
|
|
20
|
+
import { SlotsBitmapLibrary } from "../libs/SlotsBitmapLibrary.sol";
|
|
19
21
|
import { AgreementLibrary } from "./AgreementLibrary.sol";
|
|
20
|
-
import { SlotsBitmapLibrary } from "./SlotsBitmapLibrary.sol";
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPLv3
|
|
2
2
|
pragma solidity 0.8.13;
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
ISuperfluidToken
|
|
6
|
-
} from "../interfaces/agreements/IInstantDistributionAgreementV1.sol";
|
|
4
|
+
import {ISuperfluidToken} from "../interfaces/superfluid/ISuperfluidToken.sol";
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* @title Slots Bitmap library
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superfluid-finance/ethereum-contracts",
|
|
3
|
-
"version": "1.2.2-dev.
|
|
3
|
+
"version": "1.2.2-dev.a4c583c.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": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"!/build/contracts/*Mock*.json",
|
|
17
17
|
"!/build/contracts/*Tester*.json",
|
|
18
18
|
"!/build/contracts/*Anvil.json",
|
|
19
|
+
"!/build/contracts/*Properties.json",
|
|
19
20
|
"/build/contracts-sizes.txt",
|
|
20
21
|
"/build/abi.js",
|
|
21
22
|
"scripts/**/*",
|