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
6247a7bf
Commit
6247a7bf
authored
Sep 27, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert AllowanceCrowdsale to initializers
parent
22f8660c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
AllowanceCrowdsale.sol
contracts/crowdsale/emission/AllowanceCrowdsale.sol
+6
-2
AllowanceCrowdsaleImpl.sol
contracts/mocks/AllowanceCrowdsaleImpl.sol
+4
-1
AllowanceCrowdsale.test.js
test/crowdsale/AllowanceCrowdsale.test.js
+1
-1
No files found.
contracts/crowdsale/emission/AllowanceCrowdsale.sol
View file @
6247a7bf
pragma solidity ^0.4.24;
import "../../Initializable.sol";
import "../Crowdsale.sol";
import "../../token/ERC20/IERC20.sol";
import "../../token/ERC20/SafeERC20.sol";
...
...
@@ -10,17 +11,20 @@ import "../../math/SafeMath.sol";
* @title AllowanceCrowdsale
* @dev Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale.
*/
contract AllowanceCrowdsale is Crowdsale {
contract AllowanceCrowdsale is
Initializable,
Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private _tokenWallet;
constructor(address tokenWallet) public {
}
/**
* @dev Constructor, takes token wallet address.
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address tokenWallet) public
{
function initialize(address tokenWallet) public initializer
{
require(tokenWallet != address(0));
_tokenWallet = tokenWallet;
}
...
...
contracts/mocks/AllowanceCrowdsaleImpl.sol
View file @
6247a7bf
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../token/ERC20/IERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol";
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
contract AllowanceCrowdsaleImpl is
Initializable, Crowdsale,
AllowanceCrowdsale {
constructor (
uint256 rate,
...
...
@@ -16,6 +17,8 @@ contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
Crowdsale(rate, wallet, token)
AllowanceCrowdsale(tokenWallet)
{
Crowdsale.initialize(rate, wallet, token);
AllowanceCrowdsale.initialize(tokenWallet);
}
}
test/crowdsale/AllowanceCrowdsale.test.js
View file @
6247a7bf
...
...
@@ -9,7 +9,7 @@ const should = require('chai')
.
should
();
const
AllowanceCrowdsale
=
artifacts
.
require
(
'AllowanceCrowdsaleImpl'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken
Mock
'
);
contract
(
'AllowanceCrowdsale'
,
function
([
_
,
investor
,
wallet
,
purchaser
,
tokenWallet
])
{
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