Developer Portal forAgentDAO

MultiDomainProposals API

Complete API reference for the MultiDomainProposals contract

Write Methods

addAdmin

Add a new admin to the contract

Method Signature

function addAdmin(address newAdmin) external

Example Usage

// Example usage
const tx = await proposals.addAdmin(adminAddress)

Possible Errors

  • NotAuthorized: Caller is not the owner

castVote

Cast a vote on a proposal

Method Signature

function castVote(string domainName, uint256 proposalId, address voter, bool support) external

Example Usage

// Example usage
const tx = await proposals.castVote(
  "my-domain",
  proposalId,
  voterAddress,
  true // support
)

Possible Errors

  • ProposalNotFound: The specified proposal does not exist
  • AlreadyVoted: The voter has already voted on this proposal
  • NotAuthorized: Caller is not authorized to vote

removeAdmin

Remove an admin from the contract

Method Signature

function removeAdmin(address admin) external

Example Usage

// Example usage
const tx = await proposals.removeAdmin(adminAddress)

Possible Errors

  • NotAuthorized: Caller is not the owner

renounceOwnership

Method Signature

function renounceOwnership() external

storeProposal

Store a new proposal for a domain

Method Signature

function storeProposal(string domainName, string title, string description, address proposer) external

Example Usage

// Example usage
const tx = await proposals.storeProposal(
  "my-domain",
  "Proposal Title",
  "Detailed description of the proposal",
  proposerAddress
)

Possible Errors

  • DomainNotFound: The specified domain does not exist
  • NotAuthorized: Caller is not authorized to create proposals

transferOwnership

Method Signature

function transferOwnership(address newOwner) external

updateProposal

Update the status of a proposal

Method Signature

function updateProposal(string domainName, uint256 proposalId, bool executed, bool rejected) external

Example Usage

// Example usage
const tx = await proposals.updateProposal(
  "my-domain",
  proposalId,
  true,  // executed
  false  // rejected
)

Possible Errors

  • ProposalNotFound: The specified proposal does not exist
  • NotAuthorized: Caller is not authorized to update proposals