@superfluid-finance/ethereum-contracts 1.3.1-dev.b8455ea.0 → 1.3.1-dev.ff4f866.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 +1 -1
  5. package/build/contracts/AgreementLibrary.json +1 -1
  6. package/build/contracts/BaseRelayRecipient.json +1 -1
  7. package/build/contracts/BatchLiquidator.json +1 -1
  8. package/build/contracts/BatchOperation.json +1 -1
  9. package/build/contracts/CFAv1Library.json +1 -1
  10. package/build/contracts/CallUtils.json +1 -1
  11. package/build/contracts/ClosingOnUpdateFlowTestApp.json +1 -1
  12. package/build/contracts/ConstantFlowAgreementV1.json +1 -1
  13. package/build/contracts/Context.json +1 -1
  14. package/build/contracts/ContextDefinitions.json +1 -1
  15. package/build/contracts/Create2.json +1 -1
  16. package/build/contracts/CustomSuperTokenBase.json +1 -1
  17. package/build/contracts/ERC165.json +1 -1
  18. package/build/contracts/ERC1820Implementer.json +1 -1
  19. package/build/contracts/ERC1820RegistryCompiled.json +1 -1
  20. package/build/contracts/ERC20.json +1 -1
  21. package/build/contracts/ERC20Burnable.json +1 -1
  22. package/build/contracts/ERC20Pausable.json +1 -1
  23. package/build/contracts/ERC20PresetMinterPauser.json +1 -1
  24. package/build/contracts/ERC20WithTokenInfo.json +1 -1
  25. package/build/contracts/ERC777Helper.json +1 -1
  26. package/build/contracts/ERC777RecipientDrainingGas.json +1 -1
  27. package/build/contracts/ERC777RecipientReverting.json +1 -1
  28. package/build/contracts/EnumerableSet.json +1 -1
  29. package/build/contracts/EventsEmitter.json +1 -1
  30. package/build/contracts/ExclusiveInflowTestApp.json +1 -1
  31. package/build/contracts/FixedSizeData.json +1 -1
  32. package/build/contracts/FlowExchangeTestApp.json +1 -1
  33. package/build/contracts/FlowOperatorDefinitions.json +1 -1
  34. package/build/contracts/FullUpgradableSuperTokenProxy.json +1 -1
  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 +1 -1
  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/IERC777.json +1 -1
  45. package/build/contracts/IERC777Recipient.json +1 -1
  46. package/build/contracts/IERC777Sender.json +1 -1
  47. package/build/contracts/IInstantDistributionAgreementV1.json +1 -1
  48. package/build/contracts/IMaticBridgedNativeSuperToken.json +1 -1
  49. package/build/contracts/IMaticBridgedNativeSuperTokenCustom.json +1 -1
  50. package/build/contracts/IMultiSigWallet.json +1 -1
  51. package/build/contracts/IPureSuperToken.json +1 -1
  52. package/build/contracts/IPureSuperTokenCustom.json +1 -1
  53. package/build/contracts/IRelayRecipient.json +1 -1
  54. package/build/contracts/IResolver.json +1 -1
  55. package/build/contracts/ISETH.json +1 -1
  56. package/build/contracts/ISETHCustom.json +1 -1
  57. package/build/contracts/ISuperAgreement.json +1 -1
  58. package/build/contracts/ISuperApp.json +1 -1
  59. package/build/contracts/ISuperToken.json +1 -1
  60. package/build/contracts/ISuperTokenFactory.json +1 -1
  61. package/build/contracts/ISuperfluid.json +1 -1
  62. package/build/contracts/ISuperfluidGovernance.json +1 -1
  63. package/build/contracts/ISuperfluidToken.json +1 -1
  64. package/build/contracts/ITOGAv1.json +1 -1
  65. package/build/contracts/ITOGAv2.json +1 -1
  66. package/build/contracts/Initializable.json +1 -1
  67. package/build/contracts/InstantDistributionAgreementV1.json +1 -1
  68. package/build/contracts/MaticBridgedNativeSuperTokenProxy.json +1 -1
  69. package/build/contracts/NonClosableOutflowTestApp.json +1 -1
  70. package/build/contracts/Ownable.json +1 -1
  71. package/build/contracts/Pausable.json +1 -1
  72. package/build/contracts/Proxy.json +1 -1
  73. package/build/contracts/PureSuperToken.json +1 -1
  74. package/build/contracts/Resolver.json +1 -1
  75. package/build/contracts/SETHProxy.json +1 -1
  76. package/build/contracts/SafeCast.json +1 -1
  77. package/build/contracts/SafeERC20.json +1 -1
  78. package/build/contracts/SafeMath.json +1 -1
  79. package/build/contracts/SelfDeletingFlowTestApp.json +1 -1
  80. package/build/contracts/SlotsBitmapLibrary.json +1 -1
  81. package/build/contracts/Strings.json +1 -1
  82. package/build/contracts/SuperAppBase.json +1 -1
  83. package/build/contracts/SuperAppDefinitions.json +1 -1
  84. package/build/contracts/SuperToken.json +1 -1
  85. package/build/contracts/SuperTokenFactory.json +1 -1
  86. package/build/contracts/SuperTokenFactoryBase.json +1 -1
  87. package/build/contracts/SuperTokenFactoryHelper.json +1 -1
  88. package/build/contracts/SuperUpgrader.json +1 -1
  89. package/build/contracts/Superfluid.json +1 -1
  90. package/build/contracts/SuperfluidFrameworkDeployer.json +1 -1
  91. package/build/contracts/SuperfluidGovernanceBase.json +1 -1
  92. package/build/contracts/SuperfluidGovernanceConfigs.json +1 -1
  93. package/build/contracts/SuperfluidGovernanceII.json +1 -1
  94. package/build/contracts/SuperfluidGovernanceIIProxy.json +1 -1
  95. package/build/contracts/SuperfluidLoader.json +1 -1
  96. package/build/contracts/SuperfluidToken.json +1 -1
  97. package/build/contracts/TOGA.json +1 -1
  98. package/build/contracts/TestGovernance.json +1 -1
  99. package/build/contracts/TestToken.json +1 -1
  100. package/build/contracts/TokenCustodian.json +1 -1
  101. package/build/contracts/TokenInfo.json +1 -1
  102. package/build/contracts/UUPSProxiable.json +1 -1
  103. package/build/contracts/UUPSProxy.json +1 -1
  104. package/build/contracts/UUPSUtils.json +1 -1
  105. package/build/contracts-sizes.txt +3 -3
  106. package/package.json +2 -2
  107. package/scripts/deploy-framework.js +5 -5
  108. package/scripts/deploy-super-token.js +13 -4
  109. package/scripts/gov-create-new-app-registration-key.js +2 -1
  110. package/scripts/gov-create-new-factory-registration.js +1 -1
  111. package/scripts/gov-set-trusted-forwarder.js +77 -0
  112. package/scripts/info-show-protocol.js +28 -12
  113. package/scripts/libs/getConfig.js +21 -3
  114. package/scripts/resolver-list-super-token.js +1 -0
  115. package/utils/README.md +2 -2
  116. package/utils/stream-closer.html +2 -1
  117. package/utils/supertoken-deployer.html +2 -1
