ETH Price: $2,522.87 (-0.23%)

Transaction Decoder

Block:
13152029 at Sep-03-2021 09:50:18 AM +UTC
Transaction Fee:
0.002535126797317257 ETH $6.40
Gas Used:
22,881 Gas / 110.796153897 Gwei

Emitted Events:

185 KingdomPay.Buy( code=528582166353400107, value=52797360000000010 )

Account State Difference:

  Address   Before After State Difference Code
0x4f31aa5d...65D5ffd8A
0.059024507634263767 Eth
Nonce: 364
0.0036920208369465 Eth
Nonce: 365
0.055332486797317267
0xA1775DE5...356605f83 11.323253578646639401 Eth11.376050938646639411 Eth0.05279736000000001
(Miner: 0xc8F...7C9)
8,627.95884240187861391 Eth8,627.959319560545828596 Eth0.000477158667214686

Execution Trace

ETH 0.05279736000000001 KingdomPay.buy( code=528582166353400107 )
pragma solidity ^0.5.12;

// import "./ownership/Ownable.sol";
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

contract KingdomPay is Ownable {
    event Buy(uint256 code, uint256 value);
    event Take(uint256 code, uint256 value);
    
    address payable private receiver;

    constructor() public
    {
    }

    function () payable external {}

    function take(uint256 code) public payable {
        emit Take(code, msg.value);
    }

    function buy(uint256 code) public payable {
        emit Buy(code, msg.value);
    }

    function setReceiver(address payable r) public onlyOwner{
        receiver = r;
    }

    function withdraw() public {
        require(_msgSender() == receiver || _msgSender() == owner(), "Incorrect address");
        receiver.transfer(address(this).balance);
    }
}