-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
packages/ethereum-contracts/scripts/gov-create-new-factory-registration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const SuperfluidSDK = require("@superfluid-finance/js-sdk"); | ||
const { | ||
getScriptRunnerFactory: S, | ||
extractWeb3Options, | ||
builtTruffleContractLoader, | ||
sendGovernanceAction, | ||
} = require("./libs/common"); | ||
|
||
/** | ||
* @dev Create a new super app factory registration. | ||
* @param {Array} argv Overriding command line arguments | ||
* @param {boolean} options.isTruffle Whether the script is used within native truffle framework | ||
* @param {Web3} options.web3 Injected web3 instance | ||
* @param {Address} options.from Address to deploy contracts from | ||
* @param {boolean} options.protocolReleaseVersion Specify the protocol release version to be used | ||
* | ||
* Usage: npx truffle exec scripts/create-new-factory-registration.js : {FACTORY_ADDRESS} | ||
*/ | ||
module.exports = eval(`(${S.toString()})({ | ||
doNotPrintColonArgs: true | ||
})`)(async function (args, options = {}) { | ||
console.log("======== Creating new factory registration ========"); | ||
let {protocolReleaseVersion} = options; | ||
|
||
if (args.length !== 1) { | ||
throw new Error("Wrong number of arguments"); | ||
} | ||
const factoryAddress = args.pop(); | ||
|
||
console.log("protocol release version:", protocolReleaseVersion); | ||
|
||
const sf = new SuperfluidSDK.Framework({ | ||
...extractWeb3Options(options), | ||
version: protocolReleaseVersion, | ||
additionalContracts: [ | ||
"Ownable", | ||
"IMultiSigWallet", | ||
"SuperfluidGovernanceBase", | ||
], | ||
contractLoader: builtTruffleContractLoader, | ||
}); | ||
await sf.initialize(); | ||
|
||
console.log("Factory Address:", factoryAddress); | ||
|
||
await sendGovernanceAction(sf, (gov) => | ||
gov.authorizeAppFactory(sf.host.address, factoryAddress) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters