We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERC20继承 ERC20votes后实现mint后调用_writeCheckpoint来记录代币总的权重。
function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes"); _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); }
对应的地址权重使用数组mapping(address => Checkpoint[]) private _checkpoints;记录,对于Checkpointp[]是一个区块索引数组,记录了不同区块下的votes代币数量来标识权重。对于权重所有者,在mint后会调用钩子函数_afterTokenTransfer来对投票权进行转移,并且记录。
mapping(address => Checkpoint[]) private _checkpoints;
_afterTokenTransfer
The text was updated successfully, but these errors were encountered:
提案门槛_proposalThreshold 由GovernorSettings构造时设置,用来判断address的投票权重是否符合投票门槛
Sorry, something went wrong.
法定人数由ERC20区块对应的代币总数的百分比来确定。
function quorum(uint256 blockNumber) public view virtual override returns (uint256) { return (token.getPastTotalSupply(blockNumber) * quorumNumerator()) / quorumDenominator(); }
其中只有赞成和弃权票计入法定人数。当投票超过法定人数,提案成立。
_proposalThreshold
GovernorSettings
address
No branches or pull requests
ERC20继承 ERC20votes后实现mint后调用_writeCheckpoint来记录代币总的权重。
对应的地址权重使用数组
mapping(address => Checkpoint[]) private _checkpoints;
记录,对于Checkpointp[]是一个区块索引数组,记录了不同区块下的votes代币数量来标识权重。对于权重所有者,在mint后会调用钩子函数_afterTokenTransfer
来对投票权进行转移,并且记录。The text was updated successfully, but these errors were encountered: