EthereumCommonwealth / Roadmap

GNU Lesser General Public License v2.1
57 stars 17 forks source link

Governance System UI #60

Open Dexaran opened 4 years ago

Dexaran commented 4 years ago

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:

TabProposals_edited

Vote Proposal tab

VOTE_tab_edited

Vote tab represents a list of submitted proposals. Proposals can have one of the three status types:

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:

Entity

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:

VOTE_tab_proposal_entity

PROPOSAL_structure

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:

Submit Proposal tab

Dexaran commented 4 years ago

Test implementation of the governance contract deployed at CLO MAINNET: https://explorer2.callisto.network/addr/0x590396425fc45f69568ac02fda01fdd3ff09efea

Dexaran commented 4 years ago

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"
    }
]
Dexaran commented 4 years ago

Test Proposal is created.

Query 0xeac4b25d9db71364cb2a2812dbc47eed8e23f9ffc223b07b7ed2dcef7d02d9bc name hash to obtain the proposal info.

Dexaran commented 4 years ago

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"}]
ghost commented 4 years ago

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?