@superfluid-finance/ethereum-contracts 1.2.2-dev.a4c583c.0 → 1.2.2-dev.ec379f7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/build/contracts/AccessControl.json +1 -1
  2. package/build/contracts/AccessControlEnumerable.json +1 -1
  3. package/build/contracts/Address.json +1 -1
  4. package/build/contracts/AgreementBase.json +18 -18
  5. package/build/contracts/AgreementLibrary.json +167 -167
  6. package/build/contracts/BaseRelayRecipient.json +55 -55
  7. package/build/contracts/BatchLiquidator.json +178 -178
  8. package/build/contracts/BatchOperation.json +599 -599
  9. package/build/contracts/CFAv1Library.json +257 -257
  10. package/build/contracts/CallUtils.json +198 -198
  11. package/build/contracts/ClosingOnUpdateFlowTestApp.json +1501 -1501
  12. package/build/contracts/ConstantFlowAgreementV1.json +925 -925
  13. package/build/contracts/Context.json +1 -1
  14. package/build/contracts/ContextDefinitions.json +599 -599
  15. package/build/contracts/Create2.json +1 -1
  16. package/build/contracts/CustomSuperTokenBase.json +19 -19
  17. package/build/contracts/ERC165.json +1 -1
  18. package/build/contracts/ERC1820Implementer.json +1 -1
  19. package/build/contracts/ERC20.json +1 -1
  20. package/build/contracts/ERC20Burnable.json +1 -1
  21. package/build/contracts/ERC20Pausable.json +1 -1
  22. package/build/contracts/ERC20PresetMinterPauser.json +1 -1
  23. package/build/contracts/ERC20WithTokenInfo.json +23 -23
  24. package/build/contracts/ERC721.json +1 -1
  25. package/build/contracts/ERC777Helper.json +380 -380
  26. package/build/contracts/ERC777RecipientDrainingGas.json +855 -855
  27. package/build/contracts/ERC777RecipientReverting.json +855 -855
  28. package/build/contracts/EnumerableSet.json +1 -1
  29. package/build/contracts/ExclusiveInflowTestApp.json +1501 -1501
  30. package/build/contracts/FixedSizeData.json +200 -200
  31. package/build/contracts/FlowExchangeTestApp.json +1502 -1502
  32. package/build/contracts/FlowOperatorDefinitions.json +599 -599
  33. package/build/contracts/FullUpgradableSuperTokenProxy.json +113 -113
  34. package/build/contracts/IAccessControl.json +1 -1
  35. package/build/contracts/IAccessControlEnumerable.json +1 -1
  36. package/build/contracts/IConstantFlowAgreementV1.json +567 -567
  37. package/build/contracts/IDAv1Library.json +398 -398
  38. package/build/contracts/IERC165.json +1 -1
  39. package/build/contracts/IERC1820Implementer.json +1 -1
  40. package/build/contracts/IERC1820Registry.json +1 -1
  41. package/build/contracts/IERC20.json +1 -1
  42. package/build/contracts/IERC20Metadata.json +1 -1
  43. package/build/contracts/IERC721.json +1 -1
  44. package/build/contracts/IERC721Metadata.json +1 -1
  45. package/build/contracts/IERC721Receiver.json +1 -1
  46. package/build/contracts/IERC777.json +1 -1
  47. package/build/contracts/IERC777Recipient.json +1 -1
  48. package/build/contracts/IERC777Sender.json +1 -1
  49. package/build/contracts/IInstantDistributionAgreementV1.json +640 -640
  50. package/build/contracts/IMaticBridgedNativeSuperToken.json +62 -62
  51. package/build/contracts/IMaticBridgedNativeSuperTokenCustom.json +62 -62
  52. package/build/contracts/IMultiSigWallet.json +24 -24
  53. package/build/contracts/IPureSuperToken.json +42 -42
  54. package/build/contracts/IPureSuperTokenCustom.json +42 -42
  55. package/build/contracts/IRelayRecipient.json +27 -27
  56. package/build/contracts/IResolver.json +38 -38
  57. package/build/contracts/ISETH.json +47 -47
  58. package/build/contracts/ISETHCustom.json +47 -47
  59. package/build/contracts/ISuperAgreement.json +50 -50
  60. package/build/contracts/ISuperApp.json +191 -191
  61. package/build/contracts/ISuperToken.json +523 -523
  62. package/build/contracts/ISuperTokenFactory.json +160 -160
  63. package/build/contracts/ISuperfluid.json +829 -829
  64. package/build/contracts/ISuperfluidGovernance.json +242 -242
  65. package/build/contracts/ISuperfluidToken.json +389 -389
  66. package/build/contracts/ITOGAv1.json +1431 -1431
  67. package/build/contracts/ITOGAv2.json +1431 -1431
  68. package/build/contracts/Initializable.json +1 -1
  69. package/build/contracts/InstantDistributionAgreementV1.json +577 -577
  70. package/build/contracts/Int96SafeMath.json +281 -281
  71. package/build/contracts/MaticBridgedNativeSuperTokenProxy.json +228 -228
  72. package/build/contracts/NonClosableOutflowTestApp.json +1502 -1502
  73. package/build/contracts/Ownable.json +1 -1
  74. package/build/contracts/Pausable.json +1 -1
  75. package/build/contracts/Proxy.json +1 -1
  76. package/build/contracts/PureSuperToken.json +106 -106
  77. package/build/contracts/Resolver.json +98 -98
  78. package/build/contracts/SETHProxy.json +224 -224
  79. package/build/contracts/SafeCast.json +1 -1
  80. package/build/contracts/SafeERC20.json +1 -1
  81. package/build/contracts/SafeMath.json +1 -1
  82. package/build/contracts/SelfDeletingFlowTestApp.json +1501 -1501
  83. package/build/contracts/SlotsBitmapLibrary.json +441 -441
  84. package/build/contracts/Strings.json +1 -1
  85. package/build/contracts/SuperAppBase.json +42 -42
  86. package/build/contracts/SuperAppDefinitions.json +599 -599
  87. package/build/contracts/SuperToken.json +2350 -2350
  88. package/build/contracts/SuperTokenFactory.json +731 -731
  89. package/build/contracts/SuperTokenFactoryBase.json +721 -721
  90. package/build/contracts/SuperTokenFactoryHelper.json +724 -724
  91. package/build/contracts/SuperUpgrader.json +437 -437
  92. package/build/contracts/Superfluid.json +9812 -10169
  93. package/build/contracts/SuperfluidFrameworkDeployer.json +490 -490
  94. package/build/contracts/SuperfluidGovernanceBase.json +1769 -2087
  95. package/build/contracts/SuperfluidGovernanceConfigs.json +599 -599
  96. package/build/contracts/SuperfluidGovernanceII.json +2015 -2265
  97. package/build/contracts/SuperfluidGovernanceIIProxy.json +131 -131
  98. package/build/contracts/SuperfluidLoader.json +207 -207
  99. package/build/contracts/SuperfluidToken.json +1345 -1345
  100. package/build/contracts/TOGA.json +1448 -1448
  101. package/build/contracts/TestGovernance.json +2192 -2442
  102. package/build/contracts/TestToken.json +94 -94
  103. package/build/contracts/TokenCustodian.json +214 -214
  104. package/build/contracts/TokenInfo.json +32 -32
  105. package/build/contracts/UInt128SafeMath.json +97 -97
  106. package/build/contracts/UUPSProxiable.json +132 -132
  107. package/build/contracts/UUPSProxy.json +81 -81
  108. package/build/contracts/UUPSUtils.json +37 -37
  109. package/build/contracts-sizes.txt +2 -2
  110. package/contracts/gov/SuperfluidGovernanceBase.sol +9 -26
  111. package/contracts/mocks/SuperfluidMock.sol +2 -2
  112. package/contracts/superfluid/Superfluid.sol +5 -10
  113. package/package.json +1 -1
  114. package/scripts/gov-create-new-app-registration-key.js +26 -3
