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.
const client: Client = new Client(context);
// Addresses which will be allowed to vote in the Multisig plugin.
const members: string[] = [
"0x1234567890123456789012345678901234567890",
"0x2345678901234567890123456789012345678901",
"0x3456789012345678901234567890123456789012",
"0x4567890123456789012345678901234567890123",
];
const multisigPluginIntallParams: 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.
const multisigPluginInstallItem = MultisigClient.encoding
.getPluginInstallItem(multisigPluginIntallParams, "goerli");
// Pin metadata to IPFS, returns IPFS CID string.
const metadataUri: string = await client.methods.pinMetadata({
name: "My DAO",
description: "This is a description",
avatar: "", // image url
links: [{
name: "Web site",
url: "https://...",
}],
});
const createParams: CreateDaoParams = {
metadataUri,
ensSubdomain: "my-org", // my-org.dao.eth
plugins: [multisigPluginInstallItem],
};
// Estimate gas for the transaction.
const estimatedGas: GasFeeEstimation = await client.estimation.createDao(
createParams,
);
console.log({ avg: estimatedGas.average, max: estimatedGas.max });
// Creates a DAO with a Multisig plugin installed.
const steps = client.methods.createDao(createParams);
for await (const step of steps) {
try {
switch (step.key) {
case DaoCreationSteps.CREATING:
console.log({ txHash: step.txHash });
break;
case DaoCreationSteps.DONE:
console.log({
daoAddress: step.address,
pluginAddresses: step.pluginAddresses,
});
break;
}
} catch (err) {
console.error(err);
}
}