@@ -0,0 +1,77 @@
1
+ const SuperfluidSDK = require("@superfluid-finance/js-sdk");
2
+ const {
3
+ getScriptRunnerFactory: S,
4
+ extractWeb3Options,
5
+ builtTruffleContractLoader,
6
+ sendGovernanceAction,
7
+ } = require("./libs/common");
8
+
9
+ /**
10
+ * @dev Enable or disable a trusted forwarder
11
+ * @param {Array} argv Overriding command line arguments
12
+ * @param {boolean} options.isTruffle Whether the script is used within native truffle framework
13
+ * @param {Web3} options.web3 Injected web3 instance
14
+ * @param {Address} options.from Address to send transactions from
15
+ * @param {boolean} options.protocolReleaseVersion Specify the protocol release version to be used
16
+ *
17
+ * Usage: npx truffle exec scripts/gov-set-trusted-forwarder.js : {TOKEN ADDRESS} {FORWARDER ADDRESS} {ENABLE}
18
+ * use TOKEN ADDRESS 0x0000000000000000000000000000000000000000 to set for all tokens.
19
+ * If ENABLE is 1, the forwarder is enabled; if ENABLE is 0, the forwarder is disabled.
20
+ *
21
+ * Make sure to only set forwarders which can be fully trusted!
22
+ */
23
+ module.exports = eval(`(${S.toString()})()`)(async function (
24
+ args,
25
+ options = {}
26
+ ) {
27
+ console.log("======== Setting trusted forwarder ========");
28
+ let {protocolReleaseVersion} = options;
29
+
30
+ if (args.length !== 3) {
31
+ throw new Error("Wrong number of arguments");
32
+ }
33
+ const enable = parseInt(args.pop());
34
+ const forwarderAddr = args.pop();
35
+ const tokenAddr = args.pop();
36
+ console.log("token address", tokenAddr);
37
+ console.log("forwarder address", forwarderAddr);
38
+ console.log("enable", enable);
39
+
40
+ const sf = new SuperfluidSDK.Framework({
41
+ ...extractWeb3Options(options),
42
+ version: protocolReleaseVersion,
43
+ additionalContracts: [
44
+ "Ownable",
45
+ "IMultiSigWallet",
46
+ "SuperfluidGovernanceBase",
47
+ ],
48
+ contractLoader: builtTruffleContractLoader,
49
+ });
50
+ await sf.initialize();
51
+
52
+ if (enable === 1) {
53
+ console.log(
54
+ `Enabling trusted forwarder ${forwarderAddr} for ${tokenAddr}`
55
+ );
56
+ await sendGovernanceAction(sf, (gov) =>
57
+ gov.enableTrustedForwarder(
58
+ sf.host.address,
59
+ tokenAddr,
60
+ forwarderAddr
61
+ )
62
+ );
63
+ } else if (enable === 0) {
64
+ console.log(
65
+ `Disabling trusted forwarder ${forwarderAddr} for ${tokenAddr}`
66
+ );
67
+ await sendGovernanceAction(sf, (gov) =>
68
+ gov.disableTrustedForwarder(
69
+ sf.host.address,
70
+ tokenAddr,
71
+ forwarderAddr
72
+ )
73
+ );
74
+ } else {
75
+ console.error("invalid value for argument ENABLE provided!");
76
+ }
77
+ });
@@ -137,22 +137,38 @@ async function printGovernanceInformation({sf}) {
137
137
  {
138
138
  console.log("## TrustedForwarders");
139
139
  try {
140
- const latests = await fetchLatestGovernanceUpdate(
141
- gov,
142
- "TrustedForwarderChanged",
143
- {
140
+ // here we don't want to merge by same token addr, thus not using fetchLatestGovernanceUpdate()
141
+ const enabledEvents = (
142
+ await sf.getPastEvents(gov, "TrustedForwarderChanged", {
144
143
  host: sf.host.address,
145
- }
146
- );
147
- latests
148
- .filter((i) => !!i.enabled)
149
- .forEach((i) =>
144
+ })
145
+ ).filter((i) => !!i.enabled);
146
+ const enabledEventsUnique = [
147
+ ...new Set(
148
+ enabledEvents.map((i) => ({
149
+ superToken: i.superToken,
150
+ forwarder: i.forwarder,
151
+ }))
152
+ ),
153
+ ];
154
+ for (const i of enabledEventsUnique) {
155
+ // checking if currently enabled. This avoids false positives (disabled in a later event)
156
+ if (
157
+ await gov.isTrustedForwarder.call(
158
+ sf.host.address,
159
+ i.superToken,
160
+ i.forwarder
161
+ )
162
+ ) {
150
163
  console.log(
151
- "SuperToken: " + i.superToken,
164
+ i.superToken === ZERO_ADDRESS
165
+ ? "DEFAULT"
166
+ : "SuperToken: " + i.superToken,
152
167
  "\nForwarder: " + i.forwarder,
153
168
  "\n---"
154
- )
155
- );
169
+ );
170
+ }
171
+ }
156
172
  } catch (e) {
157
173
  console.warn(
158
174
  "There was an error fetching TrustedForwarderChanged past events.",
@@ -104,10 +104,17 @@ module.exports = function getConfig(chainId) {
104
104
  // misc
105
105
  disableTestGovernance: true,
106
106
  data: {
107
- initialBlockNumber: 5000000,
107
+ initialBlockNumber: 18800000,
108
108
  getLogsRange: 5000,
109
109
  },
110
110
  },
111
+ 97: {
112
+ // BSC chapel testnet
113
+ data: {
114
+ initialBlockNumber: 19437500,
115
+ getLogsRange: 10000,
116
+ },
117
+ },
111
118
 
112
119
  //
113
120
  // Optimistic Ethereum: https://community.optimism.io/docs/
@@ -177,7 +184,7 @@ module.exports = function getConfig(chainId) {
177
184
  // governance default configs
178
185
  gov_enableAppWhiteListing: true,
179
186
  // misc
180
- disableTestGovernance: true,
187
+ // disableTestGovernance: true,
181
188
  data: {
182
189
  initialBlockNumber: 14700000,
183
190
  getLogsRange: 50000,
@@ -202,7 +209,18 @@ module.exports = function getConfig(chainId) {
202
209
  // governance default configs
203
210
  gov_enableAppWhiteListing: true,
204
211
  // misc
205
- disableTestGovernance: true,
212
+ // disableTestGovernance: true,
213
+ data: {
214
+ initialBlockNumber: 13075000,
215
+ getLogsRange: 50000,
216
+ },
217
+ },
218
+ 44787: {
219
+ // Celo alfajores testnet
220
+ data: {
221
+ initialBlockNumber: 11519000,
222
+ getLogsRange: 50000,
223
+ },
206
224
  },
207
225
  };
208
226
 
@@ -42,6 +42,7 @@ module.exports = eval(`(${S.toString()})()`)(async function (
42
42
  "SuperfluidGovernanceBase",
43
43
  "SuperToken",
44
44
  "Resolver",
45
+ "IAccessControlEnumerable",
45
46
  ],
46
47
  contractLoader: builtTruffleContractLoader,
47
48
  });
package/utils/README.md CHANGED
@@ -8,7 +8,7 @@ python -m SimpleHTTPServer 1337
8
8
  ```
9
9
  Then navigate to http://localhost:1337/supertoken-deployer.html
10
10
 
11
- Alternatively, you can also find it on IPFS: [QmbjeSLXfmePAnWRBhkhajCpdu58Xsn7BqQwj8pSxRS9d8](http://ipfs.io/ipfs/QmbjeSLXfmePAnWRBhkhajCpdu58Xsn7BqQwj8pSxRS9d8)
11
+ Alternatively, you can also find it on IPFS: [QmbjeSLXfmePAnWRBhkhajCpdu58Xsn7BqQwj8pSxRS9d8](https://ipfs.io/ipfs/QmaCBCARcUthLcG1sNYC8SAE7okuDUZqbythvWuYozBpgC)
12
12
 
13
13
  ## Stream Closer
14
14
 
@@ -21,7 +21,7 @@ python -m SimpleHTTPServer 1337
21
21
 
22
22
  Then navigate to http://localhost:1337/stream-closer.html
23
23
 
24
- Alternatively, you can also find it on IPFS: [QmRJmHatYiGgGsXYCsYZdqPMx4dd2qbMskMJvXGWZ53oJJ](http://ipfs.io/ipfs/QmRJmHatYiGgGsXYCsYZdqPMx4dd2qbMskMJvXGWZ53oJJ)
24
+ Alternatively, you can also find it on IPFS: [QmRJmHatYiGgGsXYCsYZdqPMx4dd2qbMskMJvXGWZ53oJJ](https://ipfs.io/ipfs/QmVQ4B9MyEpr3i39XiEZ4qefuqMKv5HnfLPPB42r19mhEi)
25
25
 
26
26
  In order to set the parameter in the URL, use this format:
27
27
  stream-closer.html?chainId=<chainId>&token=<tokenAddress>&sender=<senderAddress>&receiver=<receiverAddress>
@@ -68,7 +68,8 @@
68
68
  { chainId: 100, hostAddr: "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7" }, // xdai-mainnet
69
69
  { chainId: 10, hostAddr: "0x567c4B141ED61923967cA25Ef4906C8781069a10" }, // optimism-mainnnet
70
70
  { chainId: 42161, hostAddr: "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192" }, // arbitrum-one
71
- { chainId: 43114, hostAddr: "0x60377C7016E4cdB03C87EF474896C11cB560752C" } // avalanche-c
71
+ { chainId: 43114, hostAddr: "0x60377C7016E4cdB03C87EF474896C11cB560752C" }, // avalanche-c
72
+ { chainId: 56, hostAddr: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E" } // bsc-mainnet
72
73
  ];
73
74
 
74
75
  // pre-fill input fields from query params if present
@@ -66,7 +66,8 @@
66
66
  { chainId: 100, hostAddr: "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7" }, // xdai-mainnet
67
67
  { chainId: 10, hostAddr: "0x567c4B141ED61923967cA25Ef4906C8781069a10" }, // optimism-mainnnet
68
68
  { chainId: 42161, hostAddr: "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192" }, // arbitrum-one
69
- { chainId: 43114, hostAddr: "0x60377C7016E4cdB03C87EF474896C11cB560752C" } // avalanche-c
69
+ { chainId: 43114, hostAddr: "0x60377C7016E4cdB03C87EF474896C11cB560752C" }, // avalanche-c
70
+ { chainId: 56, hostAddr: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E" } // bsc-mainnet
70
71
  ];
71
72
 
72
73
  let connData = {}; // chainId, provider, userAddress, ...