diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-02 16:50:48 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-02 16:50:48 +0800 |
commit | 32d75b6483d8d10073238d228e180fbee46cf192 (patch) | |
tree | df144ccc2e02782f050ae6a7d3a9f6593ddcfd01 | |
parent | cb6cace910b9639fc80b207b04dc8938831bae93 (diff) | |
download | dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.tar dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.tar.gz dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.tar.bz2 dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.tar.lz dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.tar.xz dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.tar.zst dexon-sol-tools-32d75b6483d8d10073238d228e180fbee46cf192.zip |
Transfer ERC721 token instead of burning, so we can still set an allowance to it in tests
-rw-r--r-- | packages/contracts/src/utils/asset_wrapper.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/contracts/src/utils/asset_wrapper.ts b/packages/contracts/src/utils/asset_wrapper.ts index a7f91f413..9946e4bde 100644 --- a/packages/contracts/src/utils/asset_wrapper.ts +++ b/packages/contracts/src/utils/asset_wrapper.ts @@ -86,7 +86,15 @@ export class AssetWrapper { ); } else if (tokenOwner === userAddress && desiredBalance.eq(0)) { // Burn token - await erc721Wrapper.burnAsync(assetProxyData.tokenAddress, assetProxyData.tokenId, userAddress); + // await erc721Wrapper.burnAsync(assetProxyData.tokenAddress, assetProxyData.tokenId, userAddress); + const userAddresses = await (erc721Wrapper as any)._web3Wrapper.getAvailableAddressesAsync(); + const nonOwner = _.find(userAddresses, a => a !== userAddress); + await erc721Wrapper.transferFromAsync( + assetProxyData.tokenAddress, + assetProxyData.tokenId, + tokenOwner, + nonOwner, + ); return; } else if ( (userAddress !== tokenOwner && desiredBalance.eq(0)) || |