Skip to content

Commit

Permalink
Added missing events
Browse files Browse the repository at this point in the history
  • Loading branch information
The-3D committed Feb 9, 2021
1 parent 138ec5c commit fdc8cf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contracts/stake/StakedTokenV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ contract StakedTokenV3 is StakedTokenV2,
return 3;
}


//maximum percentage of the underlying that can be slashed in a single realization event
uint256 internal _maxSlashablePercentage;
bool _cooldownPaused;
Expand All @@ -58,7 +57,9 @@ contract StakedTokenV3 is StakedTokenV2,

event Staked(address indexed from, address indexed onBehalfOf, uint256 amount, uint256 sharesMinted);
event Redeem(address indexed from, address indexed to, uint256 amount, uint256 underlyingTransferred);
event CooldownPauseSet(bool pause);
event CooldownPauseChanged(bool pause);
event MaxSlashablePercentageChanged(uint256 newPercentage);
event Slashed(address indexed destination, uint256 amount);
event CooldownPauseAdminChanged(address indexed newAdmin);
event SlashingAdminChanged(address indexed newAdmin);

Expand Down Expand Up @@ -237,6 +238,8 @@ contract StakedTokenV3 is StakedTokenV2,
require(amount <= maxSlashable, "INVALID_SLASHING_AMOUNT");

IERC20(STAKED_TOKEN).safeTransfer(destination, amount);

emit Slashed(destination, amount);
}

/**
Expand All @@ -252,6 +255,7 @@ contract StakedTokenV3 is StakedTokenV2,
*/
function setCooldownPause(bool paused) external override onlyCooldownAdmin {
_cooldownPaused = paused;
emit CooldownPauseChanged(paused);
}

/**
Expand All @@ -262,6 +266,7 @@ contract StakedTokenV3 is StakedTokenV2,
require(percentage <= PercentageMath.PERCENTAGE_FACTOR, "INVALID_SLASHING_PERCENTAGE");

_maxSlashablePercentage = percentage;
emit MaxSlashablePercentageChanged(percentage);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions contracts/utils/RoleManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ contract RoleManager {
mapping(uint256 => address) private _admins;
mapping(uint256 => address) private _pendingAdmins;

event PendingAdminChanged(address indexed newPendingAdmin);
event RoleClaimed(address indexed newAdming, uint256 role);

modifier onlyRoleAdmin(uint256 role) {
require(_admins[role] == msg.sender, 'CALLER_NOT_ROLE_ADMIN');
_;
Expand Down Expand Up @@ -43,6 +46,7 @@ contract RoleManager {
**/
function setPendingAdmin(uint256 role, address newPendingAdmin) public onlyRoleAdmin(role) {
_pendingAdmins[role] = newPendingAdmin;
emit PendingAdminChanged(newPendingAdmin);
}

/**
Expand All @@ -51,6 +55,7 @@ contract RoleManager {
**/
function claimRoleAdmin(uint256 role) external onlyPendingRoleAdmin(role) {
_admins[role] = msg.sender;
emit RoleClaimed(msg.sender, role);
}

function _initAdmins(uint256[] memory roles, address[] memory admins) internal {
Expand All @@ -59,6 +64,7 @@ contract RoleManager {
for (uint256 i = 0; i < roles.length; i++) {
require(_admins[i] == address(0), 'ADMIN_ALREADY_INITIALIZED');
_admins[roles[i]] = admins[i];
emit RoleClaimed(admins[i], roles[i]);
}
}
}

0 comments on commit fdc8cf2

Please sign in to comment.