-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPDATED: BuyTokens getting the token amount from a function instead of just multiplication. Useful for making Crowdsales with bonus periods #638
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "zeppelin-solidity", | |||
"version": "1.5.0", | |||
"version": "1.5.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change the version? The version is changed only on each release I think and by the maintainers of the repo, please remove this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The build is failing with "Error: Could not connect to your Ethereum client. Please check that your Ethereum client:" after my commit changing back the lib version. I do not think the error is related to my changes :) |
@Perseverance it is not! Is a problem in travis that happens randomly. Im going to restart it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove all changes in packaje.json file, there still one line break left in the last line.
@AugustoL done, should have reverted the first time :) Please squash them if you have such option when merging |
contracts/crowdsale/Crowdsale.sol
Outdated
// fallback function can be used to buy tokens | ||
function () external payable { | ||
buyTokens(msg.sender); | ||
} | ||
|
||
// Override this function to create logic for periodization | ||
function getTokenAmount(uint256 weiAmount) internal constant returns(uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change constant
for view
? They're aliases but we use view
throughout the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
@frangio Changed constant to view ;) |
@frangio Is it good to go now? |
Thank you @Perseverance! |
BuyTokens getting the token amount from a function instead of just multiplication. Useful for making Crowdsales with bonus periods
I've changed the buyTokens method to get the rate from
getTokenAmount
function. This function can later be overridden to make crowdsales with different rate periods based on some business logic.This is an update pull request as the previous one was too messy due to conflicts
Fixes #302