aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol66
1 files changed, 48 insertions, 18 deletions
diff --git a/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol b/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol
index 3d44e4c07..cc5808813 100644
--- a/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol
+++ b/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol
@@ -18,15 +18,19 @@
pragma solidity ^0.4.10;
-import { MultiSigWalletWithTimeLock } from "../MultiSigWalletWithTimeLock/MultiSigWalletWithTimeLock.sol";
+import "../MultiSigWalletWithTimeLock/MultiSigWalletWithTimeLock.sol";
-contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is MultiSigWalletWithTimeLock {
+contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is
+ MultiSigWalletWithTimeLock
+{
+ event AssetProxyRegistration(address assetProxyContract, bool isRegistered);
- address public TOKEN_TRANSFER_PROXY_CONTRACT;
+ // Mapping of AssetProxy contract address => approved to execute removeAuthorizedAddress without time lock.
+ mapping (address => bool) public isAssetProxyRegistered;
- modifier validRemoveAuthorizedAddressTx(uint transactionId) {
+ modifier validRemoveAuthorizedAddressTx(uint256 transactionId) {
Transaction storage tx = transactions[transactionId];
- require(tx.destination == TOKEN_TRANSFER_PROXY_CONTRACT);
+ require(isAssetProxyRegistered[tx.destination]);
require(isFunctionRemoveAuthorizedAddress(tx.data));
_;
}
@@ -35,21 +39,36 @@ contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is MultiSigWall
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
- /// @param _tokenTransferProxy Address of TokenTransferProxy contract.
+ /// @param _assetProxyContracts Array of AssetProxy contract addresses.
function MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress(
- address[] _owners,
- uint _required,
- uint _secondsTimeLocked,
- address _tokenTransferProxy)
+ address[] memory _owners,
+ uint256 _required,
+ uint256 _secondsTimeLocked,
+ address[] memory _assetProxyContracts)
public
MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked)
{
- TOKEN_TRANSFER_PROXY_CONTRACT = _tokenTransferProxy;
+ for (uint256 i = 0; i < _assetProxyContracts.length; i++) {
+ require(_assetProxyContracts[i] != address(0));
+ isAssetProxyRegistered[_assetProxyContracts[i]] = true;
+ }
+ }
+
+ /// @dev Sets approval for calling removeAuthorizedAddress on an AssetProxy contract without a timelock.
+ /// @param assetProxyContract Address of AssetProxy contract.
+ /// @param isRegistered Status of approval for AssetProxy contract.
+ function registerAssetProxy(address assetProxyContract, bool isRegistered)
+ public
+ onlyWallet
+ notNull(assetProxyContract)
+ {
+ isAssetProxyRegistered[assetProxyContract] = isRegistered;
+ AssetProxyRegistration(assetProxyContract, isRegistered);
}
/// @dev Allows execution of removeAuthorizedAddress without time lock.
/// @param transactionId Transaction ID.
- function executeRemoveAuthorizedAddress(uint transactionId)
+ function executeRemoveAuthorizedAddress(uint256 transactionId)
public
notExecuted(transactionId)
fullyConfirmed(transactionId)
@@ -68,15 +87,26 @@ contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is MultiSigWall
/// @dev Compares first 4 bytes of byte array to removeAuthorizedAddress function signature.
/// @param data Transaction data.
/// @return Successful if data is a call to removeAuthorizedAddress.
- function isFunctionRemoveAuthorizedAddress(bytes data)
+ function isFunctionRemoveAuthorizedAddress(bytes memory data)
public
- constant
+ pure
returns (bool)
{
- bytes4 removeAuthorizedAddressSignature = bytes4(sha3("removeAuthorizedAddress(address)"));
- for (uint i = 0; i < 4; i++) {
- require(data[i] == removeAuthorizedAddressSignature[i]);
- }
+ bytes4 removeAuthorizedAddressSelector = bytes4(keccak256("removeAuthorizedAddress(address)"));
+ bytes4 first4Bytes = readFirst4(data);
+ require(removeAuthorizedAddressSelector == first4Bytes);
return true;
}
+
+ function readFirst4(bytes memory data)
+ public
+ pure
+ returns (bytes4 result)
+ {
+ require(data.length >= 4);
+ assembly {
+ result := mload(add(data, 32))
+ }
+ return result;
+ }
}