Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Changed getRate to getTokenAmount. The function is now used to calcul…
…ate how many tokens are minted to the backer
  • Loading branch information
Perseverance committed Jan 2, 2018
commit c07ebb4bac11b003803d8f60bc59addfb7c5d1a5
8 changes: 3 additions & 5 deletions contracts/crowdsale/Crowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ contract Crowdsale {
buyTokens(msg.sender);
}

// determines the rate of the crowdsale. Override this for periodization logic
function getRate() internal constant returns(uint256) {
return rate;
function getTokenAmount(uint256 weiAmount) internal constant returns(uint256) {
return weiAmount.mul(rate);
}

// low level token purchase function
Expand All @@ -78,8 +77,7 @@ contract Crowdsale {
uint256 weiAmount = msg.value;

// calculate token amount to be created
uint256 _rate = getRate();
uint256 tokens = weiAmount.mul(_rate);
uint256 tokens = getTokenAmount(weiAmount);

// update state
weiRaised = weiRaised.add(weiAmount);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zeppelin-solidity",
"version": "1.4.1",
"version": "1.5.1",
"description": "Secure Smart Contract library for Solidity",
"scripts": {
"test": "scripts/test.sh",
Expand Down