From 804ad7ace255774c3fca93b5b2f47a6beded804c Mon Sep 17 00:00:00 2001 From: h-ivor Date: Wed, 8 Sep 2021 12:28:28 +0200 Subject: [PATCH] add virtual keyword to functions for governance upgrade --- contracts/Delegation.sol | 2 +- contracts/Governance.sol | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/Delegation.sol b/contracts/Delegation.sol index 5985398..b0d4fbe 100644 --- a/contracts/Delegation.sol +++ b/contracts/Delegation.sol @@ -47,7 +47,7 @@ abstract contract Delegation is Core { address[] memory from, uint256 proposalId, bool support - ) external { + ) external virtual { for (uint256 i = 0; i < from.length; i++) { require(delegatedTo[from[i]] == msg.sender, "Governance: not authorized"); _castVote(from[i], proposalId, support); diff --git a/contracts/Governance.sol b/contracts/Governance.sol index bd7c5b0..68c615d 100644 --- a/contracts/Governance.sol +++ b/contracts/Governance.sol @@ -113,7 +113,7 @@ contract Governance is Initializable, Configuration, Delegation, EnsResolve { _transferTokens(msg.sender, amount); } - function unlock(uint256 amount) external { + function unlock(uint256 amount) external virtual { require(getBlockTimestamp() > canWithdrawAfter[msg.sender], "Governance: tokens are locked"); lockedBalance[msg.sender] = lockedBalance[msg.sender].sub(amount, "Governance: insufficient balance"); require(torn.transfer(msg.sender, amount), "TORN: transfer failed"); @@ -191,7 +191,7 @@ contract Governance is Initializable, Configuration, Delegation, EnsResolve { emit ProposalExecuted(proposalId); } - function castVote(uint256 proposalId, bool support) external { + function castVote(uint256 proposalId, bool support) external virtual { _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"); lockedBalance[owner] = lockedBalance[owner].add(amount); }