ETH Price: $1,892.15 (-0.42%)

Transaction Decoder

Block:
11601995 at Jan-06-2021 03:55:20 PM +UTC
Transaction Fee:
0.002511718 ETH $4.75
Gas Used:
23,474 Gas / 107 Gwei

Account State Difference:

  Address   Before After State Difference Code
0x848482De...c5445ac6D
0.750950313 Eth
Nonce: 54
0.748438595 Eth
Nonce: 55
0.002511718
(Ethermine)
1,657.698451257031436903 Eth1,657.700962975031436903 Eth0.002511718

Execution Trace

ETH 0.05 XGoldProxy.876cb217( )
  • ETH 0.05 0x7a4a9b21f114126fbfe38969e2a7cbbae4ccadcc.876cb217( )
    // SPDX-License-Identifier: MIT
    
    pragma solidity ^0.6.0;
    
    /**
     * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
     * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
     * be specified by overriding the virtual {_implementation} function.
     * 
     * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
     * different contract through the {_delegate} function.
     * 
     * The success and return data of the delegated call will be returned back to the caller of the proxy.
     */
    abstract contract Proxy {
        /**
         * @dev Delegates the current call to `implementation`.
         * 
         * This function does not return to its internall call site, it will return directly to the external caller.
         */
        function _delegate(address implementation) internal {
            // solhint-disable-next-line no-inline-assembly
            assembly {
                // Copy msg.data. We take full control of memory in this inline assembly
                // block because it will not return to Solidity code. We overwrite the
                // Solidity scratch pad at memory position 0.
                calldatacopy(0, 0, calldatasize())
    
                // Call the implementation.
                // out and outsize are 0 because we don't know the size yet.
                let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
    
                // Copy the returned data.
                returndatacopy(0, 0, returndatasize())
    
                switch result
                // delegatecall returns 0 on error.
                case 0 { revert(0, returndatasize()) }
                default { return(0, returndatasize()) }
            }
        }
    
        /**
         * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
         * and {_fallback} should delegate.
         */
        function _implementation() internal virtual view returns (address);
    
        /**
         * @dev Delegates the current call to the address returned by `_implementation()`.
         * 
         * This function does not return to its internall call site, it will return directly to the external caller.
         */
        function _fallback() internal {
            _beforeFallback();
            _delegate(_implementation());
        }
    
        /**
         * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
         * function in the contract matches the call data.
         */
        fallback () payable external {
            _fallback();
        }
    
        /**
         * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
         * is empty.
         */
        receive () payable external {
            _fallback();
        }
    
        /**
         * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
         * call, or as part of the Solidity `fallback` or `receive` functions.
         * 
         * If overriden should call `super._beforeFallback()`.
         */
        function _beforeFallback() internal virtual {
        }
    }
    
    contract XGoldProxy is Proxy {
        
        address public impl;
        address public contractOwner;
    
        address public fourthLevelUpdater;
    
        modifier onlyContractOwner() { 
            require(msg.sender == contractOwner); 
            _; 
        }
    
        constructor(address _impl) public {
            impl = _impl;
            contractOwner = msg.sender;
        }
        
        function update(address newImpl) public onlyContractOwner {
            impl = newImpl;
        }
    
        function removeOwnership() public onlyContractOwner {
            contractOwner = address(0);
        }
        
        function _implementation() internal override view returns (address) {
            return impl;
        }
    }