Creating a Community with an Installed Membership Plugin
The Membership plugin serves as a governance mechanism, allowing a defined portion of members to approve proposals for them to be ratified. It specifies a minimum number of approvals required and designates the addresses permitted to cast votes.
To set up a DAO that incorporates the Membership plugin, you need to first initialize the Membership plugin client and then employ it in the process of creating your DAO.
import { Client, CreateDaoParams, DaoCreationSteps, MultisigClient, MultisigPluginInstallParams,} from"@aragon/sdk-client";import { GasFeeEstimation } from"@aragon/sdk-client-common";import { context } from"../index";// Instantiate a client from the Aragon OSx SDK context.constclient:Client=newClient(context);// Addresses which will be allowed to vote in the Multisig plugin.constmembers:string[] = ["0x1234567890123456789012345678901234567890","0x2345678901234567890123456789012345678901","0x3456789012345678901234567890123456789012","0x4567890123456789012345678901234567890123",];constmultisigPluginIntallParams:MultisigPluginInstallParams= { votingSettings: { minApprovals:1, onlyListed:true, }, members,};// Encodes the parameters of the Multisig plugin. These will get used in the installation plugin for the DAO.constmultisigPluginInstallItem=MultisigClient.encoding.getPluginInstallItem(multisigPluginIntallParams,"goerli");// Pin metadata to IPFS, returns IPFS CID string.constmetadataUri:string=awaitclient.methods.pinMetadata({ name:"My DAO", description:"This is a description", avatar:"",// image url links: [{ name:"Web site", url:"https://...", }],});constcreateParams:CreateDaoParams= { metadataUri, ensSubdomain:"my-org",// my-org.dao.eth plugins: [multisigPluginInstallItem],};// Estimate gas for the transaction.constestimatedGas:GasFeeEstimation=awaitclient.estimation.createDao( createParams,);console.log({ avg:estimatedGas.average, max:estimatedGas.max });// Creates a DAO with a Multisig plugin installed.conststeps=client.methods.createDao(createParams);forawait (conststepof steps) {try {switch (step.key) {caseDaoCreationSteps.CREATING:console.log({ txHash:step.txHash });break;caseDaoCreationSteps.DONE:console.log({ daoAddress:step.address, pluginAddresses:step.pluginAddresses, });break; } } catch (err) {console.error(err); }}