Latest 2 txns

TxHash Age From To Value [TxFee]
0x22efdf2939cf2f2186bbd5a4bc31c2134218ece177fcb3cc432570f690a1e44326 days 22 hrs ago0x9ba6d6e6c071bf863e091ac7a1fcc6b7774ebff6  IN   0xdfcf3ef8daef5aa61a80c724cc0e59356bba6d750 Ether0.00089196
0xa2bd3c34302348f843e977ddd2a741ba6646d4574b9024ce15bf91475a8cfc3626 days 22 hrs ago0x9ba6d6e6c071bf863e091ac7a1fcc6b7774ebff6  IN    Contract Creation0 Ether0.02177828


[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Contract Source Code Verified (Exact Match)
Contract Name: Logistics
Compiler Text: v0.4.25+commit.59dbf8f1
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

/**
  Copyright (c) 2018, ZSC Dev Team
  2018-10-19: v0.00.01
 */

pragma solidity ^0.4.25;

contract LogisticsCore {
    function getParcel(string _num) external view returns (string, string, string, string, string);
    function getParcelEx(string _num) external view returns (string);
}

contract Delegate {
    uint sum_;
    mapping (uint => address) private addrs_;
    /** @desc prioritie map.
      * == 0: invalid
      * == 1: ownable
      * >= 2: define by user
      */
    mapping (uint => uint) private prios_;
    mapping (address => uint) private ids_;
    mapping (address => bool) private exists_;

    constructor() public {
        addrs_[0] = msg.sender;
        prios_[0] = 1;
        ids_[msg.sender] = 0;
        exists_[msg.sender] = true;
        sum_ = 1;
    }

    modifier _onlyOwner() {
        require(exists_[msg.sender]);
        require(0 == ids_[msg.sender]);
        require(addrs_[0] == msg.sender);
        require(1 == prios_[0]);
        _;
    }

    function _update(address _addr, uint _prio) private {
        uint id;
        if (exists_[_addr]) {
            id = ids_[_addr];
            // addrs_[id] = _addr;
            prios_[id] = _prio;
        } else {
            id = sum_;
            exists_[_addr] = true;
            ids_[_addr] = id;
            addrs_[id] = _addr;
            prios_[id] = _prio;
            sum_ ++;
        }
    }

    function _swap(address _addr1, uint _id2) private {
        uint prio1 = 0;
        uint id1 = 0;
        address addr2 = 0;
        uint prio2 = 0;

        addr2 = addrs_[_id2];
        prio2 = prios_[_id2];
        // _id2;

        // _addr1
        id1 = ids_[_addr1];
        prio1 = prios_[id1];

        addrs_[id1] = addr2;
        prios_[id1] = prio2;
        ids_[addr2] = id1;

        addrs_[_id2] = _addr1;
        prios_[_id2] = prio1;
        ids_[_addr1] = _id2;
    }

    function checkDelegate(address _addr, uint _prio) public view returns (bool)  {
        if (_addr == address(this)) return true;
        if (0 == _prio) return false;
        if (!exists_[_addr]) return false;

        uint id = ids_[_addr];
        return (prios_[id] != 0 && prios_[id] <= _prio);
    }

    // This unnamed function is called whenever someone tries to send ether to it
    function() external payable { revert(); }

    function kill() external _onlyOwner {
        selfdestruct(addrs_[0]);   
    }

    function transferOwnership(address _newOwner, uint _degradePrio) external _onlyOwner {
        require(0 != _newOwner);
        require(addrs_[0] != _newOwner);
        require(1 < _degradePrio);

        // upgrade new owner
        _update(_newOwner, 1);

        // _swap old owner and new owner
        uint newOwnerId = ids_[_newOwner];
        address owner = addrs_[0];
        _swap(_newOwner, 0);
        require(0 == ids_[_newOwner]);
        require(newOwnerId == ids_[owner]);

        // degrade old owner
        prios_[ids_[owner]] = _degradePrio;
    }

    function updateDelegate(address _addr, uint _prio) external _onlyOwner {
        if (address(this) == _addr) return;

        // owner's priority can't be changed
        require(addrs_[0] != _addr);

        // invalid priority and owner's priority can't be set
        require(1 < _prio);

        _update(_addr, _prio);
    }

    function removeDelegate(address _addr) external _onlyOwner {
        if (address(this) == _addr) return;

        // owner's priority can't be remove
        require(addrs_[0] != _addr);

        require(0 < sum_);
        require(exists_[_addr]);

        uint id1 = ids_[_addr];
        address addr2 = addrs_[sum_-1];
        _swap(_addr, sum_-1);
        require((sum_-1) == ids_[_addr]);
        require(id1 == ids_[addr2]);

        delete addrs_[sum_-1];
        delete prios_[sum_-1];
        delete ids_[_addr];

        sum_ --;

        exists_[_addr] = false;
    }

    function numberOfDelegates() external view returns (uint) {
        return sum_;
    }

    function getDelegateById(uint _id) external view returns (address, uint) {
        require(_id < sum_);
        require(exists_[addrs_[_id]]);
        require(ids_[addrs_[_id]] == _id);
        return (addrs_[_id], prios_[_id]);
    }
}

contract Logistics is Delegate {

    /** @desc core address */
    address private coreAddr_; 

    // Constructor
    constructor() public {
        coreAddr_ = 0;
    }

    modifier _checkCoreAddr() {
        require(0 != coreAddr_);
        _;
    }

    function setup(address _coreAddr) external _onlyOwner {
        // check core address
        require(0 != _coreAddr);
        coreAddr_ = _coreAddr;
    }

    function getLogisticsInfo(string _num) external view _checkCoreAddr returns (string) {
        // check param
        if (0 == bytes(_num).length) {
            return "";
        }

        return LogisticsCore(coreAddr_).getParcelEx(_num);
    }
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_newOwner","type":"address"},{"name":"_degradePrio","type":"uint256"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_num","type":"string"}],"name":"getLogisticsInfo","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"},{"name":"_prio","type":"uint256"}],"name":"checkDelegate","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_coreAddr","type":"address"}],"name":"setup","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"}],"name":"removeDelegate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"numberOfDelegates","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"getDelegateById","outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_prio","type":"uint256"}],"name":"updateDelegate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b507fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb498054600160a060020a03199081163390811790925560017fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b819055600092835260036020908152604080852085905560049091528320805460ff191682179055909155600580549091169055610dd2806100ad6000396000f3006080604052600436106100985763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a276680811461009d5780633a8ed76c146100c357806341c0e1b51461015857806354b664501461016d57806366d38203146101a557806367e7646f146101c6578063b04d2e9b146101e7578063c560fe4a1461020e578063d25117d814610249575b600080fd5b3480156100a957600080fd5b506100c1600160a060020a036004351660243561026d565b005b3480156100cf57600080fd5b506100e3600480356024810191013561040f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561011d578181015183820152602001610105565b50505050905090810190601f16801561014a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016457600080fd5b506100c1610554565b34801561017957600080fd5b50610191600160a060020a0360043516602435610602565b604080519115158252519081900360200190f35b3480156101b157600080fd5b506100c1600160a060020a03600435166106a9565b3480156101d257600080fd5b506100c1600160a060020a0360043516610777565b3480156101f357600080fd5b506101fc610982565b60408051918252519081900360200190f35b34801561021a57600080fd5b50610226600435610988565b60408051600160a060020a03909316835260208301919091528051918290030190f35b34801561025557600080fd5b506100c1600160a060020a0360043516602435610a27565b33600090815260046020526040812054819060ff16151561028d57600080fd5b33600090815260036020526040902054156102a757600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a031633146102d457600080fd5b600080526002602052600080516020610d87833981519152546001146102f957600080fd5b600160a060020a038416151561030e57600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a038581169116141561033f57600080fd5b6001831161034c57600080fd5b610357846001610b13565b5050600160a060020a0380831660009081526003602090815260408220548280526001909152600080516020610d67833981519152549092169061039c908590610bd7565b600160a060020a038416600090815260036020526040902054156103bf57600080fd5b600160a060020a03811660009081526003602052604090205482146103e357600080fd5b600160a060020a0316600090815260036020908152604080832054835260029091529020919091555050565b600554606090600160a060020a0316151561042957600080fd5b811515610445575060408051602081019091526000815261054e565b6005546040517fba7a067000000000000000000000000000000000000000000000000000000000815260206004820190815260248201859052600160a060020a039092169163ba7a06709186918691819060440184848082843782019150509350505050600060405180830381600087803b1580156104c357600080fd5b505af11580156104d7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561050057600080fd5b81019080805164010000000081111561051857600080fd5b8201602081018481111561052b57600080fd5b815164010000000081118282018710171561054557600080fd5b50909450505050505b92915050565b3360009081526004602052604090205460ff16151561057257600080fd5b336000908152600360205260409020541561058c57600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a031633146105b957600080fd5b600080526002602052600080516020610d87833981519152546001146105de57600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a0316ff5b600080600160a060020a03841630141561061f57600191506106a2565b82151561062f57600091506106a2565b600160a060020a03841660009081526004602052604090205460ff16151561065a57600091506106a2565b50600160a060020a0383166000908152600360209081526040808320548084526002909252909120541580159061069f57506000818152600260205260409020548310155b91505b5092915050565b3360009081526004602052604090205460ff1615156106c757600080fd5b33600090815260036020526040902054156106e157600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a0316331461070e57600080fd5b600080526002602052600080516020610d878339815191525460011461073357600080fd5b600160a060020a038116151561074857600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b33600090815260046020526040812054819060ff16151561079757600080fd5b33600090815260036020526040902054156107b157600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a031633146107de57600080fd5b600080526002602052600080516020610d878339815191525460011461080357600080fd5b30600160a060020a03841614156108195761097d565b600080526001602052600080516020610d6783398151915254600160a060020a038481169116141561084a57600080fd5b600080541161085857600080fd5b600160a060020a03831660009081526004602052604090205460ff16151561087f57600080fd5b5050600160a060020a038082166000908152600360209081526040808320548354600019018085526001909352922054919291909116906108c1908490610bd7565b600160a060020a038316600090815260036020526040812054905460001901146108ea57600080fd5b600160a060020a038116600090815260036020526040902054821461090e57600080fd5b600080546000199081018252600160209081526040808420805473ffffffffffffffffffffffffffffffffffffffff1916905583548301845260028252808420849055600160a060020a03871684526003825280842084905583549092018355600490529020805460ff191690555b505050565b60005490565b600080548190831061099957600080fd5b600083815260016020908152604080832054600160a060020a03168352600490915290205460ff1615156109cc57600080fd5b600083815260016020908152604080832054600160a060020a03168352600390915290205483146109fc57600080fd5b5050600090815260016020908152604080832054600290925290912054600160a060020a0390911691565b3360009081526004602052604090205460ff161515610a4557600080fd5b3360009081526003602052604090205415610a5f57600080fd5b600080526001602052600080516020610d6783398151915254600160a060020a03163314610a8c57600080fd5b600080526002602052600080516020610d8783398151915254600114610ab157600080fd5b30600160a060020a0383161415610ac757610b0f565b600080526001602052600080516020610d6783398151915254600160a060020a0383811691161415610af857600080fd5b60018111610b0557600080fd5b610b0f8282610b13565b5050565b600160a060020a03821660009081526004602052604081205460ff1615610b645750600160a060020a038216600090815260036020908152604080832054808452600290925290912082905561097d565b5060008054600160a060020a038416808352600460209081526040808520805460ff1916600190811790915560038352818620859055848652808352818620805473ffffffffffffffffffffffffffffffffffffffff191690941790935560029091528320849055825401909155505050565b600080600080600093506000925060009150600090506001600086815260200190815260200160002060009054906101000a9004600160a060020a03169150600260008681526020019081526020016000205490506003600087600160a060020a0316600160a060020a0316815260200190815260200160002054925060026000848152602001908152602001600020549350816001600085815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a03160217905550806002600085815260200190815260200160002081905550826003600084600160a060020a0316600160a060020a0316815260200190815260200160002081905550856001600087815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a03160217905550836002600087815260200190815260200160002081905550846003600088600160a060020a0316600160a060020a03168152602001908152602001600020819055505050505050505600a6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49ac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077ba165627a7a72305820618bbb9ef684df082d9b98107034468a1208ff2edd24b6e4b7b878bef2c925040029

   Swarm Source:
bzzr://618bbb9ef684df082d9b98107034468a1208ff2edd24b6e4b7b878bef2c92504

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward