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
b39d9812
Commit
b39d9812
authored
May 11, 2020
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename Wrapper to Mock
parent
79734a2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
SafeERC20Helper.sol
contracts/mocks/SafeERC20Helper.sol
+1
-1
SafeERC20.test.js
test/token/ERC20/SafeERC20.test.js
+5
-5
No files found.
contracts/mocks/SafeERC20Helper.sol
View file @
b39d9812
...
@@ -91,7 +91,7 @@ contract ERC20NoReturnMock is Context {
...
@@ -91,7 +91,7 @@ contract ERC20NoReturnMock is Context {
}
}
}
}
contract SafeERC20
Wrapper
is Context {
contract SafeERC20
Mock
is Context {
using SafeERC20 for IERC20;
using SafeERC20 for IERC20;
IERC20 private _token;
IERC20 private _token;
...
...
test/token/ERC20/SafeERC20.test.js
View file @
b39d9812
...
@@ -5,14 +5,14 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -5,14 +5,14 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const
ERC20ReturnFalseMock
=
contract
.
fromArtifact
(
'ERC20ReturnFalseMock'
);
const
ERC20ReturnFalseMock
=
contract
.
fromArtifact
(
'ERC20ReturnFalseMock'
);
const
ERC20ReturnTrueMock
=
contract
.
fromArtifact
(
'ERC20ReturnTrueMock'
);
const
ERC20ReturnTrueMock
=
contract
.
fromArtifact
(
'ERC20ReturnTrueMock'
);
const
ERC20NoReturnMock
=
contract
.
fromArtifact
(
'ERC20NoReturnMock'
);
const
ERC20NoReturnMock
=
contract
.
fromArtifact
(
'ERC20NoReturnMock'
);
const
SafeERC20
Wrapper
=
contract
.
fromArtifact
(
'SafeERC20Wrapper
'
);
const
SafeERC20
Mock
=
contract
.
fromArtifact
(
'SafeERC20Mock
'
);
describe
(
'SafeERC20'
,
function
()
{
describe
(
'SafeERC20'
,
function
()
{
const
[
hasNoCode
]
=
accounts
;
const
[
hasNoCode
]
=
accounts
;
describe
(
'with address that has no contract code'
,
function
()
{
describe
(
'with address that has no contract code'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
wrapper
=
await
SafeERC20
Wrapper
.
new
(
hasNoCode
);
this
.
wrapper
=
await
SafeERC20
Mock
.
new
(
hasNoCode
);
});
});
shouldRevertOnAllCalls
(
'SafeERC20: call to non-contract'
);
shouldRevertOnAllCalls
(
'SafeERC20: call to non-contract'
);
...
@@ -20,7 +20,7 @@ describe('SafeERC20', function () {
...
@@ -20,7 +20,7 @@ describe('SafeERC20', function () {
describe
(
'with token that returns false on all calls'
,
function
()
{
describe
(
'with token that returns false on all calls'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
wrapper
=
await
SafeERC20
Wrapper
.
new
((
await
ERC20ReturnFalseMock
.
new
()).
address
);
this
.
wrapper
=
await
SafeERC20
Mock
.
new
((
await
ERC20ReturnFalseMock
.
new
()).
address
);
});
});
shouldRevertOnAllCalls
(
'SafeERC20: ERC20 operation did not succeed'
);
shouldRevertOnAllCalls
(
'SafeERC20: ERC20 operation did not succeed'
);
...
@@ -28,7 +28,7 @@ describe('SafeERC20', function () {
...
@@ -28,7 +28,7 @@ describe('SafeERC20', function () {
describe
(
'with token that returns true on all calls'
,
function
()
{
describe
(
'with token that returns true on all calls'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
wrapper
=
await
SafeERC20
Wrapper
.
new
((
await
ERC20ReturnTrueMock
.
new
()).
address
);
this
.
wrapper
=
await
SafeERC20
Mock
.
new
((
await
ERC20ReturnTrueMock
.
new
()).
address
);
});
});
shouldOnlyRevertOnErrors
();
shouldOnlyRevertOnErrors
();
...
@@ -36,7 +36,7 @@ describe('SafeERC20', function () {
...
@@ -36,7 +36,7 @@ describe('SafeERC20', function () {
describe
(
'with token that returns no boolean values'
,
function
()
{
describe
(
'with token that returns no boolean values'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
wrapper
=
await
SafeERC20
Wrapper
.
new
((
await
ERC20NoReturnMock
.
new
()).
address
);
this
.
wrapper
=
await
SafeERC20
Mock
.
new
((
await
ERC20NoReturnMock
.
new
()).
address
);
});
});
shouldOnlyRevertOnErrors
();
shouldOnlyRevertOnErrors
();
...
...
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