ETH Price: $2,064.99 (-4.55%)

Transaction Decoder

Block:
4293367 at Sep-20-2017 03:41:15 AM +UTC
Transaction Fee:
0.00393045600491307 ETH $8.12
Gas Used:
982,614 Gas / 4.000000005 Gwei

Account State Difference:

  Address   Before After State Difference Code
0x00000000...438691c04
0x07480B2b...812f5C896
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x0f6f0864...48Fa8C4c1
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x12Cc3DE0...15A2ABB33
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x176AEA46...E07a7D44E
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x1Abc2D8C...de7659F3d
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x30B666a7...0377ad411
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x41dedD0A...1737Bf8A5
15.08909124686126956 Eth
Nonce: 234
15.08516079085635649 Eth
Nonce: 235
0.00393045600491307
0x4D27bDc5...b3117b562
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x51D8Dd0f...5Aa1B1321
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x6470fbC7...35097e1aE
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x6483078d...50C2FA635
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x6f44a885...F9b41a454
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x76D4Dfcb...9e9DF7B49
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x84d8F9D5...5B4925D01
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x84E0ac94...22D4820bE
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x897Ae294...C15fFa67E
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x8D5AC798...341dd6e1D
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x932651B8...59479e4CD
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0x9b4148Bf...49A3Cea44
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xAA487292...210A963f1
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
(MiningPoolHub: Old Address)
20,104.433664243526240645 Eth20,104.437594699531153715 Eth0.00393045600491307
0xb41E1CCA...4099515b5
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xB9837ACc...a267E0EA8
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xBe99Ea64...F281bF3d8
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xcc7aB0D6...476a976e0
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xCcD2aE36...98aD250dE
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xcd88542b...beFF8C1E8
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551
0xeD0cDAC3...C222fD2aA
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 41418913446122256543177627431469775010672191485719551

Execution Trace

