[T]utorial [A]bout





Welcome to Panoramix.





Quickly rushed out of the door for Devcon.

Expect bugs, lots of bugs :)

kolinko@gmail.com




Some fun stuff after 1,050,657 decompiled contracts...

[1]transfer functions  [2]selfdestruct piniata  [3]stats
Some of the ways you can write a transfer function.

def transfer(address _to, uint256 _value) : # not payable
  require addr(_to)
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require addr(_to) != 0
  require balanceOf[caller] >= _value
  require balanceOf[addr(_to)] + _value >= balanceOf[addr(_to)]
  balanceOf[caller] = balanceOf[caller] - _value
  balanceOf[addr(_to)] = balanceOf[addr(_to)] + _value
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require not stor1.160.uint8
  require addr(_to)
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log 0xddf252ad, caller, addr(_to), _value
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log 0xddf252ad, ORIGIN, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require CALLDATASIZE >= 68
  require addr(_to) != 0
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require balanceOf[addr(_to)] + _value >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = balanceOf[addr(_to)] + _value
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require caller == ownerAddress
  require _value < eth.balance(this.address)
  call addr(_to) with:	# withdraw / default function
       gas 2300 * not _value wei
     value _value wei
  require call_ret_code
  STOP


def transfer(address _to, uint256 _value) : # not payable
  require addr(_to)
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log 0xddf252ad, caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require _value <= balanceOf[caller]
  require addr(_to)
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log 0xddf252ad, caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require not stor1.160
  require addr(_to)
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require balanceOf[caller] >= _value
  balanceOf[caller] = balanceOf[caller] - _value
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require _value <= balanceOf[caller].uint256
  require addr(_to)
  require _value <= balanceOf[caller].uint256
  balanceOf[caller].uint256 = balanceOf[caller].uint256 - _value
  require _value + balanceOf[addr(_to)].uint256 >= balanceOf[addr(_to)].uint256
  balanceOf[addr(_to)].uint256 = _value + balanceOf[addr(_to)].uint256
  log 0x69ddf252, caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require not stor3[caller].0.uint8
  if stor5:
      return with bool(0)
  require addr(_to)
  if _value > balanceOf[caller]:
      return with bool(0)
  if _value <= 0 OR (addr(_to) == caller):
      log Transfer(address,address,uint256), caller, addr(_to), _value
      return with bool(1)
  require _value <= balanceOf[caller]
  balanceOf[caller] = balanceOf[caller] - _value
  require _value + balanceOf[addr(_to)] >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] = _value + balanceOf[addr(_to)]
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require allowed[caller] >= _value
  if caller == addr(_to):
      allowed[caller] = allowed[caller] - _value
      allowed[addr(_to)] = allowed[addr(_to)] + _value
      log Transfer(address,address,uint256), caller, addr(_to), _value
      return with bool(1)
  require allowed[addr(_to)] <= -_value - 1
  allowed[caller] = allowed[caller] - _value
  allowed[addr(_to)] = allowed[addr(_to)] + _value
  log Transfer(address,address,uint256), caller, addr(_to), _value
  return with bool(1)


def transfer(address _to, uint256 _value) : # not payable
  require caller == stor1.0.addr
  require _value <= licensesOf[caller].uint256
  require licensesOf[addr(_to)].uint256 + _value >= licensesOf[addr(_to)].uint256
  licensesOf[caller].uint256 = licensesOf[caller].uint256 - _value
  licensesOf[addr(_to)].uint256 = _value + licensesOf[addr(_to)].uint256
  return with bool(1)