ETH Price: $2,627.73 (-2.28%)

Transaction Decoder

Block:
14483000 at Mar-29-2022 07:29:27 PM +UTC
Transaction Fee:
0.002800300628981261 ETH $7.36
Gas Used:
50,951 Gas / 54.960660811 Gwei

Emitted Events:

Account State Difference:

  Address   Before After State Difference Code
(Hiveon Pool)
10,470.619962065684356601 Eth10,470.620089443184356601 Eth0.0001273775
0x4b520c81...26C83588D
0x4f81C790...cC8C71c8d
0xa6734119...40C045e3C
0.014931115882130015 Eth
Nonce: 15
0.012130815253148754 Eth
Nonce: 16
0.002800300628981261

Execution Trace

DGTownHall.stepOutside( _xDGAmount=1031081000000000000000 )
  • DGLight.balanceOf( _account=0x4f81C790581b240A5C948Afd173620EcC8C71c8d ) => ( 331493775308370022722440019 )
  • DGLight.transfer( _recipient=0xa673411920BF5Ab98717ec7C5aa825340C045e3C, _amount=1076626074014993207944 ) => ( True )
    File 1 of 2: DGTownHall
    {"DGTownHall.sol":{"content":"// SPDX-License-Identifier: DG\n\npragma solidity ^0.8.9;\n\nimport \"./ERC20.sol\";\n\ninterface DGToken {\n\n    function balanceOf(\n        address _account\n    )\n        external\n        view\n        returns (uint256);\n\n    function transfer(\n        address _recipient,\n        uint256 _amount\n    )\n        external\n        returns (bool);\n\n    function transferFrom(\n        address _sender,\n        address _recipient,\n        uint256 _amount\n    )\n        external\n        returns (bool);\n}\n\ncontract DGTownHall is ERC20(\"Decentral Games Governance\", \"xDG\") {\n\n    DGToken public immutable DG;\n\n    constructor(\n        address _tokenAddress\n    ) {\n        DG = DGToken(\n            _tokenAddress\n        );\n    }\n\n    function stepInside(\n        uint256 _DGAmount\n    )\n        external\n    {\n        uint256 DGTotal = innerSupply();\n        uint256 xDGTotal = totalSupply();\n\n        DGTotal == 0 || xDGTotal == 0\n            ? _mint(msg.sender, _DGAmount)\n            : _mint(msg.sender, _DGAmount * xDGTotal / DGTotal);\n\n        DG.transferFrom(\n            msg.sender,\n            address(this),\n            _DGAmount\n        );\n    }\n\n    function stepOutside(\n        uint256 _xDGAmount\n    )\n        external\n    {\n        uint256 transferAmount = _xDGAmount\n            * innerSupply()\n            / totalSupply();\n\n        _burn(\n            msg.sender,\n            _xDGAmount\n        );\n\n        DG.transfer(\n            msg.sender,\n            transferAmount\n        );\n    }\n\n    function DGAmount(\n        address _account\n    )\n        external\n        view\n        returns (uint256)\n    {\n        return balanceOf(_account)\n            * innerSupply()\n            / totalSupply();\n    }\n\n    function outsidAmount(\n        uint256 _xDGAmount\n    )\n        external\n        view\n        returns (uint256 _DGAmount)\n    {\n        return _xDGAmount\n            * innerSupply()\n            / totalSupply();\n    }\n\n    function insideAmount(\n        uint256 _DGAmount\n    )\n        external\n        view\n        returns (uint256 _xDGAmount)\n    {\n        uint256 xDGTotal = totalSupply();\n        uint256 DGTotal = innerSupply();\n\n        return xDGTotal == 0 || DGTotal == 0\n            ? _DGAmount\n            : _DGAmount * xDGTotal / DGTotal;\n    }\n\n    function innerSupply()\n        public\n        view\n        returns (uint256)\n    {\n        return DG.balanceOf(address(this));\n    }\n}\n"},"ERC20.sol":{"content":"// SPDX-License-Identifier: ---DG----\n\npragma solidity ^0.8.9;\n\ncontract ERC20 {\n\n    string private _name;\n    string private _symbol;\n    uint8 private  _decimals;\n\n    uint256 private _totalSupply;\n\n    mapping(address =\u003e uint256) private _balances;\n    mapping(address =\u003e mapping(address =\u003e uint256)) private _allowances;\n    mapping(address =\u003e uint) public nonces;\n\n    bytes32 public DOMAIN_SEPARATOR;\n    bytes32 public constant PERMIT_TYPEHASH = keccak256(\n        \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n    );\n\n    event Transfer(\n        address indexed _from,\n        address indexed _to,\n        uint256 _value\n    );\n\n    event Approval(\n        address indexed _owner,\n        address indexed _spender,\n        uint256 _value\n    );\n\n    constructor(\n        string memory _entryname,\n        string memory _entrysymbol\n    ) {\n        _name = _entryname;\n        _symbol = _entrysymbol;\n        _decimals = 18;\n    }\n\n    function name()\n        public\n        view\n        returns (string memory)\n    {\n        return _name;\n    }\n\n    function symbol()\n        public\n        view\n        returns (string memory)\n    {\n        return _symbol;\n    }\n\n    function decimals()\n        public\n        view\n        returns (uint8)\n    {\n        return _decimals;\n    }\n\n    function totalSupply()\n        public\n        view\n        returns (uint256)\n    {\n        return _totalSupply;\n    }\n\n    function balanceOf(\n        address _account\n    )\n        public\n        view\n        returns (uint256)\n    {\n        return _balances[_account];\n    }\n\n    function transfer(\n        address _recipient,\n        uint256 _amount\n    )\n        external\n        returns (bool)\n    {\n        _transfer(\n            msg.sender,\n            _recipient,\n            _amount\n        );\n\n        return true;\n    }\n\n    function allowance(\n        address _owner,\n        address _spender\n    )\n        external\n        view\n        returns (uint256)\n    {\n        return _allowances[_owner][_spender];\n    }\n\n    function approve(\n        address _spender,\n        uint256 _amount\n    )\n        external\n        returns (bool)\n    {\n        _approve(\n            msg.sender,\n            _spender,\n            _amount\n        );\n\n        return true;\n    }\n\n    function transferFrom(\n        address _sender,\n        address _recipient,\n        uint256 _amount\n    )\n        public\n        returns (bool)\n    {\n        _approve(\n            _sender,\n            msg.sender,\n            _allowances[_sender][msg.sender] - _amount\n        );\n\n        _transfer(\n            _sender,\n            _recipient,\n            _amount\n        );\n\n        return true;\n    }\n\n    function permit(\n        address _owner,\n        address _spender,\n        uint256 _value,\n        uint256 _deadline,\n        uint8 _v,\n        bytes32 _r,\n        bytes32 _s\n    )\n        external\n    {\n        require(\n            _deadline \u003e= block.timestamp,\n            \u0027ERC20: PERMIT_CALL_EXPIRED\u0027\n        );\n\n        bytes32 digest = keccak256(\n            abi.encodePacked(\n                \u0027\\x19\\x01\u0027,\n                DOMAIN_SEPARATOR,\n                keccak256(\n                    abi.encode(\n                        PERMIT_TYPEHASH,\n                        _owner,\n                        _spender,\n                        _value,\n                        nonces[_owner]++,\n                        _deadline\n                    )\n                )\n            )\n        );\n\n        address recoveredAddress = ecrecover(\n            digest,\n            _v,\n            _r,\n            _s\n        );\n\n        require(\n            recoveredAddress != address(0) \u0026\u0026\n            recoveredAddress == _owner,\n            \u0027INVALID_SIGNATURE\u0027\n        );\n\n        _approve(\n            _owner,\n            _spender,\n            _value\n        );\n    }\n\n    function _transfer(\n        address _sender,\n        address _recipient,\n        uint256 _amount\n    )\n        internal\n    {\n        _balances[_sender] =\n        _balances[_sender] - _amount;\n\n        _balances[_recipient] =\n        _balances[_recipient] + _amount;\n\n        emit Transfer(\n            _sender,\n            _recipient,\n            _amount\n        );\n    }\n\n    function _mint(\n        address _account,\n        uint256 _amount\n    )\n        internal\n    {\n        _totalSupply =\n        _totalSupply + _amount;\n\n        unchecked {\n            _balances[_account] =\n            _balances[_account] + _amount;\n        }\n\n        emit Transfer(\n            address(0),\n            _account,\n            _amount\n        );\n    }\n\n    function _burn(\n        address _account,\n        uint256 _amount\n    )\n        internal\n    {\n        _balances[_account] =\n        _balances[_account] - _amount;\n\n        unchecked {\n            _totalSupply =\n            _totalSupply - _amount;\n        }\n\n        emit Transfer(\n            _account,\n            address(0),\n            _amount\n        );\n    }\n\n    function _approve(\n        address _owner,\n        address _spender,\n        uint256 _amount\n    )\n        internal\n    {\n        _allowances[_owner][_spender] = _amount;\n\n        emit Approval(\n            _owner,\n            _spender,\n            _amount\n        );\n    }\n}\n"}}

    File 2 of 2: DGLight
    {"DGLightToken.sol":{"content":"// SPDX-License-Identifier: ---DG----\n\npragma solidity ^0.8.9;\n\nimport \"./ERC20.sol\";\n\ninterface IClassicDGToken {\n\n    function transfer(\n        address _recipient,\n        uint256 _amount\n    )\n        external\n        returns (bool);\n\n    function transferFrom(\n        address _sender,\n        address _recipient,\n        uint256 _amount\n    )\n        external\n        returns (bool);\n}\n\ncontract DGLight is ERC20(\"Decentral Games\", \"DG\") {\n\n    IClassicDGToken immutable public classicDG;\n    uint16 constant public RATIO = 1000;\n\n    constructor(\n        address _classicDGTokenAddress\n    ) {\n        classicDG = IClassicDGToken(\n            _classicDGTokenAddress\n        );\n\n        DOMAIN_SEPARATOR = keccak256(\n            abi.encode(\n                keccak256(\u0027EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\u0027),\n                keccak256(bytes(name())),\n                keccak256(bytes(\u00271\u0027)),\n                block.chainid,\n                address(this)\n            )\n        );\n    }\n\n    function goLight(\n        uint256 _classicAmountToDeposit\n    )\n        external\n    {\n        classicDG.transferFrom(\n            msg.sender,\n            address(this),\n            _classicAmountToDeposit\n        );\n\n        _mint(\n            msg.sender,\n            _classicAmountToDeposit * RATIO\n        );\n    }\n\n    function goClassic(\n        uint256 _classicAmountToReceive\n    )\n        external\n    {\n        classicDG.transfer(\n            msg.sender,\n            _classicAmountToReceive\n        );\n\n        _burn(\n            msg.sender,\n            _classicAmountToReceive * RATIO\n        );\n    }\n}\n"},"ERC20.sol":{"content":"// SPDX-License-Identifier: ---DG----\n\npragma solidity ^0.8.9;\n\ncontract ERC20 {\n\n    string private _name;\n    string private _symbol;\n    uint8 private  _decimals;\n\n    uint256 private _totalSupply;\n\n    mapping(address =\u003e uint256) private _balances;\n    mapping(address =\u003e mapping(address =\u003e uint256)) private _allowances;\n    mapping(address =\u003e uint) public nonces;\n\n    bytes32 public DOMAIN_SEPARATOR;\n    bytes32 public constant PERMIT_TYPEHASH = keccak256(\n        \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n    );\n\n    event Transfer(\n        address indexed _from,\n        address indexed _to,\n        uint256 _value\n    );\n\n    event Approval(\n        address indexed _owner,\n        address indexed _spender,\n        uint256 _value\n    );\n\n    constructor(\n        string memory _entryname,\n        string memory _entrysymbol\n    ) {\n        _name = _entryname;\n        _symbol = _entrysymbol;\n        _decimals = 18;\n    }\n\n    function name()\n        public\n        view\n        returns (string memory)\n    {\n        return _name;\n    }\n\n    function symbol()\n        public\n        view\n        returns (string memory)\n    {\n        return _symbol;\n    }\n\n    function decimals()\n        public\n        view\n        returns (uint8)\n    {\n        return _decimals;\n    }\n\n    function totalSupply()\n        public\n        view\n        returns (uint256)\n    {\n        return _totalSupply;\n    }\n\n    function balanceOf(\n        address _account\n    )\n        public\n        view\n        returns (uint256)\n    {\n        return _balances[_account];\n    }\n\n    function transfer(\n        address _recipient,\n        uint256 _amount\n    )\n        external\n        returns (bool)\n    {\n        _transfer(\n            msg.sender,\n            _recipient,\n            _amount\n        );\n\n        return true;\n    }\n\n    function allowance(\n        address _owner,\n        address _spender\n    )\n        external\n        view\n        returns (uint256)\n    {\n        return _allowances[_owner][_spender];\n    }\n\n    function approve(\n        address _spender,\n        uint256 _amount\n    )\n        external\n        returns (bool)\n    {\n        _approve(\n            msg.sender,\n            _spender,\n            _amount\n        );\n\n        return true;\n    }\n\n    function transferFrom(\n        address _sender,\n        address _recipient,\n        uint256 _amount\n    )\n        public\n        returns (bool)\n    {\n        _approve(\n            _sender,\n            msg.sender,\n            _allowances[_sender][msg.sender] - _amount\n        );\n\n        _transfer(\n            _sender,\n            _recipient,\n            _amount\n        );\n\n        return true;\n    }\n\n    function permit(\n        address _owner,\n        address _spender,\n        uint256 _value,\n        uint256 _deadline,\n        uint8 _v,\n        bytes32 _r,\n        bytes32 _s\n    )\n        external\n    {\n        require(\n            _deadline \u003e= block.timestamp,\n            \u0027ERC20: PERMIT_CALL_EXPIRED\u0027\n        );\n\n        bytes32 digest = keccak256(\n            abi.encodePacked(\n                \u0027\\x19\\x01\u0027,\n                DOMAIN_SEPARATOR,\n                keccak256(\n                    abi.encode(\n                        PERMIT_TYPEHASH,\n                        _owner,\n                        _spender,\n                        _value,\n                        nonces[_owner]++,\n                        _deadline\n                    )\n                )\n            )\n        );\n\n        address recoveredAddress = ecrecover(\n            digest,\n            _v,\n            _r,\n            _s\n        );\n\n        require(\n            recoveredAddress != address(0) \u0026\u0026\n            recoveredAddress == _owner,\n            \u0027INVALID_SIGNATURE\u0027\n        );\n\n        _approve(\n            _owner,\n            _spender,\n            _value\n        );\n    }\n\n    function _transfer(\n        address _sender,\n        address _recipient,\n        uint256 _amount\n    )\n        internal\n    {\n        _balances[_sender] =\n        _balances[_sender] - _amount;\n\n        _balances[_recipient] =\n        _balances[_recipient] + _amount;\n\n        emit Transfer(\n            _sender,\n            _recipient,\n            _amount\n        );\n    }\n\n    function _mint(\n        address _account,\n        uint256 _amount\n    )\n        internal\n    {\n        _totalSupply =\n        _totalSupply + _amount;\n\n        unchecked {\n            _balances[_account] =\n            _balances[_account] + _amount;\n        }\n\n        emit Transfer(\n            address(0),\n            _account,\n            _amount\n        );\n    }\n\n    function _burn(\n        address _account,\n        uint256 _amount\n    )\n        internal\n    {\n        _balances[_account] =\n        _balances[_account] - _amount;\n\n        unchecked {\n            _totalSupply =\n            _totalSupply - _amount;\n        }\n\n        emit Transfer(\n            _account,\n            address(0),\n            _amount\n        );\n    }\n\n    function _approve(\n        address _owner,\n        address _spender,\n        uint256 _amount\n    )\n        internal\n    {\n        _allowances[_owner][_spender] = _amount;\n\n        emit Approval(\n            _owner,\n            _spender,\n            _amount\n        );\n    }\n}\n"}}