add events

This commit is contained in:
Ricardo Guilherme Schmidt 2019-09-18 05:39:44 -03:00
parent d6ee98f43f
commit 2a06243124
No known key found for this signature in database
GPG Key ID: 1FD1630B93893608
2 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
pragma solidity >=0.5.0 <0.6.0; pragma solidity >=0.5.0 <0.6.0;
contract Controlled { contract Controlled {
event NewController(address controller);
/// @notice The address of the controller is the only address that can call /// @notice The address of the controller is the only address that can call
/// a function with this modifier /// a function with this modifier
modifier onlyController { modifier onlyController {
@ -18,5 +19,6 @@ contract Controlled {
/// @param _newController The new controller of the contract /// @param _newController The new controller of the contract
function changeController(address payable _newController) public onlyController { function changeController(address payable _newController) public onlyController {
controller = _newController; controller = _newController;
emit NewController(_newController);
} }
} }

View File

@ -3,6 +3,7 @@ pragma solidity >=0.5.0 <0.6.0;
/// @dev `Owned` is a base level contract that assigns an `owner` that can be /// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed /// later changed
contract Owned { contract Owned {
event OwnerChanged(address newOwner);
/// @dev `owner` is the only address that can call a function with this /// @dev `owner` is the only address that can call a function with this
/// modifier /// modifier
@ -24,6 +25,7 @@ contract Owned {
/// @param _newOwner The address of the new owner. 0x0 can be used to create /// @param _newOwner The address of the new owner. 0x0 can be used to create
/// an unowned neutral vault, however that cannot be undone /// an unowned neutral vault, however that cannot be undone
function changeOwner(address payable _newOwner) public onlyOwner { function changeOwner(address payable _newOwner) public onlyOwner {
emit OwnerChanged(_newOwner);
newOwner = _newOwner; newOwner = _newOwner;
} }