@superfluid-finance/ethereum-contracts 1.3.2-dev.75a0001.0 → 1.3.2-dev.bf84335.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 (117) 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 +9 -9
  5. package/build/contracts/AgreementLibrary.json +4 -4
  6. package/build/contracts/BaseRelayRecipient.json +1 -1
  7. package/build/contracts/BatchLiquidator.json +1046 -1046
  8. package/build/contracts/BatchOperation.json +530 -530
  9. package/build/contracts/CFAv1Library.json +4 -4
  10. package/build/contracts/CallUtils.json +1 -1
  11. package/build/contracts/ClosingOnUpdateFlowTestApp.json +1575 -1575
  12. package/build/contracts/ConstantFlowAgreementV1.json +6639 -6639
  13. package/build/contracts/Context.json +1 -1
  14. package/build/contracts/ContextDefinitions.json +530 -530
  15. package/build/contracts/Create2.json +1 -1
  16. package/build/contracts/CustomSuperTokenBase.json +2 -2
  17. package/build/contracts/ERC165.json +1 -1
  18. package/build/contracts/ERC1820Implementer.json +79 -79
  19. package/build/contracts/ERC1820RegistryCompiled.json +1 -1
  20. package/build/contracts/ERC20.json +1008 -1008
  21. package/build/contracts/ERC20Burnable.json +1 -1
  22. package/build/contracts/ERC20Pausable.json +1 -1
  23. package/build/contracts/ERC20PresetMinterPauser.json +1816 -1816
  24. package/build/contracts/ERC20WithTokenInfo.json +1 -1
  25. package/build/contracts/ERC777Helper.json +1 -1
  26. package/build/contracts/ERC777RecipientDrainingGas.json +354 -354
  27. package/build/contracts/ERC777RecipientReverting.json +377 -377
  28. package/build/contracts/EnumerableSet.json +1 -1
  29. package/build/contracts/EventsEmitter.json +1 -1
  30. package/build/contracts/ExclusiveInflowTestApp.json +1603 -1603
  31. package/build/contracts/FixedSizeData.json +1 -1
  32. package/build/contracts/FlowExchangeTestApp.json +1713 -1713
  33. package/build/contracts/FlowOperatorDefinitions.json +530 -530
  34. package/build/contracts/FullUpgradableSuperTokenProxy.json +306 -306
  35. package/build/contracts/IAccessControl.json +1 -1
  36. package/build/contracts/IAccessControlEnumerable.json +1 -1
  37. package/build/contracts/IConstantFlowAgreementV1.json +1 -1
  38. package/build/contracts/IDAv1Library.json +4 -4
  39. package/build/contracts/IERC165.json +1 -1
  40. package/build/contracts/IERC1820Implementer.json +1 -1
  41. package/build/contracts/IERC1820Registry.json +1 -1
  42. package/build/contracts/IERC20.json +1 -1
  43. package/build/contracts/IERC20Metadata.json +1 -1
  44. package/build/contracts/IERC20Permit.json +1 -1
  45. package/build/contracts/IERC777.json +1 -1
  46. package/build/contracts/IERC777Recipient.json +1 -1
  47. package/build/contracts/IERC777Sender.json +1 -1
  48. package/build/contracts/IInstantDistributionAgreementV1.json +1 -1
  49. package/build/contracts/IMaticBridgedNativeSuperToken.json +2 -2
  50. package/build/contracts/IMaticBridgedNativeSuperTokenCustom.json +2 -2
  51. package/build/contracts/IMultiSigWallet.json +1 -1
  52. package/build/contracts/IPureSuperToken.json +2 -2
  53. package/build/contracts/IPureSuperTokenCustom.json +2 -2
  54. package/build/contracts/IRelayRecipient.json +1 -1
  55. package/build/contracts/IResolver.json +1 -1
  56. package/build/contracts/ISETH.json +2 -2
  57. package/build/contracts/ISETHCustom.json +2 -2
  58. package/build/contracts/ISuperAgreement.json +1 -1
  59. package/build/contracts/ISuperApp.json +2 -2
  60. package/build/contracts/ISuperToken.json +2 -2
  61. package/build/contracts/ISuperTokenFactory.json +2 -2
  62. package/build/contracts/ISuperfluid.json +369 -369
  63. package/build/contracts/ISuperfluidGovernance.json +2 -2
  64. package/build/contracts/ISuperfluidToken.json +1 -1
  65. package/build/contracts/ITOGAv1.json +2144 -2144
  66. package/build/contracts/ITOGAv2.json +2144 -2144
  67. package/build/contracts/Initializable.json +1 -1
  68. package/build/contracts/InstantDistributionAgreementV1.json +5430 -5430
  69. package/build/contracts/MaticBridgedNativeSuperTokenProxy.json +971 -971
  70. package/build/contracts/NonClosableOutflowTestApp.json +1478 -1478
  71. package/build/contracts/Ownable.json +1 -1
  72. package/build/contracts/Pausable.json +1 -1
  73. package/build/contracts/Proxy.json +1 -1
  74. package/build/contracts/PureSuperToken.json +694 -694
  75. package/build/contracts/Resolver.json +1058 -1058
  76. package/build/contracts/SETHProxy.json +661 -661
  77. package/build/contracts/SafeCast.json +1 -1
  78. package/build/contracts/SafeERC20.json +1 -1
  79. package/build/contracts/SafeMath.json +1 -1
  80. package/build/contracts/SelfDeletingFlowTestApp.json +1575 -1575
  81. package/build/contracts/SlotsBitmapLibrary.json +973 -973
  82. package/build/contracts/StreamRedirector.json +16865 -0
  83. package/build/contracts/Strings.json +1 -1
  84. package/build/contracts/SuperAppBase.json +2 -2
  85. package/build/contracts/SuperAppDefinitions.json +530 -530
  86. package/build/contracts/SuperToken.json +9089 -9089
  87. package/build/contracts/SuperTokenFactory.json +2116 -2116
  88. package/build/contracts/SuperTokenFactoryBase.json +1012 -1012
  89. package/build/contracts/SuperTokenFactoryHelper.json +1118 -1118
  90. package/build/contracts/SuperUpgrader.json +2495 -2495
  91. package/build/contracts/Superfluid.json +13443 -13590
  92. package/build/contracts/SuperfluidFrameworkDeployer.json +2423 -2423
  93. package/build/contracts/SuperfluidGovernanceBase.json +21 -21
  94. package/build/contracts/SuperfluidGovernanceConfigs.json +530 -530
  95. package/build/contracts/SuperfluidGovernanceII.json +2080 -2080
  96. package/build/contracts/SuperfluidGovernanceIIProxy.json +227 -227
  97. package/build/contracts/SuperfluidLoader.json +752 -752
  98. package/build/contracts/SuperfluidToken.json +2293 -2293
  99. package/build/contracts/TOGA.json +4121 -4121
  100. package/build/contracts/TestGovernance.json +2402 -2402
  101. package/build/contracts/TestToken.json +1254 -1254
  102. package/build/contracts/TokenCustodian.json +903 -903
  103. package/build/contracts/TokenInfo.json +1 -1
  104. package/build/contracts/UUPSProxiable.json +247 -247
  105. package/build/contracts/UUPSProxy.json +257 -257
  106. package/build/contracts/UUPSUtils.json +85 -85
  107. package/build/contracts-sizes.txt +1 -1
  108. package/contracts/agreements/ConstantFlowAgreementV1.sol +1 -1
  109. package/contracts/interfaces/superfluid/Definitions.sol +6 -6
  110. package/contracts/interfaces/superfluid/ISuperfluid.sol +4 -4
  111. package/contracts/mocks/AgreementMock.sol +2 -2
  112. package/contracts/mocks/StreamRedirector.sol +179 -0
  113. package/contracts/mocks/SuperAppMocks.sol +3 -4
  114. package/contracts/mocks/SuperfluidMock.sol +2 -2
  115. package/contracts/superfluid/Superfluid.sol +20 -15
  116. package/package.json +3 -3
  117. package/scripts/deploy-test-token.js +7 -3
