Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
2f8e8445
Commit
2f8e8445
authored
Apr 24, 2019
by
Nicolás Venturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix remaining revert reasons.
parent
3682c657
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
ERC721.sol
contracts/token/ERC721/ERC721.sol
+1
-1
ERC20Capped.behavior.js
test/token/ERC20/behaviors/ERC20Capped.behavior.js
+2
-2
ERC721.behavior.js
test/token/ERC721/ERC721.behavior.js
+3
-4
No files found.
contracts/token/ERC721/ERC721.sol
View file @
2f8e8445
...
@@ -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"
...
...
test/token/ERC20/behaviors/ERC20Capped.behavior.js
View file @
2f8e8445
...
@@ -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'
);
});
});
});
});
}
}
...
...
test/token/ERC721/ERC721.behavior.js
View file @
2f8e8445
...
@@ -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'
);
);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment