From ec3a71d1009ab23b0df527798879f8cd1c205e80 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 10 Nov 2021 11:09:43 -0600 Subject: [PATCH 1/3] update NewVote, Voted, and VoteTallied events --- contracts/Governance.sol | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/contracts/Governance.sol b/contracts/Governance.sol index 923e149..88094cb 100755 --- a/contracts/Governance.sol +++ b/contracts/Governance.sol @@ -71,16 +71,26 @@ contract Governance is TellorVars { uint256 _timestamp, address _reporter ); // Emitted when a new dispute is opened - event NewVote(address _contract, bytes4 _function, bytes _data); // Emitted when a new proposal vote is initiated + event NewVote( + address _contract, + bytes4 _function, + bytes _data, + uint256 _disputeId + ); // Emitted when a new proposal vote is initiated event Voted( - uint256 _voteId, + uint256 _disputeId, bool _supports, address _voter, uint256 _voteWeight, bool _invalidQuery ); // Emitted when an address casts their vote event VoteExecuted(uint256 _disputeId, VoteResult _result); // Emitted when a vote is executed - event VoteTallied(uint256 _disputeId, VoteResult _result); // Emitted when all casting for a vote is tallied + event VoteTallied( + uint256 _disputeId, + VoteResult _result, + address _initiator, + address _reporter + ); // Emitted when all casting for a vote is tallied // Functions /** @@ -343,7 +353,10 @@ contract Governance is TellorVars { _STAKE_COUNT, _stakeCount + 1 ); - _controller.changeStakingStatus(_thisDispute.disputedReporter, 1); // Change staking status of disputed reporter, but don't slash + _controller.changeStakingStatus( + _thisDispute.disputedReporter, + 1 + ); // Change staking status of disputed reporter, but don't slash } else if (_thisVote.result == VoteResult.FAILED) { // If vote is in dispute and fails, iterate through each vote round and transfer the dispute fee to disputed reporter uint256 _reporterReward = 0; @@ -367,7 +380,10 @@ contract Governance is TellorVars { _STAKE_COUNT, _stakeCount - 1 ); - _controller.changeStakingStatus(_thisDispute.disputedReporter, 1); + _controller.changeStakingStatus( + _thisDispute.disputedReporter, + 1 + ); } emit VoteExecuted(_disputeId, voteInfo[_disputeId].result); } @@ -438,7 +454,7 @@ contract Governance is TellorVars { "Must interact with the Tellor system" ); require(functionApproved[_function], "Function must be approved"); - emit NewVote(_contract, _function, _data); + emit NewVote(_contract, _function, _data, _disputeId); } /** @@ -510,7 +526,12 @@ contract Governance is TellorVars { _thisVote.result = VoteResult.FAILED; } _thisVote.tallyDate = block.timestamp; // Update time vote was tallied - emit VoteTallied(_disputeId, _thisVote.result); + emit VoteTallied( + _disputeId, + _thisVote.result, + _thisVote.initiator, + disputeInfo[_disputeId].disputedReporter + ); } /** From a5f8a174ccb702425a45e98021c3ca5e98f09248 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 10 Nov 2021 13:16:30 -0600 Subject: [PATCH 2/3] add events for newContract functions --- contracts/Controller.sol | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contracts/Controller.sol b/contracts/Controller.sol index a8fe339..5d54459 100755 --- a/contracts/Controller.sol +++ b/contracts/Controller.sol @@ -13,6 +13,12 @@ import "./Getters.sol"; * changing contract addresses, as well as minting and migrating tokens */ contract Controller is TellorStaking, Transition, Getters { + // Events + event NewControllerContract(address _newController); + event NewGovernanceContract(address _newGovernance); + event NewOracleContract(address _newOracle); + event NewTreasuryContract(address _newTreasury); + // Functions /** * @dev Saves new Tellor contract addresses. Available to Transition init function after fork vote @@ -41,6 +47,7 @@ contract Controller is TellorStaking, Transition, Getters { assembly { sstore(_EIP_SLOT, _newController) } + emit NewControllerContract(_newController); } /** @@ -55,6 +62,7 @@ contract Controller is TellorStaking, Transition, Getters { ); require(_isValid(_newGovernance)); addresses[_GOVERNANCE_CONTRACT] = _newGovernance; + emit NewGovernanceContract(_newGovernance); } /** @@ -69,6 +77,7 @@ contract Controller is TellorStaking, Transition, Getters { ); require(_isValid(_newOracle)); addresses[_ORACLE_CONTRACT] = _newOracle; + emit NewOracleContract(_newOracle); } /** @@ -83,6 +92,7 @@ contract Controller is TellorStaking, Transition, Getters { ); require(_isValid(_newTreasury)); addresses[_TREASURY_CONTRACT] = _newTreasury; + emit NewTreasuryContract(_newTreasury); } /** From c61336d75b59346b2f248c8db40cc71818935daa Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 10 Nov 2021 13:28:26 -0600 Subject: [PATCH 3/3] update events --- contracts/Controller.sol | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/contracts/Controller.sol b/contracts/Controller.sol index 5d54459..fa34b69 100755 --- a/contracts/Controller.sol +++ b/contracts/Controller.sol @@ -14,10 +14,7 @@ import "./Getters.sol"; */ contract Controller is TellorStaking, Transition, Getters { // Events - event NewControllerContract(address _newController); - event NewGovernanceContract(address _newGovernance); - event NewOracleContract(address _newOracle); - event NewTreasuryContract(address _newTreasury); + event NewContractAddress(address _newContract, string _contractName); // Functions /** @@ -47,7 +44,7 @@ contract Controller is TellorStaking, Transition, Getters { assembly { sstore(_EIP_SLOT, _newController) } - emit NewControllerContract(_newController); + emit NewContractAddress(_newController, "Controller"); } /** @@ -62,7 +59,7 @@ contract Controller is TellorStaking, Transition, Getters { ); require(_isValid(_newGovernance)); addresses[_GOVERNANCE_CONTRACT] = _newGovernance; - emit NewGovernanceContract(_newGovernance); + emit NewContractAddress(_newGovernance, "Governance"); } /** @@ -77,7 +74,7 @@ contract Controller is TellorStaking, Transition, Getters { ); require(_isValid(_newOracle)); addresses[_ORACLE_CONTRACT] = _newOracle; - emit NewOracleContract(_newOracle); + emit NewContractAddress(_newOracle, "Oracle"); } /** @@ -92,7 +89,7 @@ contract Controller is TellorStaking, Transition, Getters { ); require(_isValid(_newTreasury)); addresses[_TREASURY_CONTRACT] = _newTreasury; - emit NewTreasuryContract(_newTreasury); + emit NewContractAddress(_newTreasury, "Treasury"); } /**