Gov
The Gov Contract contains logic for holding governance polls and handling Anchor Token (ANC) staking, and allows Anchor Protocol to be governed by its users in a decentralized manner. After the initial bootstrapping of Anchor Protocol's contracts, the Gov Contract is assigned to be the owner of all contracts in Anchor Protocol.
New proposals for change are submitted as polls, and are voted on by ANC stakers through the voting procedure. Polls can contain messages that can be executed directly without changing the Anchor Protocol code.
The Gov Contract keeps a balance of ANC tokens, which it uses to reward stakers with funds it receives from trading fees sent by the Anchor Collector and user deposits from creating new governance polls. This balance is separate from the Community Pool, which is held by the Community contract (owned by the Gov contract).
Config
Key | Type | Description |
| CanonicalAddr | Address of contract owner |
| CanonicalAddr | Contract address of Anchor Token (ANC) |
| Decimal | Minimum percentage of participation required for a poll to pass |
| Decimal | Minimum percentage of |
| u64 | Number of blocks during which votes can be cast [blocks] |
| u64 | Number of blocks required after a poll pass before executing changes [blocks] |
| u64 | Number of blocks after a poll's voting period during which the poll can be executed [blocks] |
| Uint128 | Minimum ANC deposit required for submitting a new poll |
| u64 | Window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks] |
InstantiateMsg
Key | Type | Description |
| Decimal | Minimum percentage of participation required for a poll to pass |
| Decimal | Minimum percentage of |
| u64 | Number of blocks during which votes can be cast [blocks] |
| u64 | Number of blocks required after a poll pass before executing changes [blocks] |
| u64 | Number of blocks after a poll's voting period during which the poll can be executed [blocks] |
| Uint128 | Minimum ANC deposit required for submitting a new poll |
| u64 | Window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks] |
ExecuteMsg
Receive
Receive
Can be called during a CW20 token transfer when the Gov contract is the recipient. Allows the token transfer to execute a Receive Hook as a subsequent action within the same transaction.
Key | Type | Description |
| String | Sender of token transfer |
| Uint128 | Amount of tokens received |
| Binary | Base64-encoded JSON of Receive Hook |
[Internal] ExecutePollMsgs
[Internal] ExecutePollMsgs
Executes messages in a passed poll. Can only by issued by Gov
.
Key | Type | Description |
| u64 | Poll ID |
RegisterContracts
RegisterContracts
Registers the contract addresses (i.e. Anchor Token, ANC) to Gov.
Key | Type | Description |
| String | Contract address of Anchor Token (ANC) |
UpdateConfig
UpdateConfig
Updates the configuration of the Gov contract.
Key | Type | Description |
| String | New address of contract owner |
| Decimal | New percentage of participation (of total staked ANC) required for a poll to pass |
| Decimal | New percentage of |
| u64 | New number of blocks during which votes for a poll can be cast after it has finished its deposit [blocks] |
| u64 | New number of blocks required after a poll pass before executing changes [blocks] |
| u64 | New number of blocks after a poll's voting period during which the poll can be executed [blocks] |
| Uint128 | New minimum ANC deposit required for a poll to enter voting |
| u64 | New window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks] |
* = optional
CastVote
CastVote
Submits a user's vote for an active poll. Once a user has voted, they cannot change their vote with subsequent messages (increasing voting power, changing vote option, cancelling vote, etc.)
Key | Type | Description |
| u64 | Poll ID |
| VoteOption | Can be |
| Uint128 | Amount of voting power (staked ANC) to allocate |
WithdrawVotingTokens
WithdrawVotingTokens
Removes specified amount of staked ANC tokens from a staking position and returns them to a user's balance. Withdraws all staked ANC tokens if amount
is not specified.
Key | Type | Description |
| Uint128 | Amount of ANC tokens to withdraw |
* = optional
EndPoll
EndPoll
Can be issued by anyone to end the voting for an active poll. Triggers tally the results to determine whether the poll has passed. The current block height must exceed the end height of voting phase.
Key | Type | Description |
| u64 | Poll ID |
ExecutePoll
ExecutePoll
Can be issued by anyone to implement into action the contents of a passed poll. The current block height must exceed the end height of the poll's effective delay.
Key | Type | Description |
| u64 | Poll ID |
SnapshotPoll
SnapshotPoll
Snapshots the total amount of staked ANC and stores the number to the specified poll. This staked ANC amount is used to determine the degree of participation for this poll, calculated by dividing the total amount of ANC voted to the poll with the total staked ANC supply at the time of EndPoll. Can only be issued within a window of snapshot_period
blocks before the poll's end_height
.
Key | Type | Description |
| u64 | Poll ID |
Receive Hooks
StakeVotingTokens
StakeVotingTokens
WARNING Sending ANC tokens to the Gov contract without issuing this hook will lead to PERMANENT LOSS OF FUNDS and will be irrevocably donated to the reward pool for stakers.
Issued when sending ANC tokens to the Gov contract to add them to their ANC staking position.
Key | Type | Description |
CreatePoll
CreatePoll
Issued when sending ANC tokens to the Gov contract to create a new poll. Will only succeed if the amount of tokens sent meets the configured proposal_deposit
amount. Can contain a list of generic messages to be issued by the Gov contract if it passes (can invoke messages in other contracts it owns).
Key | Type | Description |
| String | Poll title |
| String | Poll description |
| String | URL to external post about poll (forum, PDF, etc.) |
| Vec<PollExecuteMsg> | List of governance messages to be issued by Gov contract upon poll execution |
Key | Type | Description |
| u64 | Order sequence of message |
| String | Contract address of governance message recipient |
| Binary | Base64-encoded JSON of governance message |
* = optional
QueryMsg
Config
Config
Gets the configuration for the Gov contract.
Key | Type | Description |
ConfigResponse
ConfigResponse
Key | Type | Description |
| String | Address of contract owner |
| String | Contract address of Anchor Token (ANC) |
| Decimal | Minimum percentage of participation required for a poll to pass |
| Decimal | Minimum percentage of |
| u64 | Number of blocks during which votes can be cast [blocks] |
| u64 | Number of blocks required after a poll pass before executing changes [blocks] |
| u64 | Number of blocks after a poll's voting period during which the poll can be executed [blocks] |
| Uint128 | Minimum ANC deposit required for submitting a new poll |
| u64 | Window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks] |
State
State
Gets state information for the Gov contract.
Key | Type | Description |
StateResponse
StateResponse
Key | Type | Description |
| u64 | Total number of created polls |
| Uint128 | Current total number of voting shares |
| Uint128 | Total amount of ANC currently deposited for poll creation |
Staker
Staker
Gets information for the specified ANC staker.
Key | Type | Description |
| String | Address of staker |
StakerResponse
StakerResponse
Key | Type | Description |
| Uint128 | Amount of ANC staked by staker |
| Uint128 | Total voting shares owned by staker |
| Vec<(u64, VoterInfo)> | List of (voted poll's ID, voter's vote information) |
Name | Type | Description |
| VoteOption | Vote type made by staker |
| Uint128 | Amount of staked ANC locked to vote this poll |
Name | Description |
| Staker has voted for the proposal |
| Staker has voted against the proposal |
Poll
Poll
Gets information for the specified poll.
Key | Type | Description |
| u64 | Poll ID |
PollResponse
PollResponse
Key | Type | Description |
| u64 | Poll ID |
| String | Poll creator |
| PollStatus | Current poll status |
| u64 | Block number when voting for this poll closes [block] |
| String | Poll title |
| String | Poll description |
| String | URL to external post about poll (forum, PDF, etc.) |
| Uint128 | ANC deposit used to submit poll |
|
| List of governance messages to be issued upon poll execution |
| Uint128 | Total yes votes (staked ANC amount) for this poll |
| Uint128 | Total no votes (staked ANC amount) for this poll |
| Uint128 | Total staked ANC amount at time of poll snapshot |
| Uint128 | Total staked ANC amount at the end of this poll |
Key | Description |
| Voting for this poll is currently in progress |
| This poll has been passed by governance |
| This poll has been rejected by governance |
| This poll has been passed by governance and executed |
| This poll has been expired after rejection / execution [Deprecated] |
| This poll has been passed, but failed to execute |
Key | Type | Description |
| u64 | Order sequence of message |
| String | Contract address of governance message recipient |
| Binary | Base64-encoded JSON governance message |
* = optional
Polls
Polls
Gets information for all polls.
Key | Type | Description |
| PollStatus | Poll statuses to search for |
| u64 | Poll ID to start query at |
| u32 | Maximum number of query entries |
| OrderBy | Order to make query |
Key | Description |
| Poll is currently in voting period |
| Poll has been passed by governance |
| Poll has been rejected by governance |
| Poll has been passed and executed by governance |
| Poll has been expired after rejection / execution [Deprecated] |
| Poll has been passed, but failed to execute |
Key | Description |
| Make query in ascending order |
| Make query in descending order |
* = optional
PollsResponse
PollsResponse
Key | Type | Description |
| Vec<PollResponse> | List of poll information |
Key | Type | Description |
| u64 | Poll ID |
| String | Poll creator |
| PollStatus | Current poll status |
| u64 | Block number when voting for this poll closes [block] |
| String | Poll title |
| String | Poll description |
| String | URL to external post about poll (forum, PDF, etc.) |
| Uint128 | ANC deposit used to submit poll |
| Vec<PollExecuteMsg> | List of governance messages to be issued upon poll execution |
| Uint128 | Total yes votes (staked ANC amount) for this poll |
| Uint128 | Total no votes (staked ANC amount) for this poll |
| Uint128 | Total staked ANC amount at time of poll snapshot |
| Uint128 | Total staked ANC amount at the end of this poll |
Key | Description |
| Voting for this poll is currently in progress |
| This poll has been passed by governance |
| This poll has been rejected by governance |
| This poll has been passed by governance and executed |
| This poll has been expired after rejection / execution [Deprecated] |
| This poll has been passed, but failed to execute |
Key | Type | Description |
| u64 | Order sequence of message |
| String | Contract address of governance message recipient |
| Binary | Base64-encoded JSON governance message |
* = optional
Voters
Voters
Gets voter information of the poll with the specified ID.
Key | Type | Description |
| u64 | ID of poll to query voters |
| String | Address of voter to start query |
| u32 | Maximum number of query entries |
| OrderBy | Order to make query |
Key | Description |
| Make query in ascending order |
| Make query in descending order |
* = optional
VotersResponse
VotersResponse
Key | Type | Description |
| Vec<VotersResponseItem> | List of voter information |
Key | Type | Description |
| String | Address of voter |
| VoteOption | Vote type made by voter |
| Uint128 | Amount of staked ANC locked to vote this poll |
Key | Description |
| Voter has voted for the proposal |
| Voter has voted against the proposal |
Last updated