Permissions

Limit members to certain interactions

Permissions allow you to limit what actions specific members can take in your Squad. This is particularly useful when you want to assign different roles or responsibilities to different members. For example, you might want some members to only be able to vote on proposals, while others can initiate and execute transactions.

By assigning specific permissions, you can create a more secure and flexible Squads setup. For instance, you could have:

  • Proposers: Members who can initiate transactions

  • Voters: Members who can vote on proposals

  • Executors: Members who can execute transactions

  • Almighty: Members with full permissions to manage all aspects of the multisig (this is all of the above assigned to one member)

With the SDK, we provide a Permissions enum, that abstracts any of the complexities related to assigning permissions. Here's an example of how this is used with multisigCreate:

import * as multisig from "@sqds/multisig";
import { Connection, Keypair } from "@solana/web3.js";

// Enums
// "Permission" gives single permissions to aggregate in any combination
// "Permissions" provides a method for almighty, and method to aggregate other permissions
const { Permission, Permissions } = multisig.types;

async function main() {
    /*
    See Instructions -> Create Multisig for full snippet
    */
    
    const ix = await multisig.instructions.multisigCreateV2({
        createKey: createKey.publicKey,
        creator: creator.publicKey,
        multisigPda,
        configAuthority: null,
        timeLock: 0,
        members: [{
                key: creator.publicKey,
                // Granted Proposer, Voter, and Executor permissions
                permissions: Permissions.all(),
            },
            {
                key: secondMember.publicKey,
                // Member can only add votes to proposed transactions
                permissions: Permissions.fromPermissions([Permission.Vote]),
            },
        ],
        threshold: 2,
        rentCollector: null
    });
}

Permission Mappings

Permissions in the program are just mappings of u8 values. Stacking permissions for a single member requires adding up the combination of the permission mappings. Each permission maps to the following value:

  • Proposer - 1

  • Voter - 2

  • Executor - 4

  • Almighty (combination of all) - 7

This is only required to be understood if you are using the CLI, or interacting with the program without using the SDK.

Last updated