ParamsControl
一般而言,区块链需要通过硬分叉(hardfork)才能更改区块奖励等全局参数。Conflux引入ParamsControl
内置合约,使得DAO能够在链上投票来调整Conflux的链参数,如PoW的每个区块的出块奖励,或PoS链上的利率。ParamsControl
内置合约由CIP-94引入,CIP-94 介绍页面进行了一定的介绍。
合约接口
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface ParamsControl {
struct Vote {
uint16 topic_index;
uint256[3] votes;
}
/*** Query Functions ***/
/**
* @dev cast vote for parameters
* @param vote_round The round to vote for
* @param vote_data The list of votes to cast
*/
function castVote(uint64 vote_round, Vote[] calldata vote_data) external;
/**
* @dev read the vote data of an account
* @param addr The address of the account to read
*/
function readVote(address addr) external view returns (Vote[] memory);
/**
* @dev Current vote round
*/
function currentRound() external view returns (uint64);
/**
* @dev read the total votes of given round
* @param vote_round The vote number
*/
function totalVotes(uint64 vote_round) external view returns (Vote[] memory);
/**
* @dev read the PoS stake for the round.
*/
function posStakeForVotes(uint64) external view returns (uint256);
event CastVote(uint64 indexed vote_round, address indexed addr, uint16 indexed topic_index, uint256[3] votes);
event RevokeVote(uint64 indexed vote_round, address indexed addr, uint16 indexed topic_index, uint256[3] votes);
}
No Comments