đī¸Governance Contract
Last updated
Last updated
The Governance Contract contains logic for holding governance polls and handling VEGAS Token staking, and allows the Terra-vegas casino to be governed by its users in a decentralised manner.
It is a fork from the Governance Contract developed by the Anchor protocol.
After the initial bootstrapping of Terra-vegas contracts, the Gov Contract is assigned to be the owner of all contracts in Terra-vegas.New proposals for change are submitted as polls, and are voted on by VEGAS stakers through the voting procedure. Polls can contain messages that can be executed directly without changing the Terra-vegas code.The Gov Contract keeps a balance of VEGAS tokens, which it uses to reward stakers with funds it receives from the player bets and the reserve contract deposits on the anchor protocol.
Key | Type | Description |
---|---|---|
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.
[Internal] ExecutePollMsgs
Executes messages in a passed poll. Can only by issued by Gov
.
RegisterContracts
Registers the contract addresses (i.e. Terra-vegas Token, VEGAS) to Gov.
UpdateConfig
Updates the configuration of the Gov contract.
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.)
WithdrawVotingTokens
Removes specified amount of staked VEGAS tokens from a staking position and returns them to a user's balance. Withdraws all staked VEGAS tokens if amount
is not specified.
* = optional
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.
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.
SnapshotPoll
Snapshots the total amount of staked VEGAS and stores the number to the specified poll. This staked VEGAS amount is used to determine the degree of participation for this poll, calculated by dividing the total amount of VEGAS voted to the poll with the total staked VEGAS supply at the time of EndPoll. Can only be issued within a window of snapshot_period
blocks before the poll's end_height
.
StakeVotingTokens
WARNING Sending VEGAS 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.
CreatePoll
Issued when sending VEGAS 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).
* = optional
Config
Gets the configuration for the Gov contract.
ConfigResponse
State
Gets state information for the Gov contract.
StateResponse
Staker
Gets information for the specified VEGAS staker.
StakerResponse
Poll
Gets information for the specified poll.
PollResponse
Polls
Gets information for all polls.
PollsResponse
Voters
Gets voter information of the poll with the specified ID.
VotersResponse
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
Key | Type | Description |
---|---|---|
owner
CanonicalAddr
Address of contract owner
token_contract
CanonicalAddr
Contract address of VEGAS Token (VEGAS)
quorum
Decimal
Minimum percentage of participation required for a poll to pass
threshold
Decimal
Minimum percentage of yes
votes required for a poll to pass
voting_period
u64
Number of blocks during which votes can be cast [blocks]
timelock_period
u64
Number of blocks required after a poll pass before executing changes [blocks]
expiration_period
u64
Number of blocks after a poll's voting period during which the poll can be executed [blocks]
proposal_deposit
Uint128
Minimum VEGAS deposit required for submitting a new poll
snapshot_period
u64
Window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks]
quorum
Decimal
Minimum percentage of participation required for a poll to pass
threshold
Decimal
Minimum percentage of yes
votes required for a poll to pass
voting_period
u64
Number of blocks during which votes can be cast [blocks]
timelock_period
u64
Number of blocks required after a poll pass before executing changes [blocks]
expiration_period
u64
Number of blocks after a poll's voting period during which the poll can be executed [blocks]
proposal_deposit
Uint128
Minimum VEGAS deposit required for submitting a new poll
snapshot_period
u64
Window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks]
sender
String
Sender of token transfer
amount
Uint128
Amount of tokens received
msg
Binary
Base64-encoded JSON of Receive Hook
poll_id
u64
Poll ID
token_contract
String
Contract address of Terra-vegas Token (VEGAS)
owner
String
Address of contract owner
quorum
Decimal
New
percentage of participation required for a poll to pass
threshold
Decimal
New percentage of yes
votes required for a poll to pass
voting_period
u64
New number of blocks during which votes can be cast [blocks]
timelock_period
u64
New number of blocks required after a poll pass before executing changes [blocks]
expiration_period
u64
New number of blocks after a poll's voting period during which the poll can be executed [blocks]
proposal_deposit
Uint128
New minimum VEGAS deposit required for submitting a new poll
snapshot_period
u64
New window of time (number of blocks) allowed for poll snapshot before a poll's end [blocks]
poll_id
u64
Poll ID
vote
VoteOption
Can be yes
or no
amount
Uint128
Amount of voting power (staked VEGAS) to allocate
amount
*
Uint128
Amount of VEGAS tokens to withdraw
poll_id
u64
Poll ID
poll_id
u64
Poll ID
poll_id
u64
Poll ID
title
String
Poll title
description
String
Poll description
link
*
String
URL to external post about poll (forum, PDF, etc.)
execute_msgs
*
Vec<PollExecuteMsg>
List of governance messages to be issued by Gov contract upon poll execution
order
u64
Order sequence of message
contract
String
Contract address of governance message recipient
msg
Binary
New minimum VEGAS deposit required for submitting a new poll
snapshot_period
u64
Base64-encoded JSON of governance message