@@ -15,15 +15,15 @@
15
15
  "absolutePath": "project:/contracts/upgradability/UUPSUtils.sol",
16
16
  "exportedSymbols": {
17
17
  "UUPSUtils": [
18
- 36434
18
+ 36399
19
19
  ]
20
20
  },
21
- "id": 36435,
21
+ "id": 36400,
22
22
  "license": "AGPLv3",
23
23
  "nodeType": "SourceUnit",
24
24
  "nodes": [
25
25
  {
26
- "id": 36412,
26
+ "id": 36377,
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": 36413,
42
+ "id": 36378,
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": 36434,
48
+ "id": 36399,
49
49
  "linearizedBaseContracts": [
50
- 36434
50
+ 36399
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": 36414,
59
+ "id": 36379,
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": 36417,
64
+ "id": 36382,
65
65
  "mutability": "constant",
66
66
  "name": "_IMPLEMENTATION_SLOT",
67
67
  "nameLocation": "481:20:100",
68
68
  "nodeType": "VariableDeclaration",
69
- "scope": 36434,
69
+ "scope": 36399,
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": 36415,
78
+ "id": 36380,
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": 36416,
89
+ "id": 36381,
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": 36424,
107
+ "id": 36389,
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": 36417,
148
+ "declaration": 36382,
149
149
  "isOffset": false,
150
150
  "isSlot": false,
151
151
  "src": "751:20:100",
152
152
  "valueSize": 1
153
153
  },
154
154
  {
155
- "declaration": 36421,
155
+ "declaration": 36386,
156
156
  "isOffset": false,
157
157
  "isSlot": false,
158
158
  "src": "737:4:100",
159
159
  "valueSize": 1
160
160
  }
161
161
  ],
162
- "id": 36423,
162
+ "id": 36388,
163
163
  "nodeType": "InlineAssembly",
164
164
  "src": "691:91:100"
165
165
  }
166
166
  ]
167
167
  },
168
168
  "documentation": {
169
- "id": 36418,
169
+ "id": 36383,
170
170
  "nodeType": "StructuredDocumentation",
171
171
  "src": "577:36:100",
172
172
  "text": "@dev Get implementation address."
173
173
  },
174
- "id": 36425,
174
+ "id": 36390,
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": 36419,
182
+ "id": 36384,
183
183
  "nodeType": "ParameterList",
184
184
  "parameters": [],
185
185
  "src": "641:2:100"
186
186
  },
187
187
  "returnParameters": {
188
- "id": 36422,
188
+ "id": 36387,
189
189
  "nodeType": "ParameterList",
190
190
  "parameters": [
191
191
  {
192
192
  "constant": false,
193
- "id": 36421,
193
+ "id": 36386,
194
194
  "mutability": "mutable",
195
195
  "name": "impl",
196
196
  "nameLocation": "675:4:100",
197
197
  "nodeType": "VariableDeclaration",
198
- "scope": 36425,
198
+ "scope": 36390,
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": 36420,
207
+ "id": 36385,
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": 36434,
222
+ "scope": 36399,
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": 36432,
230
+ "id": 36397,
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": 36417,
269
+ "declaration": 36382,
270
270
  "isOffset": false,
271
271
  "isSlot": false,
272
272
  "src": "988:20:100",
273
273
  "valueSize": 1
274
274
  },
275
275
  {
276
- "declaration": 36428,
276
+ "declaration": 36393,
277
277
  "isOffset": false,
278
278
  "isSlot": false,
279
279
  "src": "1026:11:100",
280
280
  "valueSize": 1
281
281
  }
282
282
  ],
283
- "id": 36431,
283
+ "id": 36396,
284
284
  "nodeType": "InlineAssembly",
285
285
  "src": "906:155:100"
286
286
  }
287
287
  ]
288
288
  },
289
289
  "documentation": {
290
- "id": 36426,
290
+ "id": 36391,
291
291
  "nodeType": "StructuredDocumentation",
292
292
  "src": "794:40:100",
293
293
  "text": "@dev Set new implementation address."
294
294
  },
295
- "id": 36433,
295
+ "id": 36398,
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": 36429,
303
+ "id": 36394,
304
304
  "nodeType": "ParameterList",
305
305
  "parameters": [
306
306
  {
307
307
  "constant": false,
308
- "id": 36428,
308
+ "id": 36393,
309
309
  "mutability": "mutable",
310
310
  "name": "codeAddress",
311
311
  "nameLocation": "874:11:100",
312
312
  "nodeType": "VariableDeclaration",
313
- "scope": 36433,
313
+ "scope": 36398,
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": 36427,
322
+ "id": 36392,
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": 36430,
338
+ "id": 36395,
339
339
  "nodeType": "ParameterList",
340
340
  "parameters": [],
341
341
  "src": "896:0:100"
342
342
  },
343
- "scope": 36434,
343
+ "scope": 36399,
344
344
  "src": "839:228:100",
345
345
  "stateMutability": "nonpayable",
346
346
  "virtual": false,
347
347
  "visibility": "internal"
348
348
  }
349
349
  ],
350
- "scope": 36435,
350
+ "scope": 36400,
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-05T13:57:31.654Z",
363
+ "updatedAt": "2022-05-06T12:43:05.834Z",
364
364
  "devdoc": {
365
365
  "kind": "dev",
366
366
  "methods": {},
@@ -1,5 +1,5 @@
1
1
  FullUpgradableSuperTokenProxy.sol : 635 (23941)
2
- Superfluid.sol : 22163 (2413)
2
+ Superfluid.sol : 22046 (2530)
3
3
  SuperfluidToken.sol : 2 (24574)
4
4
  SuperTokenFactory.sol : 4997 (19579)
5
5
  SuperToken.sol : 18673 (5903)
@@ -8,4 +8,4 @@ AgreementLibrary.sol : 143 (24433)
8
8
  AgreementBase.sol : 2 (24574)
9
9
  ConstantFlowAgreementV1.sol : 21777 (2799)
10
10
  SuperfluidGovernanceBase.sol : 2 (24574)
11
- SuperfluidGovernanceII.sol : 6919 (17657)
11
+ SuperfluidGovernanceII.sol : 6831 (17745)
@@ -111,7 +111,7 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
111
111
  ISuperfluidToken superToken,
112
112
  bytes32 key,
113
113
  address value
114
- )
114
+ )
115
115
  external override
116
116
  {
117
117
  _setConfig(host, superToken, key, value);
@@ -122,7 +122,7 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
122
122
  ISuperfluidToken superToken,
123
123
  bytes32 key,
124
124
  uint256 value
125
- )
125
+ )
126
126
  external override
127
127
  {
128
128
  _setConfig(host, superToken, key, value);
@@ -132,7 +132,7 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
132
132
  ISuperfluid host,
133
133
  ISuperfluidToken superToken,
134
134
  bytes32 key
135
- )
135
+ )
136
136
  external override
137
137
  {
138
138
  _clearConfig(host, superToken, key);
@@ -278,8 +278,8 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
278
278
  returns (uint256 liquidationPeriod, uint256 patricianPeriod)
279
279
  {
280
280
  uint256 pppConfig = getConfigAsUint256(
281
- host,
282
- superToken,
281
+ host,
282
+ superToken,
283
283
  SuperfluidGovernanceConfigs.CFAV1_PPP_CONFIG_KEY
284
284
  );
285
285
  (liquidationPeriod, patricianPeriod) = SuperfluidGovernanceConfigs.decodePPPConfig(pppConfig);
@@ -290,7 +290,7 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
290
290
  ISuperfluidToken superToken,
291
291
  uint256 liquidationPeriod,
292
292
  uint256 patricianPeriod
293
- )
293
+ )
294
294
  public
