diff options
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); - } } |