creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/CoreRouter.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\n/// @title Cyan Wallet Core Router - A Cyan wallet's core router.\n/// @author Bulgantamir Gankhuyag - <bulgaa@usecyan.com>\n/// @author Naranbayar Uuganbayar - <naba@usecyan.com>\ncontract CoreRouter {\n    address payable private immutable _this;\n    address private _admin;\n    address private _core;\n\n    event SetRouterAdmin(address admin);\n    event SetCore(address core);\n\n    modifier onlyAdmin() {\n        require(_admin == msg.sender, \"Caller is not an admin.\");\n        _;\n    }\n\n    constructor(address core) {\n        require(core != address(0x0), \"Invalid core address.\");\n\n        _admin = msg.sender;\n        _core = core;\n        _this = payable(address(this));\n    }\n\n    /// @notice Changes the admin of the router.\n    /// @param admin Address of the new admin.\n    function setRouterAdmin(address admin) external onlyAdmin {\n        require(admin != address(0x0), \"Invalid admin address.\");\n\n        _admin = admin;\n        emit SetRouterAdmin(admin);\n    }\n\n    /// @notice Returns an admin address of the router.\n    /// @return Address of the current admin.\n    function getRouterAdmin() external view returns (address) {\n        return _admin;\n    }\n\n    /// @notice Changes the address of the core contract.\n    ///     Note: Changing the core address will affect to all wallets.\n    /// @param core Address of the new core contract.\n    function setCore(address core) external onlyAdmin {\n        require(core != address(0x0), \"Invalid core address.\");\n\n        _core = core;\n        emit SetCore(core);\n    }\n\n    /// @notice Returns the address of the core contract.\n    /// @return Address of the current core contract.\n    function getCore() external view returns (address) {\n        return _core;\n    }\n\n    /// @notice Delegates all transcations to the core contract.\n    fallback() external payable {\n        address core = CoreRouter(_this).getCore();\n        assembly {\n            calldatacopy(0, 0, calldatasize())\n            let success := delegatecall(gas(), core, 0, calldatasize(), 0, 0)\n            returndatacopy(0, 0, returndatasize())\n            if eq(success, 0) {\n                revert(0, returndatasize())\n            }\n            return(0, returndatasize())\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 500
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}