diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-10-18 07:00:39 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-11-27 01:45:38 +0800 |
commit | 994c6032bbaa1a5bf617751235ce2db23d527802 (patch) | |
tree | 5d34824136431b09c1147bbc9f1728ef767c4bd9 | |
parent | 6d565f4bff38b12515f4d8f0e29cdc223c12d1fb (diff) | |
download | dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.tar dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.tar.gz dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.tar.bz2 dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.tar.lz dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.tar.xz dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.tar.zst dexon-0x-contracts-994c6032bbaa1a5bf617751235ce2db23d527802.zip |
fix: remove getApproved check from OrderValidator since approval is removed after a single transfer
-rw-r--r-- | packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol | 2 | ||||
-rw-r--r-- | packages/contracts/test/extensions/order_validator.ts | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol b/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol index 8bfde3847..3385d35ef 100644 --- a/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol +++ b/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol @@ -148,7 +148,7 @@ contract OrderValidator { balance = target == owner ? 1 : 0; // Check if ERC721Proxy is approved to spend tokenId - bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy) || IERC721Token(token).getApproved(tokenId) == assetProxy; + bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy); // Set alowance to 1 if ERC721Proxy is approved to spend tokenId allowance = isApproved ? 1 : 0; diff --git a/packages/contracts/test/extensions/order_validator.ts b/packages/contracts/test/extensions/order_validator.ts index 37bd1b0e2..37d7c4c5a 100644 --- a/packages/contracts/test/extensions/order_validator.ts +++ b/packages/contracts/test/extensions/order_validator.ts @@ -198,7 +198,7 @@ describe('OrderValidator', () => { ); expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE); }); - it('should return an allowance of 1 when ERC721Proxy is approved for specific tokenId', async () => { + it('should return an allowance of 0 when ERC721Proxy is approved for specific tokenId', async () => { await web3Wrapper.awaitTransactionSuccessAsync( await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId), constants.AWAIT_TRANSACTION_MINED_MS, @@ -213,7 +213,7 @@ describe('OrderValidator', () => { makerAddress, erc721AssetData, ); - expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE); + expect(newAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT); }); }); }); @@ -248,8 +248,9 @@ describe('OrderValidator', () => { await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId), constants.AWAIT_TRANSACTION_MINED_MS, ); + const isApproved = true; await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, { + await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, { from: makerAddress, }), constants.AWAIT_TRANSACTION_MINED_MS, @@ -311,8 +312,9 @@ describe('OrderValidator', () => { await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId), constants.AWAIT_TRANSACTION_MINED_MS, ); + const isApproved = true; await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, { + await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, { from: takerAddress, }), constants.AWAIT_TRANSACTION_MINED_MS, @@ -465,8 +467,9 @@ describe('OrderValidator', () => { await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId), constants.AWAIT_TRANSACTION_MINED_MS, ); + const isApproved = true; await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, { + await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, { from: takerAddress, }), constants.AWAIT_TRANSACTION_MINED_MS, |