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
418b6f7c
Commit
418b6f7c
authored
Sep 28, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert IncreasingPriceCrowdsale to initializers
parent
ed200a02
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
IncreasingPriceCrowdsale.sol
contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
+6
-2
IncreasingPriceCrowdsaleImpl.sol
contracts/mocks/IncreasingPriceCrowdsaleImpl.sol
+5
-1
IncreasingPriceCrowdsale.test.js
test/crowdsale/IncreasingPriceCrowdsale.test.js
+1
-1
No files found.
contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
View file @
418b6f7c
pragma solidity ^0.4.24;
import "../../Initializable.sol";
import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
...
...
@@ -10,18 +11,21 @@ import "../../math/SafeMath.sol";
* Note that what should be provided to the constructor is the initial and final _rates_, that is,
* the amount of tokens per wei contributed. Thus, the initial rate must be greater than the final rate.
*/
contract IncreasingPriceCrowdsale is TimedCrowdsale {
contract IncreasingPriceCrowdsale is
Initializable,
TimedCrowdsale {
using SafeMath for uint256;
uint256 private _initialRate;
uint256 private _finalRate;
constructor(uint256 initialRate, uint256 finalRate) public {
}
/**
* @dev Constructor, takes initial and final rates of tokens received per wei contributed.
* @param initialRate Number of tokens a buyer gets per wei at the start of the crowdsale
* @param finalRate Number of tokens a buyer gets per wei at the end of the crowdsale
*/
constructor(uint256 initialRate, uint256 finalRate) public
{
function initialize(uint256 initialRate, uint256 finalRate) public initializer
{
require(finalRate > 0);
require(initialRate >= finalRate);
_initialRate = initialRate;
...
...
contracts/mocks/IncreasingPriceCrowdsaleImpl.sol
View file @
418b6f7c
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
import "../math/SafeMath.sol";
contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
contract IncreasingPriceCrowdsaleImpl is In
itializable, In
creasingPriceCrowdsale {
constructor (
uint256 openingTime,
...
...
@@ -19,6 +20,9 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
TimedCrowdsale(openingTime, closingTime)
IncreasingPriceCrowdsale(initialRate, finalRate)
{
Crowdsale.initialize(initialRate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
IncreasingPriceCrowdsale.initialize(initialRate, finalRate);
}
}
test/crowdsale/IncreasingPriceCrowdsale.test.js
View file @
418b6f7c
...
...
@@ -11,7 +11,7 @@ require('chai')
.
should
();
const
IncreasingPriceCrowdsale
=
artifacts
.
require
(
'IncreasingPriceCrowdsaleImpl'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken
Mock
'
);
contract
(
'IncreasingPriceCrowdsale'
,
function
([
_
,
investor
,
wallet
,
purchaser
])
{
const
value
=
ether
(
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