Governance System UI
Dexaran opened this issue · comments
The following describes a graphical interface to simplify the interaction with the Governance System smart-contract of Callisto Network.
Definition
The UI must represent a modification of wallet.callisto.network service.
It must contain two new tabs as it is shown at the image below:
-
Vote Proposal
-
Submit Proposal
Vote Proposal tab
Vote tab represents a list of submitted proposals. Proposals can have one of the three status types:
-
votable (a user can submit a vote for/against this proposal)
-
active (proposal is already accepted or rejected. A user can not submit a vote anymore)
-
pending (proposal is submitted but it is not yet available for voting. It will become votable in the next Treasury Epoch)
Once a user has clicked the "Vote Proposal" tab button the interface must search blockchain for the ProposalSubmitted event entry and retrieve a name
of each submitted proposal. Name of a proposal is a unique identifier of proposal entity (or a keccak256 hash of the proposal name).
Once a list of proposal names (or name hashes) is obtained, the UI must retrieve the information for each proposal using the proposals mapping of the contract.
NOTE: Retrieving the content of each proposal works the same as querying the hash of the name of a proposal using contract ABI at the Interact With Contracts tab. The image below is an illustration of the contract invocation form which implements the same logic for retrieving values:
Proposals should be displayed on the page one below the other.
Each proposal should be displayed in concise form and only the most necessary information should be displayed by default. There should be a + show more details
button at the bottom of each proposal. The purpose of the +
button is to display a dropdown menu with more info for a certain proposal.
Proposal content
Once a user has clicked the + show details
button a dropdown content of the selected proposal must be displayed as it is shown at the image below:
Broadcasting a user's vote
If a user clicked the "Vote FOR" / "Vote AGAINST" / "Vote ABSTAIN" button then the vote_cast transaction must be generated. This transaction will be sent to the contract if a user will confirm it at the popup confirmation form.
{
"gasLimit":"150000",
"to":" < Contract address >",
"value":"0",
"data":" < ABI encoded call of the cast_vote() function >",
"chainId":820
}
The UI must provide two vatiables for the cast_vote() function:
-
proposal name (name of the corresponding proposal)
-
vote code (depends on the clicked button:
0
= FOR /1
= AGAINST /2
= ABSTAIN)
Submit Proposal tab
Test implementation of the governance contract deployed at CLO MAINNET: https://explorer2.callisto.network/addr/0x590396425fc45f69568ac02fda01fdd3ff09efea
ABI
[
{
"constant": true,
"inputs": [],
"name": "last_proposal",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_new_staking_contract",
"type": "address"
}
],
"name": "set_staking_contract",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "bytes32"
}
],
"name": "proposals",
"outputs": [
{
"name": "name",
"type": "string"
},
{
"name": "URL",
"type": "string"
},
{
"name": "hash",
"type": "bytes32"
},
{
"name": "start_epoch",
"type": "uint256"
},
{
"name": "end_epoch",
"type": "uint256"
},
{
"name": "payment_address",
"type": "address"
},
{
"name": "payment_amount",
"type": "uint256"
},
{
"name": "last_funded_epoch",
"type": "uint256"
},
{
"name": "votes_for",
"type": "uint256"
},
{
"name": "votes_against",
"type": "uint256"
},
{
"name": "votes_abstain",
"type": "uint256"
},
{
"name": "status",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_proposal_name",
"type": "string"
}
],
"name": "reevaluate_multiepoch_proposal",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "cold_staking_contract",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_name",
"type": "string"
}
],
"name": "is_votable_proposal",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_who",
"type": "address"
},
{
"name": "_new_weight",
"type": "uint256"
}
],
"name": "update_voter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "epoch_length",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_threshold",
"type": "uint256"
}
],
"name": "set_proposal_threshold",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_who",
"type": "address"
}
],
"name": "is_voter",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "proposal_threshold",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "start_timestamp",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "get_current_epoch",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_proposal_name",
"type": "string"
}
],
"name": "request_funding",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "voting_threshold",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_proposal_name",
"type": "string"
},
{
"name": "_voter",
"type": "address"
}
],
"name": "reevaluate_vote_record",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "bytes32"
},
{
"name": "",
"type": "address"
}
],
"name": "votes",
"outputs": [
{
"name": "vote_code",
"type": "uint256"
},
{
"name": "weight",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "voting_weight",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_threshold",
"type": "uint256"
}
],
"name": "set_voting_threshold",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "become_voter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_name",
"type": "string"
},
{
"name": "_url",
"type": "string"
},
{
"name": "_hash",
"type": "bytes32"
},
{
"name": "_start",
"type": "uint256"
},
{
"name": "_end",
"type": "uint256"
},
{
"name": "_destination",
"type": "address"
},
{
"name": "_funding",
"type": "uint256"
}
],
"name": "submit_proposal",
"outputs": [],
"payable": true,
"stateMutability": "payable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "uint256"
}
],
"name": "proposal_names",
"outputs": [
{
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_name",
"type": "string"
}
],
"name": "evaluate_proposal",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_epoch_length",
"type": "uint256"
}
],
"name": "set_epoch_length",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_name",
"type": "string"
}
],
"name": "withdraw_proposal",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_proposal_name",
"type": "string"
},
{
"name": "_vote_code",
"type": "uint256"
}
],
"name": "cast_vote",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "total_voting_weight",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "resign_voter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "treasurer",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
Test Proposal
is created.
Query 0xeac4b25d9db71364cb2a2812dbc47eed8e23f9ffc223b07b7ed2dcef7d02d9bc
name hash to obtain the proposal info.
New governance system contract is deployed here: 0xcd184d60e04389416ecf09d2cb2cd39d5cf19b19
ABI:
[{"constant":true,"inputs":[],"name":"last_proposal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_new_staking_contract","type":"address"}],"name":"set_staking_contract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"proposals","outputs":[{"name":"name","type":"string"},{"name":"URL","type":"string"},{"name":"hash","type":"bytes32"},{"name":"start_epoch","type":"uint256"},{"name":"end_epoch","type":"uint256"},{"name":"payment_address","type":"address"},{"name":"payment_amount","type":"uint256"},{"name":"last_funded_epoch","type":"uint256"},{"name":"votes_for","type":"uint256"},{"name":"votes_against","type":"uint256"},{"name":"votes_abstain","type":"uint256"},{"name":"status","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposal_name","type":"string"}],"name":"reevaluate_multiepoch_proposal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"cold_staking_contract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_name","type":"string"}],"name":"is_votable_proposal","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"},{"name":"_new_weight","type":"uint256"}],"name":"update_voter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"epoch_length","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_threshold","type":"uint256"}],"name":"set_proposal_threshold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"is_voter","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposal_threshold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"start_timestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"get_current_epoch","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposal_name","type":"string"}],"name":"request_funding","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"voting_threshold","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposal_name","type":"string"},{"name":"_voter","type":"address"}],"name":"reevaluate_vote_record","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"address"}],"name":"votes","outputs":[{"name":"vote_code","type":"uint256"},{"name":"weight","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"voting_weight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_threshold","type":"uint256"}],"name":"set_voting_threshold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"become_voter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_url","type":"string"},{"name":"_hash","type":"bytes32"},{"name":"_start","type":"uint256"},{"name":"_end","type":"uint256"},{"name":"_destination","type":"address"},{"name":"_funding","type":"uint256"}],"name":"submit_proposal","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposal_names","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"evaluate_proposal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_epoch_length","type":"uint256"}],"name":"set_epoch_length","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"}],"name":"withdraw_proposal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_proposal_name","type":"string"},{"name":"_vote_code","type":"uint256"}],"name":"cast_vote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"total_voting_weight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"resign_voter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"treasurer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]
Hello @Dexaran !
I see that in EOS you can delegate your votes to someone else (proxys). Is this something that is considered for the CLO governance?
I guessing that is has been added on EOSIO to raise the amount of EOS that takes part in all the different votes.
But maybe it could create to powerful proxys also
What are you thoughts around this ?
Also! After what we just saw happen with steem where exchanges totally took over the chain.
Do you see some kind of fix for hindering exchanges to use its customers coins to vote?