GasToken2.mint( value=26 )
  • 0x30b666a7d334cbf7f37a3803e8e3aa40377ad411.756eb3f8( )
  • 0xb9837acc7c3efd896d8aa7f412340aba267e0ea8.756eb3f8( )
  • 0xaa48729260b6928239e6bf8e939dae6210a963f1.756eb3f8( )
  • 0x8d5ac79859e26115b7b99b09ccd5b5b341dd6e1d.756eb3f8( )
  • 0x6470fbc74c73f553f3ecd1dc0f19a3035097e1ae.756eb3f8( )
  • 0x6483078dfbdc9f9d0241487bd12d61a50c2fa635.756eb3f8( )
  • 0x4d27bdc51a5750a18d68d99f51ecf67b3117b562.756eb3f8( )
  • 0xcc7ab0d62772f7c44f189a90016f003476a976e0.756eb3f8( )
  • 0xb41e1cca0138ba478cd25e4989200c34099515b5.756eb3f8( )
  • 0x07480b2bbb9766f371eed64fea6d382812f5c896.756eb3f8( )
  • 0x1abc2d8c85779645dae93bf6eee694ade7659f3d.756eb3f8( )
  • 0x84d8f9d5075404ceb299f98196752325b4925d01.756eb3f8( )
  • 0x6f44a885bfed5f63f8805072da37734f9b41a454.756eb3f8( )
  • 0x12cc3de0d6b11abcc89a32a8863ff7915a2abb33.756eb3f8( )
  • 0x0f6f0864806aa72ffadf233450652c748fa8c4c1.756eb3f8( )
  • 0x84e0ac94cc81c73e5cafa86ac2193f122d4820be.756eb3f8( )
  • 0xccd2ae364bf02d3be8372dba709fffb98ad250de.756eb3f8( )
  • 0x76d4dfcb5ab9e66eb3dfefbdb2c43cb9e9df7b49.756eb3f8( )
  • 0x9b4148bf09f63b7c8fb704142c4230249a3cea44.756eb3f8( )
  • 0xed0cdac37e6914af11ac8553d0a4768c222fd2aa.756eb3f8( )
  • 0x51d8dd0f8a99ee52682b30e63852c5c5aa1b1321.756eb3f8( )
  • 0x176aea4643ede9f0cc2b4728c1e49a6e07a7d44e.756eb3f8( )
  • 0x897ae2941634d75d9d15dc62ff95f15c15ffa67e.756eb3f8( )
  • 0x932651b85bed85905193c42b3acfad259479e4cd.756eb3f8( )
  • 0xbe99ea64afe4dd49a7bbcda932996abf281bf3d8.756eb3f8( )
  • 0xcd88542bf213858b3faca1d71d94f70beff8c1e8.756eb3f8( )
    pragma solidity ^0.4.10;
    
    contract GasToken2 {
        //////////////////////////////////////////////////////////////////////////
        // RLP.sol
        // Due to some unexplained bug, we get a slightly different bytecode if 
        // we use an import, and are then unable to verify the code in Etherscan
        //////////////////////////////////////////////////////////////////////////
        
        uint256 constant ADDRESS_BYTES = 20;
        uint256 constant MAX_SINGLE_BYTE = 128;
        uint256 constant MAX_NONCE = 256**9 - 1;
    
        // count number of bytes required to represent an unsigned integer
        function count_bytes(uint256 n) constant internal returns (uint256 c) {
            uint i = 0;
            uint mask = 1;
            while (n >= mask) {
                i += 1;
                mask *= 256;
            }
    
            return i;
        }
    
        function mk_contract_address(address a, uint256 n) constant internal returns (address rlp) {
            /*
             * make sure the RLP encoding fits in one word:
             * total_length      1 byte
             * address_length    1 byte
             * address          20 bytes
             * nonce_length      1 byte (or 0)
             * nonce           1-9 bytes
             *                ==========
             *                24-32 bytes
             */
            require(n <= MAX_NONCE);
    
            // number of bytes required to write down the nonce
            uint256 nonce_bytes;
            // length in bytes of the RLP encoding of the nonce
            uint256 nonce_rlp_len;
    
            if (0 < n && n < MAX_SINGLE_BYTE) {
                // nonce fits in a single byte
                // RLP(nonce) = nonce
                nonce_bytes = 1;
                nonce_rlp_len = 1;
            } else {
                // RLP(nonce) = [num_bytes_in_nonce nonce]
                nonce_bytes = count_bytes(n);
                nonce_rlp_len = nonce_bytes + 1;
            }
    
            // [address_length(1) address(20) nonce_length(0 or 1) nonce(1-9)]
            uint256 tot_bytes = 1 + ADDRESS_BYTES + nonce_rlp_len;
    
            // concatenate all parts of the RLP encoding in the leading bytes of
            // one 32-byte word
            uint256 word = ((192 + tot_bytes) * 256**31) +
                           ((128 + ADDRESS_BYTES) * 256**30) +
                           (uint256(a) * 256**10);
    
            if (0 < n && n < MAX_SINGLE_BYTE) {
                word += n * 256**9;
            } else {
                word += (128 + nonce_bytes) * 256**9;
                word += n * 256**(9 - nonce_bytes);
            }
    
            uint256 hash;
    
            assembly {
                let mem_start := mload(0x40)        // get a pointer to free memory
                mstore(0x40, add(mem_start, 0x20))  // update the pointer
    
                mstore(mem_start, word)             // store the rlp encoding
                hash := sha3(mem_start,
                             add(tot_bytes, 1))     // hash the rlp encoding
            }
    
            // interpret hash as address (20 least significant bytes)
            return address(hash);
        }
        
        //////////////////////////////////////////////////////////////////////////
        // Generic ERC20
        //////////////////////////////////////////////////////////////////////////
    
        // owner -> amount
        mapping(address => uint256) s_balances;
        // owner -> spender -> max amount
        mapping(address => mapping(address => uint256)) s_allowances;
    
        event Transfer(address indexed from, address indexed to, uint256 value);
    
        event Approval(address indexed owner, address indexed spender, uint256 value);
    
        // Spec: Get the account balance of another account with address `owner`
        function balanceOf(address owner) public constant returns (uint256 balance) {
            return s_balances[owner];
        }
    
        function internalTransfer(address from, address to, uint256 value) internal returns (bool success) {
            if (value <= s_balances[from]) {
                s_balances[from] -= value;
                s_balances[to] += value;
                Transfer(from, to, value);
                return true;
            } else {
                return false;
            }
        }
    
        // Spec: Send `value` amount of tokens to address `to`
        function transfer(address to, uint256 value) public returns (bool success) {
            address from = msg.sender;
            return internalTransfer(from, to, value);
        }
    
        // Spec: Send `value` amount of tokens from address `from` to address `to`
        function transferFrom(address from, address to, uint256 value) public returns (bool success) {
            address spender = msg.sender;
            if(value <= s_allowances[from][spender] && internalTransfer(from, to, value)) {
                s_allowances[from][spender] -= value;
                return true;
            } else {
                return false;
            }
        }
    
        // Spec: Allow `spender` to withdraw from your account, multiple times, up
        // to the `value` amount. If this function is called again it overwrites the
        // current allowance with `value`.
        function approve(address spender, uint256 value) public returns (bool success) {
            address owner = msg.sender;
            if (value != 0 && s_allowances[owner][spender] != 0) {
                return false;
            }
            s_allowances[owner][spender] = value;
            Approval(owner, spender, value);
            return true;
        }
    
        // Spec: Returns the `amount` which `spender` is still allowed to withdraw
        // from `owner`.
        // What if the allowance is higher than the balance of the `owner`?
        // Callers should be careful to use min(allowance, balanceOf) to make sure
        // that the allowance is actually present in the account!
        function allowance(address owner, address spender) public constant returns (uint256 remaining) {
            return s_allowances[owner][spender];
        }
    
        //////////////////////////////////////////////////////////////////////////
        // GasToken specifics
        //////////////////////////////////////////////////////////////////////////
    
        uint8 constant public decimals = 2;
        string constant public name = "Gastoken.io";
        string constant public symbol = "GST2";
    
        // We build a queue of nonces at which child contracts are stored. s_head is
        // the nonce at the head of the queue, s_tail is the nonce behind the tail
        // of the queue. The queue grows at the head and shrinks from the tail.
        // Note that when and only when a contract CREATEs another contract, the
        // creating contract's nonce is incremented.
        // The first child contract is created with nonce == 1, the second child
        // contract is created with nonce == 2, and so on...
        // For example, if there are child contracts at nonces [2,3,4],
        // then s_head == 4 and s_tail == 1. If there are no child contracts,
        // s_head == s_tail.
        uint256 s_head;
        uint256 s_tail;
    
        // totalSupply gives  the number of tokens currently in existence
        // Each token corresponds to one child contract that can be SELFDESTRUCTed
        // for a gas refund.
        function totalSupply() public constant returns (uint256 supply) {
            return s_head - s_tail;
        }
    
        // Creates a child contract that can only be destroyed by this contract.
        function makeChild() internal returns (address addr) {
            assembly {
                // EVM assembler of runtime portion of child contract:
                //     ;; Pseudocode: if (msg.sender != 0x0000000000b3f879cb30fe243b4dfee438691c04) { throw; }
                //     ;;             suicide(msg.sender)
                //     PUSH15 0xb3f879cb30fe243b4dfee438691c04 ;; hardcoded address of this contract
                //     CALLER
                //     XOR
                //     PC
                //     JUMPI
                //     CALLER
                //     SELFDESTRUCT
                // Or in binary: 6eb3f879cb30fe243b4dfee438691c043318585733ff
                // Since the binary is so short (22 bytes), we can get away
                // with a very simple initcode:
                //     PUSH22 0x6eb3f879cb30fe243b4dfee438691c043318585733ff
                //     PUSH1 0
                //     MSTORE ;; at this point, memory locations mem[10] through
                //            ;; mem[31] contain the runtime portion of the child
                //            ;; contract. all that's left to do is to RETURN this
                //            ;; chunk of memory.
                //     PUSH1 22 ;; length
                //     PUSH1 10 ;; offset
                //     RETURN
                // Or in binary: 756eb3f879cb30fe243b4dfee438691c043318585733ff6000526016600af3
                // Almost done! All we have to do is put this short (31 bytes) blob into
                // memory and call CREATE with the appropriate offsets.
                let solidity_free_mem_ptr := mload(0x40)
                mstore(solidity_free_mem_ptr, 0x00756eb3f879cb30fe243b4dfee438691c043318585733ff6000526016600af3)
                addr := create(0, add(solidity_free_mem_ptr, 1), 31)
            }
        }
    
        // Mints `value` new sub-tokens (e.g. cents, pennies, ...) by creating `value`
        // new child contracts. The minted tokens are owned by the caller of this
        // function.
        function mint(uint256 value) public {
            for (uint256 i = 0; i < value; i++) {
                makeChild();
            }
            s_head += value;
            s_balances[msg.sender] += value;
        }
    
        // Destroys `value` child contracts and updates s_tail.
        //
        // This function is affected by an issue in solc: https://github.com/ethereum/solidity/issues/2999
        // The `mk_contract_address(this, i).call();` doesn't forward all available gas, but only GAS - 25710.
        // As a result, when this line is executed with e.g. 30000 gas, the callee will have less than 5000 gas
        // available and its SELFDESTRUCT operation will fail leading to no gas refund occurring.
        // The remaining ~29000 gas left after the call is enough to update s_tail and the caller's balance.
        // Hence tokens will have been destroyed without a commensurate gas refund.
        // Fortunately, there is a simple workaround:
        // Whenever you call free, freeUpTo, freeFrom, or freeUpToFrom, ensure that you pass at least
        // 25710 + `value` * (1148 + 5722 + 150) gas. (It won't all be used)
        function destroyChildren(uint256 value) internal {
            uint256 tail = s_tail;
            // tail points to slot behind the last contract in the queue
            for (uint256 i = tail + 1; i <= tail + value; i++) {
                mk_contract_address(this, i).call();
            }
    
            s_tail = tail + value;
        }
    
        // Frees `value` sub-tokens (e.g. cents, pennies, ...) belonging to the
        // caller of this function by destroying `value` child contracts, which
        // will trigger a partial gas refund.
        // You should ensure that you pass at least 25710 + `value` * (1148 + 5722 + 150) gas
        // when calling this function. For details, see the comment above `destroyChilden`.
        function free(uint256 value) public returns (bool success) {
            uint256 from_balance = s_balances[msg.sender];
            if (value > from_balance) {
                return false;
            }
    
            destroyChildren(value);
    
            s_balances[msg.sender] = from_balance - value;
    
            return true;
        }
    
        // Frees up to `value` sub-tokens. Returns how many tokens were freed.
        // Otherwise, identical to free.
        // You should ensure that you pass at least 25710 + `value` * (1148 + 5722 + 150) gas
        // when calling this function. For details, see the comment above `destroyChilden`.
        function freeUpTo(uint256 value) public returns (uint256 freed) {
            uint256 from_balance = s_balances[msg.sender];
            if (value > from_balance) {
                value = from_balance;
            }
    
            destroyChildren(value);
    
            s_balances[msg.sender] = from_balance - value;
    
            return value;
        }
    
        // Frees `value` sub-tokens owned by address `from`. Requires that `msg.sender`
        // has been approved by `from`.
        // You should ensure that you pass at least 25710 + `value` * (1148 + 5722 + 150) gas
        // when calling this function. For details, see the comment above `destroyChilden`.
        function freeFrom(address from, uint256 value) public returns (bool success) {
            address spender = msg.sender;
            uint256 from_balance = s_balances[from];
            if (value > from_balance) {
                return false;
            }
    
            mapping(address => uint256) from_allowances = s_allowances[from];
            uint256 spender_allowance = from_allowances[spender];
            if (value > spender_allowance) {
                return false;
            }
    
            destroyChildren(value);
    
            s_balances[from] = from_balance - value;
            from_allowances[spender] = spender_allowance - value;
    
            return true;
        }
    
        // Frees up to `value` sub-tokens owned by address `from`. Returns how many tokens were freed.
        // Otherwise, identical to `freeFrom`.
        // You should ensure that you pass at least 25710 + `value` * (1148 + 5722 + 150) gas
        // when calling this function. For details, see the comment above `destroyChilden`.
        function freeFromUpTo(address from, uint256 value) public returns (uint256 freed) {
            address spender = msg.sender;
            uint256 from_balance = s_balances[from];
            if (value > from_balance) {
                value = from_balance;
            }
    
            mapping(address => uint256) from_allowances = s_allowances[from];
            uint256 spender_allowance = from_allowances[spender];
            if (value > spender_allowance) {
                value = spender_allowance;
            }
    
            destroyChildren(value);
    
            s_balances[from] = from_balance - value;
            from_allowances[spender] = spender_allowance - value;
    
            return value;
        }
    }