aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-04-13 06:10:36 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commitcb27fe17cdfec3ead79ed17903836cc628593327 (patch)
tree0ac59e5d8efda81ccd42a516cb9bc25bc15cb290
parent682ab76ba12c4f009257916318769395672f67b6 (diff)
downloaddexon-sol-tools-cb27fe17cdfec3ead79ed17903836cc628593327.tar.gz
dexon-sol-tools-cb27fe17cdfec3ead79ed17903836cc628593327.tar.zst
dexon-sol-tools-cb27fe17cdfec3ead79ed17903836cc628593327.zip
Changed order of encode/decode functions in token proxies
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol22
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol22
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol28
3 files changed, 36 insertions, 36 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol
index bcf6e0a80..922d300c7 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy.sol
@@ -47,6 +47,17 @@ contract ERC20Proxy is
require(success == true);
}
+ /// @dev Decodes ERC20-encoded byte array.
+ /// @param assetMetadata ERC20-encoded byte array.
+ /// @return tokenAddress Address of ERC20 token.
+ function decodeMetadata(bytes memory assetMetadata)
+ public pure
+ returns (address tokenAddress)
+ {
+ require(assetMetadata.length == 21);
+ return readAddress(assetMetadata, 1);
+ }
+
/// @dev Encodes ERC20 byte array.
/// @param assetProxyId Id of the asset proxy.
/// @param tokenAddress Address of the asset.
@@ -66,15 +77,4 @@ contract ERC20Proxy is
writeAddress(assetMetadata, 1, tokenAddress);
return assetMetadata;
}
-
- /// @dev Decodes ERC20-encoded byte array.
- /// @param assetMetadata ERC20-encoded byte array.
- /// @return tokenAddress Address of ERC20 token.
- function decodeMetadata(bytes memory assetMetadata)
- public pure
- returns (address tokenAddress)
- {
- require(assetMetadata.length == 21);
- return readAddress(assetMetadata, 1);
- }
}
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol
index 80aa5a091..3bcbe3fd0 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol
@@ -57,6 +57,17 @@ contract ERC20Proxy_v1 is
require(success == true);
}
+ /// @dev Decodes ERC20-encoded byte array.
+ /// @param assetMetadata ERC20-encoded byte array.
+ /// @return tokenAddress Address of ERC20 token.
+ function decodeMetadata(bytes memory assetMetadata)
+ public pure
+ returns (address tokenAddress)
+ {
+ require(assetMetadata.length == 21);
+ return readAddress(assetMetadata, 1);
+ }
+
/// @dev Encodes ERC20 byte array.
/// @param assetProxyId Id of the asset proxy.
/// @param tokenAddress Address of the asset.
@@ -76,15 +87,4 @@ contract ERC20Proxy_v1 is
writeAddress(assetMetadata, 1, tokenAddress);
return assetMetadata;
}
-
- /// @dev Decodes ERC20-encoded byte array.
- /// @param assetMetadata ERC20-encoded byte array.
- /// @return tokenAddress Address of ERC20 token.
- function decodeMetadata(bytes memory assetMetadata)
- public pure
- returns (address tokenAddress)
- {
- require(assetMetadata.length == 21);
- return readAddress(assetMetadata, 1);
- }
}
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol
index 6e0f46147..e27a104b9 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol
@@ -57,6 +57,20 @@ contract ERC721Proxy is
ERC721Token(token).transferFrom(from, to, tokenId);
}
+ /// @dev Decodes ERC721-encoded byte array.
+ /// @param assetMetadata ERC721-encoded byte array.
+ /// @return tokenAddress Address of ERC721 token.
+ /// @return tokenId Id of ERC721 token.
+ function decodeMetadata(bytes memory assetMetadata)
+ public pure
+ returns (address tokenAddress, uint256 tokenId)
+ {
+ require(assetMetadata.length == 53);
+ tokenAddress = readAddress(assetMetadata, 1);
+ tokenId = uint256(readBytes32(assetMetadata, 21));
+ return (tokenAddress, tokenId);
+ }
+
/// @dev Encodes ERC721 byte array.
/// @param assetProxyId Id of the asset proxy.
/// @param tokenAddress Address of the asset.
@@ -79,18 +93,4 @@ contract ERC721Proxy is
writeBytes32(assetMetadata, 21, bytes32(tokenId));
return assetMetadata;
}
-
- /// @dev Decodes ERC721-encoded byte array.
- /// @param assetMetadata ERC721-encoded byte array.
- /// @return tokenAddress Address of ERC721 token.
- /// @return tokenId Id of ERC721 token.
- function decodeMetadata(bytes memory assetMetadata)
- public pure
- returns (address tokenAddress, uint256 tokenId)
- {
- require(assetMetadata.length == 53);
- tokenAddress = readAddress(assetMetadata, 1);
- tokenId = uint256(readBytes32(assetMetadata, 21));
- return (tokenAddress, tokenId);
- }
}