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
10642d14
Commit
10642d14
authored
Sep 25, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert Escrow to initializers
parent
6ac45333
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
EscrowMock.sol
contracts/mocks/EscrowMock.sol
+10
-0
Escrow.sol
contracts/payment/Escrow.sol
+6
-1
Escrow.test.js
test/payment/Escrow.test.js
+1
-1
No files found.
contracts/mocks/EscrowMock.sol
0 → 100644
View file @
10642d14
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../payment/Escrow.sol";
contract EscrowMock is Initializable, Escrow {
constructor() public {
Escrow.initialize();
}
}
contracts/payment/Escrow.sol
View file @
10642d14
pragma solidity ^0.4.24;
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../math/SafeMath.sol";
import "../math/SafeMath.sol";
import "../ownership/Secondary.sol";
import "../ownership/Secondary.sol";
...
@@ -11,7 +12,7 @@ import "../ownership/Secondary.sol";
...
@@ -11,7 +12,7 @@ import "../ownership/Secondary.sol";
* should be its primary, and provide public methods redirecting to the escrow's
* should be its primary, and provide public methods redirecting to the escrow's
* deposit and withdraw.
* deposit and withdraw.
*/
*/
contract Escrow is Secondary {
contract Escrow is
Initializable,
Secondary {
using SafeMath for uint256;
using SafeMath for uint256;
event Deposited(address indexed payee, uint256 weiAmount);
event Deposited(address indexed payee, uint256 weiAmount);
...
@@ -19,6 +20,10 @@ contract Escrow is Secondary {
...
@@ -19,6 +20,10 @@ contract Escrow is Secondary {
mapping(address => uint256) private _deposits;
mapping(address => uint256) private _deposits;
function initialize() public initializer {
Secondary.initialize();
}
function depositsOf(address payee) public view returns (uint256) {
function depositsOf(address payee) public view returns (uint256) {
return _deposits[payee];
return _deposits[payee];
}
}
...
...
test/payment/Escrow.test.js
View file @
10642d14
const
{
shouldBehaveLikeEscrow
}
=
require
(
'./Escrow.behavior'
);
const
{
shouldBehaveLikeEscrow
}
=
require
(
'./Escrow.behavior'
);
const
Escrow
=
artifacts
.
require
(
'Escrow'
);
const
Escrow
=
artifacts
.
require
(
'Escrow
Mock
'
);
contract
(
'Escrow'
,
function
([
_
,
primary
,
...
otherAccounts
])
{
contract
(
'Escrow'
,
function
([
_
,
primary
,
...
otherAccounts
])
{
beforeEach
(
async
function
()
{
beforeEach
(
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