aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol59
1 files changed, 29 insertions, 30 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
index eb423ad28..14d5eb7ca 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
@@ -17,11 +17,10 @@
*/
pragma solidity ^0.4.23;
-pragma experimental ABIEncoderV2;
import "../../utils/Ownable/Ownable.sol";
-import "../AssetProxy/IAssetProxy.sol";
-import "./LibExchangeErrors.sol";
+import "../AssetProxy/interfaces/IAssetProxy.sol";
+import "./lib/LibExchangeErrors.sol";
import "./mixins/MAssetProxyDispatcher.sol";
contract MixinAssetProxyDispatcher is
@@ -32,33 +31,6 @@ contract MixinAssetProxyDispatcher is
// Mapping from Asset Proxy Id's to their respective Asset Proxy
mapping (uint8 => IAssetProxy) public assetProxies;
- /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
- /// @param assetMetadata Byte array encoded for the respective asset proxy.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param amount Amount of token to transfer.
- function dispatchTransferFrom(
- bytes memory assetMetadata,
- address from,
- address to,
- uint256 amount)
- internal
- {
- // Do nothing if no amount should be transferred.
- if (amount > 0) {
- // Lookup asset proxy
- require(
- assetMetadata.length >= 1,
- GREATER_THAN_ZERO_LENGTH_REQUIRED
- );
- uint8 assetProxyId = uint8(assetMetadata[0]);
- IAssetProxy assetProxy = assetProxies[assetProxyId];
-
- // transferFrom will either succeed or throw.
- assetProxy.transferFrom(assetMetadata, from, to, amount);
- }
- }
-
/// @dev Registers an asset proxy to an asset proxy id.
/// An id can only be assigned to a single proxy at a given time.
/// @param assetProxyId Id to register`newAssetProxy` under.
@@ -104,4 +76,31 @@ contract MixinAssetProxyDispatcher is
address assetProxy = address(assetProxies[assetProxyId]);
return assetProxy;
}
+
+ /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
+ /// @param assetMetadata Byte array encoded for the respective asset proxy.
+ /// @param from Address to transfer token from.
+ /// @param to Address to transfer token to.
+ /// @param amount Amount of token to transfer.
+ function dispatchTransferFrom(
+ bytes memory assetMetadata,
+ address from,
+ address to,
+ uint256 amount)
+ internal
+ {
+ // Do nothing if no amount should be transferred.
+ if (amount > 0) {
+ // Lookup asset proxy
+ require(
+ assetMetadata.length >= 1,
+ GREATER_THAN_ZERO_LENGTH_REQUIRED
+ );
+ uint8 assetProxyId = uint8(assetMetadata[0]);
+ IAssetProxy assetProxy = assetProxies[assetProxyId];
+
+ // transferFrom will either succeed or throw.
+ assetProxy.transferFrom(assetMetadata, from, to, amount);
+ }
+ }
}