Reverted change that allowed ERC721 transfer proxy to be called with amount 0. This now throws.
This commit is contained in:
committed by
Amir Bandeali
parent
6be5fe928e
commit
dfe6b2844b
@@ -42,9 +42,6 @@ contract ERC721Proxy is
|
||||
external
|
||||
onlyAuthorized
|
||||
{
|
||||
// No work to do if amount is zero
|
||||
if (amount == 0) return;
|
||||
|
||||
// There exists only 1 of each token.
|
||||
require(amount == 1);
|
||||
|
||||
|
@@ -364,7 +364,7 @@ describe('Asset Transfer Proxies', () => {
|
||||
expect(newOwnerMakerToken).to.be.bignumber.equal(takerAddress);
|
||||
});
|
||||
|
||||
it('should do nothing if transferring 0 amount of a token', async () => {
|
||||
it('should throw if transferring 0 amount of a token', async () => {
|
||||
// Construct metadata for ERC721 proxy
|
||||
const encodedProxyMetadata = encodeERC721ProxyData(erc721Token.address, makerTokenId);
|
||||
// Verify pre-condition
|
||||
@@ -373,16 +373,15 @@ describe('Asset Transfer Proxies', () => {
|
||||
// Perform a transfer from makerAddress to takerAddress
|
||||
const balances = await dmyBalances.getAsync();
|
||||
const amount = new BigNumber(0);
|
||||
await erc721TransferProxy.transferFrom.sendTransactionAsync(
|
||||
encodedProxyMetadata,
|
||||
makerAddress,
|
||||
takerAddress,
|
||||
amount,
|
||||
{ from: assetProxyDispatcherAddress },
|
||||
);
|
||||
// Verify transfer was successful
|
||||
const newOwnerMakerToken = await erc721Token.ownerOf.callAsync(makerTokenId);
|
||||
expect(newOwnerMakerToken).to.be.bignumber.equal(makerAddress);
|
||||
return expect(
|
||||
erc721TransferProxy.transferFrom.sendTransactionAsync(
|
||||
encodedProxyMetadata,
|
||||
makerAddress,
|
||||
takerAddress,
|
||||
amount,
|
||||
{ from: assetProxyDispatcherAddress },
|
||||
),
|
||||
).to.be.rejectedWith(constants.REVERT);
|
||||
});
|
||||
|
||||
it('should throw if transferring > 1 amount of a token', async () => {
|
||||
|
Reference in New Issue
Block a user