Модификации контракта SmartToken [закрыто]

Я хочу создать смарт-токен в реальной сети ethereum, и я протестировал этот контракт в тестовой сети ropsten, кажется, он отлично работает так, как я этого хочу, теперь, если бы я опубликовал точно такой же контракт в реальной сети ethereum. так же работает?

А также, не упускаю ли я каких-либо фатальных вещей или каких-либо фатальных ошибок, которые впоследствии вызовут ошибку? какие основные детали можно улучшить и какие детали кажутся странными?

pragma solidity ^0.4.15;

/**
 * Math operations with safety checks
 */
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
    uint c = a * b;
    assert(a == 0 || c / a == b);
    return c;
}

function safeDiv(uint a, uint b) internal returns (uint) {
    assert(b > 0);
    uint c = a / b;
    assert(a == b * c + a % b);
    return c;
}

function safeSub(uint a, uint b) internal returns (uint) {
    assert(b <= a);
    return a - b;
}

function safeAdd(uint a, uint b) internal returns (uint) {
    uint c = a + b;
    assert(c >= a);
    return c;
}

function max64(uint64 a, uint64 b) internal constant returns (uint64) {
    return a >= b ? a : b;
}

function min64(uint64 a, uint64 b) internal constant returns (uint64) 
{
    return a < b ? a : b;
}

function max256(uint256 a, uint256 b) internal constant returns 
(uint256) {
    return a >= b ? a : b;
}

function min256(uint256 a, uint256 b) internal constant returns 
(uint256) {
    return a < b ? a : b;
}

//This is built in the Solidity language anyway as far as I know
function assert(bool assertion) internal {
    if (!assertion) {
        throw;
    }
}
 }

 contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
event Transfer(address indexed from, address indexed to, uint value);
 }

  contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns 
(uint);

function transferFrom(address from, address to, uint value);
function approve(address spender, uint value);
event Approval(address indexed owner, address indexed spender, uint 
value);
 }

 contract BasicToken is ERC20Basic, SafeMath {

mapping(address => uint) balances;

     /**
   * @dev transfer token for a specified address
   * @param _to The address to transfer to.
   * @param _value The amount to be transferred.
  */

function transfer(address _to, uint _value) {
    balances[msg.sender] = safeSub(balances[msg.sender], _value);
    balances[_to] = safeAdd(balances[_to], _value);
    Transfer(msg.sender, _to, _value);
}

      /**
   * @dev Gets the balance of the specified address.
   * @param _owner The address to query the the balance of. 
   * @return An uint256 representing the amount owned by the passed address.
   */
function balanceOf(address _owner) constant returns (uint balance) {
    return balances[_owner];
}

 }


 contract StandardToken is BasicToken, ERC20 {

mapping (address => mapping (address => uint)) allowed;

function transferFrom(address _from, address _to, uint _value) {
    var _allowance = allowed[_from][msg.sender];

    // Check is not needed because safeSub(_allowance, _value) will already throw if this condition is not met
    // if (_value > _allowance) throw;

    balances[_to] = safeAdd(balances[_to], _value);
    balances[_from] = safeSub(balances[_from], _value);
    allowed[_from][msg.sender] = safeSub(_allowance, _value);
    Transfer(_from, _to, _value);
}

function approve(address _spender, uint _value) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
}

function allowance(address _owner, address _spender) constant returns 
(uint remaining) {
    return allowed[_owner][_spender];
} 

 }

 contract Ownable {
   address public owner =0x00000;


   /**
    * @dev The Ownable constructor sets the original `owner` of the 
 contract to the sender
    * account.
    */
   function Ownable() {
     owner = msg.sender;
   }


   /**
    * @dev Throws if called by any account other than the owner.
    */
   modifier onlyOwner() {
     require(msg.sender == owner);
_;
   }


   /**
    * @dev Allows the current owner to transfer control of the contract to a newOwner.
    * @param newOwner The address to transfer ownership to.
    */
   function transferOwnership(address newOwner) onlyOwner {
     require(newOwner != address(0));      
     owner = newOwner;
   }

 }

contract CrowdsaleToken is StandardToken , Ownable {


   uint public startBlock= block.timestamp;
   uint public endBlock= startBlock + noOfSec;



  string public constant name = "EcoToken";
  string public constant symbol = "ECT";
  uint public constant decimals = 0;
  // replace with your fund collection multisig address 
  address public constant multisig = 0x000000; 
  uint public constant INITIAL_SUPPLY = 10000;

 function CrowdsaleToken() {
balances[msg.sender] = INITIAL_SUPPLY;
  }


  // 1 ether = 400 example tokens 
  uint public constant PRICE = 400;

   function () payable {
     createTokens(msg.sender);
   }

   function createTokens(address recipient) payable {
     if (msg.value == 0) {
       throw;
     }

require(now >= startBlock && now <= endBlock); 

uint tokens = safeDiv(safeMul(msg.value * 1.01 ether, getPrice()), 1000000000000000000 ether);
totalSupply = safeAdd(safeAdd(totalSupply, tokens), INITIAL_SUPPLY);

balances[recipient] = safeAdd(balances[recipient], tokens);

if (!multisig.send(msg.value)) {
  throw;
}
  }

// replace this with any other price function
  function getPrice() constant returns (uint result) {
    return PRICE;
}
  }
Я голосую за то, чтобы закрыть этот вопрос как не по теме, потому что это не похоже на вопрос.
... было несколько периодов, когда я делал это голосование по закрытию.
@taid Пожалуйста, не редактируйте вопросы, чтобы удалить контент. Даже если вопрос закрыт как слишком широкий, он все равно является полезной ссылкой и должен быть сохранен. Если у вас есть другие проблемы и вы считаете, что пост нужно удалить, обратитесь к модератору.

Ответы (1)

Во-первых, ваш контракт должен работать одинаково в тестовой сети и в основной сети (конечно, за исключением того факта, что состояние в двух цепях отличается).

Во-вторых, и это только мое мнение, вы совершаете «смертельную» ошибку, запрашивая рассмотрение вашего смарт-контракта на публичном форуме.

Если бы я был «злым» (а это не так!) я бы притворился «полезным» и пересмотрел бы ваш контракт. Если бы я нашел какое-нибудь место, где я мог бы украсть ваши деньги, я бы сделал вид, что все работает нормально, а затем позволил бы вам развернуть его и через десять секунд после того, как вы подняли мега-деньги, украл бы ваш эфир. Плохая идея — запрашивать отзыв у кого-либо, кроме известного эксперта по смарт-контрактам.

омг, я не знал об этом, что мне теперь делать? Кроме того, есть ли в этом контракте место, где вы могли бы украсть мои деньги? также объясните мне, как он мог украсть мой эфир? большое спасибо за разъяснение этого. Могу ли я заключить с вами контракт?
Также следует убедиться в отсутствии конфликта интересов с тем экспертом, который просматривает ваш контракт.