295
295
  {
296
296
  require(liquidationPeriod > patricianPeriod
@@ -325,8 +325,8 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
325
325
  function getSuperTokenMinimumDeposit(
326
326
  ISuperfluid host,
327
327
  ISuperfluidToken superToken
328
- ) public view
329
- returns (uint256 value)
328
+ ) public view
329
+ returns (uint256 value)
330
330
  {
331
331
  return getConfigAsUint256(host, superToken,
332
332
  SuperfluidGovernanceConfigs.SUPERTOKEN_MINIMUM_DEPOSIT_KEY);
@@ -344,7 +344,7 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
344
344
  function clearSuperTokenMinimumDeposit(
345
345
  ISuperfluid host,
346
346
  ISuperToken superToken
347
- ) public
347
+ ) public
348
348
  {
349
349
  emit SuperTokenMinimumDepositChanged(host, superToken, false, 0);
350
350
  return _clearConfig(host, superToken, SuperfluidGovernanceConfigs.SUPERTOKEN_MINIMUM_DEPOSIT_KEY);
@@ -412,23 +412,6 @@ abstract contract SuperfluidGovernanceBase is ISuperfluidGovernance
412
412
  SuperfluidGovernanceConfigs.getTrustedForwarderConfigKey(forwarder));
413
413
  }
414
414
 
415
- /**
416
- * @dev Whitelist a new app using a onetime key
417
- * @param key is a deployer specific hash key which can be used once to register an app
418
- *
419
- * NOTE:
420
- * To generate the key, use the SuperfluidGovernanceConfigs.getAppRegistrationConfigKey
421
- * offchain.
422
- */
423
- function whiteListNewApp(
424
- ISuperfluid host,
425
- bytes32 key
426
- )
427
- external
428
- {
429
- _setConfig(host, ISuperfluidToken(address(0)), key, 1);
430
- }
431
-
432
415
  /**
433
416
  * @dev tells if the given factory is authorized to register apps
434
417
  */
@@ -44,8 +44,8 @@ contract SuperfluidUpgradabilityTester is Superfluid {
44
44
  assembly { slot:= _ctxStamp.slot offset := _ctxStamp.offset }
45
45
  require(slot == 6 && offset == 0, "_ctxStamp changed location");
46
46
 
47
- assembly { slot:= _appKeysUsed.slot offset := _appKeysUsed.offset }
48
- require(slot == 7 && offset == 0, "_appKeysUsed changed location");
47
+ assembly { slot:= _appKeysUsedDeprecated.slot offset := _appKeysUsedDeprecated.offset }
48
+ require(slot == 7 && offset == 0, "_appKeysUsedDeprecated changed location");
49
49
  }
50
50
 
51
51
  // @dev Make sure the context struct layout never change over the course of the development
@@ -90,7 +90,7 @@ contract Superfluid is
90
90
  /// zero before transaction finishes
91
91
  bytes32 internal _ctxStamp;
92
92
  /// @dev if app whitelisting is enabled, this is to make sure the keys are used only once
93
- mapping(bytes32 => bool) internal _appKeysUsed;
93
+ mapping(bytes32 => bool) internal _appKeysUsedDeprecated;
94
94
 
95
95
  constructor(bool nonUpgradable, bool appWhiteListingEnabled) {
96
96
  NON_UPGRADABLE_DEPLOYMENT = nonUpgradable;
@@ -315,21 +315,16 @@ contract Superfluid is
315
315
  tx.origin,
316
316
  registrationKey
317
317
  );
318
- // check if the key is enabled
318
+ // check if the key is valid and not expired
319
319
  require(
320
320
  _gov.getConfigAsUint256(
321
321
  this,
322
322
  ISuperfluidToken(address(0)),
323
323
  configKey
324
- ) == 1,
325
- "SF: invalid registration key"
324
+ // solhint-disable-next-line not-rely-on-time
325
+ ) >= block.timestamp,
326
+ "SF: invalid or expired registration key"
326
327
  );
