aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-23 08:17:55 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-06-23 19:53:39 +0800
commitea8c2b8d6923f37412cefcb8dc8482e009dce104 (patch)
treedfc19be5d7d961357658b82f7d1a94c6c9055ec1 /packages/contracts/src
parent8ddcb6c841fd97bca2cddffd49a5b773cf53635f (diff)
downloaddexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.tar
dexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.tar.gz
dexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.tar.bz2
dexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.tar.lz
dexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.tar.xz
dexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.tar.zst
dexon-sol-tools-ea8c2b8d6923f37412cefcb8dc8482e009dce104.zip
Add modifier and tests for removeAuthorizedAddressAtIndex
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol7
-rw-r--r--packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol5
2 files changed, 10 insertions, 2 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol
index 8cb4254c5..37c12f861 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol
@@ -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,8 +87,13 @@ contract MixinAuthorizable is
uint256 index
)
external
+ onlyOwner
{
require(
+ authorized[target],
+ TARGET_NOT_AUTHORIZED
+ );
+ require(
index < authorities.length,
INDEX_OUT_OF_BOUNDS
);
diff --git a/packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol b/packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol
index 296c6c856..99b93d0d2 100644
--- a/packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol
+++ b/packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol
@@ -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
);
_;
}