Remove deprecated functions and contracts (#2125)

* Remove ERC721.burn(owner, tokenId)

* Remove ERC721._checkOnERC721Received from the contract's API

* Fix linter error

* Remove Escrow and PullPayment withdrawWithGas, replace for withdraw

* Add changelog entry

* Add reentrancy notice
This commit is contained in:
Nicolás Venturo
2020-03-16 17:42:33 -03:00
committed by GitHub
parent c173392e15
commit f1db30955d
8 changed files with 22 additions and 123 deletions

View File

@ -46,16 +46,4 @@ describe('PullPayment', function () {
expect(await balanceTracker.delta()).to.be.bignumber.equal(amount);
expect(await this.contract.payments(payee1)).to.be.bignumber.equal('0');
});
it('can withdraw payment forwarding all gas', async function () {
const balanceTracker = await balance.tracker(payee1);
await this.contract.callTransfer(payee1, amount, { from: payer });
expect(await this.contract.payments(payee1)).to.be.bignumber.equal(amount);
await this.contract.withdrawPaymentsWithGas(payee1);
expect(await balanceTracker.delta()).to.be.bignumber.equal(amount);
expect(await this.contract.payments(payee1)).to.be.bignumber.equal('0');
});
});

View File

@ -9,7 +9,7 @@ const { shouldBehaveLikeERC721 } = require('./ERC721.behavior');
const ERC721Mock = contract.fromArtifact('ERC721Mock');
describe('ERC721', function () {
const [ owner, other ] = accounts;
const [ owner ] = accounts;
beforeEach(async function () {
this.token = await ERC721Mock.new();
@ -47,10 +47,10 @@ describe('ERC721', function () {
});
});
describe('_burn(address, uint256)', function () {
describe('_burn', function () {
it('reverts when burning a non-existent token id', async function () {
await expectRevert(
this.token.methods['burn(address,uint256)'](owner, tokenId), 'ERC721: owner query for nonexistent token'
this.token.burn(tokenId), 'ERC721: owner query for nonexistent token'
);
});
@ -59,15 +59,9 @@ describe('ERC721', function () {
await this.token.mint(owner, tokenId);
});
it('reverts when the account is not the owner', async function () {
await expectRevert(
this.token.methods['burn(address,uint256)'](other, tokenId), 'ERC721: burn of token that is not own'
);
});
context('with burnt token', function () {
beforeEach(async function () {
({ logs: this.logs } = await this.token.methods['burn(address,uint256)'](owner, tokenId));
({ logs: this.logs } = await this.token.burn(tokenId));
});
it('emits a Transfer event', function () {
@ -83,45 +77,7 @@ describe('ERC721', function () {
it('reverts when burning a token id that has been deleted', async function () {
await expectRevert(
this.token.methods['burn(address,uint256)'](owner, tokenId),
'ERC721: owner query for nonexistent token'
);
});
});
});
});
describe('_burn(uint256)', function () {
it('reverts when burning a non-existent token id', async function () {
await expectRevert(
this.token.methods['burn(uint256)'](tokenId), 'ERC721: owner query for nonexistent token'
);
});
context('with minted token', function () {
beforeEach(async function () {
await this.token.mint(owner, tokenId);
});
context('with burnt token', function () {
beforeEach(async function () {
({ logs: this.logs } = await this.token.methods['burn(uint256)'](tokenId));
});
it('emits a Transfer event', function () {
expectEvent.inLogs(this.logs, 'Transfer', { from: owner, to: ZERO_ADDRESS, tokenId });
});
it('deletes the token', async function () {
expect(await this.token.balanceOf(owner)).to.be.bignumber.equal('0');
await expectRevert(
this.token.ownerOf(tokenId), 'ERC721: owner query for nonexistent token'
);
});
it('reverts when burning a token id that has been deleted', async function () {
await expectRevert(
this.token.methods['burn(uint256)'](tokenId), 'ERC721: owner query for nonexistent token'
this.token.burn(tokenId), 'ERC721: owner query for nonexistent token'
);
});
});