327
- require(
328
- !_appKeysUsed[configKey],
329
- "SF: registration key already used"
330
- );
331
- // clear the key so that it can't be reused
332
- _appKeysUsed[configKey] = true;
333
328
  _registerApp(configWord, ISuperApp(msg.sender), true);
334
329
  }
335
330
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfluid-finance/ethereum-contracts",
3
- "version": "1.2.2-dev.a4c583c.0",
3
+ "version": "1.2.2-dev.ec379f7.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": {
@@ -6,6 +6,8 @@ const {
6
6
  sendGovernanceAction,
7
7
  } = require("./libs/common");
8
8
 
9
+ const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
10
+
9
11
  /**
10
12
  * @dev Create a new super app registration key.
11
13
  * @param {Array} argv Overriding command line arguments
@@ -14,7 +16,13 @@ const {
14
16
  * @param {Address} options.from Address to deploy contracts from
15
17
  * @param {boolean} options.protocolReleaseVersion Specify the protocol release version to be used
16
18
  *
17
- * Usage: npx truffle exec scripts/create-new-app-registration-key.js : {DEPLOYER} {REGISTRATION_KEY}
19
+ * Note: the key itself doesn't have much meaning, it could be "stolen" from a broadcast tx anyway.
20
+ * But since it's bound to a deployer address, that doesn't really matter.
21
+ *
22
+ * Usage: npx truffle exec scripts/create-new-app-registration-key.js : {DEPLOYER} {REGISTRATION_KEY} [EXPIRATION_TS]
23
+ * EXPIRATION_TS is a Unix timestamp in seconds for when the key should expire.
24
+ * If not set, we default to 90 days in the future.
25
+ * Hint: you may use https://www.unixtimestamp.com/ to calculate a timestamp
18
26
  */
19
27
  module.exports = eval(`(${S.toString()})({
20
28
  doNotPrintColonArgs: true
@@ -22,9 +30,20 @@ module.exports = eval(`(${S.toString()})({
22
30
  console.log("======== Creating new app registration key ========");
23
31
  let {protocolReleaseVersion} = options;
24
32
 
25
- if (args.length !== 2) {
33
+ if (args.length > 3 || args.length < 2) {
26
34
  throw new Error("Wrong number of arguments");
27
35
  }
36
+
37
+ let expirationTs = Math.floor(Date.now() / 1000) + 3600 * 24 * 90; // 90 days from now
38
+ if (args.length === 3) {
39
+ const expTsStr = args.pop();
40
+ const parsedExpTs = parseInt(expTsStr);
41
+ if (parsedExpTs.toString() !== expTsStr) {
42
+ throw new Error("EXPIRATON_TS not an integer");
43
+ }
44
+ expirationTs = parsedExpTs;
45
+ console.log("Expiration timestamp", expirationTs);
46
+ }
28
47
  const registrationkey = args.pop();
29
48
  const deployer = args.pop();
30
49
  console.log("Deployer", deployer);
@@ -54,8 +73,12 @@ module.exports = eval(`(${S.toString()})({
54
73
  )
55
74
  );
56
75
  console.log("App key", appKey);
76
+ console.log("Expiration date", new Date(expirationTs * 1000)); // print human readable
57
77
 
78
+ // Note that we are NOT using gov.whiteListNewApp here, because it doesn't support setting
79
+ // an expiration date and will eventually be deprecated.
80
+ // Instead we use the lower level setConfig directly.
58
81
  await sendGovernanceAction(sf, (gov) =>
59
- gov.whiteListNewApp(sf.host.address, appKey)
82
+ gov.setConfig(sf.host.address, ZERO_ADDRESS, appKey, expirationTs)
60
83
  );
61
84
  });