@superfluid-finance/ethereum-contracts 1.4.1-dev.e675dbc.0 → 1.4.2-dev.e06ddfc.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 +28 -28
- package/build/contracts/AgreementLibrary.json +165 -165
- package/build/contracts/BaseRelayRecipient.json +55 -55
- package/build/contracts/BatchLiquidator.json +208 -208
- package/build/contracts/BatchOperation.json +784 -784
- package/build/contracts/CFAv1Forwarder.json +2299 -2473
- package/build/contracts/CFAv1Library.json +2279 -2279
- package/build/contracts/CallUtils.json +198 -198
- package/build/contracts/ClosingOnUpdateFlowTestApp.json +1544 -1544
- package/build/contracts/ConstantFlowAgreementV1.json +8579 -8423
- package/build/contracts/Context.json +1 -1
- package/build/contracts/ContextDefinitions.json +784 -784
- package/build/contracts/Create2.json +1 -1
- package/build/contracts/CustomSuperTokenBase.json +19 -19
- package/build/contracts/ERC165.json +1 -1
- package/build/contracts/ERC1820Implementer.json +1 -1
- package/build/contracts/ERC1820RegistryCompiled.json +22 -22
- 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 +23 -23
- package/build/contracts/ERC777Helper.json +380 -380
- package/build/contracts/ERC777RecipientDrainingGas.json +855 -855
- package/build/contracts/ERC777RecipientReverting.json +855 -855
- package/build/contracts/EnumerableSet.json +1 -1
- package/build/contracts/EventsEmitter.json +43 -43
- package/build/contracts/ExclusiveInflowTestApp.json +1544 -1544
- package/build/contracts/FixedSizeData.json +200 -200
- package/build/contracts/FlowExchangeTestApp.json +1545 -1545
- package/build/contracts/FlowOperatorDefinitions.json +784 -784
- package/build/contracts/FullUpgradableSuperTokenProxy.json +116 -116
- package/build/contracts/IAccessControl.json +1 -1
- package/build/contracts/IAccessControlEnumerable.json +1 -1
- package/build/contracts/IConstantFlowAgreementV1.json +608 -608
- package/build/contracts/IDAv1Library.json +2611 -2611
- 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 +652 -652
- package/build/contracts/IMultiSigWallet.json +24 -24
- package/build/contracts/IPureSuperToken.json +47 -47
- package/build/contracts/IPureSuperTokenCustom.json +47 -47
- package/build/contracts/IRelayRecipient.json +27 -27
- package/build/contracts/IResolver.json +38 -38
- package/build/contracts/ISETH.json +52 -52
- package/build/contracts/ISETHCustom.json +52 -52
- package/build/contracts/ISuperAgreement.json +50 -50
- package/build/contracts/ISuperApp.json +191 -191
- package/build/contracts/ISuperToken.json +544 -544
- package/build/contracts/ISuperTokenFactory.json +166 -166
- package/build/contracts/ISuperfluid.json +874 -874
- package/build/contracts/ISuperfluidGovernance.json +254 -254
- package/build/contracts/ISuperfluidToken.json +395 -395
- package/build/contracts/ITOGAv1.json +1441 -1441
- package/build/contracts/ITOGAv2.json +1441 -1441
- package/build/contracts/Initializable.json +1 -1
- package/build/contracts/InstantDistributionAgreementV1.json +5893 -5893
- package/build/contracts/NonClosableOutflowTestApp.json +1545 -1545
- 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 +1544 -1544
- package/build/contracts/SlotsBitmapLibrary.json +457 -457
- package/build/contracts/StreamRedirector.json +745 -745
- package/build/contracts/Strings.json +1 -1
- package/build/contracts/SuperAppBase.json +239 -239
- package/build/contracts/SuperAppDefinitions.json +784 -784
- package/build/contracts/SuperToken.json +2475 -2475
- package/build/contracts/SuperTokenFactory.json +774 -774
- package/build/contracts/SuperTokenFactoryBase.json +764 -764
- package/build/contracts/SuperTokenFactoryHelper.json +767 -767
- package/build/contracts/SuperUpgrader.json +437 -437
- package/build/contracts/Superfluid.json +5082 -5082
- package/build/contracts/SuperfluidErrors.json +784 -784
- package/build/contracts/SuperfluidFrameworkDeployer.json +765 -765
- package/build/contracts/SuperfluidGovernanceBase.json +2459 -2459
- package/build/contracts/SuperfluidGovernanceConfigs.json +784 -784
- package/build/contracts/SuperfluidGovernanceII.json +155 -155
- package/build/contracts/SuperfluidGovernanceIIProxy.json +135 -135
- package/build/contracts/SuperfluidLoader.json +207 -207
- package/build/contracts/SuperfluidToken.json +1471 -1471
- package/build/contracts/TOGA.json +1457 -1457
- package/build/contracts/TestGovernance.json +250 -250
- package/build/contracts/TestToken.json +93 -93
- package/build/contracts/TokenCustodian.json +214 -214
- package/build/contracts/TokenInfo.json +32 -32
- package/build/contracts/UUPSProxiable.json +139 -139
- package/build/contracts/UUPSProxy.json +81 -81
- package/build/contracts/UUPSUtils.json +37 -37
- package/build/contracts-sizes.txt +1 -1
- package/contracts/agreements/ConstantFlowAgreementV1.sol +8 -3
- package/contracts/utils/CFAv1Forwarder.sol +2 -6
- package/package.json +10 -6
- package/scripts/deploy-deterministically.js +35 -24
- package/scripts/deploy-framework.js +65 -38
- package/scripts/gov-upgrade-governance.js +87 -0
- package/scripts/info-print-contract-addresses.js +1 -1
- package/scripts/libs/common.js +2 -1
- package/scripts/libs/getConfig.js +1 -1
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"absolutePath": "project:/contracts/upgradability/UUPSUtils.sol",
|
|
16
16
|
"exportedSymbols": {
|
|
17
17
|
"UUPSUtils": [
|
|
18
|
-
|
|
18
|
+
37600
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
|
-
"id":
|
|
21
|
+
"id": 37601,
|
|
22
22
|
"license": "AGPLv3",
|
|
23
23
|
"nodeType": "SourceUnit",
|
|
24
24
|
"nodes": [
|
|
25
25
|
{
|
|
26
|
-
"id":
|
|
26
|
+
"id": 37578,
|
|
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": 37579,
|
|
43
43
|
"nodeType": "StructuredDocumentation",
|
|
44
44
|
"src": "60:76:95",
|
|
45
45
|
"text": " @title UUPS (Universal Upgradeable Proxy Standard) Shared Library"
|
|
46
46
|
},
|
|
47
47
|
"fullyImplemented": true,
|
|
48
|
-
"id":
|
|
48
|
+
"id": 37600,
|
|
49
49
|
"linearizedBaseContracts": [
|
|
50
|
-
|
|
50
|
+
37600
|
|
51
51
|
],
|
|
52
52
|
"name": "UUPSUtils",
|
|
53
53
|
"nameLocation": "145:9:95",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
{
|
|
57
57
|
"constant": true,
|
|
58
58
|
"documentation": {
|
|
59
|
-
"id":
|
|
59
|
+
"id": 37580,
|
|
60
60
|
"nodeType": "StructuredDocumentation",
|
|
61
61
|
"src": "162:288:95",
|
|
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": 37583,
|
|
65
65
|
"mutability": "constant",
|
|
66
66
|
"name": "_IMPLEMENTATION_SLOT",
|
|
67
67
|
"nameLocation": "481:20:95",
|
|
68
68
|
"nodeType": "VariableDeclaration",
|
|
69
|
-
"scope":
|
|
69
|
+
"scope": 37600,
|
|
70
70
|
"src": "455:115:95",
|
|
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": 37581,
|
|
79
79
|
"name": "bytes32",
|
|
80
80
|
"nodeType": "ElementaryTypeName",
|
|
81
81
|
"src": "455:7:95",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"value": {
|
|
88
88
|
"hexValue": "307833363038393461313362613161333231303636376338323834393264623938646361336532303736636333373335613932306133636135303564333832626263",
|
|
89
|
-
"id":
|
|
89
|
+
"id": 37582,
|
|
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": 37590,
|
|
108
108
|
"nodeType": "Block",
|
|
109
109
|
"src": "681:107:95",
|
|
110
110
|
"statements": [
|
|
@@ -145,33 +145,33 @@
|
|
|
145
145
|
"evmVersion": "london",
|
|
146
146
|
"externalReferences": [
|
|
147
147
|
{
|
|
148
|
-
"declaration":
|
|
148
|
+
"declaration": 37583,
|
|
149
149
|
"isOffset": false,
|
|
150
150
|
"isSlot": false,
|
|
151
151
|
"src": "751:20:95",
|
|
152
152
|
"valueSize": 1
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
|
-
"declaration":
|
|
155
|
+
"declaration": 37587,
|
|
156
156
|
"isOffset": false,
|
|
157
157
|
"isSlot": false,
|
|
158
158
|
"src": "737:4:95",
|
|
159
159
|
"valueSize": 1
|
|
160
160
|
}
|
|
161
161
|
],
|
|
162
|
-
"id":
|
|
162
|
+
"id": 37589,
|
|
163
163
|
"nodeType": "InlineAssembly",
|
|
164
164
|
"src": "691:91:95"
|
|
165
165
|
}
|
|
166
166
|
]
|
|
167
167
|
},
|
|
168
168
|
"documentation": {
|
|
169
|
-
"id":
|
|
169
|
+
"id": 37584,
|
|
170
170
|
"nodeType": "StructuredDocumentation",
|
|
171
171
|
"src": "577:36:95",
|
|
172
172
|
"text": "@dev Get implementation address."
|
|
173
173
|
},
|
|
174
|
-
"id":
|
|
174
|
+
"id": 37591,
|
|
175
175
|
"implemented": true,
|
|
176
176
|
"kind": "function",
|
|
177
177
|
"modifiers": [],
|
|
@@ -179,23 +179,23 @@
|
|
|
179
179
|
"nameLocation": "627:14:95",
|
|
180
180
|
"nodeType": "FunctionDefinition",
|
|
181
181
|
"parameters": {
|
|
182
|
-
"id":
|
|
182
|
+
"id": 37585,
|
|
183
183
|
"nodeType": "ParameterList",
|
|
184
184
|
"parameters": [],
|
|
185
185
|
"src": "641:2:95"
|
|
186
186
|
},
|
|
187
187
|
"returnParameters": {
|
|
188
|
-
"id":
|
|
188
|
+
"id": 37588,
|
|
189
189
|
"nodeType": "ParameterList",
|
|
190
190
|
"parameters": [
|
|
191
191
|
{
|
|
192
192
|
"constant": false,
|
|
193
|
-
"id":
|
|
193
|
+
"id": 37587,
|
|
194
194
|
"mutability": "mutable",
|
|
195
195
|
"name": "impl",
|
|
196
196
|
"nameLocation": "675:4:95",
|
|
197
197
|
"nodeType": "VariableDeclaration",
|
|
198
|
-
"scope":
|
|
198
|
+
"scope": 37591,
|
|
199
199
|
"src": "667:12:95",
|
|
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": 37586,
|
|
208
208
|
"name": "address",
|
|
209
209
|
"nodeType": "ElementaryTypeName",
|
|
210
210
|
"src": "667:7:95",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
],
|
|
220
220
|
"src": "666:14:95"
|
|
221
221
|
},
|
|
222
|
-
"scope":
|
|
222
|
+
"scope": 37600,
|
|
223
223
|
"src": "618:170:95",
|
|
224
224
|
"stateMutability": "view",
|
|
225
225
|
"virtual": false,
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
"body": {
|
|
230
|
-
"id":
|
|
230
|
+
"id": 37598,
|
|
231
231
|
"nodeType": "Block",
|
|
232
232
|
"src": "896:171:95",
|
|
233
233
|
"statements": [
|
|
@@ -266,33 +266,33 @@
|
|
|
266
266
|
"evmVersion": "london",
|
|
267
267
|
"externalReferences": [
|
|
268
268
|
{
|
|
269
|
-
"declaration":
|
|
269
|
+
"declaration": 37583,
|
|
270
270
|
"isOffset": false,
|
|
271
271
|
"isSlot": false,
|
|
272
272
|
"src": "988:20:95",
|
|
273
273
|
"valueSize": 1
|
|
274
274
|
},
|
|
275
275
|
{
|
|
276
|
-
"declaration":
|
|
276
|
+
"declaration": 37594,
|
|
277
277
|
"isOffset": false,
|
|
278
278
|
"isSlot": false,
|
|
279
279
|
"src": "1026:11:95",
|
|
280
280
|
"valueSize": 1
|
|
281
281
|
}
|
|
282
282
|
],
|
|
283
|
-
"id":
|
|
283
|
+
"id": 37597,
|
|
284
284
|
"nodeType": "InlineAssembly",
|
|
285
285
|
"src": "906:155:95"
|
|
286
286
|
}
|
|
287
287
|
]
|
|
288
288
|
},
|
|
289
289
|
"documentation": {
|
|
290
|
-
"id":
|
|
290
|
+
"id": 37592,
|
|
291
291
|
"nodeType": "StructuredDocumentation",
|
|
292
292
|
"src": "794:40:95",
|
|
293
293
|
"text": "@dev Set new implementation address."
|
|
294
294
|
},
|
|
295
|
-
"id":
|
|
295
|
+
"id": 37599,
|
|
296
296
|
"implemented": true,
|
|
297
297
|
"kind": "function",
|
|
298
298
|
"modifiers": [],
|
|
@@ -300,17 +300,17 @@
|
|
|
300
300
|
"nameLocation": "848:17:95",
|
|
301
301
|
"nodeType": "FunctionDefinition",
|
|
302
302
|
"parameters": {
|
|
303
|
-
"id":
|
|
303
|
+
"id": 37595,
|
|
304
304
|
"nodeType": "ParameterList",
|
|
305
305
|
"parameters": [
|
|
306
306
|
{
|
|
307
307
|
"constant": false,
|
|
308
|
-
"id":
|
|
308
|
+
"id": 37594,
|
|
309
309
|
"mutability": "mutable",
|
|
310
310
|
"name": "codeAddress",
|
|
311
311
|
"nameLocation": "874:11:95",
|
|
312
312
|
"nodeType": "VariableDeclaration",
|
|
313
|
-
"scope":
|
|
313
|
+
"scope": 37599,
|
|
314
314
|
"src": "866:19:95",
|
|
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": 37593,
|
|
323
323
|
"name": "address",
|
|
324
324
|
"nodeType": "ElementaryTypeName",
|
|
325
325
|
"src": "866:7:95",
|
|
@@ -335,19 +335,19 @@
|
|
|
335
335
|
"src": "865:21:95"
|
|
336
336
|
},
|
|
337
337
|
"returnParameters": {
|
|
338
|
-
"id":
|
|
338
|
+
"id": 37596,
|
|
339
339
|
"nodeType": "ParameterList",
|
|
340
340
|
"parameters": [],
|
|
341
341
|
"src": "896:0:95"
|
|
342
342
|
},
|
|
343
|
-
"scope":
|
|
343
|
+
"scope": 37600,
|
|
344
344
|
"src": "839:228:95",
|
|
345
345
|
"stateMutability": "nonpayable",
|
|
346
346
|
"virtual": false,
|
|
347
347
|
"visibility": "internal"
|
|
348
348
|
}
|
|
349
349
|
],
|
|
350
|
-
"scope":
|
|
350
|
+
"scope": 37601,
|
|
351
351
|
"src": "137:933:95",
|
|
352
352
|
"usedErrors": []
|
|
353
353
|
}
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
},
|
|
361
361
|
"networks": {},
|
|
362
362
|
"schemaVersion": "3.4.9",
|
|
363
|
-
"updatedAt": "2022-09-
|
|
363
|
+
"updatedAt": "2022-09-21T11:06:18.589Z",
|
|
364
364
|
"devdoc": {
|
|
365
365
|
"kind": "dev",
|
|
366
366
|
"methods": {},
|
|
@@ -5,7 +5,7 @@ SuperToken.sol : 18114 (6462)
|
|
|
5
5
|
SuperfluidToken.sol : 2 (24574)
|
|
6
6
|
InstantDistributionAgreementV1.sol : 21380 (3196)
|
|
7
7
|
AgreementLibrary.sol : 143 (24433)
|
|
8
|
-
ConstantFlowAgreementV1.sol :
|
|
8
|
+
ConstantFlowAgreementV1.sol : 20609 (3967)
|
|
9
9
|
AgreementBase.sol : 2 (24574)
|
|
10
10
|
SuperfluidGovernanceII.sol : 8155 (16421)
|
|
11
11
|
SuperfluidGovernanceBase.sol : 2 (24574)
|
|
@@ -446,7 +446,7 @@ contract ConstantFlowAgreementV1 is
|
|
|
446
446
|
ctx, currentContext);
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
_requireAvailableBalance(flowVars.token, currentContext);
|
|
449
|
+
_requireAvailableBalance(flowVars.token, flowVars.sender, currentContext);
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
function _updateFlow(
|
|
@@ -474,7 +474,7 @@ contract ConstantFlowAgreementV1 is
|
|
|
474
474
|
ctx, currentContext);
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
-
_requireAvailableBalance(flowVars.token, currentContext);
|
|
477
|
+
_requireAvailableBalance(flowVars.token, flowVars.sender, currentContext);
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
function _deleteFlow(
|
|
@@ -1221,6 +1221,7 @@ contract ConstantFlowAgreementV1 is
|
|
|
1221
1221
|
}
|
|
1222
1222
|
function _requireAvailableBalance(
|
|
1223
1223
|
ISuperfluidToken token,
|
|
1224
|
+
address flowSender,
|
|
1224
1225
|
ISuperfluid.Context memory currentContext
|
|
1225
1226
|
)
|
|
1226
1227
|
private view
|
|
@@ -1228,7 +1229,7 @@ contract ConstantFlowAgreementV1 is
|
|
|
1228
1229
|
// do not enforce balance checks during callbacks for the appCreditToken
|
|
1229
1230
|
if (currentContext.callType != ContextDefinitions.CALL_INFO_CALL_TYPE_APP_CALLBACK ||
|
|
1230
1231
|
currentContext.appCreditToken != token) {
|
|
1231
|
-
(int256 availableBalance,,) = token.realtimeBalanceOf(
|
|
1232
|
+
(int256 availableBalance,,) = token.realtimeBalanceOf(flowSender, currentContext.timestamp);
|
|
1232
1233
|
if (availableBalance < 0) {
|
|
1233
1234
|
revert SuperfluidErrors.INSUFFICIENT_BALANCE(SuperfluidErrors.CFA_INSUFFICIENT_BALANCE);
|
|
1234
1235
|
}
|
|
@@ -1432,6 +1433,10 @@ contract ConstantFlowAgreementV1 is
|
|
|
1432
1433
|
internal pure
|
|
1433
1434
|
returns (bool)
|
|
1434
1435
|
{
|
|
1436
|
+
if (signedTotalCFADeposit == 0) {
|
|
1437
|
+
return false;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1435
1440
|
int256 totalRewardLeft = availableBalance + signedTotalCFADeposit;
|
|
1436
1441
|
int256 totalCFAOutFlowrate = signedTotalCFADeposit / int256(liquidationPeriod);
|
|
1437
1442
|
// divisor cannot be zero with existing outflow
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { CallUtils } from "../libs/CallUtils.sol";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
+
* Contract address: 0xCfA1E187C9141B8bA90a436CB789017FA573d051
|
|
18
19
|
* The CFAv1Forwarder contract provides an easy to use interface to
|
|
19
20
|
* ConstantFlowAgreementV1 specific functionality of Super Tokens.
|
|
20
21
|
* Instances of this contract can operate on the protocol only if configured as "trusted forwarder"
|
|
@@ -376,7 +377,7 @@ contract CFAv1Forwarder {
|
|
|
376
377
|
)
|
|
377
378
|
);
|
|
378
379
|
|
|
379
|
-
_forwardBatchCall(address(_cfa), cfaCallData);
|
|
380
|
+
_forwardBatchCall(address(_cfa), cfaCallData, new bytes(0));
|
|
380
381
|
}
|
|
381
382
|
|
|
382
383
|
// compiles the calldata of a single operation for the host invocation and executes it
|
|
@@ -405,9 +406,4 @@ contract CFAv1Forwarder {
|
|
|
405
406
|
CallUtils.revertFromReturnedData(returnedData);
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
|
-
|
|
409
|
-
// invokes_forwardBatchCall with empty userData
|
|
410
|
-
function _forwardBatchCall(address target, bytes memory callData) internal {
|
|
411
|
-
_forwardBatchCall(target, callData, new bytes(0));
|
|
412
|
-
}
|
|
413
409
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superfluid-finance/ethereum-contracts",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2-dev.e06ddfc.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": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"run-hardhat": "IS_HARDHAT=true hardhat",
|
|
28
28
|
"run-truffle": "IS_TRUFFLE=true truffle",
|
|
29
29
|
"run-forge": "IS_FOUNDRY=true forge",
|
|
30
|
-
"run-nodemon": "nodemon -e sol,js,ts -
|
|
30
|
+
"run-nodemon": "nodemon -e sol,js,ts -x",
|
|
31
31
|
"build": "run-s build:*",
|
|
32
32
|
"build:contracts": "rm -f build/contracts/*;yarn run-truffle compile",
|
|
33
33
|
"build:hardhat": "yarn run-hardhat compile",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"testenv:deploy": "yarn run-truffle exec scripts/deploy-test-environment.js : TEST",
|
|
38
38
|
"pretest": "{ yarn testenv:start > /dev/null& } && sleep 5",
|
|
39
39
|
"test": "run-s test:*:*",
|
|
40
|
-
"test:contracts:hardhat": "yarn run-hardhat test testsuites/all-contracts.
|
|
40
|
+
"test:contracts:hardhat": "yarn run-hardhat test testsuites/all-contracts.ts",
|
|
41
41
|
"test:contracts:foundry": "yarn run-forge test --hardhat",
|
|
42
42
|
"test:contracts:solc-compatibility": "test/test-solc-compatibility.sh",
|
|
43
43
|
"test:deployment:scripts-js-hardhat": "yarn run-hardhat test test/scripts/deployment.test.js",
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"lint": "run-s lint:*",
|
|
49
49
|
"lint:sol": "solhint -w 0 contracts/*.sol contracts/*/*.sol && echo '✔ Your .sol files look good.'",
|
|
50
50
|
"lint:js-eslint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .js files look good.'",
|
|
51
|
+
"lint-ts": "eslint test -c .eslintrc.ts.json --ext .ts",
|
|
52
|
+
"lint:ts-eslint": "yarn lint-ts --max-warnings=0 --report-unused-disable-directives && echo '✔ Your .ts files look good.'",
|
|
53
|
+
"fix": "run-s fix:*",
|
|
54
|
+
"fix:eslint": "yarn lint-ts --fix",
|
|
51
55
|
"lint:check-no-focused-tests": "grep -FR .only test || { echo 'No test is focused.';exit 0; } && { echo '✘ You have focused tests.'; exit 1; }",
|
|
52
56
|
"pre-commit": "if [ ! -z \"$(git status -s .)\" ];then run-s pre-commit:*;else true;fi",
|
|
53
57
|
"pre-commit:lint": "yarn lint",
|
|
@@ -58,21 +62,21 @@
|
|
|
58
62
|
"dependencies": {
|
|
59
63
|
"@decentral.ee/web3-helpers": "0.5.3",
|
|
60
64
|
"@openzeppelin/contracts": "4.7.3",
|
|
61
|
-
"@superfluid-finance/js-sdk": "
|
|
65
|
+
"@superfluid-finance/js-sdk": "0.6.3",
|
|
62
66
|
"@truffle/contract": "4.5.23",
|
|
63
67
|
"ethereumjs-tx": "2.1.2",
|
|
64
68
|
"ethereumjs-util": "7.1.5",
|
|
65
69
|
"stack-trace": "0.0.10"
|
|
66
70
|
},
|
|
67
71
|
"devDependencies": {
|
|
68
|
-
"@nomiclabs/hardhat-truffle5": "^2.0.
|
|
72
|
+
"@nomiclabs/hardhat-truffle5": "^2.0.7",
|
|
69
73
|
"async": "^3.2.4",
|
|
70
74
|
"csv-writer": "^1.6.0",
|
|
71
75
|
"ganache-time-traveler": "1.0.16",
|
|
72
76
|
"mochawesome": "^7.1.3",
|
|
73
77
|
"readline": "1.3.0",
|
|
74
78
|
"solhint": "3.3.7",
|
|
75
|
-
"solidity-coverage": "0.
|
|
79
|
+
"solidity-coverage": "0.8.0",
|
|
76
80
|
"solidity-docgen": "^0.6.0-beta.25",
|
|
77
81
|
"truffle-flattener": "^1.6.0",
|
|
78
82
|
"truffle-plugin-verify": "0.5.28"
|
|
@@ -4,7 +4,7 @@ const SuperfluidSDK = require("@superfluid-finance/js-sdk");
|
|
|
4
4
|
const Resolver = artifacts.require("Resolver");
|
|
5
5
|
|
|
6
6
|
const SuperfluidLoader = artifacts.require("SuperfluidLoader");
|
|
7
|
-
const
|
|
7
|
+
const CFAv1Forwarder = artifacts.require("CFAv1Forwarder");
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @dev Deploy specified contract at a deterministic address (defined by sender, nonce)
|
|
@@ -12,16 +12,23 @@ const AgreementForwarder = artifacts.require("AgreementForwarder");
|
|
|
12
12
|
* In order to make this easy, the script takes a private key of the deployer account and funds it.
|
|
13
13
|
* Recommendation: create a new account (guaranteed to be at nonce 1 everywhere) for the deployer.
|
|
14
14
|
*
|
|
15
|
+
* Note: fee estimation does currently not work on optimism (mainnet and testnets).
|
|
16
|
+
* It's unknown how to do an estimation of the overall cost (L1 and L2).
|
|
17
|
+
* Solution: manually pre-fund the deployer account.
|
|
18
|
+
*
|
|
15
19
|
* @param web3 The web3 instance to be used
|
|
16
20
|
* @param from address to use for funding the deployer account
|
|
17
21
|
*
|
|
18
|
-
* Usage: npx truffle exec scripts/deploy-deterministically.js : {
|
|
22
|
+
* Usage: npx truffle exec scripts/deploy-deterministically.js : {CONTRACT NAME} [{NONCE}]
|
|
19
23
|
* CONTRACT NAME must be one of SuperfluidLoader, AgreementForwarder
|
|
20
|
-
* If NONCE is not defined,
|
|
24
|
+
* If NONCE is not defined, 0 is assumed (-> first tx done from the deployer account)
|
|
25
|
+
*
|
|
26
|
+
* Required ENV var: DETERMINISTIC_DEPLOYER_PK
|
|
21
27
|
*
|
|
22
28
|
* (optional) ENV vars:
|
|
23
|
-
*
|
|
24
|
-
*
|
|
29
|
+
* GAS_LIMIT: override the gas limit for networks with misbehaving estimation
|
|
30
|
+
* GAS_PRICE: override the estimated gas price
|
|
31
|
+
* EST_TX_COST: override the estimated tx cost (amount to be sent to deployer)
|
|
25
32
|
* for networks with different cost derivation structure (Optimism)
|
|
26
33
|
*/
|
|
27
34
|
module.exports = eval(`(${S.toString()})()`)(async function (
|
|
@@ -32,19 +39,19 @@ module.exports = eval(`(${S.toString()})()`)(async function (
|
|
|
32
39
|
|
|
33
40
|
console.log("======== Deploying deterministically ========");
|
|
34
41
|
|
|
35
|
-
let nonce =
|
|
36
|
-
if (args.length ===
|
|
42
|
+
let nonce = 0;
|
|
43
|
+
if (args.length === 2) {
|
|
37
44
|
nonce = parseInt(args.pop());
|
|
38
|
-
if (nonce
|
|
39
|
-
console.error("nonce must be
|
|
45
|
+
if (nonce < 0) {
|
|
46
|
+
console.error("nonce must be >= 0");
|
|
40
47
|
process.exit(1);
|
|
41
48
|
}
|
|
42
|
-
} else if (args.length !==
|
|
49
|
+
} else if (args.length !== 1) {
|
|
43
50
|
throw new Error("Wrong number of arguments");
|
|
44
51
|
}
|
|
45
52
|
const contractName = args.pop();
|
|
46
|
-
const privKey = args.pop();
|
|
47
53
|
|
|
54
|
+
const privKey = process.env.DETERMINISTIC_DEPLOYER_PK;
|
|
48
55
|
const deployer = web3.eth.accounts.privateKeyToAccount(privKey);
|
|
49
56
|
console.log("deployer:", deployer.address);
|
|
50
57
|
console.log("nonce:", nonce);
|
|
@@ -67,22 +74,20 @@ module.exports = eval(`(${S.toString()})()`)(async function (
|
|
|
67
74
|
console.log(
|
|
68
75
|
`setting up SuperfluidLoader for chainId ${chainId}, resolver ${resolverAddr}`
|
|
69
76
|
);
|
|
70
|
-
} else if (contractName === "
|
|
71
|
-
ContractArtifact =
|
|
77
|
+
} else if (contractName === "CFAv1Forwarder") {
|
|
78
|
+
ContractArtifact = CFAv1Forwarder;
|
|
72
79
|
deployArgs = [hostAddr];
|
|
73
80
|
console.log(
|
|
74
|
-
`setting up
|
|
81
|
+
`setting up CFAv1Forwarder for chainId ${chainId}, host ${hostAddr}`
|
|
75
82
|
);
|
|
76
83
|
} else {
|
|
77
84
|
throw new Error("Contract unknown / not supported");
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
const deployerTxCnt = await web3.eth.getTransactionCount(deployer.address);
|
|
81
|
-
if (nonce !== deployerTxCnt
|
|
88
|
+
if (nonce !== deployerTxCnt) {
|
|
82
89
|
console.error(
|
|
83
|
-
`### ERR: requested nonce is ${nonce}, but next usable nonce is ${
|
|
84
|
-
deployerTxCnt + 1
|
|
85
|
-
}`
|
|
90
|
+
`### ERR: requested nonce is ${nonce}, but next usable nonce is ${deployerTxCnt}`
|
|
86
91
|
);
|
|
87
92
|
process.exit(1);
|
|
88
93
|
}
|
|
@@ -90,7 +95,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
|
|
|
90
95
|
const deployerBalance = await web3.eth.getBalance(deployer.address);
|
|
91
96
|
console.log("deployer balance:", web3.utils.fromWei(deployerBalance));
|
|
92
97
|
|
|
93
|
-
const gasPrice = await web3.eth.getGasPrice();
|
|
98
|
+
const gasPrice = process.env.GAS_PRICE || (await web3.eth.getGasPrice());
|
|
94
99
|
console.log("gas price:", gasPrice);
|
|
95
100
|
|
|
96
101
|
const Contract = new web3.eth.Contract(ContractArtifact.abi);
|
|
@@ -99,7 +104,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
|
|
|
99
104
|
arguments: deployArgs,
|
|
100
105
|
});
|
|
101
106
|
|
|
102
|
-
const gasLimit = process.env.
|
|
107
|
+
const gasLimit = process.env.GAS_LIMIT || (await deployTx.estimateGas());
|
|
103
108
|
console.log("gas limit:", gasLimit);
|
|
104
109
|
|
|
105
110
|
const deployCode = deployTx.encodeABI();
|
|
@@ -107,19 +112,24 @@ module.exports = eval(`(${S.toString()})()`)(async function (
|
|
|
107
112
|
const BN = web3.utils.BN;
|
|
108
113
|
// calc delta between deployer balance and estimated deployment cost
|
|
109
114
|
// On Optimism, this won't reflect the actual cost bcs of missing L1 component, see https://community.optimism.io/docs/developers/build/transaction-fees/#estimating-the-total-fee
|
|
110
|
-
const estTxCost = process.env.
|
|
111
|
-
? new BN(process.env.
|
|
115
|
+
const estTxCost = process.env.EST_TX_COST
|
|
116
|
+
? new BN(process.env.EST_TX_COST)
|
|
112
117
|
: new BN(gasLimit).mul(new BN(gasPrice));
|
|
113
118
|
console.log("estimated tx cost:", estTxCost.toString());
|
|
114
119
|
const missingBalance = estTxCost.sub(new BN(deployerBalance));
|
|
115
120
|
if (missingBalance.gt(new BN(0))) {
|
|
116
121
|
console.log("deployer missing balance", missingBalance.toString());
|
|
117
122
|
console.log("sending funding tx...");
|
|
118
|
-
const
|
|
123
|
+
const fundingTxObj = {
|
|
119
124
|
from: options.from || (await web3.eth.getAccounts())[0],
|
|
120
125
|
to: deployer.address,
|
|
121
126
|
value: missingBalance,
|
|
122
|
-
}
|
|
127
|
+
};
|
|
128
|
+
if (process.env.GAS_PRICE !== undefined) {
|
|
129
|
+
fundingTxObj.gasPrice = gasPrice;
|
|
130
|
+
}
|
|
131
|
+
const fundingTx = await web3.eth.sendTransaction(fundingTxObj);
|
|
132
|
+
|
|
123
133
|
console.log(
|
|
124
134
|
`funded deployer account in tx ${fundingTx.transactionHash}`
|
|
125
135
|
);
|
|
@@ -134,6 +144,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
|
|
|
134
144
|
const unsignedTx = {
|
|
135
145
|
data: deployCode,
|
|
136
146
|
gas: gasLimit,
|
|
147
|
+
nonce,
|
|
137
148
|
};
|
|
138
149
|
if (hasEip1559) {
|
|
139
150
|
console.log("creating EIP-1559 tx");
|