Merge pull request #1 from h-ivor/master

Add virtual keywords for Governance upgrade proposal.
This commit is contained in:
Alexey Pertsev 2021-09-08 13:36:04 +03:00 committed by GitHub
commit 77ce3c96d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ abstract contract Delegation is Core {
address[] memory from, address[] memory from,
uint256 proposalId, uint256 proposalId,
bool support bool support
) external { ) external virtual {
for (uint256 i = 0; i < from.length; i++) { for (uint256 i = 0; i < from.length; i++) {
require(delegatedTo[from[i]] == msg.sender, "Governance: not authorized"); require(delegatedTo[from[i]] == msg.sender, "Governance: not authorized");
_castVote(from[i], proposalId, support); _castVote(from[i], proposalId, support);

View File

@ -113,7 +113,7 @@ contract Governance is Initializable, Configuration, Delegation, EnsResolve {
_transferTokens(msg.sender, amount); _transferTokens(msg.sender, amount);
} }
function unlock(uint256 amount) external { function unlock(uint256 amount) external virtual {
require(getBlockTimestamp() > canWithdrawAfter[msg.sender], "Governance: tokens are locked"); require(getBlockTimestamp() > canWithdrawAfter[msg.sender], "Governance: tokens are locked");
lockedBalance[msg.sender] = lockedBalance[msg.sender].sub(amount, "Governance: insufficient balance"); lockedBalance[msg.sender] = lockedBalance[msg.sender].sub(amount, "Governance: insufficient balance");
require(torn.transfer(msg.sender, amount), "TORN: transfer failed"); require(torn.transfer(msg.sender, amount), "TORN: transfer failed");
@ -191,7 +191,7 @@ contract Governance is Initializable, Configuration, Delegation, EnsResolve {
emit ProposalExecuted(proposalId); emit ProposalExecuted(proposalId);
} }
function castVote(uint256 proposalId, bool support) external { function castVote(uint256 proposalId, bool support) external virtual {
_castVote(msg.sender, proposalId, support); _castVote(msg.sender, proposalId, support);
} }
@ -241,7 +241,7 @@ contract Governance is Initializable, Configuration, Delegation, EnsResolve {
} }
} }
function _transferTokens(address owner, uint256 amount) internal { function _transferTokens(address owner, uint256 amount) internal virtual {
require(torn.transferFrom(owner, address(this), amount), "TORN: transferFrom failed"); require(torn.transferFrom(owner, address(this), amount), "TORN: transferFrom failed");
lockedBalance[owner] = lockedBalance[owner].add(amount); lockedBalance[owner] = lockedBalance[owner].add(amount);
} }