diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-06-01 09:59:02 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-06-08 06:38:48 +0800 |
commit | 8496c1cdd3bc477fcfe584adf8200f4ed35da2b0 (patch) | |
tree | 078dc48542a8a73da8217d7e6ce990c674aab303 /packages/contracts/src | |
parent | 3c3851c221873baf3b7fec7213324dae0c1c3351 (diff) | |
download | dexon-0x-contracts-8496c1cdd3bc477fcfe584adf8200f4ed35da2b0.tar.gz dexon-0x-contracts-8496c1cdd3bc477fcfe584adf8200f4ed35da2b0.tar.zst dexon-0x-contracts-8496c1cdd3bc477fcfe584adf8200f4ed35da2b0.zip |
Call safeTransferFrom only when there is receiver data present
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/AssetProxy/ERC721Proxy.sol | 7 |
1 files changed, 6 insertions, 1 deletions
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. |