@superfluid-finance/ethereum-contracts 1.7.2-dev.09f3be3.0 → 1.7.2-dev.1ef77a5.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 (188) hide show
  1. package/README.md +2 -2
  2. package/artifacts/contracts/apps/SuperAppBaseFlow.sol/SuperAppBaseFlow.json +13 -13
  3. package/artifacts/contracts/apps/SuperfluidLoaderLibrary.sol/SuperfluidLoaderLibrary.json +2 -2
  4. package/artifacts/contracts/mocks/SuperAppBaseFlowTester.sol/SuperAppBaseFlowTester.json +15 -15
  5. package/build/contracts/AccessControl.json +1 -1
  6. package/build/contracts/AccessControlEnumerable.json +1 -1
  7. package/build/contracts/Address.json +1 -1
  8. package/build/contracts/AgreementBase.json +18 -18
  9. package/build/contracts/AgreementLibrary.json +165 -165
  10. package/build/contracts/BaseRelayRecipient.json +57 -57
  11. package/build/contracts/BatchLiquidator.json +382 -382
  12. package/build/contracts/BatchOperation.json +614 -614
  13. package/build/contracts/CFAv1Forwarder.json +1250 -1250
  14. package/build/contracts/CFAv1ForwarderDeployerLibrary.json +2384 -2384
  15. package/build/contracts/CFAv1Library.json +389 -389
  16. package/build/contracts/CallUtils.json +198 -198
  17. package/build/contracts/ClosingOnUpdateFlowTestApp.json +1525 -1525
  18. package/build/contracts/ConstantFlowAgreementV1.json +1087 -1087
  19. package/build/contracts/ConstantInflowNFT.json +402 -402
  20. package/build/contracts/ConstantOutflowNFT.json +661 -661
  21. package/build/contracts/Context.json +1 -1
  22. package/build/contracts/ContextDefinitions.json +614 -614
  23. package/build/contracts/CustomSuperTokenBase.json +19 -19
  24. package/build/contracts/ERC165.json +1 -1
  25. package/build/contracts/ERC1820Implementer.json +1 -1
  26. package/build/contracts/ERC1820RegistryCompiled.json +22 -22
  27. package/build/contracts/ERC20.json +1 -1
  28. package/build/contracts/ERC20WithTokenInfo.json +23 -23
  29. package/build/contracts/ERC777Helper.json +384 -384
  30. package/build/contracts/ERC777RecipientDrainingGas.json +863 -863
  31. package/build/contracts/ERC777RecipientReverting.json +863 -863
  32. package/build/contracts/EnumerableSet.json +1 -1
  33. package/build/contracts/EventsEmitter.json +43 -43
  34. package/build/contracts/ExclusiveInflowTestApp.json +1525 -1525
  35. package/build/contracts/FixedSizeData.json +200 -200
  36. package/build/contracts/FlowExchangeTestApp.json +1526 -1526
  37. package/build/contracts/FlowNFTBase.json +1280 -1280
  38. package/build/contracts/FlowOperatorDefinitions.json +614 -614
  39. package/build/contracts/ForwarderBase.json +190 -190
  40. package/build/contracts/FullUpgradableSuperTokenProxy.json +116 -116
  41. package/build/contracts/IAccessControl.json +1 -1
  42. package/build/contracts/IAccessControlEnumerable.json +1 -1
  43. package/build/contracts/IConstantFlowAgreementV1.json +677 -677
  44. package/build/contracts/IConstantInflowNFT.json +54 -54
  45. package/build/contracts/IConstantOutflowNFT.json +107 -107
  46. package/build/contracts/IDAv1Forwarder.json +912 -912
  47. package/build/contracts/IDAv1ForwarderDeployerLibrary.json +2384 -2384
  48. package/build/contracts/IDAv1Library.json +430 -430
  49. package/build/contracts/IERC165.json +1 -1
  50. package/build/contracts/IERC1820Implementer.json +1 -1
  51. package/build/contracts/IERC1820Registry.json +1 -1
  52. package/build/contracts/IERC20.json +1 -1
  53. package/build/contracts/IERC20Metadata.json +1 -1
  54. package/build/contracts/IERC20Permit.json +1 -1
  55. package/build/contracts/IERC721.json +1 -1
  56. package/build/contracts/IERC721Metadata.json +1 -1
  57. package/build/contracts/IERC777.json +1 -1
  58. package/build/contracts/IERC777Recipient.json +1 -1
  59. package/build/contracts/IERC777Sender.json +1 -1
  60. package/build/contracts/IFlowNFTBase.json +115 -115
  61. package/build/contracts/IInstantDistributionAgreementV1.json +667 -667
  62. package/build/contracts/IMultiSigWallet.json +31 -31
  63. package/build/contracts/IPoolAdminNFT.json +7 -7
  64. package/build/contracts/IPoolMemberNFT.json +7 -7
  65. package/build/contracts/IPureSuperToken.json +62 -62
  66. package/build/contracts/IPureSuperTokenCustom.json +62 -62
  67. package/build/contracts/IRelayRecipient.json +27 -27
  68. package/build/contracts/IResolver.json +38 -38
  69. package/build/contracts/ISETH.json +67 -67
  70. package/build/contracts/ISETHCustom.json +67 -67
  71. package/build/contracts/ISuperAgreement.json +50 -50
  72. package/build/contracts/ISuperApp.json +191 -191
  73. package/build/contracts/ISuperToken.json +695 -695
  74. package/build/contracts/ISuperTokenFactory.json +225 -225
  75. package/build/contracts/ISuperfluid.json +904 -904
  76. package/build/contracts/ISuperfluidGovernance.json +251 -251
  77. package/build/contracts/ISuperfluidToken.json +407 -407
  78. package/build/contracts/ITOGAv1.json +1346 -1346
  79. package/build/contracts/ITOGAv2.json +1346 -1346
  80. package/build/contracts/ITOGAv3.json +1346 -1346
  81. package/build/contracts/Initializable.json +1 -1
  82. package/build/contracts/InstantDistributionAgreementV1.json +594 -594
  83. package/build/contracts/Math.json +1 -1
  84. package/build/contracts/NonClosableOutflowTestApp.json +1526 -1526
  85. package/build/contracts/Ownable.json +1 -1
  86. package/build/contracts/Proxy.json +1 -1
  87. package/build/contracts/ProxyDeployerLibrary.json +2382 -2382
  88. package/build/contracts/PureSuperToken.json +106 -106
  89. package/build/contracts/Resolver.json +98 -98
  90. package/build/contracts/SETHProxy.json +224 -224
  91. package/build/contracts/SafeCast.json +1 -1
  92. package/build/contracts/SafeERC20.json +1 -1
  93. package/build/contracts/SafeGasLibrary.json +51 -51
  94. package/build/contracts/SafeMath.json +1 -1
  95. package/build/contracts/SelfDeletingFlowTestApp.json +1525 -1525
  96. package/build/contracts/SlotsBitmapLibrary.json +457 -457
  97. package/build/contracts/StreamRedirector.json +704 -704
  98. package/build/contracts/Strings.json +1 -1
  99. package/build/contracts/SuperAppBase.json +42 -42
  100. package/build/contracts/SuperAppBaseFlow.json +800 -800
  101. package/build/contracts/SuperAppDefinitions.json +614 -614
  102. package/build/contracts/SuperToken.json +2714 -2714
  103. package/build/contracts/SuperTokenDeployerLibrary.json +2383 -2383
  104. package/build/contracts/SuperTokenFactory.json +1347 -1347
  105. package/build/contracts/SuperTokenFactoryBase.json +1329 -1329
  106. package/build/contracts/SuperTokenV1Library.json +1483 -1483
  107. package/build/contracts/SuperUpgrader.json +439 -439
  108. package/build/contracts/Superfluid.json +5196 -5196
  109. package/build/contracts/SuperfluidCFAv1DeployerLibrary.json +2383 -2383
  110. package/build/contracts/SuperfluidFrameworkDeployer.json +1260 -1260
  111. package/build/contracts/SuperfluidFrameworkDeploymentSteps.json +2382 -2382
  112. package/build/contracts/SuperfluidGovDeployerLibrary.json +2383 -2383
  113. package/build/contracts/SuperfluidGovernanceBase.json +2449 -2449
  114. package/build/contracts/SuperfluidGovernanceConfigs.json +614 -614
  115. package/build/contracts/SuperfluidGovernanceII.json +155 -155
  116. package/build/contracts/SuperfluidGovernanceIIProxy.json +135 -135
  117. package/build/contracts/SuperfluidHostDeployerLibrary.json +2382 -2382
  118. package/build/contracts/SuperfluidIDAv1DeployerLibrary.json +2383 -2383
  119. package/build/contracts/SuperfluidLoader.json +207 -207
  120. package/build/contracts/SuperfluidLoaderDeployerLibrary.json +2384 -2384
  121. package/build/contracts/SuperfluidLoaderLibrary.json +552 -417
  122. package/build/contracts/SuperfluidNFTLogicDeployerLibrary.json +2387 -2387
  123. package/build/contracts/SuperfluidPeripheryDeployerLibrary.json +2385 -2385
  124. package/build/contracts/SuperfluidToken.json +1423 -1423
  125. package/build/contracts/TOGA.json +1360 -1360
  126. package/build/contracts/TestGovernance.json +250 -250
  127. package/build/contracts/TestResolver.json +47 -47
  128. package/build/contracts/TestToken.json +102 -102
  129. package/build/contracts/TokenDeployerLibrary.json +2384 -2384
  130. package/build/contracts/TokenInfo.json +32 -32
  131. package/build/contracts/UUPSProxiable.json +139 -139
  132. package/build/contracts/UUPSProxy.json +81 -81
  133. package/build/contracts/UUPSUtils.json +37 -37
  134. package/build/contracts-sizes.txt +15 -15
  135. package/build/typechain/contracts/apps/SuperAppBaseFlow.d.ts +9 -9
  136. package/build/typechain/contracts/apps/SuperAppBaseFlow.d.ts.map +1 -1
  137. package/build/typechain/contracts/mocks/SuperAppBaseFlowTester.d.ts +9 -9
  138. package/build/typechain/contracts/mocks/SuperAppBaseFlowTester.d.ts.map +1 -1
  139. package/build/typechain/factories/contracts/apps/SuperAppBaseFlow__factory.d.ts +10 -10
  140. package/build/typechain/factories/contracts/apps/SuperAppBaseFlow__factory.js +13 -13
  141. package/build/typechain/factories/contracts/apps/SuperAppBaseFlow__factory.js.map +1 -1
  142. package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.d.ts +1 -1
  143. package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.d.ts.map +1 -1
  144. package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.js +1 -1
  145. package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.js.map +1 -1
  146. package/build/typechain/factories/contracts/mocks/SuperAppBaseFlowTester__factory.d.ts +11 -11
  147. package/build/typechain/factories/contracts/mocks/SuperAppBaseFlowTester__factory.d.ts.map +1 -1
  148. package/build/typechain/factories/contracts/mocks/SuperAppBaseFlowTester__factory.js +14 -14
  149. package/build/typechain/factories/contracts/mocks/SuperAppBaseFlowTester__factory.js.map +1 -1
  150. package/contracts/apps/SuperAppBaseFlow.sol +8 -8
  151. package/contracts/apps/SuperfluidLoaderLibrary.sol +5 -2
  152. package/package.json +5 -5
  153. package/ops-scripts/.eslintrc.js +0 -15
  154. package/ops-scripts/artifacts/ERC1820Registry.json +0 -5
  155. package/ops-scripts/deploy-aux-contracts.js +0 -99
  156. package/ops-scripts/deploy-deterministically.js +0 -169
  157. package/ops-scripts/deploy-erc1820.js +0 -83
  158. package/ops-scripts/deploy-framework.js +0 -895
  159. package/ops-scripts/deploy-mfa.ts +0 -27
  160. package/ops-scripts/deploy-super-token.js +0 -206
  161. package/ops-scripts/deploy-test-environment.js +0 -98
  162. package/ops-scripts/deploy-test-token.js +0 -86
  163. package/ops-scripts/deploy-unlisted-pure-super-token.js +0 -69
  164. package/ops-scripts/deploy-unlisted-super-token.js +0 -68
  165. package/ops-scripts/gov-create-new-app-registration-key.js +0 -75
  166. package/ops-scripts/gov-create-new-factory-registration.js +0 -49
  167. package/ops-scripts/gov-set-3Ps-config.js +0 -67
  168. package/ops-scripts/gov-set-reward-address.js +0 -60
  169. package/ops-scripts/gov-set-token-min-deposit.js +0 -53
  170. package/ops-scripts/gov-set-trusted-forwarder.js +0 -80
  171. package/ops-scripts/gov-transfer-framework-ownership.js +0 -90
  172. package/ops-scripts/gov-upgrade-governance.js +0 -87
  173. package/ops-scripts/gov-upgrade-super-token-logic.js +0 -193
  174. package/ops-scripts/info-inspect-account.js +0 -118
  175. package/ops-scripts/info-list-apps.js +0 -55
  176. package/ops-scripts/info-print-contract-addresses.js +0 -136
  177. package/ops-scripts/info-scan-deployments.js +0 -63
  178. package/ops-scripts/info-show-protocol.js +0 -400
  179. package/ops-scripts/libs/common.js +0 -436
  180. package/ops-scripts/libs/getConfig.js +0 -289
  181. package/ops-scripts/libs/truffleScriptRunnerFactory.js +0 -97
  182. package/ops-scripts/resolver-list-super-token.js +0 -73
  183. package/ops-scripts/resolver-register-token.js +0 -72
  184. package/ops-scripts/resolver-reset-deployment.js +0 -54
  185. package/ops-scripts/resolver-set-key-value.js +0 -69
  186. package/ops-scripts/resolver-unlist-super-token.js +0 -61
  187. package/ops-scripts/tmp-trigger-token-transfer.js +0 -33
  188. package/ops-scripts/validate-nft-addresses.ts +0 -49
