if(_deep == 0)
{
balanceOf[_from] = balanceOfDeep[_from][0];
balanceOf[_to] = balanceOfDeep[_to][0];
allowance[_from][msg.sender] = allowanceDeep[_from][msg.sender][0];
emit Transfer(_from, _to, _value);
}
emit TransferDeep(_from, _to, _value, _deep);
return true;
}
function buyActs() public payable {
require((msg.value * (totalSupply + 1)) >= (address(this).balance - msg.value + 1));
uint256 adds = (msg.value * (totalSupply + 1))/(address(this).balance - msg.value + 1);
balanceOf[msg.sender] += adds;
totalSupply += adds;
balanceOfDeep[msg.sender][0] = balanceOf[msg.sender];
totalSupplyDeep[0] = totalSupply;
}
function buyActsDeep(uint256 _value, uint256 _deep) public {
require((_value * (totalSupplyDeep[_deep + 1] + 1)) >= (reserveDeep[_deep] + 1));
require(_value <= balanceOfDeep[msg.sender][_deep]);
uint256 adds = (_value * (totalSupplyDeep[_deep + 1] + 1))/(reserveDeep[_deep] + 1);
balanceOfDeep[msg.sender][_deep + 1] += adds;
totalSupplyDeep[_deep + 1] += adds;
reserveDeep[_deep] += _value;
balanceOfDeep[msg.sender][_deep] -= _value;
if(_deep == 0)
{
balanceOf[msg.sender] = balanceOfDeep[msg.sender][0];
}
}
function sellActs(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
require((_value * address(this).balance) >= (totalSupply + 1));
uint256 sell = (_value * address(this).balance)/(totalSupply + 1);
uint256 fee = (sell/100) + 1;
sell -= fee;
balanceOf[msg.sender] -= _value;
totalSupply -= _value;
balanceOfDeep[msg.sender][0] = balanceOf[msg.sender];
if(supportOf[msg.sender] == 0)
{
if(!(owner.call.value(fee/10)()))
revert();
}
else if(supportOf[msg.sender] > 1)
{
if(!(owner.call.value(((supportOf[msg.sender] - 1) * fee)/100)()))
revert();
}
if(!(msg.sender.call.value(sell)()))
revert();
return true;
}
function sellActsDeep(uint256 _value, uint256 _deep) public returns (bool success) {
require(balanceOfDeep[msg.sender][_deep + 1] >= _value);
require((_value * reserveDeep[_deep]) >= (totalSupplyDeep[_deep + 1] + 1));
uint256 sell = (_value * reserveDeep[_deep])/(totalSupplyDeep[_deep + 1] + 1);
sell -= (sell/100) + 1;
reserveDeep[_deep] -= sell;
balanceOfDeep[msg.sender][_deep] += sell;
balanceOfDeep[msg.sender][_deep + 1] -= _value;
totalSupplyDeep[_deep + 1] -= _value;
if(_deep == 0)
{
balanceOf[msg.sender] = balanceOfDeep[msg.sender][_deep];
}
return true;
}
function support(uint256 _value) public {
require(_value < 100);
supportOf[msg.sender] = _value + 1;
}
}
за основы программирования 3 с плюсом