Skip to content

Commit

Permalink
Merge pull request #129 from tellor-io/tim2
Browse files Browse the repository at this point in the history
Updated NewVote, Voted, and VoteTallied events
  • Loading branch information
brendaloya authored Nov 10, 2021
2 parents 2eba19a + c61336d commit 4afbdb9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
7 changes: 7 additions & 0 deletions contracts/Controller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import "./Getters.sol";
* changing contract addresses, as well as minting and migrating tokens
*/
contract Controller is TellorStaking, Transition, Getters {
// Events
event NewContractAddress(address _newContract, string _contractName);

// Functions
/**
* @dev Saves new Tellor contract addresses. Available to Transition init function after fork vote
Expand Down Expand Up @@ -41,6 +44,7 @@ contract Controller is TellorStaking, Transition, Getters {
assembly {
sstore(_EIP_SLOT, _newController)
}
emit NewContractAddress(_newController, "Controller");
}

/**
Expand All @@ -55,6 +59,7 @@ contract Controller is TellorStaking, Transition, Getters {
);
require(_isValid(_newGovernance));
addresses[_GOVERNANCE_CONTRACT] = _newGovernance;
emit NewContractAddress(_newGovernance, "Governance");
}

/**
Expand All @@ -69,6 +74,7 @@ contract Controller is TellorStaking, Transition, Getters {
);
require(_isValid(_newOracle));
addresses[_ORACLE_CONTRACT] = _newOracle;
emit NewContractAddress(_newOracle, "Oracle");
}

/**
Expand All @@ -83,6 +89,7 @@ contract Controller is TellorStaking, Transition, Getters {
);
require(_isValid(_newTreasury));
addresses[_TREASURY_CONTRACT] = _newTreasury;
emit NewContractAddress(_newTreasury, "Treasury");
}

/**
Expand Down
35 changes: 28 additions & 7 deletions contracts/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
/**
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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
);
}

/**
Expand Down

0 comments on commit 4afbdb9

Please sign in to comment.