diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-06-22 05:49:16 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-06-23 19:53:39 +0800 |
commit | 1681361aedb2c7c4d97f8b74890ee2f86d96df45 (patch) | |
tree | 4c4da6ad5a1a19506ba6c572aa24af24ad9ff452 /packages/contracts/src | |
parent | 6a6f98299de5fd67f9162cc57c73583702924a2f (diff) | |
download | dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.tar dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.tar.gz dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.tar.bz2 dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.tar.lz dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.tar.xz dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.tar.zst dexon-sol-tools-1681361aedb2c7c4d97f8b74890ee2f86d96df45.zip |
Change removeAuthorizedAddress => removeAuthorizedAddressAtIndex
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol | 18 | ||||
-rw-r--r-- | packages/contracts/src/contracts/current/test/TestAssetProxyOwner/TestAssetProxyOwner.sol | 17 |
2 files changed, 22 insertions, 13 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol index 79f64312f..eb58b3374 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol @@ -29,17 +29,17 @@ contract AssetProxyOwner is event AssetProxyRegistration(address assetProxyContract, bool isRegistered); // Mapping of AssetProxy contract address => - // if this contract is allowed to call the AssetProxy's removeAuthorizedAddress method without a time lock. + // if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock. mapping (address => bool) public isAssetProxyRegistered; - bytes4 constant REMOVE_AUTHORIZED_ADDRESS_SELECTOR = bytes4(keccak256("removeAuthorizedAddress(address)")); + bytes4 constant REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)")); - /// @dev Function will revert if the transaction does not call `removeAuthorizedAddress` + /// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex` /// on an approved AssetProxy contract. - modifier validRemoveAuthorizedAddressTx(uint256 transactionId) { + modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) { Transaction storage tx = transactions[transactionId]; require(isAssetProxyRegistered[tx.destination]); - require(tx.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_SELECTOR); + require(tx.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR); _; } @@ -66,7 +66,7 @@ contract AssetProxyOwner is } /// @dev Registers or deregisters an AssetProxy to be able to execute - /// removeAuthorizedAddress without a timelock. + /// `removeAuthorizedAddressAtIndex` without a timelock. /// @param assetProxyContract Address of AssetProxy contract. /// @param isRegistered Status of approval for AssetProxy contract. function registerAssetProxy(address assetProxyContract, bool isRegistered) @@ -78,13 +78,13 @@ contract AssetProxyOwner is AssetProxyRegistration(assetProxyContract, isRegistered); } - /// @dev Allows execution of removeAuthorizedAddress without time lock. + /// @dev Allows execution of `removeAuthorizedAddressAtIndex` without time lock. /// @param transactionId Transaction ID. - function executeRemoveAuthorizedAddress(uint256 transactionId) + function executeRemoveAuthorizedAddressAtIndex(uint256 transactionId) public notExecuted(transactionId) fullyConfirmed(transactionId) - validRemoveAuthorizedAddressTx(transactionId) + validRemoveAuthorizedAddressAtIndexTx(transactionId) { Transaction storage tx = transactions[transactionId]; tx.executed = true; diff --git a/packages/contracts/src/contracts/current/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/packages/contracts/src/contracts/current/test/TestAssetProxyOwner/TestAssetProxyOwner.sol index 35746d2ad..40a6255cb 100644 --- a/packages/contracts/src/contracts/current/test/TestAssetProxyOwner/TestAssetProxyOwner.sol +++ b/packages/contracts/src/contracts/current/test/TestAssetProxyOwner/TestAssetProxyOwner.sol @@ -34,14 +34,23 @@ contract TestAssetProxyOwner is { } - /// @dev Compares first 4 bytes of byte array to removeAuthorizedAddress function selector. + function testValidRemoveAuthorizedAddressTx(uint256 id) + public + validRemoveAuthorizedAddressAtIndexTx(id) + returns (bool) + { + // Do nothing. We expect reverts through the modifier + return true; + } + + /// @dev Compares first 4 bytes of byte array to `removeAuthorizedAddressAtIndex` function selector. /// @param data Transaction data. - /// @return Successful if data is a call to removeAuthorizedAddress. - function isFunctionRemoveAuthorizedAddress(bytes memory data) + /// @return Successful if data is a call to `removeAuthorizedAddressAtIndex`. + function isFunctionRemoveAuthorizedAddressAtIndex(bytes memory data) public pure returns (bool) { - return data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_SELECTOR; + return data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR; } } |