Vote
Create a decentralized organization for token holders to vote on proposals.
import { ThirdwebSDK } from "@thirdweb-dev/sdk"; const sdk = new ThirdwebSDK("{{chainName}}");const contract = await sdk.getContract( "{{contract_address}}", "vote",);
class Vote implements UpdateableNetwork {}
function constructor(network: NetworkInput, address: string, storage: ThirdwebStorage<IpfsUploadBatchOptions>, options: undefined | ({ clientId?: string; gasSettings?: { maxPriceInGwei?: number; speed?: "standard" | "fast" | "fastest" }; gasless?: ({ experimentalChainlessSupport?: boolean; openzeppelin: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; useEOAForwarder?: boolean } }) | ({ biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number } }) | ({ engine: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string }; experimentalChainlessSupport?: boolean }); gatewayUrls?: Array<string>; readonlySettings?: { chainId?: number; rpcUrl: string }; rpcBatchSettings?: { sizeLimit?: number; timeLimit?: number }; secretKey?: string; supportedChains?: Array<{ chainId: number; nativeCurrency: { decimals: number; name: string; symbol: string }; rpc: Array<string>; slug: string }> }), abi: Array<objectInputType<{ inputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; name: ZodDefault<ZodString>; outputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; type: ZodString }, ZodAny, "strip">>, chainId: number, contractWrapper: ContractWrapper<VoteERC20>) : Vote
let options: | undefined | { clientId?: string; gasSettings?: { maxPriceInGwei?: number; speed?: "standard" | "fast" | "fastest"; }; gasless?: | { experimentalChainlessSupport?: boolean; openzeppelin: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; useEOAForwarder?: boolean; }; } | { biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number; }; } | { engine: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; }; experimentalChainlessSupport?: boolean; }; gatewayUrls?: Array<string>; readonlySettings?: { chainId?: number; rpcUrl: string }; rpcBatchSettings?: { sizeLimit?: number; timeLimit?: number }; secretKey?: string; supportedChains?: Array<{ chainId: number; nativeCurrency: { decimals: number; name: string; symbol: string; }; rpc: Array<string>; slug: string; }>; };
let abi: Array<objectInputType<{ inputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; name: ZodDefault<ZodString>; outputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; type: ZodString }, ZodAny, "strip">>
Check the balance of the project wallet in the native token of the chain
function balance(): Promise<{ decimals: number; displayValue: string; name: string; symbol: string; value: BigNumber;}>;
Check the balance of the project wallet in a particular ERC20 token contract
function balanceOfToken( tokenAddress: string,): Promise<{ decimals: number; displayValue: string; name: string; symbol: string; value: BigNumber;}>;
Can Execute
Check if a proposal can be executed (if the proposal has succeeded).
// The proposal ID of the proposal you want to checkconst proposalId = "0";const canExecute = await contract.canExecute(proposalId);console.log(canExecute);
function canExecute(proposalId: string): Promise<boolean>;
Get a proposal by id.
The proposal.
Get All Proposals
Get all the proposals in this contract.
const proposals = await contract.getAll();console.log(proposals);
All the proposals in the contract.
Get the votes for a specific proposal
function getProposalVotes( proposalId: BigNumber,
Check If Wallet Voted
Check if a specified wallet has voted a specific proposal
// The proposal ID of the proposal you want to checkconst proposalId = "0";// The address of the wallet you want to check to see if they votedconst address = "{{wallet_address}}"; await contract.hasVoted(proposalId, address);
function hasVoted( proposalId: string, account?: string,): Promise<boolean>;
Get the Vote contract configuration
function execute(proposalId: string): Promise<TResult>;
Preparable
You can also prepare the transaction without executing it by calling execute.prepare()
with same arguments. Learn more
function propose( description: string,): Promise<TResult>;
let returnType: Promise<TResult>;
The id of the created proposal and the transaction receipt.
Preparable
You can also prepare the transaction without executing it by calling propose.prepare()
with same arguments. Learn more
function vote( proposalId: string, reason: any,): Promise<TResult>;
Preparable
You can also prepare the transaction without executing it by calling vote.prepare()
with same arguments. Learn more
let abi: Array<objectOutputType<{ inputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; name: ZodDefault<ZodString>; outputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; type: ZodString }, ZodAny, "strip">>
let metadata: ContractMetadata<VoteERC20, { deploy: ZodObject<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<[..., ...]>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[..., ..., ..., ...]>, BigNumber, string | number | bigint | (BigNumber)>, string, string | number | bigint | (BigNumber)>>; 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, (`${...}.eth`) | (`${...}.cb.id`)>]> }>, { trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>, "many">> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; proposal_token_threshold: string; social_urls?: Record<string, string>; trusted_forwarders: Array<string>; voting_delay_in_blocks: number; voting_period_in_blocks: number; voting_quorum_fraction: number; voting_token_address: string }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; proposal_token_threshold?: string | number | bigint | (BigNumber); social_urls?: Record<string, string>; trusted_forwarders?: Array<string>; voting_delay_in_blocks?: number; voting_period_in_blocks?: number; voting_quorum_fraction?: number; voting_token_address: string }>; input: ZodObject<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, (`${...}.eth`) | (`${...}.cb.id`)>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<..., ..., ..., ..., ...>]>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<..., ..., ...>]>, BigNumber, string | number | bigint | (BigNumber)>, string, string | number | bigint | (BigNumber)>>; 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; defaultAdmin?: 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; defaultAdmin?: 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<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<[..., ...]>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { image: ZodOptional<ZodString> }>, extendShape<{ proposal_token_threshold: ZodDefault<ZodEffects<ZodEffects<ZodUnion<[..., ..., ..., ...]>, BigNumber, string | number | bigint | (BigNumber)>, string, string | number | bigint | (BigNumber)>>; 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, (`${...}.eth`) | (`${...}.cb.id`)>]> }, { proposal_token_threshold: ZodEffects<ZodUnion<[ZodString, ZodNumber, ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>]>, BigNumber, string | number | bigint | (BigNumber)> }>>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: 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; defaultAdmin?: string; description?: string; external_link?: string; image?: string; 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 }> }>
let chainId: number;