diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-06-02 05:17:13 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-06-08 06:38:48 +0800 |
commit | e4e36760952287a84f8991df8589c183036383db (patch) | |
tree | 83c5ba694848232f6d3b01a72dc8c3d94cb9d071 /packages/contracts/src | |
parent | 3ed13150e106c19563c8e9b06621be3d44d66b6c (diff) | |
download | dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.gz dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.bz2 dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.lz dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.xz dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.tar.zst dexon-sol-tools-e4e36760952287a84f8991df8589c183036383db.zip |
Fixed up after rebasing. Contracts build and tests pass
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol | 7 | ||||
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol | 18 |
2 files changed, 9 insertions, 16 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol index 96950f1cd..4e9ae64f8 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol @@ -54,8 +54,6 @@ contract ERC20Proxy is ) = decodeERC20AssetData(assetData); // Data must be intended for this proxy. - uint256 length = assetMetadata.length; - require( proxyId == PROXY_ID, PROXY_ID_MISMATCH @@ -92,14 +90,15 @@ contract ERC20Proxy is ) { // Validate encoded data length + uint256 length = assetData.length; require( assetData.length == 21, INVALID_ASSET_DATA_LENGTH ); // Decode data - proxyId = uint8(assetData[0]); - token = readAddress(assetData, 1); + token = readAddress(assetData, 0); + proxyId = uint8(assetData[length-1]); return (proxyId, token); } diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol index 102064c15..f6c3af104 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol @@ -56,15 +56,8 @@ contract ERC721Proxy is bytes memory receiverData ) = decodeERC721AssetData(assetData); - // Data must be intended for this proxy. - uint256 length = assetMetadata.length; - require( - length == 53, - LENGTH_53_REQUIRED - ); - - // TODO: Is this too inflexible in the future? + // Data must be intended for this proxy. require( proxyId == PROXY_ID, PROXY_ID_MISMATCH @@ -113,18 +106,19 @@ contract ERC721Proxy is ) { // Validate encoded data length + uint256 length = assetData.length; require( assetData.length >= 53, INVALID_ASSET_DATA_LENGTH ); // Decode asset data. - proxyId = uint8(assetData[0]); - token = readAddress(assetData, 1); - tokenId = readUint256(assetData, 21); + token = readAddress(assetData, 0); + tokenId = readUint256(assetData, 20); if (assetData.length > 53) { - receiverData = readBytes(assetData, 53); + receiverData = readBytes(assetData, 52); } + proxyId = uint8(assetData[length-1]); return ( proxyId, |