You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
value = 28000000000000000000000000
address = 0xdedb49385ad5b94a16f236a6890cf9e0b1e30392
Zooming in ......
Where did the extra wei come from?
uint256 public decimals = 8;
uint256 coinsPerTier = 10000000000000; // 100k x 10^8
uint256 MaxCoins = 100000000000000; // 1M x 10^8
uint256 startDate;
uint256 endDate;
// 1 ether = 1000 example tokens
uint256[8] prices = [153846153,142857142,142857142,125000000,117647058,
111111111,105263157,100000000];
event purchase(uint level,uint value, uint tokens);
function createTokens(address recipient) payable {
uint level;
uint price;
if (!funding()) throw;
if (msg.value == 0) throw;
uint256 val = msg.value;
do {
uint256 coinsLeftInThisTier = coinsPerTier - (totalSupply % coinsPerTier);
(level,price) = getLevelAndPrice();
uint tokens = safeMul(val, price); // (val in eth * 10^18) * #tokens per eth
tokens = safeDiv(tokens, 1 ether); // val is in ether, msg,value is in wei
if (tokens <= coinsLeftInThisTier) {
totalSupply = safeAdd(totalSupply, tokens);
balances[recipient] = safeAdd(balances[recipient], tokens);
purchase(level,val,tokens);
return;
}
totalSupply = safeAdd(totalSupply, coinsLeftInThisTier);
balances[recipient] = safeAdd(balances[recipient], coinsLeftInThisTier);
uint weiCoinsLeftInThisTier = safeMul(coinsLeftInThisTier,1 ether);
uint costOfTheseCoins = safeDiv(weiCoinsLeftInThisTier, price);
purchase(level,costOfTheseCoins,coinsLeftInThisTier);
val = safeSub(val,costOfTheseCoins);
} while ((val > 0) && funding());
if (val > 0){
// return the remainder !
if (!msg.sender.send(val)) throw; // if you can't return the balance, abort whole process
}
}
// Our simple dropping price function
function getLevelAndPrice() constant returns (uint level,uint price) {
level = totalSupply / coinsPerTier;
return (level,prices[level]);
}
}
The text was updated successfully, but these errors were encountered:
DaveAppleton
changed the title
28000000000000000000000000 not translated correctly
msg.value not transcribed correctly from VALUE in call dialog to contract
Mar 20, 2017
value = 28000000000000000000000000
address = 0xdedb49385ad5b94a16f236a6890cf9e0b1e30392
Zooming in ......
Where did the extra wei come from?
The text was updated successfully, but these errors were encountered: