From 8496c1cdd3bc477fcfe584adf8200f4ed35da2b0 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 31 May 2018 18:59:02 -0700 Subject: Call safeTransferFrom only when there is receiver data present --- .../src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/contracts/src') diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol index eb23736a0..9dac02d87 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol @@ -77,8 +77,13 @@ contract ERC721Proxy is ); // Transfer token. + // Save gas by calling safeTransferFrom only when there is data present. // Either succeeds or throws. - ERC721Token(token).safeTransferFrom(from, to, tokenId, data); + if(data.length > 0) { + ERC721Token(token).safeTransferFrom(from, to, tokenId, data); + } else { + ERC721Token(token).transferFrom(from, to, tokenId); + } } /// @dev Gets the proxy id associated with the proxy address. -- cgit v1.2.3