Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
49b16cf
Basic idea
eternauta1337 Feb 4, 2018
fc7af3c
Fine tuning idea
eternauta1337 Feb 5, 2018
d54f799
Add comments / tidy up Crowdsale base class
eternauta1337 Feb 5, 2018
f48c150
fixed TimedCrowdsale constructor
fiiiu Feb 7, 2018
3f5680b
added simple crowdsale test
fiiiu Feb 7, 2018
a8a14df
added HODL directory under home to store unused contracts. ugly hack …
fiiiu Feb 7, 2018
469a999
Capped no longer inherits from Timed, added capReached() method (repl…
fiiiu Feb 8, 2018
90f0973
added SafeMath in TimedCrowdsale for safety, CHECK whether it is inhe…
fiiiu Feb 8, 2018
3ffe518
several fixes related to separating Capped from Timed. functions rena…
fiiiu Feb 8, 2018
a5aaf94
added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
fiiiu Feb 8, 2018
8a3cfb9
added Whitelisted implementation and test, passed.
fiiiu Feb 8, 2018
6343246
removed unnecessary super constructor call in WhitelistedCrowdsale, r…
fiiiu Feb 8, 2018
2c22337
renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implement…
fiiiu Feb 8, 2018
8c8fed1
homogeneized use of using SafeMath for uint256 across validation crow…
fiiiu Feb 8, 2018
962b5bc
adding questions.md where I track questions, bugs and progress
fiiiu Feb 8, 2018
bbb2dfa
modified VariablePriceCrowdsale, added Impl.
fiiiu Feb 9, 2018
3fdb6da
finished VariablePrice, fixed sign, added test, passing.
fiiiu Feb 9, 2018
53ec3cc
changed VariablePrice to IncreasingPrice, added corresponding require()
fiiiu Feb 14, 2018
2be5806
MintedCrowdsale done, mock implemented, test passing
fiiiu Feb 14, 2018
b814a05
PremintedCrowdsale done, mocks, tests passing
fiiiu Feb 14, 2018
dd05925
checked FinalizableCrowdsale
fiiiu Feb 14, 2018
120d277
PostDeliveryCrowdsale done, mock, tests passing.
fiiiu Feb 14, 2018
e677e33
RefundableCrowdsale done. Detached Vault. modified mock and test, pas…
fiiiu Feb 14, 2018
5873f8e
renamed crowdsale-refactor to crowdsale in contracts and test
fiiiu Feb 14, 2018
2fe239c
deleted HODL old contracts
fiiiu Feb 15, 2018
bf5e9dd
polished variable names in tests
fiiiu Feb 15, 2018
cd0ba80
fixed typos and removed comments in tests
fiiiu Feb 15, 2018
0487d25
Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
eternauta1337 Feb 15, 2018
c4a2f9c
Fix minor param naming issues in Crowdsale functions and added docume…
eternauta1337 Feb 15, 2018
3ef55bc
Added documentation to Crowdsale extensions
eternauta1337 Feb 15, 2018
c1a41ae
removed residual comments and progress tracking files
fiiiu Feb 15, 2018
b455000
added docs for validation crowdsales
fiiiu Feb 15, 2018
a841691
Made user promises in PostDeliveryCrowdsale public so that users can …
eternauta1337 Feb 15, 2018
3d4d41a
added docs for distribution crowdsales
fiiiu Feb 15, 2018
8b6b342
renamed PremintedCrowdsale to AllowanceCrowdsale
fiiiu Feb 16, 2018
1a2a5ec
added allowance check function and corresponding test. fixed filename…
fiiiu Feb 16, 2018
1680a18
spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _u…
fiiiu Feb 16, 2018
344bec6
polished tests for linter, salve Travis
fiiiu Feb 16, 2018
7d4035a
polished IncreasingPriceCrowdsale.sol for linter.
fiiiu Feb 16, 2018
bcd0464
renamed and polished for linter WhitelistedCrowdsale test.
fiiiu Feb 16, 2018
51c0954
fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
fiiiu Feb 16, 2018
cd15b41
fixed ignoring token.mint return value in MintedCrowdsale.sol
fiiiu Feb 17, 2018
e716a22
expanded docs throughout, fixed minor issues
fiiiu Feb 19, 2018
7134f0d
extended test coverage for IndividuallyCappedCrowdsale
fiiiu Feb 19, 2018
f56116e
Extended WhitelistedCrwodsale test coverage
fiiiu Feb 19, 2018
2a6dd9f
roll back decoupling of RefundVault in RefundableCrowdsale
fiiiu Feb 19, 2018
8e8e8cc
moved cap exceedance checks in Capped and IndividuallyCapped crowdsal…
fiiiu Feb 19, 2018
fa055a6
revert name change, IndividuallyCapped to UserCapped
fiiiu Feb 19, 2018
56e83b9
extended docs.
fiiiu Feb 19, 2018
1bf30f9
added crowd whitelisting with tests
fiiiu Feb 19, 2018
a70e3ed
added group capping, plus tests
fiiiu Feb 19, 2018
5f4fc83
added modifiers in TimedCrowdsale and WhitelistedCrowdsale
fiiiu Feb 19, 2018
47ce79f
polished tests for linter
fiiiu Feb 19, 2018
5dab495
moved check of whitelisted to modifier, mainly for testing coverage
fiiiu Feb 19, 2018
dd338f1
fixed minor ordering/polishingafter review
fiiiu Feb 19, 2018
8376baa
modified TimedCrowdsale modifier/constructor ordering
fiiiu Feb 19, 2018
8ad6a10
unchanged truffle-config.js
fiiiu Feb 20, 2018
107fdc4
changed indentation of visibility modifier in mocks
fiiiu Feb 20, 2018
530d85d
changed naming of modifier and function to use Open/Closed for TimedC…
fiiiu Feb 20, 2018
9fe61b8
changed ordering of constructor calls in SampleCrowdsale
fiiiu Feb 20, 2018
de8e88f
changed startTime and endTime to openingTime and closingTime throughout
fiiiu Feb 20, 2018
6c38f46
fixed exceeding line lenght for linter
fiiiu Feb 20, 2018
33839c1
Merge branch 'master' into feature/crowdsale-refactor
fiiiu Feb 20, 2018
df03099
renamed _emitTokens to _deliverTokens
fiiiu Feb 20, 2018
c6def0e
renamed addCrowdToWhitelist to addManyToWhitelist
fiiiu Feb 20, 2018
c177f01
renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
fiiiu Feb 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
extended docs.
  • Loading branch information
fiiiu committed Feb 19, 2018
commit 56e83b9047d95ebab33778c1db6f9a15a3c4d0a0
2 changes: 2 additions & 0 deletions contracts/crowdsale/distribution/RefundableCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
RefundVault public vault;

/**
* @dev Constructor, creates RefundVault.
* @param _goal Funding goal
*/
function RefundableCrowdsale(uint256 _goal) public {
Expand All @@ -41,6 +42,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
}

/**
* @dev Checks whether funding goal was reached.
* @return Whether funding goal was reached
*/
function goalReached() public view returns (bool) {
Expand Down
2 changes: 2 additions & 0 deletions contracts/crowdsale/emission/AllowanceCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ contract AllowanceCrowdsale is Crowdsale {
address public tokenWallet;

/**
* @dev Constructor, takes token wallet address.
* @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
function AllowanceCrowdsale(address _tokenWallet) public {
Expand All @@ -23,6 +24,7 @@ contract AllowanceCrowdsale is Crowdsale {
}

/**
* @dev Checks the amount of tokens left in the allowance.
* @return Amount of tokens left in the allowance
*/
function remainingTokens() public view returns (uint256) {
Expand Down
5 changes: 3 additions & 2 deletions contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "../../math/SafeMath.sol";
* @title IncreasingPriceCrowdsale
* @dev Extension of Crowdsale contract that increases the price of tokens linearly in time.
* Note that what should be provided to the constructor is the initial and final _rates_, that is,
* the amount of tokens per ETH contributed. Thus, the initial rate must be greater than the final rate.
* the amount of tokens per wei contributed. Thus, the initial rate must be greater than the final rate.
*/
contract IncreasingPriceCrowdsale is TimedCrowdsale {
using SafeMath for uint256;
Expand All @@ -16,6 +16,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
uint256 public finalRate;

/**
* @dev Constructor, takes intial 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to enforce that the linear function here must make the tokens increase in price? I expect a crowdsale that gets cheaper over time could be desired as well. I'm not sure there's a benefit to requiring an increase. We should let the creator make a linear function of their own slope. (and in that case this contract could be LinearlyScaledRateCrowdsale

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of restricting the price to be increasing was to be able to use unsigned ints throughout.. Plus I didn't see much use for a decreasing price crowdsale, but we could add this more general crowdsale flavor later if you think it might be useful!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I'm happy with that logic πŸ‘

* @param _finalRate Number of tokens a buyer gets per wei at the end of the crowdsale
*/
Expand All @@ -27,7 +28,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
}

/**
* @dev Returns the rate of tokens per ETH at the present time.
* @dev Returns the rate of tokens per wei at the present time.
* Note that, as price _increases_ with time, the rate _decreases_.
* @return The number of tokens a buyer gets per wei at a given time
*/
Expand Down
2 changes: 2 additions & 0 deletions contracts/crowdsale/validation/CappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ contract CappedCrowdsale is Crowdsale {
uint256 public cap;

/**
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param _cap Max amount of wei to be contributed
*/
function CappedCrowdsale(uint256 _cap) public {
Expand All @@ -22,6 +23,7 @@ contract CappedCrowdsale is Crowdsale {
}

/**
* @dev Checks whether the cap has been reached.
* @return Whether the cap was reached
*/
function capReached() public view returns (bool) {
Expand Down
2 changes: 2 additions & 0 deletions contracts/crowdsale/validation/TimedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ contract TimedCrowdsale is Crowdsale {
uint256 public endTime;

/**
* @dev Constructor, takes crowdsale opening and closing times.
* @param _startTime Crowdsale opening time
* @param _endTime Crowdsale closing time
*/
Expand All @@ -27,6 +28,7 @@ contract TimedCrowdsale is Crowdsale {
}

/**
* @dev Checks whether the period in which the crowdsale is open has already elapsed.
* @return Whether crowdsale period has elapsed
*/
function hasExpired() public view returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expired instead of Ended (_endTime) for any particular reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasEnded was the prior method that encompassed ending either by reaching endTime or by reaching the cap in a CappedCrowdsale. Now the purchase validation is done in separate places so we need to split this (hasExpired and capReached). While we could call this one hasEnded, a crowdsale could also end "prematurely" by reaching its cap, thus, be ended but not expired..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason we're not using the existing naming of hasEnded? I don't mind either way, but it's good to know why we changed the api.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasEnded was the prior method that encompassed ending either by reaching endTime or by reaching the cap in a CappedCrowdsale. Now the purchase validation is done in separate places so we need to split this (hasExpired and capReached). While we could call this one hasEnded, a crowdsale could also end "prematurely" by reaching its cap, thus, be ended but not expired..

Expand Down
3 changes: 3 additions & 0 deletions contracts/crowdsale/validation/UserCappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract UserCappedCrowdsale is Crowdsale, Ownable {
mapping(address => uint256) public caps;

/**
* @dev Sets a specific user's maximum contribution.
* @param _beneficiary Address to be capped
* @param _cap Wei limit for individual contribution
*/
Expand All @@ -24,6 +25,7 @@ contract UserCappedCrowdsale is Crowdsale, Ownable {
}

/**
* @dev Returns the cap of a specific user.
* @param _beneficiary Address whose cap is to be checked
* @return Current cap for individual user
*/
Expand All @@ -32,6 +34,7 @@ contract UserCappedCrowdsale is Crowdsale, Ownable {
}

/**
* @dev Returns the amount contributed so far by a sepecific user.
* @param _beneficiary Address of contributor
* @return User contribution so far
*/
Expand Down
3 changes: 3 additions & 0 deletions contracts/crowdsale/validation/WhitelistedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,23 @@ contract WhitelistedCrowdsale is Crowdsale, Ownable {
mapping(address => bool) public whitelist;

/**
* @dev Adds address to whitelist.
* @param _beneficiary Address to be added to the whitelist
*/
function addToWhitelist(address _beneficiary) external onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this is a crowd sale, we should provide an addToWhitelist(address[] _beneficiaries) function, that would save lots of function calls.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or a constructor

whitelist[_beneficiary] = true;
}

/**
* @dev Removes address from whitelist.
* @param _beneficiary Address to be removed to the whitelist
*/
function removeFromWhitelist(address _beneficiary) external onlyOwner {
whitelist[_beneficiary] = false;
}

/**
* @dev Checks whether a specific user is whitelisted.
* @param _beneficiary Address to check whether already in the whitelist
* @return Whether the address is whitelisted
*/
Expand Down