Commit d95ca124 by Andrew B Coathup Committed by Francisco Giordano

Update crowdsales.md (#1822)

Change reference to Tokens documentation
Fix typo `CROWDALE_ADDRESS` to `CROWDSALE_ADDRESS`

Resolve compilation errors in sample contracts:
* Change `address wallet` to `address payable wallet` in multiple sample contracts
* Change `ERC20 token` to `IERC20 token` in multiple sample contracts
* Reorder inheritance of crowdsales to prevent error: "Linearization of inheritance graph impossible" in multiple sample contracts
* Change `startTime` to constructor parameter `openingTime`
parent 136710cd
...@@ -88,14 +88,14 @@ To use a [`MintedCrowdsale`](api/crowdsale#mintedcrowdsale), your token must als ...@@ -88,14 +88,14 @@ To use a [`MintedCrowdsale`](api/crowdsale#mintedcrowdsale), your token must als
```solidity ```solidity
contract MyToken is ERC20, ERC20Mintable { contract MyToken is ERC20, ERC20Mintable {
// ... see "Learn About Tokens" for more info // ... see "Tokens" for more info
} }
contract MyCrowdsale is Crowdsale, MintedCrowdsale { contract MyCrowdsale is Crowdsale, MintedCrowdsale {
constructor( constructor(
uint256 rate, // rate in TKNbits uint256 rate, // rate in TKNbits
address wallet, address payable wallet,
ERC20 token IERC20 token
) )
MintedCrowdsale() MintedCrowdsale()
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
...@@ -131,11 +131,11 @@ contract MyCrowdsaleDeployer { ...@@ -131,11 +131,11 @@ contract MyCrowdsaleDeployer {
Use an [`AllowanceCrowdsale`](api/crowdsale#allowancecrowdsale) to send tokens from another wallet to the participants of the crowdsale. In order for this to work, the source wallet must give the crowdsale an allowance via the ERC20 [`approve`](api/token/ERC20#IERC20.approve(address,uint256)) method. Use an [`AllowanceCrowdsale`](api/crowdsale#allowancecrowdsale) to send tokens from another wallet to the participants of the crowdsale. In order for this to work, the source wallet must give the crowdsale an allowance via the ERC20 [`approve`](api/token/ERC20#IERC20.approve(address,uint256)) method.
```solidity ```solidity
contract MyCrowdsale is AllowanceCrowdsale, Crowdsale { contract MyCrowdsale is Crowdsale, AllowanceCrowdsale {
constructor( constructor(
uint256 rate, uint256 rate,
address wallet, address payable wallet,
ERC20 token, IERC20 token,
address tokenWallet // <- new argument address tokenWallet // <- new argument
) )
AllowanceCrowdsale(tokenWallet) // <- used here AllowanceCrowdsale(tokenWallet) // <- used here
...@@ -150,7 +150,7 @@ contract MyCrowdsale is AllowanceCrowdsale, Crowdsale { ...@@ -150,7 +150,7 @@ contract MyCrowdsale is AllowanceCrowdsale, Crowdsale {
Then after the crowdsale is created, don't forget to approve it to use your tokens! Then after the crowdsale is created, don't forget to approve it to use your tokens!
```solidity ```solidity
IERC20(tokenAddress).approve(CROWDALE_ADDRESS, SOME_TOKEN_AMOUNT); IERC20(tokenAddress).approve(CROWDSALE_ADDRESS, SOME_TOKEN_AMOUNT);
``` ```
## Validation ## Validation
...@@ -165,15 +165,15 @@ There are a bunch of different validation requirements that your crowdsale might ...@@ -165,15 +165,15 @@ There are a bunch of different validation requirements that your crowdsale might
Simply mix and match these crowdsale flavors to your heart's content: Simply mix and match these crowdsale flavors to your heart's content:
```solidity ```solidity
contract MyCrowdsale is CappedCrowdsale, TimedCrowdsale, Crowdsale { contract MyCrowdsale is Crowdsale, CappedCrowdsale, TimedCrowdsale {
constructor( constructor(
uint256 rate, // rate, in TKNbits uint256 rate, // rate, in TKNbits
address wallet, // wallet to send Ether address payable wallet, // wallet to send Ether
ERC20 token, // the token IERC20 token, // the token
uint256 cap, // total cap, in wei uint256 cap, // total cap, in wei
uint256 openingTime, // opening time in unix epoch seconds uint256 openingTime, // opening time in unix epoch seconds
uint256 closingTime // closing time in unix epoch seconds uint256 closingTime // closing time in unix epoch seconds
) )
CappedCrowdsale(cap) CappedCrowdsale(cap)
TimedCrowdsale(openingTime, closingTime) TimedCrowdsale(openingTime, closingTime)
...@@ -200,17 +200,17 @@ OpenZeppelin is here to make that easy! ...@@ -200,17 +200,17 @@ OpenZeppelin is here to make that easy!
The [`PostDeliveryCrowdsale`](api/crowdsale#postdeliverycrowdsale), as its name implies, distributes tokens after the crowdsale has finished, letting users call [`withdrawTokens`](api/crowdsale#PostDeliveryCrowdsale.withdrawTokens(address)) in order to claim the tokens they've purchased. The [`PostDeliveryCrowdsale`](api/crowdsale#postdeliverycrowdsale), as its name implies, distributes tokens after the crowdsale has finished, letting users call [`withdrawTokens`](api/crowdsale#PostDeliveryCrowdsale.withdrawTokens(address)) in order to claim the tokens they've purchased.
```solidity ```solidity
contract MyCrowdsale is PostDeliveryCrowdsale, TimedCrowdsale, Crowdsale { contract MyCrowdsale is Crowdsale, TimedCrowdsale, PostDeliveryCrowdsale {
constructor( constructor(
uint256 rate, // rate, in TKNbits uint256 rate, // rate, in TKNbits
address wallet, // wallet to send Ether address payable wallet, // wallet to send Ether
ERC20 token, // the token IERC20 token, // the token
uint256 openingTime, // opening time in unix epoch seconds uint256 openingTime, // opening time in unix epoch seconds
uint256 closingTime // closing time in unix epoch seconds uint256 closingTime // closing time in unix epoch seconds
) )
PostDeliveryCrowdsale() PostDeliveryCrowdsale()
TimedCrowdsale(startTime, closingTime) TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
public public
{ {
...@@ -226,13 +226,13 @@ The [`RefundableCrowdsale`](api/crowdsale#refundablecrowdsale) offers to refund ...@@ -226,13 +226,13 @@ The [`RefundableCrowdsale`](api/crowdsale#refundablecrowdsale) offers to refund
```solidity ```solidity
contract MyCrowdsale is RefundableCrowdsale, Crowdsale { contract MyCrowdsale is Crowdsale, RefundableCrowdsale {
constructor( constructor(
uint256 rate, // rate, in TKNbits uint256 rate, // rate, in TKNbits
address wallet, // wallet to send Ether address payable wallet, // wallet to send Ether
ERC20 token, // the token IERC20 token, // the token
uint256 goal // the minimum goal, in wei uint256 goal // the minimum goal, in wei
) )
RefundableCrowdsale(goal) RefundableCrowdsale(goal)
Crowdsale(rate, wallet, token) Crowdsale(rate, wallet, token)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment