diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-07-16 23:11:14 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-07-18 21:52:14 +0800 |
commit | e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d (patch) | |
tree | b75b219da2f95246ecc8719d226b2ad90883f579 /packages | |
parent | 9f74feb3475b14ebdf2a0b312856fc927f91b6ab (diff) | |
download | dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.tar dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.tar.gz dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.tar.bz2 dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.tar.lz dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.tar.xz dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.tar.zst dexon-sol-tools-e1a9f3435f2527fcf38e68c5749bfddf1ba3b37d.zip |
Removed receiverData from ERC721 Proxy Id generation
Diffstat (limited to 'packages')
7 files changed, 12 insertions, 17 deletions
diff --git a/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol b/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol index eadeaf5ba..cb0ed5422 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinForwarderCore.sol @@ -40,7 +40,7 @@ contract MixinForwarderCore is MForwarderCore { bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)")); - bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)")); + bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256)")); uint256 constant internal MAX_UINT = 2**256 - 1; constructor () diff --git a/packages/contracts/src/2.0.0/forwarder/MixinTransfer.sol b/packages/contracts/src/2.0.0/forwarder/MixinTransfer.sol index 6c49330f2..bebfc976b 100644 --- a/packages/contracts/src/2.0.0/forwarder/MixinTransfer.sol +++ b/packages/contracts/src/2.0.0/forwarder/MixinTransfer.sol @@ -109,12 +109,10 @@ contract MixinTransfer is // Decode asset data. address token = assetData.readAddress(16); uint256 tokenId = assetData.readUint256(36); - bytes memory receiverData = assetData.readBytesWithLength(100); - IERC721Token(token).safeTransferFrom( + IERC721Token(token).transferFrom( address(this), to, - tokenId, - receiverData + tokenId ); } } diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol index a56c41adb..53f5a14e0 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol @@ -26,7 +26,7 @@ contract ERC721Proxy is MixinAuthorizable { // Id of this proxy. - bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC721Token(address,uint256,bytes)")); + bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC721Token(address,uint256)")); // solhint-disable-next-line payable-fallback function () diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 281f3bf27..1a24ee0b6 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -377,9 +377,9 @@ describe('Asset Transfer Proxies', () => { }); }); - it('should have an id of 0x08e937fa', async () => { + it('should have an id of 0x02571792', async () => { const proxyId = await erc721Proxy.getProxyId.callAsync(); - const expectedProxyId = '0x08e937fa'; + const expectedProxyId = '0x02571792'; expect(proxyId).to.equal(expectedProxyId); }); }); diff --git a/packages/migrations/src/utils/constants.ts b/packages/migrations/src/utils/constants.ts index 068122e28..53ce2f5f1 100644 --- a/packages/migrations/src/utils/constants.ts +++ b/packages/migrations/src/utils/constants.ts @@ -9,7 +9,7 @@ export const constants = { ASSET_PROXY_OWNER_TIMELOCK: new BigNumber(0), ASSET_PROXY_OWNER_CONFIRMATIONS: new BigNumber(1), ERC20_PROXY_ID: '0xf47261b0', - ERC721_PROXY_ID: '0x08e937fa', + ERC721_PROXY_ID: '0x02571792', NULL_ADDRESS: '0x0000000000000000000000000000000000000000', RPC_URL: 'http://localhost:8545', KOVAN_NETWORK_ID: 42, diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index cb02d7d42..2b6d44227 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -50,14 +50,13 @@ export const assetDataUtils = { * @param tokenId The ERC721 tokenId to encode * @return The hex encoded assetData string */ - encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber, receiverData?: string): string { + encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string { // TODO: Pass `tokendId` as a BigNumber. return ethUtil.bufferToHex( ethAbi.simpleEncode( - 'ERC721Token(address,uint256,bytes)', + 'ERC721Token(address,uint256)', tokenAddress, `0x${tokenId.toString(constants.BASE_16)}`, - ethUtil.toBuffer(receiverData || '0x'), ), ); }, @@ -83,15 +82,14 @@ export const assetDataUtils = { }), but got ${assetProxyId}`, ); } - const [tokenAddress, tokenId, receiverData] = ethAbi.rawDecode( - ['address', 'uint256', 'bytes'], + const [tokenAddress, tokenId] = ethAbi.rawDecode( + ['address', 'uint256'], data.slice(constants.SELECTOR_LENGTH), ); return { assetProxyId, tokenAddress: ethUtil.addHexPrefix(tokenAddress), tokenId: new BigNumber(tokenId.toString()), - receiverData: ethUtil.bufferToHex(receiverData), }; }, /** diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 72e2a726b..19f2b1a23 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -159,7 +159,7 @@ export interface ECSignature { export enum AssetProxyId { ERC20 = '0xf47261b0', - ERC721 = '0x08e937fa', + ERC721 = '0x02571792', } export interface ERC20AssetData { @@ -171,7 +171,6 @@ export interface ERC721AssetData { assetProxyId: string; tokenAddress: string; tokenId: BigNumber; - receiverData: string; } export enum RevertReason { |