Create a decentralized organization for token holders to vote on proposals.

Example

import { ThirdwebSDK } from "@thirdweb-dev/sdk";

const sdk = new ThirdwebSDK("{{chainName}}");
const contract = await sdk.getContract("{{contract_address}}", "vote");

Hierarchy

  • Vote

Implements

  • UpdateableNetwork

Constructors

  • Parameters

    • network: NetworkInput
    • address: string
    • storage: ThirdwebStorage<IpfsUploadBatchOptions>
    • options: undefined | {
          clientId?: string;
          gasSettings?: { maxPriceInGwei?: number | undefined; speed?: "standard" | "fast" | "fastest" | undefined; };
          gasless?: ({ openzeppelin: { relayerUrl: string; relayerForwarderAddress?: string | undefined; useEOAForwarder?: boolean | undefined; domainName?: string | undefined; domainVersion?: string | undefined; }; experimentalChainlessSupport?: boolean | undefined; }) | ({ biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number | undefined; }; });
          gatewayUrls?: string[];
          readonlySettings?: { rpcUrl: string; chainId?: number | undefined; };
          secretKey?: string;
          supportedChains?: ({ rpc: string[]; chainId: number; nativeCurrency: { symbol: string; name: string; decimals: number; }; slug: string; })[];
      } = {}
    • abi: objectInputType<{
          inputs: ZodDefault<ZodArray<ZodObject<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, "strip", ZodAny, objectOutputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">, objectInputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">>, "many">>;
          name: ZodDefault<ZodString>;
          outputs: ZodDefault<ZodArray<ZodObject<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, "strip", ZodAny, objectOutputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">, objectInputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">>, "many">>;
          type: ZodString;
      }, ZodAny, "strip">[]
    • chainId: number
    • contractWrapper: ContractWrapper<VoteERC20> = ...

    Returns Vote

Properties

_chainId: number
abi: objectOutputType<{
    inputs: ZodDefault<ZodArray<ZodObject<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, "strip", ZodAny, objectOutputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">, objectInputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">>, "many">>;
    name: ZodDefault<ZodString>;
    outputs: ZodDefault<ZodArray<ZodObject<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, "strip", ZodAny, objectOutputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">, objectInputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">>, "many">>;
    type: ZodString;
}, ZodAny, "strip">[]
app: ContractAppURI<VoteERC20>
contractWrapper: ContractWrapper<VoteERC20>
encoder: ContractEncoder<VoteERC20>
estimator: GasCostEstimator<VoteERC20>
events: ContractEvents<VoteERC20>
execute: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Execute Proposal

      Parameters

      • Rest ...args: [proposalId: string]

      Returns Promise<TResult>

      Remarks

      Execute the related transactions for a proposal if the proposal succeeded.

      Example

      // The proposal ID of the proposal you want to execute
      const proposalId = "0"
      await contract.execute(proposalId);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [proposalId: string]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

metadata: ContractMetadata<VoteERC20, {
    deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | BigNumber>, string, string | number | bigint | BigNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>;
        voting_delay_in_blocks: ZodDefault<ZodNumber>;
        voting_period_in_blocks: ZodDefault<ZodNumber>;
        voting_quorum_fraction: ZodDefault<ZodNumber>;
        voting_token_address: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold: string;
        social_urls?: Record<string, string>;
        trusted_forwarders: string[];
        voting_delay_in_blocks: number;
        voting_period_in_blocks: number;
        voting_quorum_fraction: number;
        voting_token_address: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold?: string | number | bigint | BigNumber;
        social_urls?: Record<string, string>;
        trusted_forwarders?: string[];
        voting_delay_in_blocks?: number;
        voting_period_in_blocks?: number;
        voting_quorum_fraction?: number;
        voting_token_address: string;
    }>;
    input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | BigNumber>, string, string | number | bigint | BigNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        voting_delay_in_blocks: ZodDefault<ZodNumber>;
        voting_period_in_blocks: ZodDefault<ZodNumber>;
        voting_quorum_fraction: ZodDefault<ZodNumber>;
        voting_token_address: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold: string;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks: number;
        voting_period_in_blocks: number;
        voting_quorum_fraction: number;
        voting_token_address: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold?: string | number | bigint | BigNumber;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks?: number;
        voting_period_in_blocks?: number;
        voting_quorum_fraction?: number;
        voting_token_address: string;
    }>;
    output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        image: ZodOptional<ZodString>;
        name: ZodString;
        proposal_token_threshold: ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | BigNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        voting_delay_in_blocks: ZodDefault<ZodNumber>;
        voting_period_in_blocks: ZodDefault<ZodNumber>;
        voting_quorum_fraction: ZodDefault<ZodNumber>;
        voting_token_address: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: string;
        name: string;
        proposal_token_threshold: BigNumber;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks: number;
        voting_period_in_blocks: number;
        voting_quorum_fraction: number;
        voting_token_address: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: string;
        name: string;
        proposal_token_threshold: Object;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks?: number;
        voting_period_in_blocks?: number;
        voting_quorum_fraction?: number;
        voting_token_address: string;
    }>;
}>

