Skip to content

Commit

Permalink
Force starting tranches from zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed May 15, 2017
1 parent ed985be commit 6be0887
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contracts/EthTranchePricing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ contract EthTranchePricing is PricingStrategy, Ownable {

uint highestAmount = 0;

// We need to start from zero
if(tranches[i].amount != 0) {
throw;
}

for(uint i=0; i<_tranches.length/2; i++) {
tranches[i].amount = _tranches[i*2];
tranches[i].price = _tranches[i*2+1];
Expand Down
2 changes: 2 additions & 0 deletions ico/tests/contracts/test_eth_tranche_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def test_wei_tranche_data(chain, wei_tranche_pricing, start_time):
def test_wei_tranche_prices(chain, wei_tranche_pricing, start_time, end_time, customer):
"""We get correct wei_tranche prices for different dates."""

assert wei_tranche_pricing.call().getCurrentPrice(0) == 6666660000000000

#TODO: Instead of timetravel, buy tokens here after this line, and then copy this
assert wei_tranche_pricing.call().calculatePrice(
to_wei("0.00666666", "ether"),
Expand Down

0 comments on commit 6be0887

Please sign in to comment.