@@ -1,27 +0,0 @@
1
- import {ethers} from "hardhat";
2
-
3
- const deployMFA = async () => {
4
- const provider = new ethers.providers.JsonRpcProvider(
5
- "http://127.0.0.1:8545/"
6
- );
7
- const signer = provider.getSigner(
8
- "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
9
- );
10
- const MFAContractFactory = await ethers.getContractFactory(
11
- "MultiFlowTesterApp"
12
- );
13
- const mfa = await MFAContractFactory.connect(signer).deploy(
14
- "0x9bd03768a7DCc129555dE410FF8E85528A4F88b5",
15
- "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853"
16
- );
17
- console.log("MFA deployed at:", mfa.address);
18
- };
19
-
20
- deployMFA()
21
- .then(() => {
22
- process.exit(0);
23
- })
24
- .catch((err) => {
25
- console.error(err);
26
- process.exit(1);
27
- });
@@ -1,206 +0,0 @@
1
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
2
-
3
- const {
4
- getScriptRunnerFactory: S,
5
- ZERO_ADDRESS,
6
- extractWeb3Options,
7
- builtTruffleContractLoader,
8
- sendGovernanceAction,
9
- } = require("./libs/common");
10
-
11
- /**
12
- * @dev Deploy a listed super token (wrapper for ERC20 or native token) to the network.
13
- * @param {Array} argv Overriding command line arguments
14
- * @param {boolean} options.isTruffle Whether the script is used within native truffle framework
15
- * @param {Web3} options.web3 Injected web3 instance
16
- * @param {Address} options.from Address to deploy contracts from
17
- * @param {string} options.protocolReleaseVersion Specify the protocol release version to be used
18
- *
19
- * Usage: npx truffle exec ops-scripts/deploy-super-token.js : {UNDERLYING_TOKEN_SYMBOL_OR_ADDRESS}
20
- *
21
- * NOTE:
22
- * - If the `UNDERLYING_TOKEN_SYMBOL_OR_ADDRESS` is the ZERO_ADDRESS or the (known) native token symbol
23
- * of the network, then the SETH contract will be deployed.
24
- * If the name of the network's native token isn't known by the framework, it can be provided
25
- * via ENV var NATIVE_TOKEN_SYMBOL.
26
- * - Otherwise an ERC20 super token wrapper will be created for the underlying ERC20 token specified in
27
- * UNDERLYING_TOKEN_SYMBOL_OR_ADDRESS. This underlying token needs to already be registered in the resolver.
28
- * - A resolver entry `supertokens.${protocolReleaseVersion}.${UNDERLYING_TOKEN_SYMBOL}x` will be created
29
- * for the super token address.
30
- * - The caller needs to have permission to set resolver entries.
31
- */
32
- module.exports = eval(`(${S.toString()})()`)(async function (
33
- args,
34
- options = {}
35
- ) {
36
- console.log("======== Deploying super token ========");
37
- let {resetToken, protocolReleaseVersion} = options;
38
-
39
- if (args.length !== 1) {
40
- throw new Error("Wrong number of arguments");
41
- }
42
- const tokenSymbolOrAddress = args.pop();
43
-
44
- resetToken = resetToken || !!process.env.RESET_TOKEN;
45
- console.log("reset token: ", resetToken);
46
- console.log("protocol release version:", protocolReleaseVersion);
47
-
48
- const sf = new SuperfluidSDK.Framework({
49
- ...extractWeb3Options(options),
50
- version: protocolReleaseVersion,
51
- additionalContracts: [
52
- "Ownable",
53
- "IMultiSigWallet",
54
- "SuperfluidGovernanceBase",
55
- "Resolver",
56
- "UUPSProxiable",
57
- "SETHProxy",
58
- ],
59
- contractLoader: builtTruffleContractLoader,
60
- });
61
- await sf.initialize();
62
-
63
- const {
64
- Resolver,
65
- UUPSProxiable,
66
- ERC20WithTokenInfo,
67
- ISuperToken,
68
- ISETH,
69
- SETHProxy,
70
- } = sf.contracts;
71
-
72
- const superTokenFactory = await sf.contracts.ISuperTokenFactory.at(
73
- await sf.host.getSuperTokenFactory.call()
74
- );
75
-
76
- let tokenSymbol;
77
- let tokenAddress;
78
- let superTokenKey;
79
- let deploymentFn;
80
- if (
81
- tokenSymbolOrAddress === ZERO_ADDRESS ||
82
- tokenSymbolOrAddress === sf.config.nativeTokenSymbol
83
- ) {
84
- // deploy wrapper for the native token
85
- tokenSymbol =
86
- sf.config.nativeTokenSymbol || process.env.NATIVE_TOKEN_SYMBOL;
87
- if (tokenSymbol === undefined) {
88
- throw new Error(
89
- "Native token symbol unknown. You can set it with ENV var NATIVE_TOKEN_SYMBOL"
90
- );
91
- }
92
-
93
- superTokenKey = `supertokens.${protocolReleaseVersion}.${tokenSymbol}x`;
94
- deploymentFn = async () => {
95
- console.log("Creating SETH Proxy...");
96
- const sethProxy = await SETHProxy.new();
97
- const seth = await ISETH.at(sethProxy.address);
98
- console.log("Intialize SETH as a custom super token...");
99
- await superTokenFactory.initializeCustomSuperToken(seth.address);
100
- console.log("Intialize SETH token info...");
101
- await seth.initialize(
102
- ZERO_ADDRESS,
103
- 18,
104
- `Super ${tokenSymbol}`,
105
- `${tokenSymbol}x`
106
- );
107
- return seth;
108
- };
109
- } else {
110
- // deploy wrapper for an ERC20 token
111
- if (web3.utils.isAddress(tokenSymbolOrAddress)) {
112
- tokenAddress = tokenSymbolOrAddress;
113
- tokenSymbol = await (
114
- await ERC20WithTokenInfo.at(tokenAddress)
115
- ).symbol.call();
116
- } else {
117
- tokenSymbol = tokenSymbolOrAddress;
118
- tokenAddress = await sf.resolver.get(`tokens.${tokenSymbol}`);
119
- }
120
-
121
- console.log("Underlying token symbol", tokenSymbol);
122
- console.log("Underlying token address", tokenAddress);
123
-
124
- superTokenKey = `supertokens.${protocolReleaseVersion}.${tokenSymbol}`;
125
- if ((await sf.resolver.get(superTokenKey)) === ZERO_ADDRESS) {
126
- const tokenAddress = await sf.resolver.get(`tokens.${tokenSymbol}`);
127
- if (tokenAddress === ZERO_ADDRESS) {
128
- throw new Error("Underlying ERC20 Token not found");
129
- }
130
- const tokenInfo = await sf.contracts.TokenInfo.at(tokenAddress);
131
- const tokenInfoName = await tokenInfo.name.call();
132
- const tokenInfoSymbol = await tokenInfo.symbol.call();
133
- const tokenInfoDecimals = await tokenInfo.decimals.call();
134
- console.log("Underlying token address", tokenAddress);
135
- console.log("Underlying token info name()", tokenInfoName);
136
- console.log("Underlying token info symbol()", tokenInfoSymbol);
137
- console.log(
138
- "Underlying token info decimals()",
139
- tokenInfoDecimals.toString()
140
- );
141
- superTokenKey = `supertokens.${protocolReleaseVersion}.${tokenSymbol}x`;
142
- deploymentFn = async () => {
143
- return await sf.createERC20Wrapper(tokenInfo);
144
- };
145
- }
146
- }
147
-
148
- const superTokenAddress = await sf.resolver.get(superTokenKey);
149
- console.log("SuperToken key at the resolver: ", superTokenKey);
150
-
151
- console.log("SuperToken address: ", superTokenAddress);
152
- let doDeploy = false;
153
- if (resetToken || superTokenAddress === ZERO_ADDRESS) {
154
- doDeploy = true;
155
- } else {
156
- console.log("The superToken already registered.");
157
- const superToken = await ISuperToken.at(superTokenAddress);
158
- if ((await superToken.getHost()) !== sf.host.address) {
159
- console.log(
160
- "But the superToken uses a different host, redeploying is required."
161
- );
162
- doDeploy = true;
163
- } else {
164
- const superTokenLogic1 =
165
- await superTokenFactory.getSuperTokenLogic();
166
- console.log("Latest SuperToken logic address", superTokenLogic1);
167
- const superTokenLogic2 = await (
168
- await UUPSProxiable.at(superTokenAddress)
169
- ).getCodeAddress();
170
- console.log("Current SuperToken logic address", superTokenLogic2);
171
- if (superTokenLogic1 !== superTokenLogic2) {
172
- console.log("SuperToken logic needs to be updated.");
173
- await sendGovernanceAction(sf, (gov) =>
174
- gov.batchUpdateSuperTokenLogic(sf.host.address, [
175
- superTokenAddress,
176
- ])
177
- );
178
- if (!process.env.GOVERNANCE_ADMIN_TYPE) {
179
- // validate the token logic update for default governance type updates
180
- const superTokenLogic3 = await (
181
- await UUPSProxiable.at(superTokenAddress)
182
- ).getCodeAddress();
183
- console.log(
184
- "Updated SuperToken logic address",
185
- superTokenLogic3
186
- );
187
- if (superTokenLogic3 !== superTokenLogic1)
188
- throw new Error("SuperToken logic not updated");
189
- console.log("SuperToken's logic has been updated.");
190
- }
191
- }
192
- }
193
- }
194
- if (doDeploy) {
195
- console.log("Creating the wrapper...");
196
- const superToken = await deploymentFn();
197
- console.log("Wrapper created at", superToken.address);
198
- console.log("Resolver setting new address...");
199
- const resolver = await Resolver.at(sf.resolver.address);
200
- await resolver.set(superTokenKey, superToken.address);
201
- console.log("Resolver set done.");
202
- return superToken.address;
203
- }
204
-
205
- console.log("======== Super token deployed ========");
206
- });
@@ -1,98 +0,0 @@
1
- const fs = require("fs");
2
- const util = require("util");
3
- const getConfig = require("./libs/getConfig");
4
- const deployFramework = require("./deploy-framework");
5
- const deployTestToken = require("./deploy-test-token");
6
- const deploySuperToken = require("./deploy-super-token");
7
-
8
- const {getScriptRunnerFactory: S} = require("./libs/common");
9
-
10
- async function takeEvmSnapshot() {
11
- return new Promise((resolve, reject) => {
12
- web3.currentProvider.send(
13
- {
14
- jsonrpc: "2.0",
15
- method: "evm_snapshot",
16
- params: [],
17
- },
18
- (err, result) => {
19
- if (err) {
20
- return reject(err);
21
- }
22
- return resolve(result.result);
23
- }
24
- );
25
- });
26
- }
27
-
28
- /**
29
- * @dev Deploy the superfluid framework and test tokens for local testing
30
- *
31
- * Usage: npx truffle exec ops-scripts/deploy-test-environment.js : {TOKENS_TO_DEPLOY}
32
- * where TOKENS_TO_DEPLOY is an optional list of token symbols, e.g. TEST1,TEST2.
33
- * For each such token, an underlying ERC20 and a wrapping Super Token will be deployed.
34
- *
35
- * WARNING:
36
- * This script as is can easily overload the connected RPC.
37
- * That is because every invocation of deploy-test-token or deploy-super-token
38
- * creates an instance of SuperfluidSDK.Framework, where each instance seems to
39
- * cause a lot of RPC polling. Those instances seem to not be release until the end of this script.
40
- */
41
- module.exports = eval(`(${S.toString()})()`)(async function (
42
- args,
43
- options = {}
44
- ) {
45
- const errorHandler = (err) => {
46
- if (err) throw err;
47
- };
48
-
49
- const networkType = await web3.eth.net.getNetworkType();
50
- const networkId = await web3.eth.net.getId();
51
- const chainId = await web3.eth.getChainId();
52
- console.log("network Type: ", networkType);
53
- console.log("network ID: ", networkId);
54
- console.log("chain ID: ", chainId);
55
- const config = getConfig(chainId);
56
-
57
- let tokens;
58
-
59
- if (args.length >= 1) {
60
- tokens = args.pop().split(",");
61
- } else {
62
- tokens = ["fDAI", "fUSDC", "fTUSD", config.nativeTokenSymbol];
63
- }
64
- console.log("Tokens to be deployed", tokens);
65
-
66
- console.log("======== Deploying superfluid framework ========");
67
- await deployFramework(errorHandler, options);
68
- console.log("==== Superfluid framework deployed ========");
69
-
70
- for (let i = 0; i < tokens.length; ++i) {
71
- if (tokens[i] !== deploySuperToken) { // ???
72
- console.log(`======== Deploying test token ${tokens[i]} ========`);
73
- await deployTestToken(errorHandler, [":", tokens[i]], options);
74
- console.log(`======== Test token ${tokens[i]} deployed ========`);
75
- }
76
-
77
- console.log(`======== Creating super token for ${tokens[i]} ========`);
78
- await deploySuperToken(errorHandler, [":", tokens[i]], options);
79
- console.log(`======== Super token for ${tokens[i]} deployed ========`);
80
- }
81
-
82
- if (process.env.RESOLVER_ADDRESS) {
83
- console.log(
84
- "=============== TEST ENVIRONMENT VARS ======================"
85
- );
86
- console.log(`export RESOLVER_ADDRESS=${process.env.RESOLVER_ADDRESS}`);
87
- }
88
-
89
- if (process.env.TESTENV_SNAPSHOT_VARS) {
90
- let output = "";
91
- output += `RESOLVER_ADDRESS=${process.env.RESOLVER_ADDRESS}\n`;
92
- output += `TESTENV_EVM_SNAPSHOT_ID=${await takeEvmSnapshot()}\n`;
93
- await util.promisify(fs.writeFile)(
94
- process.env.TESTENV_SNAPSHOT_VARS,
95
- output
96
- );
97
- }
98
- });
@@ -1,86 +0,0 @@
1
- const {web3tx} = require("@decentral.ee/web3-helpers");
2
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
3
- const getConfig = require("./libs/getConfig");
4
-
5
- const {
6
- getScriptRunnerFactory: S,
7
- extractWeb3Options,
8
- builtTruffleContractLoader,
9
- } = require("./libs/common");
10
- const {ethers} = require("ethers");
11
-
12
- /**
13
- * @dev Deploy test token (Mintable ERC20) and register it in the resolver.
14
- * @param {Array} argv Overriding command line arguments
15
- * @param {boolean} options.isTruffle Whether the script is used within native truffle framework
16
- * @param {Web3} options.web3 Injected web3 instance
17
- * @param {Address} options.from Address to deploy contracts from
18
- * @param {boolean} options.resetToken Reset the token deployment
19
- *
20
- * Usage: npx truffle exec ops-scripts/deploy-test-token.js : {TOKEN_DECIMALS} {TOKEN_SYMBOL}
21
- */
22
- module.exports = eval(`(${S.toString()})()`)(async function (
23
- args,
24
- options = {}
25
- ) {
26
- console.log("======== Deploying test token ========");
27
- let {resetToken} = options;
28
-
29
- // > 2 because decimals is an optional field
30
- // symbol should be required though
31
- if (args.length > 2 || args.length < 1) {
32
- throw new Error("Wrong number of arguments");
33
- }
34
- const tokenSymbol = args.pop();
35
- console.log("Token symbol", tokenSymbol);
36
- const tokenDecimals = args.pop() || 18;
37
- console.log("Token decimals", tokenDecimals);
38
-
39
- resetToken = resetToken || !!process.env.RESET_TOKEN;
40
- console.log("reset token: ", resetToken);
41
-
42
- const networkType = await web3.eth.net.getNetworkType();
43
- const networkId = await web3.eth.net.getId();
44
- const chainId = await web3.eth.getChainId();
45
- console.log("network Type: ", networkType);
46
- console.log("network ID: ", networkId);
47
- console.log("chain ID: ", chainId);
48
- const config = getConfig(chainId);
49
-
50
- const {Resolver, TestToken} = await SuperfluidSDK.loadContracts({
51
- ...extractWeb3Options(options),
52
- additionalContracts: ["Resolver", "TestToken"],
53
- contractLoader: builtTruffleContractLoader,
54
- networkId,
55
- });
56
-
57
- const resolver = await Resolver.at(config.resolverAddress);
58
- console.log("Resolver address", resolver.address);
59
-
60
- // deploy test token
61
- const name = `tokens.${tokenSymbol}`;
62
- let testTokenAddress = await resolver.get(name);
63
- if (
64
- resetToken ||
65
- testTokenAddress === "0x0000000000000000000000000000000000000000"
66
- ) {
67
- const testToken = await web3tx(TestToken.new, "TestToken.new")(
68
- tokenSymbol + " Fake Token",
69
- tokenSymbol,
70
- tokenDecimals,
71
- ethers.utils.parseUnits((1e12).toString())
72
- );
73
- testTokenAddress = testToken.address;
74
- await web3tx(resolver.set, `Resolver set ${name}`)(
75
- name,
76
- testTokenAddress
77
- );
78
- } else {
79
- console.log("Token already deployed");
80
- }
81
- console.log(`Token ${tokenSymbol} address`, testTokenAddress);
82
-
83
- console.log("======== Test token deployed ========");
84
-
85
- return testTokenAddress;
86
- });
@@ -1,69 +0,0 @@
1
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
2
-
3
- const {
4
- getScriptRunnerFactory: S,
5
- extractWeb3Options,
6
- builtTruffleContractLoader,
7
- } = require("./libs/common");
8
-
9
- /**
10
- * @dev Deploy unlisted pure super token to the network.
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 deploy contracts from
15
- * @param {string} options.protocolReleaseVersion Specify the protocol release version to be used
16
- *
17
- * Usage: npx truffle exec ops-scripts/deploy-unlisted-pure-super-token.js : {NAME} {SYMBOL} {INITIAL SUPPLY}
18
- */
19
- module.exports = eval(`(${S.toString()})()`)(async function (
20
- args,
21
- options = {}
22
- ) {
23
- console.log("======== Deploying unlisted pure super token ========");
24
- let {protocolReleaseVersion} = options;
25
-
26
- if (args.length !== 3) {
27
- throw new Error("Wrong number of arguments");
28
- }
29
- const initialSupply = args.pop();
30
- const superTokenSymbol = args.pop();
31
- const superTokenName = args.pop();
32
- console.log("Super token name", superTokenName);
33
- console.log("Super token symbol", superTokenSymbol);
34
- console.log("Super token initial supply", initialSupply);
35
-
36
- const sf = new SuperfluidSDK.Framework({
37
- ...extractWeb3Options(options),
38
- version: protocolReleaseVersion,
39
- additionalContracts: ["PureSuperToken", "IPureSuperToken"],
40
- contractLoader: builtTruffleContractLoader,
41
- });
42
- await sf.initialize();
43
-
44
- const {PureSuperToken, IPureSuperToken} = sf.contracts;
45
-
46
- const superTokenFactory = await sf.contracts.ISuperTokenFactory.at(
47
- await sf.host.getSuperTokenFactory.call()
48
- );
49
-
50
- console.log("Deploying PureSuperToken...");
51
- const proxy = await PureSuperToken.new();
52
-
53
- const token = await IPureSuperToken.at(proxy.address);
54
-
55
- console.log("Invoking initializeCustomSuperToken...");
56
- await superTokenFactory.initializeCustomSuperToken(token.address);
57
-
58
- // Note: this must be done AFTER initializeCustomSuperToken()!
59
- console.log("Invoking initialize...");
60
- await token.initialize(
61
- superTokenName,
62
- superTokenSymbol,
63
- web3.utils.toWei(String(initialSupply))
64
- );
65
-
66
- console.log(`Pure SuperToken deployed at ${token.address}`);
67
-
68
- return token.address;
69
- });
@@ -1,68 +0,0 @@
1
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
2
-
3
- const {
4
- getScriptRunnerFactory: S,
5
- extractWeb3Options,
6
- builtTruffleContractLoader,
7
- } = require("./libs/common");
8
-
9
- /**
10
- * @dev Deploy unlisted super token to the network.
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 deploy contracts from
15
- * @param {string} options.protocolReleaseVersion Specify the protocol release version to be used
16
- *
17
- * Usage: npx truffle exec scripts/deploy-unmanaged-super-token.js : {UNDERLYING_TOKEN_ADDRESS} {NAME} {SYMBOL}
18
- */
19
- module.exports = eval(`(${S.toString()})()`)(async function (
20
- args,
21
- options = {}
22
- ) {
23
- console.log("======== Deploying unmanaged super token ========");
24
- let {resetToken, protocolReleaseVersion} = options;
25
-
26
- if (args.length !== 3) {
27
- throw new Error("Wrong number of arguments");
28
- }
29
- const superTokenSymbol = args.pop();
30
- const superTokenName = args.pop();
31
- const tokenAddress = args.pop();
32
- console.log("Underlying token address", tokenAddress);
33
- console.log("Super token name", superTokenName);
34
- console.log("Super token symbol", superTokenSymbol);
35
-
36
- resetToken = resetToken || !!process.env.RESET_TOKEN;
37
- console.log("reset token: ", resetToken);
38
- console.log("protocol release version:", protocolReleaseVersion);
39
-
40
- const sf = new SuperfluidSDK.Framework({
41
- ...extractWeb3Options(options),
42
- version: protocolReleaseVersion,
43
- additionalContracts: ["UUPSProxiable"],
44
- contractLoader: builtTruffleContractLoader,
45
- });
46
- await sf.initialize();
47
-
48
- const tokenInfo = await sf.contracts.TokenInfo.at(tokenAddress);
49
- const tokenInfoName = await tokenInfo.name.call();
50
- const tokenInfoSymbol = await tokenInfo.symbol.call();
51
- const tokenInfoDecimals = await tokenInfo.decimals.call();
52
- console.log("Underlying token name", tokenInfoName);
53
- console.log("Underlying token info name()", tokenInfoName);
54
- console.log("Underlying token info symbol()", tokenInfoSymbol);
55
- console.log(
56
- "Underlying token info decimals()",
57
- tokenInfoDecimals.toString()
58
- );
59
- console.log("Creating the wrapper...");
60
- const superToken = await sf.createERC20Wrapper(tokenInfo, {
61
- superTokenName,
62
- superTokenSymbol,
63
- });
64
- console.log("Wrapper created at", superToken.address);
65
-
66
- console.log("======== Super token deployed ========");
67
- return superToken.address;
68
- });
@@ -1,75 +0,0 @@
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 Create a new super app registration key.
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 deploy contracts from
15
- * @param {string} options.protocolReleaseVersion Specify the protocol release version to be used
16
- *
17
- * Note: the key itself doesn't have much meaning, it could be "stolen" from a broadcast tx anyway.
18
- * But since it's bound to a deployer address, that doesn't really matter.
19
- *
20
- * Usage:
21
- * npx truffle exec ops-scripts/gov-create-new-app-registration-key.js : {DEPLOYER} {REGISTRATION_KEY} [EXPIRATION_TS]
22
- * EXPIRATION_TS is a Unix timestamp in seconds for when the key should expire.
23
- * If not set, we default to 90 days in the future.
24
- * Hint: you may use https://www.unixtimestamp.com/ to calculate a timestamp
25
- */
26
- module.exports = eval(`(${S.toString()})({
27
- doNotPrintColonArgs: true
28
- })`)(async function (args, options = {}) {
29
- console.log("======== Creating new app registration key ========");
30
- let {protocolReleaseVersion} = options;
31
-
32
- if (args.length > 3 || args.length < 2) {
33
- throw new Error("Wrong number of arguments");
34
- }
35
-
36
- let expirationTs = Math.floor(Date.now() / 1000) + 3600 * 24 * 90; // 90 days from now
37
- if (args.length === 3) {
38
- const expTsStr = args.pop();
39
- const parsedExpTs = parseInt(expTsStr);
40
- if (parsedExpTs.toString() !== expTsStr) {
41
- throw new Error("EXPIRATON_TS not an integer");
42
- }
43
- expirationTs = parsedExpTs;
44
- }
45
- const registrationKey = args.pop();
46
- const deployer = args.pop();
47
- console.log("Deployer", deployer);
48
- console.log("Registration key", registrationKey);
49
- console.log("Expiration timestamp", expirationTs);
50
-
51
- console.log("protocol release version:", protocolReleaseVersion);
52
-
53
- const sf = new SuperfluidSDK.Framework({
54
- ...extractWeb3Options(options),
55
- version: protocolReleaseVersion,
56
- additionalContracts: [
57
- "Ownable",
58
- "IMultiSigWallet",
59
- "SuperfluidGovernanceBase",
60
- ],
61
- contractLoader: builtTruffleContractLoader,
62
- });
63
- await sf.initialize();
64
-
65
- console.log("Expiration date", new Date(expirationTs * 1000)); // print human readable
66
-
67
- await sendGovernanceAction(sf, (gov) =>
68
- gov.setAppRegistrationKey(
69
- sf.host.address,
70
- deployer,
71
- registrationKey,
72
- expirationTs
73
- )
74
- );
75
- });
@@ -1,49 +0,0 @@
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 Create a new super app factory registration.
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 deploy contracts from
15
- * @param {string}} options.protocolReleaseVersion Specify the protocol release version to be used
16
- *
17
- * Usage: npx truffle exec ops-scripts/gov-create-new-factory-registration.js : {FACTORY_ADDRESS}
18
- */
19
- module.exports = eval(`(${S.toString()})({
20
- doNotPrintColonArgs: true
21
- })`)(async function (args, options = {}) {
22
- console.log("======== Creating new factory registration ========");
23
- let {protocolReleaseVersion} = options;
24
-
25
- if (args.length !== 1) {
26
- throw new Error("Wrong number of arguments");
27
- }
28
- const factoryAddress = args.pop();
29
-
30
- console.log("protocol release version:", protocolReleaseVersion);
31
-
32
- const sf = new SuperfluidSDK.Framework({
33
- ...extractWeb3Options(options),
34
- version: protocolReleaseVersion,
35
- additionalContracts: [
36
- "Ownable",
37
- "IMultiSigWallet",
38
- "SuperfluidGovernanceBase",
39
- ],
40
- contractLoader: builtTruffleContractLoader,
41
- });
42
- await sf.initialize();
43
-
44
- console.log("Factory Address:", factoryAddress);
45
-
46
- await sendGovernanceAction(sf, (gov) =>
47
- gov.authorizeAppFactory(sf.host.address, factoryAddress)
48
- );
49
- });