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
696acab6
Commit
696acab6
authored
May 11, 2020
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename Impl contracts to Mock
parent
9efc0a88
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
16 deletions
+16
-16
AddressImpl.sol
contracts/mocks/AddressImpl.sol
+1
-1
ArraysImpl.sol
contracts/mocks/ArraysImpl.sol
+1
-1
CountersImpl.sol
contracts/mocks/CountersImpl.sol
+1
-1
Create2Impl.sol
contracts/mocks/Create2Impl.sol
+1
-1
Address.test.js
test/utils/Address.test.js
+3
-3
Arrays.test.js
test/utils/Arrays.test.js
+5
-5
Counters.test.js
test/utils/Counters.test.js
+2
-2
Create2.test.js
test/utils/Create2.test.js
+2
-2
No files found.
contracts/mocks/AddressImpl.sol
View file @
696acab6
...
@@ -2,7 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,7 +2,7 @@ pragma solidity ^0.6.0;
import "../utils/Address.sol";
import "../utils/Address.sol";
contract Address
Impl
{
contract Address
Mock
{
function isContract(address account) external view returns (bool) {
function isContract(address account) external view returns (bool) {
return Address.isContract(account);
return Address.isContract(account);
}
}
...
...
contracts/mocks/ArraysImpl.sol
View file @
696acab6
...
@@ -2,7 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,7 +2,7 @@ pragma solidity ^0.6.0;
import "../utils/Arrays.sol";
import "../utils/Arrays.sol";
contract Arrays
Impl
{
contract Arrays
Mock
{
using Arrays for uint256[];
using Arrays for uint256[];
uint256[] private _array;
uint256[] private _array;
...
...
contracts/mocks/CountersImpl.sol
View file @
696acab6
...
@@ -2,7 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,7 +2,7 @@ pragma solidity ^0.6.0;
import "../utils/Counters.sol";
import "../utils/Counters.sol";
contract Counters
Impl
{
contract Counters
Mock
{
using Counters for Counters.Counter;
using Counters for Counters.Counter;
Counters.Counter private _counter;
Counters.Counter private _counter;
...
...
contracts/mocks/Create2Impl.sol
View file @
696acab6
...
@@ -3,7 +3,7 @@ pragma solidity ^0.6.0;
...
@@ -3,7 +3,7 @@ pragma solidity ^0.6.0;
import "../utils/Create2.sol";
import "../utils/Create2.sol";
import "../introspection/ERC1820Implementer.sol";
import "../introspection/ERC1820Implementer.sol";
contract Create2
Impl
{
contract Create2
Mock
{
function deploy(uint256 value, bytes32 salt, bytes memory code) public {
function deploy(uint256 value, bytes32 salt, bytes memory code) public {
Create2.deploy(value, salt, code);
Create2.deploy(value, salt, code);
}
}
...
...
test/utils/Address.test.js
View file @
696acab6
...
@@ -3,14 +3,14 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -3,14 +3,14 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
balance
,
ether
,
expectRevert
,
send
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
balance
,
ether
,
expectRevert
,
send
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
Address
Impl
=
contract
.
fromArtifact
(
'AddressImpl
'
);
const
Address
Mock
=
contract
.
fromArtifact
(
'AddressMock
'
);
const
EtherReceiver
=
contract
.
fromArtifact
(
'EtherReceiverMock'
);
const
EtherReceiver
=
contract
.
fromArtifact
(
'EtherReceiverMock'
);
describe
(
'Address'
,
function
()
{
describe
(
'Address'
,
function
()
{
const
[
recipient
,
other
]
=
accounts
;
const
[
recipient
,
other
]
=
accounts
;
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
mock
=
await
Address
Impl
.
new
();
this
.
mock
=
await
Address
Mock
.
new
();
});
});
describe
(
'isContract'
,
function
()
{
describe
(
'isContract'
,
function
()
{
...
@@ -19,7 +19,7 @@ describe('Address', function () {
...
@@ -19,7 +19,7 @@ describe('Address', function () {
});
});
it
(
'should return true for contract address'
,
async
function
()
{
it
(
'should return true for contract address'
,
async
function
()
{
const
contract
=
await
Address
Impl
.
new
();
const
contract
=
await
Address
Mock
.
new
();
expect
(
await
this
.
mock
.
isContract
(
contract
.
address
)).
to
.
equal
(
true
);
expect
(
await
this
.
mock
.
isContract
(
contract
.
address
)).
to
.
equal
(
true
);
});
});
});
});
...
...
test/utils/Arrays.test.js
View file @
696acab6
...
@@ -3,14 +3,14 @@ require('@openzeppelin/test-helpers');
...
@@ -3,14 +3,14 @@ require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
Arrays
Impl
=
contract
.
fromArtifact
(
'ArraysImpl
'
);
const
Arrays
Mock
=
contract
.
fromArtifact
(
'ArraysMock
'
);
describe
(
'Arrays'
,
function
()
{
describe
(
'Arrays'
,
function
()
{
context
(
'Even number of elements'
,
function
()
{
context
(
'Even number of elements'
,
function
()
{
const
EVEN_ELEMENTS_ARRAY
=
[
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
];
const
EVEN_ELEMENTS_ARRAY
=
[
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
];
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
arrays
=
await
Arrays
Impl
.
new
(
EVEN_ELEMENTS_ARRAY
);
this
.
arrays
=
await
Arrays
Mock
.
new
(
EVEN_ELEMENTS_ARRAY
);
});
});
it
(
'should return correct index for the basic case'
,
async
function
()
{
it
(
'should return correct index for the basic case'
,
async
function
()
{
...
@@ -38,7 +38,7 @@ describe('Arrays', function () {
...
@@ -38,7 +38,7 @@ describe('Arrays', function () {
const
ODD_ELEMENTS_ARRAY
=
[
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
];
const
ODD_ELEMENTS_ARRAY
=
[
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
];
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
arrays
=
await
Arrays
Impl
.
new
(
ODD_ELEMENTS_ARRAY
);
this
.
arrays
=
await
Arrays
Mock
.
new
(
ODD_ELEMENTS_ARRAY
);
});
});
it
(
'should return correct index for the basic case'
,
async
function
()
{
it
(
'should return correct index for the basic case'
,
async
function
()
{
...
@@ -66,7 +66,7 @@ describe('Arrays', function () {
...
@@ -66,7 +66,7 @@ describe('Arrays', function () {
const
WITH_GAP_ARRAY
=
[
11
,
12
,
13
,
14
,
15
,
20
,
21
,
22
,
23
,
24
];
const
WITH_GAP_ARRAY
=
[
11
,
12
,
13
,
14
,
15
,
20
,
21
,
22
,
23
,
24
];
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
arrays
=
await
Arrays
Impl
.
new
(
WITH_GAP_ARRAY
);
this
.
arrays
=
await
Arrays
Mock
.
new
(
WITH_GAP_ARRAY
);
});
});
it
(
'should return index of first element in next filled range'
,
async
function
()
{
it
(
'should return index of first element in next filled range'
,
async
function
()
{
...
@@ -76,7 +76,7 @@ describe('Arrays', function () {
...
@@ -76,7 +76,7 @@ describe('Arrays', function () {
context
(
'Empty array'
,
function
()
{
context
(
'Empty array'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
arrays
=
await
Arrays
Impl
.
new
([]);
this
.
arrays
=
await
Arrays
Mock
.
new
([]);
});
});
it
(
'should always return 0 for empty array'
,
async
function
()
{
it
(
'should always return 0 for empty array'
,
async
function
()
{
...
...
test/utils/Counters.test.js
View file @
696acab6
...
@@ -3,11 +3,11 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -3,11 +3,11 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
Counters
Impl
=
contract
.
fromArtifact
(
'CountersImpl
'
);
const
Counters
Mock
=
contract
.
fromArtifact
(
'CountersMock
'
);
describe
(
'Counters'
,
function
()
{
describe
(
'Counters'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
counter
=
await
Counters
Impl
.
new
();
this
.
counter
=
await
Counters
Mock
.
new
();
});
});
it
(
'starts at zero'
,
async
function
()
{
it
(
'starts at zero'
,
async
function
()
{
...
...
test/utils/Create2.test.js
View file @
696acab6
...
@@ -3,7 +3,7 @@ const { balance, BN, ether, expectRevert, send } = require('@openzeppelin/test-h
...
@@ -3,7 +3,7 @@ const { balance, BN, ether, expectRevert, send } = require('@openzeppelin/test-h
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
Create2
Impl
=
contract
.
fromArtifact
(
'Create2Impl
'
);
const
Create2
Mock
=
contract
.
fromArtifact
(
'Create2Mock
'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock'
);
const
ERC1820Implementer
=
contract
.
fromArtifact
(
'ERC1820Implementer'
);
const
ERC1820Implementer
=
contract
.
fromArtifact
(
'ERC1820Implementer'
);
...
@@ -21,7 +21,7 @@ describe('Create2', function () {
...
@@ -21,7 +21,7 @@ describe('Create2', function () {
const
constructorByteCode
=
`
${
ERC20Mock
.
bytecode
}${
encodedParams
}
`
;
const
constructorByteCode
=
`
${
ERC20Mock
.
bytecode
}${
encodedParams
}
`
;
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
this
.
factory
=
await
Create2
Impl
.
new
();
this
.
factory
=
await
Create2
Mock
.
new
();
});
});
it
(
'should compute the correct contract address'
,
async
function
()
{
it
(
'should compute the correct contract address'
,
async
function
()
{
...
...
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