Type declaration

  • deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | BigNumber>, string, string | number | bigint | BigNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>;
        voting_delay_in_blocks: ZodDefault<ZodNumber>;
        voting_period_in_blocks: ZodDefault<ZodNumber>;
        voting_quorum_fraction: ZodDefault<ZodNumber>;
        voting_token_address: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold: string;
        social_urls?: Record<string, string>;
        trusted_forwarders: string[];
        voting_delay_in_blocks: number;
        voting_period_in_blocks: number;
        voting_quorum_fraction: number;
        voting_token_address: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold?: string | number | bigint | BigNumber;
        social_urls?: Record<string, string>;
        trusted_forwarders?: string[];
        voting_delay_in_blocks?: number;
        voting_period_in_blocks?: number;
        voting_quorum_fraction?: number;
        voting_token_address: string;
    }>
  • input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | BigNumber>, string, string | number | bigint | BigNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        voting_delay_in_blocks: ZodDefault<ZodNumber>;
        voting_period_in_blocks: ZodDefault<ZodNumber>;
        voting_quorum_fraction: ZodDefault<ZodNumber>;
        voting_token_address: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold: string;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks: number;
        voting_period_in_blocks: number;
        voting_quorum_fraction: number;
        voting_token_address: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: any;
        name: string;
        proposal_token_threshold?: string | number | bigint | BigNumber;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks?: number;
        voting_period_in_blocks?: number;
        voting_quorum_fraction?: number;
        voting_token_address: string;
    }>
  • output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        image: ZodOptional<ZodString>;
        name: ZodString;
        proposal_token_threshold: ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | BigNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        voting_delay_in_blocks: ZodDefault<ZodNumber>;
        voting_period_in_blocks: ZodDefault<ZodNumber>;
        voting_quorum_fraction: ZodDefault<ZodNumber>;
        voting_token_address: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: string;
        name: string;
        proposal_token_threshold: BigNumber;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks: number;
        voting_period_in_blocks: number;
        voting_quorum_fraction: number;
        voting_token_address: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        image?: string;
        name: string;
        proposal_token_threshold: Object;
        social_urls?: Record<string, string>;
        voting_delay_in_blocks?: number;
        voting_period_in_blocks?: number;
        voting_quorum_fraction?: number;
        voting_token_address: string;
    }>
propose: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Create Proposal

      Parameters

      Returns Promise<TResult>

      • The id of the created proposal and the transaction receipt.

      Remarks

      Create a new proposal for token holders to vote on.

      Example

      // The description of the proposal you want to pass
      const description = "This is a great proposal - vote for it!"
      // You can (optionally) pass in contract calls that will get executed when the proposal is executed.
      const executions = [
      {
      // The contract you want to make a call to
      toAddress: "0x...",
      // The amount of the native currency to send in this transaction
      nativeTokenValue: 0,
      // Transaction data that will be executed when the proposal is executed
      // This is an example transfer transaction with a token contract (which you would need to set up in code)
      transactionData: tokenContract.encoder.encode(
      "transfer", [
      fromAddress,
      amount,
      ]
      ),
      }
      ]

      const proposal = await contract.propose(description, executions);
  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>)
storage: ThirdwebStorage<IpfsUploadBatchOptions>
vote: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Vote

      Parameters

      • Rest ...args: [proposalId: string, voteType: VoteType, reason: any]

      Returns Promise<TResult>

      Remarks

      Vote on an active proposal

      Example

      // The proposal ID of the proposal you want to vote on
      const proposalId = "0";
      // The vote type you want to cast, can be VoteType.Against, VoteType.For, or VoteType.Abstain
      const voteType = VoteType.For;
      // The (optional) reason for the vote
      const reason = "I like this proposal!";

      await contract.vote(proposalId, voteType, reason);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [proposalId: string, voteType: VoteType, reason: any]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

Accessors

Methods

  • Check the balance of the project wallet in the native token of the chain

    Returns Promise<{
        decimals: number;
        displayValue: string;
        name: string;
        symbol: string;
        value: BigNumber;
    }>

    • The balance of the project in the native token of the chain
  • Check the balance of the project wallet in a particular ERC20 token contract

    Parameters

    • tokenAddress: string

    Returns Promise<{
        decimals: number;
        displayValue: string;
        name: string;
        symbol: string;
        value: BigNumber;
    }>

    • The balance of the project in the native token of the chain
  • Can Execute

    Parameters

    • proposalId: string

      The proposal ID to check.

    Returns Promise<boolean>

    • True if the proposal can be executed, false otherwise.

    Remarks

    Check if a proposal can be executed (if the proposal has succeeded).

    Example

    // The proposal ID of the proposal you want to check
    const proposalId = "0";
    const canExecute = await contract.canExecute(proposalId);
    console.log(canExecute);
  • Check If Wallet Voted

    Parameters

    • proposalId: string

      The unique identifier of a proposal .

    • Optional account: string

      (optional) wallet account address. Defaults to connected signer.

    Returns Promise<boolean>

    • True if the account has already voted on the proposal.

    Remarks

    Check if a specified wallet has voted a specific proposal

    Example

    // The proposal ID of the proposal you want to check
    const proposalId = "0";
    // The address of the wallet you want to check to see if they voted
    const address = "{{wallet_address}}";

    await contract.hasVoted(proposalId, address);

Generated using TypeDoc