@@ -0,0 +1,179 @@
1
+ // SPDX-License-Identifier: AGPLv3
2
+ pragma solidity 0.8.14;
3
+
4
+ import { ISuperfluid, ISuperToken, SuperAppBase, ISuperApp, SuperAppDefinitions } from "../apps/SuperAppBase.sol";
5
+ import { CFAv1Library } from "../apps/CFAv1Library.sol";
6
+ import { IConstantFlowAgreementV1 } from "../interfaces/agreements/IConstantFlowAgreementV1.sol";
7
+ import { ISuperAgreement } from "../interfaces/superfluid/ISuperfluid.sol";
8
+
9
+ contract StreamRedirector is SuperAppBase {
10
+ using CFAv1Library for CFAv1Library.InitData;
11
+ CFAv1Library.InitData public cfaV1;
12
+ ISuperfluid public host;
13
+ bytes32 public constant CFA_ID =
14
+ keccak256("org.superfluid-finance.agreements.ConstantFlowAgreement.v1");
15
+ address public receiver; // flow is redirected to hardcoded receiver address
16
+ ISuperToken public token; // accepted super token
17
+
18
+ constructor(
19
+ ISuperfluid _host,
20
+ ISuperToken _token,
21
+ address _receiver,
22
+ uint256 _appLevel
23
+ ) {
24
+ assert(address(_token) != address(0));
25
+ assert(address(_receiver) != address(0));
26
+ assert(address(_host) != address(0));
27
+
28
+ host = _host;
29
+
30
+ cfaV1 = CFAv1Library.InitData(
31
+ host,
32
+ IConstantFlowAgreementV1(address(host.getAgreementClass(CFA_ID)))
33
+ );
34
+
35
+ uint256 configWord = _appLevel |
36
+ SuperAppDefinitions.BEFORE_AGREEMENT_CREATED_NOOP |
37
+ SuperAppDefinitions.BEFORE_AGREEMENT_TERMINATED_NOOP;
38
+
39
+ token = _token;
40
+ receiver = _receiver;
41
+
42
+ host.registerAppWithKey(configWord, "");
43
+ }
44
+
45
+ /**
46
+ * Custom Errors
47
+ */
48
+ error OnlyHost();
49
+ error OnlyCFA();
50
+ error UnsupportedToken();
51
+
52
+ /**
53
+ * Creates a stream from an _originAccount who has granted this SuperApp ACL permissions
54
+ * to this SuperApp.
55
+ * @param _originAccount ACL permissions granter
56
+ * @param _flowRate desired flow rate
57
+ */
58
+ function startStreamToSelf(address _originAccount, int96 _flowRate) public {
59
+ cfaV1.createFlowByOperator(
60
+ _originAccount,
61
+ address(this),
62
+ token,
63
+ _flowRate
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Terminates a stream from an _originAccount who has granted this SuperApp ACL permissions
69
+ * @param _originAccount ACL permissions granter
70
+ */
71
+ function stopStreamToSelf(address _originAccount) public {
72
+ cfaV1.deleteFlowByOperator(_originAccount, address(this), token);
73
+ }
74
+
75
+ /**
76
+ * Creates a stream from this Super App to another SuperApp.
77
+ * @param _superApp the targeted super app
78
+ * @param _flowRate desired flow rate
79
+ */
80
+ function startStreamToSuperApp(address _superApp, int96 _flowRate) public {
81
+ cfaV1.createFlow(_superApp, token, _flowRate);
82
+ }
83
+
84
+ /**
85
+ * Delete a stream from sender to receiver.
86
+ * @param _sender the sender super app
87
+ * @param _receiver the receiver super app
88
+ */
89
+ function stopStreamToSuperApp(address _sender, address _receiver) public {
90
+ cfaV1.deleteFlow(_sender, _receiver, token);
91
+ }
92
+
93
+ /**
94
+ * A callback which occurs after CF agreement creation which redirects a stream.
95
+ */
96
+ function afterAgreementCreated(
97
+ ISuperToken _superToken,
98
+ address _agreementClass,
99
+ bytes32, // agreementId,
100
+ bytes calldata, // agreementData,
101
+ bytes calldata, // cbdata,
102
+ bytes calldata _ctx
103
+ )
104
+ external
105
+ override
106
+ onlyHost
107
+ onlySupportedSuperToken(_superToken)
108
+ onlyCFA(_agreementClass)
109
+ returns (bytes memory newCtx)
110
+ {
111
+ newCtx = _ctx;
112
+ int96 netFlowRate = cfaV1.cfa.getNetFlow(_superToken, address(this));
113
+ newCtx = cfaV1.createFlowWithCtx(
114
+ newCtx,
115
+ receiver,
116
+ _superToken,
117
+ netFlowRate
118
+ );
119
+ }
120
+
121
+ function afterAgreementTerminated(
122
+ ISuperToken _superToken,
123
+ address _agreementClass,
124
+ bytes32, // _agreementId,
125
+ bytes calldata, // calldata _agreementData,
126
+ bytes calldata, // calldata _cbdata,
127
+ bytes calldata _ctx
128
+ ) external override onlyHost returns (bytes memory newCtx) {
129
+ if (!_isCFAv1(_agreementClass) || address(_superToken) != address(token)) {
130
+ return _ctx;
131
+ }
132
+
133
+ newCtx = _ctx;
134
+ (, int96 currentFlowRate, , ) = cfaV1.cfa.getFlow(
135
+ _superToken,
136
+ address(this),
137
+ receiver
138
+ );
139
+
140
+ if (currentFlowRate > 0) {
141
+ newCtx = cfaV1.deleteFlowWithCtx(
142
+ newCtx,
143
+ address(this),
144
+ receiver,
145
+ _superToken
146
+ );
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Alleviates the composite app rule by allowing this app to call
152
+ * the target app.
153
+ * @param _targetApp address of the target super app, should be initialized with final_level
154
+ */
155
+ function allowCompositeApp(address _targetApp) public {
156
+ host.allowCompositeApp(ISuperApp(_targetApp));
157
+ }
158
+
159
+ function _isCFAv1(address agreementClass) private view returns (bool) {
160
+ return ISuperAgreement(agreementClass).agreementType() == CFA_ID;
161
+ }
162
+
163
+ /**
164
+ * Modifiers
165
+ */
166
+ modifier onlyHost() {
167
+ if (msg.sender != address(host)) revert OnlyHost();
168
+ _;
169
+ }
170
+ modifier onlySupportedSuperToken(ISuperToken _superToken) {
171
+ if (address(_superToken) != address(token)) revert UnsupportedToken();
172
+ _;
173
+ }
174
+
175
+ modifier onlyCFA(address agreementClass) {
176
+ if (!_isCFAv1(agreementClass)) revert OnlyCFA();
177
+ _;
178
+ }
179
+ }
@@ -10,7 +10,6 @@ import {
10
10
  } from "../superfluid/Superfluid.sol";
11
11
  import { AgreementMock } from "./AgreementMock.sol";
12
12
 
13
-
14
13
  contract SuperAppMockAux {
15
14
 
16
15
  function actionPingAgreement(ISuperfluid host, AgreementMock agreement, uint256 ping, bytes calldata ctx)
@@ -78,7 +77,7 @@ contract SuperAppMock is ISuperApp {
78
77
  function actionNoop(bytes calldata ctx) external requireValidCtx(ctx) returns (bytes memory newCtx) {
79
78
  ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
80
79
  emit NoopEvent(
81
- context.appLevel,
80
+ context.appCallbackLevel,
82
81
  context.callType,
83
82
  context.agreementSelector);
84
83
  return ctx;
@@ -92,7 +91,7 @@ contract SuperAppMock is ISuperApp {
92
91
  ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
93
92
  assert(context.msgSender == expectedMsgSender);
94
93
  emit NoopEvent(
95
- context.appLevel,
94
+ context.appCallbackLevel,
96
95
  context.callType,
97
96
  context.agreementSelector);
98
97
  return ctx;
@@ -326,7 +325,7 @@ contract SuperAppMock is ISuperApp {
326
325
  ISuperfluid.Context memory context = ISuperfluid(msg.sender).decodeCtx(ctx);
327
326
  if (_nextCallbackAction.actionType == NextCallbackActionType.Noop) {
328
327
  emit NoopEvent(
329
- context.appLevel,
328
+ context.appCallbackLevel,
330
329
  context.callType,
331
330
  context.agreementSelector);
332
331
  return ctx;
@@ -52,11 +52,11 @@ contract SuperfluidUpgradabilityTester is Superfluid {
52
52
  function validateContextStructLayout()
53
53
  external pure
54
54
  {
55
- // context.appLevel
55
+ // context.appCallbackLevel
56
56
  {
57
57
  Context memory context;
58
58
  assembly { mstore(add(context, mul(32, 0)), 42) }
59
- require(context.appLevel == 42, "appLevel changed location");
59
+ require(context.appCallbackLevel == 42, "appLevel changed location");
60
60
  }
61
61
  // context.callType
62
62
  {
@@ -62,7 +62,7 @@ contract Superfluid is
62
62
  * will not be able to call other app.
63
63
  */
64
64
  // solhint-disable-next-line var-name-mixedcase
65
- uint immutable public MAX_APP_LEVEL = 1;
65
+ uint immutable public MAX_APP_CALLBACK_LEVEL = 1;
66
66
 
67
67
  // solhint-disable-next-line var-name-mixedcase
68
68
  uint64 immutable public CALLBACK_GAS_LIMIT = 3000000;
@@ -370,7 +370,7 @@ contract Superfluid is
370
370
  }
371
371
  require(
372
372
  SuperAppDefinitions.isConfigWordClean(configWord) &&
373
- SuperAppDefinitions.getAppLevel(configWord) > 0 &&
373
+ SuperAppDefinitions.getAppCallbackLevel(configWord) > 0 &&
374
374
  (configWord & SuperAppDefinitions.APP_JAIL_BIT) == 0,
375
375
  "SF: invalid config word");
376
376
  require(_appManifests[ISuperApp(app)].configWord == 0 , "SF: app already registered");
@@ -382,8 +382,8 @@ contract Superfluid is
382
382
  return _appManifests[app].configWord > 0;
383
383
  }
384
384
 
385
- function getAppLevel(ISuperApp appAddr) public override view returns(uint8) {
386
- return SuperAppDefinitions.getAppLevel(_appManifests[appAddr].configWord);
385
+ function getAppCallbackLevel(ISuperApp appAddr) public override view returns(uint8) {
386
+ return SuperAppDefinitions.getAppCallbackLevel(_appManifests[appAddr].configWord);
387
387
  }
388
388
 
389
389
  function getAppManifest(
@@ -421,7 +421,10 @@ contract Superfluid is
421
421
  ISuperApp sourceApp = ISuperApp(msg.sender);
422
422
  require(isApp(sourceApp), "SF: sender is not an app");
423
423
  require(isApp(targetApp), "SF: target is not an app");
424
- require(getAppLevel(sourceApp) > getAppLevel(targetApp), "SF: source app should have higher app level");
424
+ require(
425
+ getAppCallbackLevel(sourceApp) > getAppCallbackLevel(targetApp),
426
+ "SF: source app should have higher app level"
427
+ );
425
428
  _compositeApps[ISuperApp(msg.sender)][targetApp] = true;
426
429
  }
427
430
 
@@ -514,11 +517,13 @@ contract Superfluid is
514
517
  returns (bytes memory appCtx)
515
518
  {
516
519
  Context memory context = decodeCtx(ctx);
517
- if (isApp(ISuperApp(context.msgSender))) {
520
+ // NOTE: we use 1 as a magic number here as we want to do this check once we are in a callback
521
+ // we use 1 instead of MAX_APP_CALLBACK_LEVEL because 1 captures what we are trying to enforce
522
+ if (isApp(ISuperApp(context.msgSender)) && context.appCallbackLevel >= 1) {
518
523
  require(_compositeApps[ISuperApp(context.msgSender)][app],
519
524
  "SF: APP_RULE_COMPOSITE_APP_IS_NOT_WHITELISTED");
520
525
  }
521
- context.appLevel++;
526
+ context.appCallbackLevel++;
522
527
  context.callType = ContextDefinitions.CALL_INFO_CALL_TYPE_APP_CALLBACK;
523
528
  context.appAllowanceGranted = appAllowanceGranted;
524
529
  context.appAllowanceWanted = 0;
@@ -588,12 +593,12 @@ contract Superfluid is
588
593
  isAgreement(agreementClass)
589
594
  returns(bytes memory returnedData)
590
595
  {
591
- // beaware of the endiness
596
+ // beware of the endianness
592
597
  bytes4 agreementSelector = CallUtils.parseSelector(callData);
593
598
 
594
599
  //Build context data
595
- bytes memory ctx = _updateContext(Context({
596
- appLevel: isApp(ISuperApp(msgSender)) ? 1 : 0,
600
+ bytes memory ctx = _updateContext(Context({
601
+ appCallbackLevel: 0,
597
602
  callType: ContextDefinitions.CALL_INFO_CALL_TYPE_AGREEMENT,
598
603
  timestamp: getNow(),
599
604
  msgSender: msgSender,
@@ -636,9 +641,9 @@ contract Superfluid is
636
641
  isValidAppAction(callData)
637
642
  returns(bytes memory returnedData)
638
643
  {
639
- //Build context data
644
+ // Build context data
640
645
  bytes memory ctx = _updateContext(Context({
641
- appLevel: isApp(ISuperApp(msgSender)) ? 1 : 0,
646
+ appCallbackLevel: 0,
642
647
  callType: ContextDefinitions.CALL_INFO_CALL_TYPE_APP_ACTION,
643
648
  timestamp: getNow(),
644
649
  msgSender: msgSender,
@@ -861,8 +866,8 @@ contract Superfluid is
861
866
  private
862
867
  returns (bytes memory ctx)
863
868
  {
864
- require(context.appLevel <= MAX_APP_LEVEL, "SF: APP_RULE_MAX_APP_LEVEL_REACHED");
865
- uint256 callInfo = ContextDefinitions.encodeCallInfo(context.appLevel, context.callType);
869
+ require(context.appCallbackLevel <= MAX_APP_CALLBACK_LEVEL, "SF: APP_RULE_MAX_APP_LEVEL_REACHED");
870
+ uint256 callInfo = ContextDefinitions.encodeCallInfo(context.appCallbackLevel, context.callType);
866
871
  uint256 allowanceIO =
867
872
  context.appAllowanceGranted.toUint128() |
868
873
  (uint256(context.appAllowanceWanted.toUint128()) << 128);
@@ -906,7 +911,7 @@ contract Superfluid is
906
911
  address,
907
912
  bytes4,
908
913
  bytes));
909
- (context.appLevel, context.callType) = ContextDefinitions.decodeCallInfo(callInfo);
914
+ (context.appCallbackLevel, context.callType) = ContextDefinitions.decodeCallInfo(callInfo);
910
915
  }
911
916
  {
912
917
  uint256 allowanceIO;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfluid-finance/ethereum-contracts",
3
- "version": "1.3.2-dev.75a0001.0",
3
+ "version": "1.3.2-dev.bf84335.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": {
@@ -36,7 +36,7 @@
36
36
  "testenv:deploy": "yarn run-truffle exec scripts/deploy-test-environment.js : TEST",
37
37
  "pretest": "{ yarn testenv:start > /dev/null& } && sleep 5",
38
38
  "test": "run-s test:*:*",
39
- "test:contracts:hardhat": "yarn run-hardhat test testsuites/all-contracts.js --parallel",
39
+ "test:contracts:hardhat": "yarn run-hardhat test testsuites/all-contracts.js",
40
40
  "test:contracts:foundry": "yarn run-forge test --hardhat",
41
41
  "test:contracts:solc-0.8.0-compatibility": "test/test-solc-0.8.0-compatibility.sh",
42
42
  "test:deployment:scripts-js-hardhat": "yarn run-hardhat test test/scripts/deployment.test.js",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "@decentral.ee/web3-helpers": "0.5.3",
59
59
  "@openzeppelin/contracts": "4.7.0",
60
- "@superfluid-finance/js-sdk": "^0.6.3-dev.75a0001.0",
60
+ "@superfluid-finance/js-sdk": "^0.6.3-dev.bf84335.0",
61
61
  "@truffle/contract": "4.5.15",
62
62
  "ethereumjs-tx": "2.1.2",
63
63
  "ethereumjs-util": "7.1.5",
@@ -16,7 +16,7 @@ const {
16
16
  * @param {Address} options.from Address to deploy contracts from
17
17
  * @param {boolean} options.resetToken Reset the token deployment
18
18
  *
19
- * Usage: npx truffle exec scripts/deploy-test-token.js : {TOKEN_SYMBOL}
19
+ * Usage: npx truffle exec scripts/deploy-test-token.js : {TOKEN_DECIMALS} {TOKEN_SYMBOL}
20
20
  */
21
21
  module.exports = eval(`(${S.toString()})()`)(async function (
22
22
  args,
@@ -25,11 +25,15 @@ module.exports = eval(`(${S.toString()})()`)(async function (
25
25
  console.log("======== Deploying test token ========");
26
26
  let {resetToken} = options;
27
27
 
28
- if (args.length !== 1) {
28
+ // > 2 because decimals is an optional field
29
+ // symbol should be required though
30
+ if (args.length > 2 || args.length < 1) {
29
31
  throw new Error("Wrong number of arguments");
30
32
  }
31
33
  const tokenSymbol = args.pop();
32
34
  console.log("Token symbol", tokenSymbol);
35
+ const tokenDecimals = args.pop() || 18;
36
+ console.log("Token decimals", tokenDecimals);
33
37
 
34
38
  resetToken = resetToken || !!process.env.RESET_TOKEN;
35
39
  console.log("reset token: ", resetToken);
@@ -62,7 +66,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
62
66
  const testToken = await web3tx(TestToken.new, "TestToken.new")(
63
67
  tokenSymbol + " Fake Token",
64
68
  tokenSymbol,
65
- 18
69
+ tokenDecimals
66
70
  );
67
71
  testTokenAddress = testToken.address;
68
72
  await web3tx(resolver.set, `Resolver set ${name}`)(