Change removeAuthorizedAddress => removeAuthorizedAddressAtIndex
This commit is contained in:
committed by
Remco Bloemen
parent
6a6f98299d
commit
1681361aed
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user