Commit 2f8e8445 by Nicolás Venturo

Fix remaining revert reasons.

parent 3682c657
...@@ -86,7 +86,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -86,7 +86,7 @@ contract ERC721 is ERC165, IERC721 {
*/ */
function approve(address to, uint256 tokenId) public { function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId); address owner = ownerOf(tokenId);
require(to != owner, "ERC721: transfer to current owner"); require(to != owner, "ERC721: approval to current owner");
require(msg.sender == owner || isApprovedForAll(owner, msg.sender), require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all" "ERC721: approve caller is not owner nor approved for all"
......
...@@ -15,12 +15,12 @@ function shouldBehaveLikeERC20Capped (minter, [other], cap) { ...@@ -15,12 +15,12 @@ function shouldBehaveLikeERC20Capped (minter, [other], cap) {
it('should fail to mint if the amount exceeds the cap', async function () { it('should fail to mint if the amount exceeds the cap', async function () {
await this.token.mint(other, cap.subn(1), { from }); await this.token.mint(other, cap.subn(1), { from });
await shouldFail.reverting.withMessage(this.token.mint(other, 2, { from })); await shouldFail.reverting.withMessage(this.token.mint(other, 2, { from }), 'ERC20Capped: cap exceeded');
}); });
it('should fail to mint after cap is reached', async function () { it('should fail to mint after cap is reached', async function () {
await this.token.mint(other, cap, { from }); await this.token.mint(other, cap, { from });
await shouldFail.reverting.withMessage(this.token.mint(other, 1, { from })); await shouldFail.reverting.withMessage(this.token.mint(other, 1, { from }), 'ERC20Capped: cap exceeded');
}); });
}); });
} }
......
...@@ -315,9 +315,8 @@ function shouldBehaveLikeERC721 ( ...@@ -315,9 +315,8 @@ function shouldBehaveLikeERC721 (
describe('to a contract that does not implement the required function', function () { describe('to a contract that does not implement the required function', function () {
it('reverts', async function () { it('reverts', async function () {
const invalidReceiver = this.token; const invalidReceiver = this.token;
await shouldFail.reverting.withMessage( await shouldFail.reverting(
this.token.safeTransferFrom(owner, invalidReceiver.address, tokenId, { from: owner }), this.token.safeTransferFrom(owner, invalidReceiver.address, tokenId, { from: owner })
'VM Exception while processing transaction: revert'
); );
}); });
}); });
...@@ -406,7 +405,7 @@ function shouldBehaveLikeERC721 ( ...@@ -406,7 +405,7 @@ function shouldBehaveLikeERC721 (
context('when the address that receives the approval is the owner', function () { context('when the address that receives the approval is the owner', function () {
it('reverts', async function () { it('reverts', async function () {
await shouldFail.reverting.withMessage( await shouldFail.reverting.withMessage(
this.token.approve(owner, tokenId, { from: owner }), 'ERC721: transfer to current owner' this.token.approve(owner, tokenId, { from: owner }), 'ERC721: approval to current owner'
); );
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment