Add modifier and tests for removeAuthorizedAddressAtIndex

This commit is contained in:
Amir Bandeali
2018-06-22 17:17:55 -07:00
committed by Remco Bloemen
parent 8ddcb6c841
commit ea8c2b8d69
3 changed files with 79 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ contract MixinAuthorizable is
);
delete authorized[target];
for (uint i = 0; i < authorities.length; i++) {
for (uint256 i = 0; i < authorities.length; i++) {
if (authorities[i] == target) {
authorities[i] = authorities[authorities.length - 1];
authorities.length -= 1;
@@ -87,7 +87,12 @@ contract MixinAuthorizable is
uint256 index
)
external
onlyOwner
{
require(
authorized[target],
TARGET_NOT_AUTHORIZED
);
require(
index < authorities.length,
INDEX_OUT_OF_BOUNDS

View File

@@ -13,6 +13,9 @@ import "./IOwnable.sol";
contract Ownable is IOwnable {
address public owner;
// Revert reasons
string constant ONLY_CONTRACT_OWNER = "ONLY_CONTRACT_OWNER";
constructor ()
public
{
@@ -22,7 +25,7 @@ contract Ownable is IOwnable {
modifier onlyOwner() {
require(
msg.sender == owner,
"Only contract owner is allowed to call this method."
ONLY_CONTRACT_OWNER
);
_;
}