Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contracts/token/ERC721/ERC721Basic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ contract ERC721Basic is SupportsInterfaceWithLookup, IERC721Basic {

/**
* @dev Gets the approved address for a token ID, or zero if no address set
* Reverts if the token ID does not exist.
* @param _tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 _tokenId) public view returns (address) {
require(_exists(_tokenId));
return tokenApprovals_[_tokenId];
}

Expand Down
8 changes: 5 additions & 3 deletions test/token/ERC721/ERC721MintBurn.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ function shouldBehaveLikeMintAndBurnERC721 (accounts) {
});
});

describe('when there is a previous approval', function () {
describe('when there is a previous approval burned', function () {
beforeEach(async function () {
await this.token.approve(accounts[1], tokenId, { from: sender });
const result = await this.token.burn(tokenId, { from: sender });
logs = result.logs;
});

it('clears the approval', async function () {
(await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS);
context('getApproved', function () {
it('reverts', async function () {
await assertRevert(this.token.getApproved(tokenId));
});
});
});

Expand Down