aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-19 23:48:06 +0800
committerFabio Berger <me@fabioberger.com>2018-07-19 23:48:06 +0800
commitd8898cf9a30cc349868afcf2b78e6369e57aa726 (patch)
treef96d1aa76c7e5aa9e3311d5cdbd0d31c8ec8d7fb /packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol
parent1aaf633df883f62fad890b2d87a2dc89067821c5 (diff)
parent3de88d5345c7a4549bc69e2ca28f0601f5d42189 (diff)
downloaddexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.tar
dexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.tar.gz
dexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.tar.bz2
dexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.tar.lz
dexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.tar.xz
dexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.tar.zst
dexon-sol-tools-d8898cf9a30cc349868afcf2b78e6369e57aa726.zip
merge v2-prototype
Diffstat (limited to 'packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol')
-rw-r--r--packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol27
1 files changed, 23 insertions, 4 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol
index e7cf4ab5c..8b7333646 100644
--- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol
+++ b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol
@@ -16,16 +16,14 @@
*/
-pragma solidity ^0.4.10;
+pragma solidity 0.4.10;
import "../../multisig/MultiSigWalletWithTimeLock.sol";
-import "../../utils/LibBytes/LibBytes.sol";
contract AssetProxyOwner is
MultiSigWalletWithTimeLock
{
- using LibBytes for bytes;
event AssetProxyRegistration(address assetProxyContract, bool isRegistered);
@@ -40,7 +38,7 @@ contract AssetProxyOwner is
modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) {
Transaction storage tx = transactions[transactionId];
require(isAssetProxyRegistered[tx.destination]);
- require(tx.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR);
+ require(readBytes4(tx.data, 0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR);
_;
}
@@ -97,4 +95,25 @@ contract AssetProxyOwner is
tx.executed = false;
}
}
+
+ /// @dev Reads an unpadded bytes4 value from a position in a byte array.
+ /// @param b Byte array containing a bytes4 value.
+ /// @param index Index in byte array of bytes4 value.
+ /// @return bytes4 value from byte array.
+ function readBytes4(
+ bytes memory b,
+ uint256 index
+ )
+ internal
+ returns (bytes4 result)
+ {
+ require(b.length >= index + 4);
+ assembly {
+ result := mload(add(b, 32))
+ // Solidity does not require us to clean the trailing bytes.
+ // We do it anyway
+ result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
+ }
+ return result;
+ }
}