@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,67 +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 Set the 3Ps config for a super token.
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-set-3Ps-config.js : {TOKEN ADDRESS} {LIQUIDATION PERIOD} {PATRICIAN PERIOD}
18
- * use TOKEN ADDRESS 0x0000000000000000000000000000000000000000 to set a default/fallback value
19
- * if LIQUIDATION PERIOD and PATRICIAN PERIOD are zero, the current config for the token is cleared
20
- * and thus falls back to the default.
21
- */
22
- module.exports = eval(`(${S.toString()})()`)(async function (
23
- args,
24
- options = {}
25
- ) {
26
- console.log("======== Setting 3Ps config ========");
27
- let {protocolReleaseVersion} = options;
28
-
29
- if (args.length !== 3) {
30
- throw new Error("Wrong number of arguments");
31
- }
32
- const patricianPeriod = parseInt(args.pop());
33
- const liquidationPeriod = parseInt(args.pop());
34
- const tokenAddr = args.pop();
35
- console.log("token address", tokenAddr);
36
- console.log("liquidation period", liquidationPeriod);
37
- console.log("patrician period", patricianPeriod);
38
-
39
- const sf = new SuperfluidSDK.Framework({
40
- ...extractWeb3Options(options),
41
- version: protocolReleaseVersion,
42
- additionalContracts: [
43
- "Ownable",
44
- "IMultiSigWallet",
45
- "SuperfluidGovernanceBase",
46
- ],
47
- contractLoader: builtTruffleContractLoader,
48
- });
49
- await sf.initialize();
50
-
51
- if (liquidationPeriod !== 0 || patricianPeriod !== 0) {
52
- console.log("setting new 3Ps config");
53
- await sendGovernanceAction(sf, (gov) =>
54
- gov.setPPPConfig(
55
- sf.host.address,
56
- tokenAddr,
57
- liquidationPeriod,
58
- patricianPeriod
59
- )
60
- );
61
- } else {
62
- console.log("clearing 3Ps config");
63
- await sendGovernanceAction(sf, (gov) =>
64
- gov.clearPPPConfig(sf.host.address, tokenAddr)
65
- );
66
- }
67
- });
@@ -1,60 +0,0 @@
1
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
2
- const {
3
- getScriptRunnerFactory: S,
4
- extractWeb3Options,
5
- builtTruffleContractLoader,
6
- sendGovernanceAction,
7
- ZERO_ADDRESS,
8
- } = require("./libs/common");
9
-
10
- /**
11
- * @dev Set the reward address for a super token.
12
- * @param {Array} argv Overriding command line arguments
13
- * @param {boolean} options.isTruffle Whether the script is used within native truffle framework
14
- * @param {Web3} options.web3 Injected web3 instance
15
- * @param {Address} options.from Address to deploy contracts from
16
- * @param {sring} options.protocolReleaseVersion Specify the protocol release version to be used
17
- *
18
- * Usage: npx truffle exec ops-scripts/gov-set-reward-address.js : {TOKEN ADDRESS} {REWARD ADDRESS}
19
- * If REWARD ADDRESS is 0x0000000000000000000000000000000000000000,
20
- * the reward address for the token is cleared and thus set to the default.
21
- */
22
- module.exports = eval(`(${S.toString()})()`)(async function (
23
- args,
24
- options = {}
25
- ) {
26
- console.log("======== Setting reward address ========");
27
- let {protocolReleaseVersion} = options;
28
-
29
- if (args.length !== 2) {
30
- throw new Error("Wrong number of arguments");
31
- }
32
- const rewardAddr = args.pop();
33
- const tokenAddr = args.pop();
34
- console.log("token address", tokenAddr);
35
- console.log("reward address", rewardAddr);
36
-
37
- const sf = new SuperfluidSDK.Framework({
38
- ...extractWeb3Options(options),
39
- version: protocolReleaseVersion,
40
- additionalContracts: [
41
- "Ownable",
42
- "IMultiSigWallet",
43
- "SuperfluidGovernanceBase",
44
- ],
45
- contractLoader: builtTruffleContractLoader,
46
- });
47
- await sf.initialize();
48
-
49
- if (rewardAddr !== ZERO_ADDRESS) {
50
- console.log("setting new reward address");
51
- await sendGovernanceAction(sf, (gov) =>
52
- gov.setRewardAddress(sf.host.address, tokenAddr, rewardAddr)
53
- );
54
- } else {
55
- console.log("clearing reward address");
56
- await sendGovernanceAction(sf, (gov) =>
57
- gov.clearRewardAddress(sf.host.address, tokenAddr)
58
- );
59
- }
60
- });
@@ -1,53 +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 Set the minimum deposit for a super token.
11
- * @param {Array} args 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-set-token-min-deposit.js : {TOKEN ADDRESS} {MINIMUM DEPOSIT}
18
- */
19
- module.exports = eval(`(${S.toString()})()`)(async function (
20
- args,
21
- options = {}
22
- ) {
23
- console.log("======== Setting minimum deposit ========");
24
- let {protocolReleaseVersion} = options;
25
-
26
- if (args.length !== 2) {
27
- throw new Error("Wrong number of arguments");
28
- }
29
- const minimumDeposit = args.pop();
30
- const tokenAddr = args.pop();
31
- console.log("token address", tokenAddr);
32
- console.log("minimum deposit", minimumDeposit);
33
-
34
- const sf = new SuperfluidSDK.Framework({
35
- ...extractWeb3Options(options),
36
- version: protocolReleaseVersion,
37
- additionalContracts: [
38
- "Ownable",
39
- "IMultiSigWallet",
40
- "SuperfluidGovernanceBase",
41
- ],
42
- contractLoader: builtTruffleContractLoader,
43
- });
44
- await sf.initialize();
45
-
46
- await sendGovernanceAction(sf, (gov) =>
47
- gov.setSuperTokenMinimumDeposit(
48
- sf.host.address,
49
- tokenAddr,
50
- minimumDeposit
51
- )
52
- );
53
- });
@@ -1,80 +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 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 {string} options.protocolReleaseVersion Specify the protocol release version to be used
16
- *
17
- * Usage: npx truffle exec ops-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
- * ENV vars:
22
- * GOVERNANCE_ADMIN_TYPE needs to be set to MULTISIG for networks with multisig owned governance
23
- *
24
- * Make sure to only set forwarders which can be fully trusted!
25
- */
26
- module.exports = eval(`(${S.toString()})()`)(async function (
27
- args,
28
- options = {}
29
- ) {
30
- console.log("======== Setting trusted forwarder ========");
31
- let {protocolReleaseVersion} = options;
32
-
33
- if (args.length !== 3) {
34
- throw new Error("Wrong number of arguments");
35
- }
36
- const enable = parseInt(args.pop());
37
- const forwarderAddr = args.pop();
38
- const tokenAddr = args.pop();
39
- console.log("token address", tokenAddr);
40
- console.log("forwarder address", forwarderAddr);
41
- console.log("enable", enable);
42
-
43
- const sf = new SuperfluidSDK.Framework({
44
- ...extractWeb3Options(options),
45
- version: protocolReleaseVersion,
46
- additionalContracts: [
47
- "Ownable",
48
- "IMultiSigWallet",
49
- "SuperfluidGovernanceBase",
50
- ],
51
- contractLoader: builtTruffleContractLoader,
52
- });
53
- await sf.initialize();
54
-
55
- if (enable === 1) {
56
- console.log(
57
- `Enabling trusted forwarder ${forwarderAddr} for ${tokenAddr}`
58
- );
59
- await sendGovernanceAction(sf, (gov) =>
60
- gov.enableTrustedForwarder(
61
- sf.host.address,
62
- tokenAddr,
63
- forwarderAddr
64
- )
65
- );
66
- } else if (enable === 0) {
67
- console.log(
68
- `Disabling trusted forwarder ${forwarderAddr} for ${tokenAddr}`
69
- );
70
- await sendGovernanceAction(sf, (gov) =>
71
- gov.disableTrustedForwarder(
72
- sf.host.address,
73
- tokenAddr,
74
- forwarderAddr
75
- )
76
- );
77
- } else {
78
- console.error("invalid value for argument ENABLE provided!");
79
- }
80
- });
@@ -1,90 +0,0 @@
1
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
2
- const {web3tx} = require("@decentral.ee/web3-helpers");
3
- const {
4
- getScriptRunnerFactory: S,
5
- extractWeb3Options,
6
- } = require("./libs/common");
7
-
8
- /**
9
- * @dev Inspect accounts and their agreements
10
- * @param {Array} argv Overriding command line arguments
11
- * @param {boolean} options.isTruffle Whether the script is used within native truffle framework
12
- * @param {Web3} options.web3 Injected web3 instance
13
- * @param {Address} options.from Address to deploy contracts from
14
- *
15
- * Usage: npx truffle exec ops-scripts/gov-transfer-framework-ownership.js : {NEW_GOV_OWNER} [ {NEW_RESOLVER_ADMIN} ]
16
- * if NEW_RESOLVER_ADMIN is not set, only governance ownership is changed
17
- * set NEW_GOV_OWNER to the current owner in order to only set a new resolver admin
18
- */
19
- module.exports = eval(`(${S.toString()})()`)(async function (
20
- args,
21
- options = {}
22
- ) {
23
- let {protocolReleaseVersion} = options;
24
-
25
- if (args.length !== 1 && args.length !== 2) {
26
- throw new Error("Wrong number of arguments");
27
- }
28
-
29
- let newResolverAdmin;
30
- if (args.length === 2) {
31
- newResolverAdmin = args.pop();
32
- }
33
- const newGovOwner = args.pop();
34
-
35
- const myAccount = (await web3.eth.getAccounts())[0];
36
- console.log("My account", myAccount);
37
- console.log("Transferring ownership of the framework to", newGovOwner);
38
- if (newResolverAdmin !== undefined) {
39
- console.log(
40
- "Transferring admin role of the resolver to",
41
- newResolverAdmin
42
- );
43
- }
44
-
45
- const sf = new SuperfluidSDK.Framework({
46
- ...extractWeb3Options(options),
47
- version: protocolReleaseVersion,
48
- additionalContracts: ["AccessControl", "Ownable"],
49
- });
50
- await sf.initialize();
51
-
52
- if (newGovOwner.toLowerCase() !== myAccount.toLowerCase()) {
53
- const govAddress = await sf.host.getGovernance.call();
54
- console.log("Governance address", govAddress);
55
- const ownable = await sf.contracts.Ownable.at(govAddress);
56
- if ((await ownable.owner()).toLowerCase() === myAccount.toLowerCase()) {
57
- await web3tx(
58
- ownable.transferOwnership,
59
- "Transfer the ownership of the governance to new owner"
60
- )(newGovOwner);
61
- } else {
62
- console.log("ERR: I am not owner of the governance.");
63
- }
64
- } else {
65
- console.log("I remain the owner of the governance.");
66
- }
67
-
68
- if (
69
- newResolverAdmin !== undefined &&
70
- newResolverAdmin.toLowerCase() !== myAccount.toLowerCase()
71
- ) {
72
- console.log("Resolver address", sf.resolver.address);
73
- const ADMIN_ROLE = "0x" + "0".repeat(64);
74
- const ac = await sf.contracts.AccessControl.at(sf.resolver.address);
75
- if (await ac.hasRole(ADMIN_ROLE, myAccount)) {
76
- await web3tx(
77
- ac.grantRole,
78
- "Grant admin rights of the resolver to new admin"
79
- )(ADMIN_ROLE, newResolverAdmin);
80
- await web3tx(
81
- ac.revokeRole,
82
- "Revoke my admin rights to the resolver"
83
- )(ADMIN_ROLE, myAccount);
84
- } else {
85
- console.log("ERR: I am not admin of the resolver.");
86
- }
87
- } else {
88
- console.log("I remain the admin of the resolver.");
89
- }
90
- });
@@ -1,87 +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 the latest governance logic and initiate an upgrade to it.
11
- * Needs the deployed governance contract to implement UUPSProxiable
12
- * and owned by a Gnosis Multisig Wallet.
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/gov-upgrade-governance.js
20
- */
21
- module.exports = eval(`(${S.toString()})()`)(async function (
22
- args,
23
- options = {}
24
- ) {
25
- console.log("======== Upgrade governance ========");
26
- let {protocolReleaseVersion} = options;
27
-
28
- console.log("protocol release version:", protocolReleaseVersion);
29
-
30
- const sf = new SuperfluidSDK.Framework({
31
- ...extractWeb3Options(options),
32
- version: protocolReleaseVersion,
33
- additionalContracts: [
34
- "Ownable",
35
- "IMultiSigWallet",
36
- "SuperfluidGovernanceBase",
37
- "SuperfluidGovernanceII",
38
- ],
39
- contractLoader: builtTruffleContractLoader,
40
- });
41
- await sf.initialize();
42
-
43
- const gov = await sf.contracts.UUPSProxiable.at(
44
- await sf.host.getGovernance.call()
45
- );
46
- console.log("Governance address:", gov.address);
47
-
48
- // sanity check - do we have an upgradable proxy contract and the right one?
49
- try {
50
- const uuidIs = await gov.proxiableUUID();
51
- const uuidWant = web3.utils.keccak256(
52
- "org.superfluid-finance.contracts.SuperfluidGovernanceII.implementation"
53
- );
54
- if (uuidIs !== uuidWant) {
55
- console.error("ERR: governance contract: proxiableUUID mismatch");
56
- process.exit(1);
57
- }
58
- } catch (e) {
59
- console.error(
60
- "ERR: governance seems not to be an instance of UUPSProxiable"
61
- );
62
- process.exit(1);
63
- }
64
-
65
- // we have the right contract, proceeding with new contract deployment
66
- console.log(
67
- "Deploying new instance of SuperfluidGovernanceII (gov logic)..."
68
- );
69
- const govLogic = await sf.contracts.SuperfluidGovernanceII.new();
70
- console.log("Deployed to", govLogic.address);
71
- await govLogic.castrate();
72
- console.log("Marked gov logic as initialized (castrate)");
73
-
74
- // prepare multisig transaction for executing the upgrade
75
- const multis = await sf.contracts.IMultiSigWallet.at(
76
- await (await sf.contracts.Ownable.at(gov.address)).owner()
77
- );
78
- console.log("MultiSig address:", multis.address);
79
-
80
- const data = gov.contract.methods.updateCode(govLogic.address).encodeABI();
81
- console.log("MultiSig data", data);
82
- console.log("Sending governance action to multisig...");
83
- await multis.submitTransaction(gov.address, 0, data);
84
- console.log(
85
- "Governance action sent, but it may still need confirmation(s)."
86
- );
87
- });
@@ -1,193 +0,0 @@
1
- const async = require("async");
2
- const fs = require("fs");
3
- const SuperfluidSDK = require("@superfluid-finance/js-sdk");
4
- const {ZERO_ADDRESS} = require("./libs/common");
5
-
6
- const MAX_REQUESTS = 20;
7
-
8
- const {
9
- getScriptRunnerFactory: S,
10
- extractWeb3Options,
11
- builtTruffleContractLoader,
12
- sendGovernanceAction,
13
- } = require("./libs/common");
14
-
15
- /**
16
- * @dev Upgrade a managed super token to the latest logic
17
- * @param {Array} argv Overriding command line arguments
18
- * @param {boolean} options.isTruffle Whether the script is used within native truffle framework
19
- * @param {Web3} options.web3 Injected web3 instance
20
- * @param {Address} options.from Address to deploy contracts from
21
- * @param {string} options.protocolReleaseVersion Specify the protocol release version to be used
22
- * @param {boolean} options.dryRun Print out what would be done without actually creating/executing a gov action
23
- * (overriding env: DRY_RUN) - NOT set by default
24
- * @param {string} options.skipTokensFile Name of a JSON file with a list of tokens (by chainId) to be skipped
25
- * (overriding env: SKIP_TOKENS_FILE) - defaults to "./upgrade_skip_tokens.json"
26
- * @param {string} options.outputFile Name of file where to log addresses of tokens (to be) updated
27
- * (overriding env: OUTPUT_FILE)
28
- *
29
- * Usage: npx truffle exec ops-scripts/gov-upgrade-super-token-logic.js : ALL | {SUPER_TOKEN_ADDRESS} ...
30
- */
31
- module.exports = eval(`(${S.toString()})()`)(async function (
32
- args,
33
- options = {}
34
- ) {
35
- console.log("======== Upgrade super token logic ========");
36
- let {protocolReleaseVersion, skipTokensFile, dryRun, outputFile} = options;
37
-
38
- console.log("protocol release version:", protocolReleaseVersion);
39
- dryRun = dryRun || process.env.DRY_RUN !== undefined;
40
- console.log("dry run:", dryRun);
41
-
42
- skipTokensFile = skipTokensFile || process.env.SKIP_OUTPUT_FILE || "./upgrade_skip_tokens.json";
43
- let skipTokens = [];
44
- if (fs.existsSync(skipTokensFile)) {
45
- console.log(`File with tokens to be skipped: ${skipTokensFile}`);
46
- const chainId = await web3.eth.getChainId();
47
- const fileContents = JSON.parse(fs.readFileSync(skipTokensFile));
48
- skipTokens = fileContents[chainId] || [];
49
- for (const t of skipTokens) {
50
- if (!web3.utils.isAddress(t)) {
51
- throw new Error(`Invalid address: ${t}`);
52
- }
53
- }
54
- console.log(`tokens to be skipped: ${JSON.stringify(skipTokens, null, 2)}`);
55
- } else {
56
- console.warn(`File with tokens to be skipped doesn't exist: ${skipTokensFile}`);
57
- }
58
-
59
- outputFile = outputFile || process.env.OUTPUT_FILE;
60
- console.log("output file: ", outputFile);
61
-
62
- const sf = new SuperfluidSDK.Framework({
63
- ...extractWeb3Options(options),
64
- version: protocolReleaseVersion,
65
- additionalContracts: [
66
- "Ownable",
67
- "IMultiSigWallet",
68
- "SuperfluidGovernanceBase",
69
- "Resolver",
70
- "UUPSProxiable",
71
- "SETHProxy",
72
- ],
73
- contractLoader: builtTruffleContractLoader,
74
- });
75
- await sf.initialize();
76
-
77
- const {UUPSProxiable, ISuperToken} = sf.contracts;
78
-
79
- const superTokenFactory = await sf.contracts.ISuperTokenFactory.at(
80
- await sf.host.getSuperTokenFactory.call()
81
- );
82
-
83
- let tokensToBeChecked;
84
- const maxItems = parseInt(process.env.MAX_ITEMS) || 1000;
85
- const skipItems = parseInt(process.env.SKIP_ITEMS) || 0;
86
- if (args.length === 1 && args[0] === "ALL") {
87
- tokensToBeChecked = (
88
- await sf.subgraphQuery(`{
89
- tokenStatistics(first: ${maxItems}, skip: ${skipItems}) {
90
- token {
91
- id
92
- }
93
- }
94
- }`)
95
- ).tokenStatistics.map((i) => i.token.id);
96
- } else {
97
- tokensToBeChecked = Array.from(args);
98
- }
99
-
100
- console.log(`Got ${tokensToBeChecked.length} candidates`);
101
- if (tokensToBeChecked.length >= maxItems) {
102
- console.warn("### There's more items than returned by the query");
103
- }
104
-
105
- const latestSuperTokenLogic = await superTokenFactory.getSuperTokenLogic();
106
- console.log("Latest SuperToken logic address", latestSuperTokenLogic);
107
-
108
- // before applying skip list
109
- let tokensToMaybeBeUpgraded = (
110
- await async.mapLimit(
111
- tokensToBeChecked,
112
- MAX_REQUESTS,
113
- async (superTokenAddress) => {
114
- const superToken = await ISuperToken.at(superTokenAddress);
115
- try {
116
- const symbol = await superToken.symbol();
117
- if ((await superToken.getHost()) !== sf.host.address) {
118
- throw new Error(
119
- "Super token is from a different universe"
120
- );
121
- }
122
- const superTokenLogic = await (
123
- await UUPSProxiable.at(superTokenAddress)
124
- ).getCodeAddress();
125
-
126
- if (superTokenLogic === ZERO_ADDRESS) {
127
- console.log(
128
- `SuperToken@${superToken.address} (${symbol}) is likely a not initalized proxy`
129
- );
130
- } else if (latestSuperTokenLogic !== superTokenLogic) {
131
- console.log(
132
- `SuperToken@${superToken.address} (${symbol}) logic needs upgrade from ${superTokenLogic}`
133
- );
134
- return superTokenAddress;
135
- } else {
136
- console.log(
137
- `SuperToken@${superToken.address} (${symbol}) logic is up to date`
138
- );
139
- return undefined;
140
- }
141
- } catch {
142
- console.warn(
143
- `[WARN] SuperToken@${superToken.address} is smelly`
144
- );
145
- return undefined;
146
- }
147
- }
148
- )
149
- ).filter((i) => typeof i !== "undefined");
150
-
151
- console.log(`${tokensToMaybeBeUpgraded.length} tokens to maybe be upgraded (before applying skip list)`);
152
-
153
- const tokensToBeUpgraded = tokensToMaybeBeUpgraded.filter(
154
- (item) => !skipTokens.map(e => e.toLowerCase()).includes(item.toLowerCase()));
155
-
156
- if (tokensToBeUpgraded.length > 0) {
157
- console.log(`${tokensToBeUpgraded.length} tokens to be upgraded`);
158
- if (outputFile !== undefined) {
159
- fs.writeFileSync(outputFile, JSON.stringify(tokensToBeUpgraded, null, 2));
160
- console.log(`List of tokens to be upgraded written to ${outputFile}`);
161
- }
162
-
163
- const batchSize = parseInt(process.env.BATCH_SIZE) || 1000;
164
- for (let offset = 0; offset < tokensToBeUpgraded.length; offset += batchSize) {
165
- const batch = tokensToBeUpgraded.slice(offset, offset + batchSize);
166
- console.log(
167
- `*** Batch ${offset/batchSize+1} | upgrading ${batch.length} super tokens: ${JSON.stringify(batch, null, 2)}`
168
- );
169
- if (!dryRun) {
170
- await sendGovernanceAction(sf, (gov) =>
171
- gov.batchUpdateSuperTokenLogic(sf.host.address, batch)
172
- );
173
-
174
- console.log("checking if 2nd run needed");
175
- try {
176
- const beaconST = await ISuperToken.at(batch[0]);
177
- const cofAddr = await beaconST.CONSTANT_OUTFLOW_NFT();
178
- if (cofAddr === ZERO_ADDRESS) {
179
- console.log("running upgrade again for NFT initialization...");
180
- // the first time it is to get the code to initialize the NFT proxies there
181
- // the second time is to actually execute that code in updateCode
182
- await sendGovernanceAction(sf, (gov) =>
183
- gov.batchUpdateSuperTokenLogic(sf.host.address, batch)
184
- );
185
- }
186
- } catch (e) {
187
- console.log(`failed to read constantOutflowNFT addr: ${e.toString()}`);
188
- console.log("this is expected if running againt a pre-1.6.0 deployment");
189
- }
190
- }
191
- }
192
- }
193
- });