Methods
The operations that can be performed on the ProposalManager
contract are listed here.
Read Operations
Pass one or more Proposal id
s in this function for it to return, for each passed id
, its Proposal
struct containing the Proposal data.
Pass one or more Proposal id
s, one or more voter addresses
and an array of bytes32
tokens in this function for it to retrieve the number of accept and refuse votes for each Proposal. The bytes32 key is defined as: bytes32 item = keccak256(abi.encode(proposalId, proposalVote.collections[z], proposalVote.objectIds[z]));
Pass the bytes32
key that corresponds to a proposalId
, _collection
and objectId
in this function for it to retrieve the weight
amount of the token (objectId
). The bytes32 key is defined as: bytes32 key = keccak256(abi.encodePacked(proposalId, collections[z],objectIds[z]));
Retrieve the governance rules defined by the ProposalConfiguration struct.
Retrieve the last Proposal id created by the Proposal Manager.
Retrieve the last block where a vote is sent by a user.
Write Operations
This function is used to create a Proposal. It takes a ProposalCodes, i.e. an array of ProposalCode
, and returns the id
of the created proposal.
This function is used to vote with an ERC20 token. Pass the tokenAddress
, the eventual permit
signature (if you want to use the Permit operation), the id
of the Proposal to vote in, the number of accept votes and refuse votes, the address of the voter (which can be different from the address of the msg.sender) and the terminate bool, which indicates if, after the vote, the terminate function should be called on the Proposal.
This function is used to vote in batch mode using ERC20 tokens. Each element in the bytes[] data array must contain the tokenAddress
, the eventual permit
signature (if you want to use the Permit operation), the id
of the Proposal to vote in, the number of accept votes and refuse votes, the address of the voter (which can be different from the address of the msg.sender) and the terminate bool, which indicates if, after the vote, the terminate function should be called on the Proposal.
This function is used to withdraw all the votes expressed by an address. It takes as input the ids of the Proposals from which you are withdrawing votes (proposalIds
), the address receiver of the withdrawn tokens (voterOrReceiver
). If passed as address(0)
the msg.sender
is taken as receiver. If afterTermination
is true, the voterOrReceiver
must be populated different from address(0)
. And a boolean parameter (afterTermination
) that represents if the Proposals from which you are withdrawing votes are terminated, i.e. can no longer be voted (true) or not (false).
This function is used to terminate and eventually execute the code of one or more Proposals, represented by their Proposal id
s.
This function can be used to change the current Proposal Manager ProposalConfiguration
containing the governance rules. The function takes as input the new ProposalConfiguration
struct.
Last updated