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
c4487ba8
Commit
c4487ba8
authored
Sep 27, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert CappedCrowdsale
parent
2c2d80d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
CappedCrowdsale.sol
contracts/crowdsale/validation/CappedCrowdsale.sol
+6
-2
CappedCrowdsaleImpl.sol
contracts/mocks/CappedCrowdsaleImpl.sol
+4
-1
CappedCrowdsale.test.js
test/crowdsale/CappedCrowdsale.test.js
+1
-1
No files found.
contracts/crowdsale/validation/CappedCrowdsale.sol
View file @
c4487ba8
pragma solidity ^0.4.24;
pragma solidity ^0.4.24;
import "../../Initializable.sol";
import "../../math/SafeMath.sol";
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
import "../Crowdsale.sol";
...
@@ -8,16 +9,19 @@ import "../Crowdsale.sol";
...
@@ -8,16 +9,19 @@ import "../Crowdsale.sol";
* @title CappedCrowdsale
* @title CappedCrowdsale
* @dev Crowdsale with a limit for total contributions.
* @dev Crowdsale with a limit for total contributions.
*/
*/
contract CappedCrowdsale is Crowdsale {
contract CappedCrowdsale is
Initializable,
Crowdsale {
using SafeMath for uint256;
using SafeMath for uint256;
uint256 private _cap;
uint256 private _cap;
constructor(uint256 cap) public {
}
/**
/**
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param cap Max amount of wei to be contributed
* @param cap Max amount of wei to be contributed
*/
*/
constructor(uint256 cap) public
{
function initialize(uint256 cap) public initializer
{
require(cap > 0);
require(cap > 0);
_cap = cap;
_cap = cap;
}
}
...
...
contracts/mocks/CappedCrowdsaleImpl.sol
View file @
c4487ba8
pragma solidity ^0.4.24;
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale {
contract CappedCrowdsaleImpl is
Initializable, Crowdsale,
CappedCrowdsale {
constructor (
constructor (
uint256 rate,
uint256 rate,
...
@@ -16,6 +17,8 @@ contract CappedCrowdsaleImpl is CappedCrowdsale {
...
@@ -16,6 +17,8 @@ contract CappedCrowdsaleImpl is CappedCrowdsale {
Crowdsale(rate, wallet, token)
Crowdsale(rate, wallet, token)
CappedCrowdsale(cap)
CappedCrowdsale(cap)
{
{
Crowdsale.initialize(rate, wallet, token);
CappedCrowdsale.initialize(cap);
}
}
}
}
test/crowdsale/CappedCrowdsale.test.js
View file @
c4487ba8
...
@@ -9,7 +9,7 @@ require('chai')
...
@@ -9,7 +9,7 @@ require('chai')
.
should
();
.
should
();
const
CappedCrowdsale
=
artifacts
.
require
(
'CappedCrowdsaleImpl'
);
const
CappedCrowdsale
=
artifacts
.
require
(
'CappedCrowdsaleImpl'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken
Mock
'
);
contract
(
'CappedCrowdsale'
,
function
([
_
,
wallet
])
{
contract
(
'CappedCrowdsale'
,
function
([
_
,
wallet
])
{
const
rate
=
new
BigNumber
(
1
);
const
rate
=
new
BigNumber
(
1
);
...
...
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