Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. geth --testnet --datadir="x:\a\b\GethWithRopsten\"
  2.  
  3. var web3 = new Web3(new web3.providers.IpcProvider('\\.\pipe\geth.ipc',net));
  4.  
  5. function div(uint256 a, uint256 b) internal pure returns (uint256) {
  6. return a / b;
  7. }
  8.  
  9. function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
  10. sellPrice = newSellPrice;
  11. buyPrice = newBuyPrice;
  12. }
  13.  
  14. function buy() payable onlyIfEnabled public {
  15. uint256 amount = msg.value.div(buyPrice);
  16. _transfer(this, msg.sender, amount);
  17. }
  18.  
  19. function _transfer(address _from, address _to, uint256 _value) internal returns (bool){
  20. require (_to != 0x0);
  21. require (balanceOf[_from] >= _value);
  22. require (balanceOf[_to].add(_value) > balanceOf[_to]);
  23. require(!frozenAccount[_from]);
  24. require(!frozenAccount[_to]);
  25. balanceOf[_from] = balanceOf[_from].sub(_value);
  26. balanceOf[_to] = balanceOf[_to].add(_value);
  27. emit Transfer(_from, _to, _value);
  28. return true;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement