Private
_chainPrivate
contractExecute Proposal
Rest
...args: [proposalId: string]Execute the related transactions for a proposal if the proposal succeeded.
// The proposal ID of the proposal you want to execute
const proposalId = "0"
await contract.execute(proposalId);
Rest
...args: [proposalId: string]Create Proposal
Rest
...args: [description: string, executions?: ProposalExecutable[]]Create a new proposal for token holders to vote on.
// 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);
Rest
...args: [description: string, executions?: ProposalExecutable[]]Private
storageVote
Rest
...args: [proposalId: string, voteType: VoteType, reason: any]Vote on an active proposal
// 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);
Rest
...args: [proposalId: string, voteType: VoteType, reason: any]Check the balance of the project wallet in the native token of the chain
Check the balance of the project wallet in a particular ERC20 token contract
Can Execute
The proposal ID to check.
Check if a proposal can be executed (if the proposal has succeeded).
// The proposal ID of the proposal you want to check
const proposalId = "0";
const canExecute = await contract.canExecute(proposalId);
console.log(canExecute);
Get the votes for a specific proposal
the proposalId
Check If Wallet Voted
The unique identifier of a proposal .
Optional
account: string(optional) wallet account address. Defaults to connected signer.
Check if a specified wallet has voted a specific proposal
// 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);
Get the Vote contract configuration
Generated using TypeDoc
Create a decentralized organization for token holders to vote on proposals.
Example