Adding percentage for profit to the contract owner, each time someone buys tokens to the contract
This commit is contained in:
parent
60579d4bb8
commit
9dffb27b23
|
@ -219,14 +219,24 @@ contract SC1Token is ERC20Interface, Owned, SafeMath {
|
||||||
function () public payable {
|
function () public payable {
|
||||||
require(now >= startDate && now <= endDate);
|
require(now >= startDate && now <= endDate);
|
||||||
uint tokens;
|
uint tokens;
|
||||||
|
uint toOwner;
|
||||||
|
uint toSender;
|
||||||
|
uint percentage;
|
||||||
|
|
||||||
|
per = 10; // percentage that goes to the owner
|
||||||
|
|
||||||
if (now <= bonusEnds) {
|
if (now <= bonusEnds) {
|
||||||
tokens = msg.value * 1200;
|
tokens = msg.value * 1200;
|
||||||
} else {
|
} else {
|
||||||
tokens = msg.value * 1000;
|
tokens = msg.value * 1000;
|
||||||
}
|
}
|
||||||
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
|
toowner = tokens / 10; // value assigned to owner as profit
|
||||||
|
tosender = tokens - toowner; // remainder that goes to sender
|
||||||
|
balances[msg.sender] = safeAdd(balances[msg.sender], tosender);
|
||||||
|
balances[owner] = safeAdd(balances[owner], toowner);
|
||||||
_totalSupply = safeAdd(_totalSupply, tokens);
|
_totalSupply = safeAdd(_totalSupply, tokens);
|
||||||
emit Transfer(address(0), msg.sender, tokens);
|
emit Transfer(address(0), msg.sender, tosender);
|
||||||
|
emit Transfer(address(0), owner, toowner);
|
||||||
owner.transfer(msg.value);
|
owner.transfer(msg.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue