ETH Price: $1,608.63 (+0.78%)

Transaction Decoder

Block:
3559932 at Apr-18-2017 11:11:15 PM +UTC
Transaction Fee:
0.01760548 ETH $28.32
Gas Used:
880,274 Gas / 20 Gwei

Account State Difference:

  Address   Before After State Difference Code
(DwarfPool)
8,736.880678610357797608 Eth8,736.898284090357797608 Eth0.01760548
0xcb657C0D...018b8DCCa
7 Eth
Nonce: 0
6.98239452 Eth
Nonce: 1
0.01760548
0xCb94be6f...25d28e41B
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 720097578080419412039622046103768062874457693333045606106729409948505634053955655542785159255974669613315143095966811355118464955748787150811890537544456670141375609471486566607738452710364697163617481969394024913267298198779893867811240471250425610970722479819723672019615457521079544632836207154672832155125650008906529460769724006112622018570493942994061904001323115807810527978591742493523282321180743178418078102878635150439308717667651858731138583232909307461931414716039571768198979492953151943313414103824110121656236437011857085066866947705051367604693044292439067799931089793377410528184260065558717381468224067621894373442730551996648529321942739955273369721173258115847233880334617348242950138846961322742259320428774530480770341839495185637020229426281450736430277928096918243846903490585825164548891065247028986552453061479426384702568676326770662731160801367406624772983388956540542864299893328156190103860950851313186637899149907117697231659788340476349391808777513469509133570936691114346744702679597997594646683588210086896107156702694705894279812563911887658952291224553832704896963488385830167170439959596394793354236857610389599848152426479126102940194398254205761855418861776321955620691517356246843012240645522728377637451246530254418426474600748887637151248088004176100628302232061610417449780524151133704931028751786329417575390804131626112760860473505024004016126632197460439102965434570819741103003531628951984368526938237940983916002984104323467586423101162298467444683365301601631680243832601453707328788131060271617292842640372559493054696123326404362594133775131251529309895597582901011235943350936999066135026798057775873542051736538181363784540227427183541512010728975303401995586781313615637412966303135787395987582090377873173096618968503084005815627212338183983364153941541667871007326799583034176905970631493096788717540892761953095577609132467446380457921705264683838941547240768900889031539846950579571182872742295195370400881361165966227708736721767073530264447617840684652368477031076853235851024258575382184264199535025440540270789964569226125031313606911282360814304165088353748198026578433327365373881780684808868211050951215443852512802207253186427266041747728910481382008830555196318526964498164724396389775677541095754234726716058501478703175730138242249321086487560840004612017379997093960714069679423405443227006146088607783671214032677744037302053192127208359888976434089058052092347640717766302764455858598179370188196134209807763799768291476996178603325990738302875070993313524274664606457129451155522569956244173681118331178821797913798361573460599659435478741337642695821000165143347808290573105952809147897051440903528832021884095385624961687627955967593614531192349483184804301623825314388200192754572733728638013302275065805549117123808008934103028776737082923382980577737306395248047228378367036036188467353750530454208550476178446662294166240826515788165531827623318724877463832328070750284161056096590701699232858501042545652847114937855746962172160004748017707489677909879658291714744027661191362020685988871925904094710054430924529202642192129248009609444142599613033102856839651105728217096784878531699205116407196096919081688250804804423323892170459011589051554525404472316423347702730339292901503742904711671041894805990887304202295124609035861511071406579508157829635605475660191260848243924138704397533245245781100694095546524333518706861101705039470381826504290207908403511140280255845725012806939526722837335648797803367067341586549754880614319031648344976551181154209844013206007384125160479946614158486782309122638029753434572372134058757315697695231727347770505110067468190276405894234185613102736302475915395760833368039558405885335504561402548763815308111130537496235983056913685509643377238285162657519047925329463002532539233865212806608897254479399575245399590177174116977361147287261216874198954313571435108226526906422985942384449468777951424143860583981471784640400270830266347773462654646676132855276290483259871525360060593281992418225535281160959315688424009980161130620042591533729482245328076696525866350488492458950936146686237572300657026861154085909529375043161456496354449373502579579232126539152798001483276823806286281634112927053077170232477079181043275332374714099232992276809579912977029803468620001799559986682132577995810527777214630368042957377140498728601330851365319119968908695178387619360647160382367674004886600111543613223695153185095099765321639341102532794441456126597602576348394410598933566648514423998755236196787210909978180515424132954733706296675210571687845547804444242600861074237228663766184464150682196662686350415149770648096706096978792653997943668362618288400482660480238090551178835668696513947311566926641042027845574978714058308478635353155636575268545712991370428073752940808187737155130541235263364150137276402727896746062388182567708898656329963833628074714481408880626930704154318842798215803231359794708758073622209367189795177734226841434898684889536277104154292801544575688085188482100566816986276143377684609006164772675787267009708508369696784710606104704471339122512306073357619311115177190494512866527813565308461793916700805081433420115665052758456307740947291132671563074249327818422680287223231727398319071897760512266738004665923082480466976980008400968318037716074242399020945862923229652328782088990544404404870034235936803011232536679745473617705281709626985594901057106737191170248860897582702312097184467882142574406250146287059655363300555833261480260774551810182456255813923889028447654891417578664008504291174348406786407451118923210439278474091813090317336912356836607323194061224211237637985133265290005916495526081060488131778934532992695606377939210182380846558976077989024790555079170730727239649202906079907121151340260296866116695884627535674928238028622833977160941695475691152457676326155713686964278584343037078309479493235263678077474111259737680697852283505752041843367369358050997035651239700415591320437595579921144894363815468532512583359102109090737694755076787372930719863342135632955385340469444435534347869912549768077732002987975684858847661149145095131204501875117524622340725170356614199058003822019918427392545421367431302996196946806840072461439968991501332585105816619185426439310741998485448984163864729593900866724239715365756511027235724903281126600720120434006899784273518131262660959211503630258443287470555827897648464167822694171961152820996185965082465287893741495250266598414184538016561475995425818603420775862659460445116286589415251563055882888722666954141974244484394252442666452807612316034778097650420233044944791902414791852162626132415062696608338465593835903312988771087989974894402855996361165955397850206653360393702682858824082388754687579749912636198578362089150844229612255205389463697235047456723991698163638960982451878719135551572211078707193763373342791603836104078970257689571886209024625964660307349366881059350559280136233

Execution Trace

Trustcoin.60806040( )
/**
 *  TRST Trustcoin contract, ERC20 compliant (see https://github.com/ethereum/EIPs/issues/20)
 *
 *  Code is based on multiple sources:
 *  https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20.sol
 *  https://github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/StandardToken.sol
 *  https://github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/HumanStandardToken.sol
 */

// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20

// Based on https://github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/Token.sol
pragma solidity 0.4.8;

contract ERC20TokenInterface {

    /// @return The total amount of tokens
    function totalSupply() constant returns (uint256 supply);

    /// @param _owner The address from which the balance will be retrieved
    /// @return The balance
    function balanceOf(address _owner) constant public returns (uint256 balance);

    /// @notice send `_value` token to `_to` from `msg.sender`
    /// @param _to The address of the recipient
    /// @param _value The amount of token to be transferred
    /// @return Whether the transfer was successful or not
    function transfer(address _to, uint256 _value) public returns (bool success);

    /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
    /// @param _from The address of the sender
    /// @param _to The address of the recipient
    /// @param _value The amount of token to be transferred
    /// @return Whether the transfer was successful or not
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);

    /// @notice `msg.sender` approves `_spender` to spend `_value` tokens
    /// @param _spender The address of the account able to transfer the tokens
    /// @param _value The amount of tokens to be approved for transfer
    /// @return Whether the approval was successful or not
    function approve(address _spender, uint256 _value) public returns (bool success);

    /// @param _owner The address of the account owning tokens
    /// @param _spender The address of the account able to transfer the tokens
    /// @return Amount of remaining tokens allowed to spent
    function allowance(address _owner, address _spender) constant public returns (uint256 remaining);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract Trustcoin is ERC20TokenInterface {

  //// Constants ////
  string public constant name = 'Trustcoin';
  uint256 public constant decimals = 6;
  string public constant symbol = 'TRST';
  string public constant version = 'TRST1.0';

  // One hundred million coins, each divided to up to 10^decimals units.
  uint256 private constant totalTokens = 100000000 * (10 ** decimals);

  mapping (address => uint256) public balances; // (ERC20)
  // A mapping from an account owner to a map from approved spender to their allowances.
  // (see ERC20 for details about allowances).
  mapping (address => mapping (address => uint256)) public allowed; // (ERC20)

  //// Events ////
  event MigrationInfoSet(string newMigrationInfo);

  // This is to be used when migration to a new contract starts.
  // This string can be used for any authorative information re the migration
  // (e.g. address to use for migration, or URL to explain where to find more info)
  string public migrationInfo = "";

  // The only address that can set migrationContractAddress, a secure multisig.
  address public migrationInfoSetter;

  //// Modifiers ////
  modifier onlyFromMigrationInfoSetter {
    if (msg.sender != migrationInfoSetter) {
      throw;
    }
    _;
  }

  //// Public functions ////
  function Trustcoin(address _migrationInfoSetter) {
    if (_migrationInfoSetter == 0) throw;
    migrationInfoSetter = _migrationInfoSetter;
    // Upon creation, all tokens belong to the deployer.
    balances[msg.sender] = totalTokens;
  }

  // See ERC20
  function totalSupply() constant returns (uint256) {
    return totalTokens;
  }

  // See ERC20
  // WARNING: If you call this with the address of a contract, the contract will receive the
  // funds, but will have no idea where they came from. Furthermore, if the contract is
  // not aware of TRST, the tokens will remain locked away in the contract forever.
  // It is always recommended to call instead compareAndApprove() (or approve()) and have the
  // receiving contract withdraw the money using transferFrom().
  function transfer(address _to, uint256 _value) public returns (bool) {
    if (balances[msg.sender] >= _value) {
      balances[msg.sender] -= _value;
      balances[_to] += _value;
      Transfer(msg.sender, _to, _value);
      return true;
    }
    return false;
  }

  // See ERC20
  function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
    if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value) {
      balances[_from] -= _value;
      allowed[_from][msg.sender] -= _value;
      balances[_to] += _value;
      Transfer(_from, _to, _value);
      return true;
    }
    return false;
  }

  // See ERC20
  function balanceOf(address _owner) constant public returns (uint256) {
    return balances[_owner];
  }

  // See ERC20
  // NOTE: this method is vulnerable and is placed here only to follow the ERC20 standard.
  // Before using, please take a look at the better compareAndApprove below.
  function approve(address _spender, uint256 _value) public returns (bool) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
  }

  // A vulernability of the approve method in the ERC20 standard was identified by
  // Mikhail Vladimirov and Dmitry Khovratovich here:
  // https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM
  // It's better to use this method which is not susceptible to over-withdrawing by the approvee.
  /// @param _spender The address to approve
  /// @param _currentValue The previous value approved, which can be retrieved with allowance(msg.sender, _spender)
  /// @param _newValue The new value to approve, this will replace the _currentValue
  /// @return bool Whether the approval was a success (see ERC20's `approve`)
  function compareAndApprove(address _spender, uint256 _currentValue, uint256 _newValue) public returns(bool) {
    if (allowed[msg.sender][_spender] != _currentValue) {
      return false;
    }
    return approve(_spender, _newValue);
  }

  // See ERC20
  function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
    return allowed[_owner][_spender];
  }

  // Allows setting a descriptive string, which will aid any users in migrating their token
  // to a newer version of the contract. This field provides a kind of 'double-layer' of
  // authentication for any migration announcement, as it can only be set by WeTrust.
  /// @param _migrationInfo The information string to be stored on the contract
  function setMigrationInfo(string _migrationInfo) onlyFromMigrationInfoSetter public {
    migrationInfo = _migrationInfo;
    MigrationInfoSet(_migrationInfo);
  }

  // To be used if the migrationInfoSetter wishes to transfer the migrationInfoSetter
  // permission to a new account, e.g. because of change in personnel, a concern that account
  // may have been compromised etc.
  /// @param _newMigrationInfoSetter The address of the new Migration Info Setter
  function changeMigrationInfoSetter(address _newMigrationInfoSetter) onlyFromMigrationInfoSetter public {
    migrationInfoSetter = _newMigrationInfoSetter;
  }
}