diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-21 01:14:04 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-21 01:14:04 +0800 |
commit | 5bfdffda1155e306b17eee0a4e60320c3433d5c4 (patch) | |
tree | 10beed3fe27c6027378e9ef347fb8de59ed6d3df /packages/contracts/src/utils/asset_wrapper.ts | |
parent | 247f8c8557a501ea5081615d9b031c9e4b7aeec7 (diff) | |
download | dexon-0x-contracts-5bfdffda1155e306b17eee0a4e60320c3433d5c4.tar.gz dexon-0x-contracts-5bfdffda1155e306b17eee0a4e60320c3433d5c4.tar.zst dexon-0x-contracts-5bfdffda1155e306b17eee0a4e60320c3433d5c4.zip |
Add support for approveAll in assetWrapper and fillOrderScenarios
Diffstat (limited to 'packages/contracts/src/utils/asset_wrapper.ts')
-rw-r--r-- | packages/contracts/src/utils/asset_wrapper.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/contracts/src/utils/asset_wrapper.ts b/packages/contracts/src/utils/asset_wrapper.ts index fd543621f..9c683054d 100644 --- a/packages/contracts/src/utils/asset_wrapper.ts +++ b/packages/contracts/src/utils/asset_wrapper.ts @@ -110,16 +110,20 @@ export class AssetWrapper { case constants.ERC721_PROXY_ID: { const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper; const erc721ProxyData = assetProxyUtils.decodeERC721AssetData(assetData); - const isProxyApproved = await assetWrapper.isProxyApprovedAsync( + const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync( + userAddress, erc721ProxyData.tokenAddress, erc721ProxyData.tokenId, ); - const isProxyApprovedForAllAsync = await assetWrapper.isProxyApprovedForAllAsync( - userAddress, + if (isProxyApprovedForAll) { + return constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS; + } + + const isProxyApproved = await assetWrapper.isProxyApprovedAsync( erc721ProxyData.tokenAddress, erc721ProxyData.tokenId, ); - const allowance = isProxyApproved || isProxyApprovedForAllAsync ? new BigNumber(1) : new BigNumber(0); + const allowance = isProxyApproved ? new BigNumber(1) : new BigNumber(0); return allowance; } default: |