Tutorial About Api




#
#  Eveem.org 26 Apr 2019 
#  Decompiled source of 0xb2EDc59fC6108884b7BdE8D623887BAdF031Fc4b
# 
#  Let's make the world open source 
# 

const name = 'Mobile switching'
const decimals = 4
const symbol = 'MBSC'

def storage:
  stor1 is addr at storage 1
  balanceOf is mapping of uint256 at storage 2
  allowance is mapping of uint256 at storage 3
  stor4 is mapping of uint8 at storage 4
  totalSupply is uint256 at storage 5
  totalDistributed is uint256 at storage 6
  totalRemaining is uint256 at storage 7
  value is uint256 at storage 8
  distributionFinished is uint8 at storage 9

def totalSupply(): # not payable
  return totalSupply

def value(): # not payable
  return value

def balanceOf(address _owner): # not payable
  return balanceOf[addr(_owner)]

def distributionFinished(): # not payable
  return bool(distributionFinished)

def totalRemaining(): # not payable
  return totalRemaining

def allowance(address _owner, address _spender): # not payable
  return allowance[addr(_owner)][addr(_spender)]

def totalDistributed(): # not payable
  return totalDistributed

def blacklist(address _param1): # not payable
  return bool(stor4[_param1])


#
#  Regular functions
#


def unknownc868d5ac(): # not payable
  stor1 = caller
  balanceOf[stor1] = totalDistributed


def transferOwnership(address _newOwner): # not payable
  require caller == stor1
  if _newOwner:
      stor1 = _newOwner


def finishDistribution(): # not payable
  require caller == stor1
  require not distributionFinished
  distributionFinished = 1
  log DistrFinished()
  return 1


def withdraw(): # not payable
  require caller == stor1
  call stor1 with:
     value eth.balance(this.address) wei
       gas 2300 * is_zero(value) wei
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]


def getTokenBalance(address _tokenAddress, address _who): # not payable
  require ext_code.size(_tokenAddress)
  call _tokenAddress.balanceOf(address owner) with:
       gas gas_remaining wei
      args _who
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]
  require return_data.size >= 32
  return ext_call.return_data[0]


def approve(address _spender, uint256 _value): # not payable
  if _value:
      if allowance[caller][addr(_spender)]:
          return 0
  allowance[caller][addr(_spender)] = _value
  log Approval(
        address owner=_value,
        address spender=caller,
        uint256 value=_spender)
  return 1


def burn(uint256 _value): # not payable
  require caller == stor1
  require _value <= balanceOf[caller]
  require _value <= balanceOf[caller]
  balanceOf[caller] -= _value
  require _value <= totalSupply
  totalSupply -= _value
  require _value <= totalDistributed
  totalDistributed -= _value
  log Burn(
        address from=_value,
        uint256 value=caller)


def transfer(address _to, uint256 _value): # not payable
  require calldata.size >= 68
  require _to
  require _value <= balanceOf[caller]
  require _value <= balanceOf[caller]
  balanceOf[caller] -= _value
  require balanceOf[addr(_to)] + _value >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] += _value
  log Transfer(
        address from=_value,
        address to=caller,
        uint256 value=_to)
  return 1


def withdrawForeignTokens(address _tokenContract): # not payable
  require caller == stor1
  require ext_code.size(_tokenContract)
  call _tokenContract.balanceOf(address owner) with:
       gas gas_remaining wei
      args this.address
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]
  require return_data.size >= 32
  require ext_code.size(_tokenContract)
  call _tokenContract.transfer(address to, uint256 value) with:
       gas gas_remaining wei
      args stor1, ext_call.return_data[0]
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]
  require return_data.size >= 32
  return bool(ext_call.return_data[0])


def getTokens() payable: 
  require not distributionFinished
  require not stor4[caller]
  if value > totalRemaining:
      value = totalRemaining
      revert
  require not distributionFinished
  require totalDistributed + value >= totalDistributed
  totalDistributed += value
  require value <= totalRemaining
  totalRemaining -= value
  require balanceOf[caller] + value >= balanceOf[caller]
  balanceOf[caller] += value
  log Distr(
        address to=value,
        uint256 amount=caller)
  log Transfer(
        address from=value,
        address to=0,
        uint256 value=caller)
  if value > 0:
      stor4[caller] = 1
  if totalDistributed >= totalSupply:
      distributionFinished = 1
  require 500 <= value
  value -= 500


def _fallback() payable: # default function
  require not distributionFinished
  require not stor4[caller]
  if value > totalRemaining:
      value = totalRemaining
      revert
  require not distributionFinished
  require totalDistributed + value >= totalDistributed
  totalDistributed += value
  require value <= totalRemaining
  totalRemaining -= value
  require balanceOf[caller] + value >= balanceOf[caller]
  balanceOf[caller] += value
  log Distr(
        address to=value,
        uint256 amount=caller)
  log Transfer(
        address from=value,
        address to=0,
        uint256 value=caller)
  if value > 0:
      stor4[caller] = 1
  if totalDistributed >= totalSupply:
      distributionFinished = 1
  require 500 <= value
  value -= 500


def transferFrom(address _from, address _to, uint256 _value): # not payable
  require calldata.size >= 100
  require _to
  require _value <= balanceOf[addr(_from)]
  require _value <= allowance[addr(_from)][caller]
  require _value <= balanceOf[addr(_from)]
  balanceOf[addr(_from)] -= _value
  require _value <= allowance[addr(_from)][caller]
  allowance[addr(_from)][caller] -= _value
  require balanceOf[addr(_to)] + _value >= balanceOf[addr(_to)]
  balanceOf[addr(_to)] += _value
  log Transfer(
        address from=_value,
        address to=_from,
        uint256 value=_to)
  return 1