ETH Price: $3,063.18 (+1.24%)
Gas: 5 Gwei

Contract

0xFB54F3B9738C53139950520c6bC9b8E6d2b8e6f2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Set Tokens With ...202268092024-07-03 15:14:476 days ago1720019687IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0008866118.87464331
Set Tokens With ...202268082024-07-03 15:14:356 days ago1720019675IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0009725820.70484564
Set Tokens With ...202268072024-07-03 15:14:236 days ago1720019663IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0005677519.01261618
Set Tokens With ...202268062024-07-03 15:14:116 days ago1720019651IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0005766919.31195256
Set Tokens With ...202268052024-07-03 15:13:596 days ago1720019639IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0009239119.66859784
Set Trusted Remo...202265492024-07-03 14:22:236 days ago1720016543IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.000627821.65507517
Set Tokens With ...202054102024-06-30 15:30:599 days ago1719761459IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.000293286.24360514
Set Tokens With ...202053702024-06-30 15:22:599 days ago1719760979IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.000254035.41071779
Set Tokens With ...202053692024-06-30 15:22:479 days ago1719760967IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.00021164.50468887
Set Tokens With ...195456862024-03-30 8:48:23101 days ago1711788503IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0006007120.10840464
Add Wmb App Cont...195336482024-03-28 16:03:35103 days ago1711641815IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0021649346.46279704
Add Wmb App Cont...195336462024-03-28 16:03:11103 days ago1711641791IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.002133745.78070565
Add Chain Id To ...195336362024-03-28 16:01:11103 days ago1711641671IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0011993745.85114936
Add Chain Id To ...195336352024-03-28 16:00:59103 days ago1711641659IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0011430343.67717674
Set Trusted Remo...195336222024-03-28 15:58:23103 days ago1711641503IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0019062638.99014143
Set Trusted Remo...195336212024-03-28 15:57:59103 days ago1711641479IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.001909739.06050442
Add Chain Id To ...195336202024-03-28 15:57:47103 days ago1711641467IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.001763738.29304242
Add Chain Id To ...195336192024-03-28 15:57:35103 days ago1711641455IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0018566940.30162053
Set Tokens With ...195336182024-03-28 15:57:23103 days ago1711641443IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0019179540.8405985
Set Tokens With ...195336172024-03-28 15:57:11103 days ago1711641431IN
0xFB54F3B9...6d2b8e6f2
0 ETH0.0019206640.8877271
0x60806040188597402023-12-25 2:19:59197 days ago1703470799IN
 Create: EnergiWmbApp
0 ETH0.0300843116.37201271

Latest 4 internal transactions

Advanced mode:
Parent Transaction Hash Block From To Value
202053822024-06-30 15:25:239 days ago1719761123
0xFB54F3B9...6d2b8e6f2
0.00000053 ETH
202053822024-06-30 15:25:239 days ago1719761123
0xFB54F3B9...6d2b8e6f2
0.00000053 ETH
196697092024-04-16 18:04:1184 days ago1713290651
0xFB54F3B9...6d2b8e6f2
0.00000053 ETH
196697092024-04-16 18:04:1184 days ago1713290651
0xFB54F3B9...6d2b8e6f2
0.00000053 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EnergiWmbApp

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion
File 1 of 18 : EnergiWmbApp.sol
// Copyright 2023 Energi Core

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// Energi Governance system is the fundamental part of Energi Core.

// NOTE: It's not allowed to change the compiler due to byte-to-byte
//       match requirement.

pragma solidity 0.8.20;

import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {WmbApp} from '@wandevs/message/contracts/app/WmbApp.sol';
import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol';
import {IEnergiWanBridge} from './interfaces/IEnergiWanBridge.sol';

contract EnergiWmbApp is Ownable, WmbApp, Pausable {
  // execute a function only from energiwanbridge contract

  // EnergiWanBridge Proxy address
  address private energiWanBridgeAddress;

  // mapping to store wmb addresses of different chain ids
  mapping(uint256 => address) private chainIdToWmbAppContract;
  mapping(uint256 => uint256) private chainIdToBIP44ChainId;

  // mapping of mapping to store token addresses for different chains
  mapping(address => mapping(uint256 => address)) public tokenAddressForChainId;

  constructor(address admin, address _wmbGateway, address _energiBridgeProxy) WmbApp() {
    initialize(admin, _wmbGateway);
    energiWanBridgeAddress = _energiBridgeProxy;
  }

  // access modifier which allows only energi wan bridge proxy contract can call
  modifier onlyEnergiWanBridge() {
    require(
      msg.sender == energiWanBridgeAddress,
      'EnergiWmbApp:: Must be EnergiWanBridge contract'
    );
    _;
  }

  // access modifier which allows only gateway contract can call
  modifier onlyGateway() {
    require(msg.sender == wmbGateway, 'EnergiWmbApp:: Must be gateway contract');
    _;
  }

  event EnergiWanBridgeAddressUpdated(
    address oldEnergiWanBridgeAddress,
    address newEnergiWanBridgeAddress
  );

  event MessgeSent(
    address _from,
    address _to,
    uint256 _amount,
    address _tokenAddress,
    uint256 _chainId
  );

  event MessegeReceived(address from, address to, uint256 amount, address tokenAddress);

  // send meesege to gateway contract on source chain
  // only energi wan bridge contract can call this function
  function sendMessage(
    address _from,
    address _to,
    uint256 _amount,
    address _tokenAddress,
    uint256 _chainId,
    uint256 _gasLimit
  ) public whenNotPaused onlyEnergiWanBridge {
    require(
      chainIdToWmbAppContract[_chainId] != address(0),
      'EnergiWmbApp:: WmbApp address cannot be address zero'
    );
    uint fee = estimateFee(chainIdToBIP44ChainId[_chainId], _gasLimit);

    // gate way interaction
    _dispatchMessage(
      chainIdToBIP44ChainId[_chainId],
      chainIdToWmbAppContract[_chainId],
      abi.encode(_from, _to, _amount, tokenAddressForChainId[_tokenAddress][_chainId]),
      fee
    );

    emit MessgeSent(_from, _to, _amount, _tokenAddress, _chainId);
  }

  function getEstimatedFees(uint256 _chainId, uint256 _gasLimit) external view returns (uint256) {
    return estimateFee(chainIdToBIP44ChainId[_chainId], _gasLimit);
  }

  // returns energi wan bridge proxy contract
  function getEnergiWanBridgeAddress() public view returns (address) {
    return energiWanBridgeAddress;
  }

  // return wmb address for given chain id
  function getEnergiWmbAppAddressForChainId(uint256 _chainId) public view returns (address) {
    return chainIdToWmbAppContract[_chainId];
  }

  // returns address of destination chain
  // _chainId - destination chain id
  // _sourceTokenAddress - address of token in source chain
  function getDestinationTokenAddress(
    uint256 _chainId,
    address _sourceTokenAddress
  ) public view returns (address) {
    return tokenAddressForChainId[_sourceTokenAddress][_chainId];
  }

  function getBIP44ChainIdForChainId(uint256 _chainId) public view returns (uint256) {
    return chainIdToBIP44ChainId[_chainId];
  }

  // add wmb contract for destination chains
  // _chainId - destination chainid
  // _wmbAppContractAddress - WmbApp contract address for destination chain
  // only called by owner of smart contract
  function addWmbAppContract(uint256 _chainId, address _wmbAppContractAddress) external onlyOwner {
    require(_wmbAppContractAddress != address(0), 'EnergiWmbApp:: Address cannot be zero address');

    require(
      chainIdToWmbAppContract[_chainId] != _wmbAppContractAddress,
      'EnergiWmbApp:: Cannot add dupicate value'
    );

    chainIdToWmbAppContract[_chainId] = _wmbAppContractAddress;
  }

  // set's energiWanBridge address
  // only called by owner of smart contract
  function setEnergiWanBridgeAddress(address _newEnergiWanBridgeAddress) external onlyOwner {
    address oldEnergiWanBridgeAddress = energiWanBridgeAddress;
    energiWanBridgeAddress = _newEnergiWanBridgeAddress;
    require(
      _newEnergiWanBridgeAddress != address(0),
      'EnergiWmbApp:: EnergiWanBridge cannot be zero address'
    );
    require(
      oldEnergiWanBridgeAddress != _newEnergiWanBridgeAddress,
      'EnergiWmbApp:: EnergiWanBridge address cannot be same as previous EnergiWanBridge address'
    );

    emit EnergiWanBridgeAddressUpdated(oldEnergiWanBridgeAddress, _newEnergiWanBridgeAddress);
  }

  // add tokens for different chain ids
  // _sourceTokenAddress - token address on source chain
  // _destinationTokenAddress - token address on destiantion chain
  // _destinationChainId - chain id of destination chain
  function setTokensWithChainId(
    address _sourceTokenAddress,
    address _destinationTokenAddress,
    uint256 _destinationChainId
  ) external onlyOwner {
    require(_sourceTokenAddress != address(0), 'EnergiWmbApp:: Source token address is invalid');
    require(
      _destinationTokenAddress != address(0),
      'EnergiWmbApp:: Destination token address is invalid'
    );

    tokenAddressForChainId[_sourceTokenAddress][_destinationChainId] = _destinationTokenAddress;
  }

  function addChainIdToBIP44ChainId(uint256 _chainId, uint256 _bip44ChainId) external onlyOwner {
    chainIdToBIP44ChainId[_chainId] = _bip44ChainId;
  }

  function pause() external whenNotPaused onlyOwner {
    _pause();
  }

  function unpause() external whenPaused onlyOwner {
    _unpause();
  }

  function _currentTime() internal view returns (uint256) {
    return block.timestamp;
  }

  function _wmbReceive(
    bytes calldata data,
    bytes32 /*messageId*/,
    uint256 fromChainId,
    address /*fromSC*/
  ) internal override {
    (address _from, address _to, uint256 _amount, address _tokenAddress) = abi.decode(
      data,
      (address, address, uint256, address)
    );

    IEnergiWanBridge(energiWanBridgeAddress).receiveTokens(
      _from,
      _to,
      _amount,
      _tokenAddress,
      fromChainId
    );

    emit MessegeReceived(_from, _to, _amount, _tokenAddress);
  }

  /* solhint-disable */
  fallback() external {}

  receive() external payable {}
  /* solhint-enable */
}

File 2 of 18 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 18 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract 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() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(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 virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 18 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/Address.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 6 of 18 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 7 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 8 of 18 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 9 of 18 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 10 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 11 of 18 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 12 of 18 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 13 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 14 of 18 : WmbApp.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "../interfaces/IWmbGateway.sol";
import "../interfaces/IWmbReceiver.sol";

/**
 * @title WmbApp
 * @dev Abstract contract to be inherited by applications to use Wanchain Message Bridge for send and receive messages between different chains.
 * All interfaces with WmbGateway have been encapsulated, so users do not need to have any interaction with the WmbGateway contract.
 */
abstract contract WmbApp is AccessControl, Initializable, IWmbReceiver {
    // The address of the WMB Gateway contract
    address public wmbGateway;

    // A mapping of remote chains and addresses that are trusted to send messages to this contract
    // fromChainId => fromAddress => trusted
    mapping (uint => mapping(address => bool)) public trustedRemotes;

    /**
     * @dev Initializes the contract with the given admin, WMB Gateway address, and block mode flag
     * @param admin Address of the contract admin
     * @param _wmbGateway Address of the WMB Gateway contract
     */
    function initialize(address admin, address _wmbGateway) virtual public initializer {
        // Initialize the AccessControl module with the given admin
        _grantRole(DEFAULT_ADMIN_ROLE, admin);
        wmbGateway = _wmbGateway;
    }

    /**
     * @dev Function to set the trusted remote addresses
     * @param fromChainIds IDs of the chains the messages are from
     * @param froms Addresses of the contracts the messages are from
     * @param trusted Trusted flag
     * @notice This function can only be called by the admin
     */
    function setTrustedRemotes(uint[] calldata fromChainIds, address[] calldata froms, bool[] calldata trusted) external {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "WmbApp: must have admin role to set trusted remotes");
        require(fromChainIds.length == froms.length && froms.length == trusted.length, "WmbApp: invalid input");
        for (uint i = 0; i < fromChainIds.length; i++) {
            trustedRemotes[fromChainIds[i]][froms[i]] = trusted[i];
        }
    }

    /**
     * @dev Function to estimate fee in native coin for sending a message to the WMB Gateway
     * @param toChain ID of the chain the message is to
     * @param gasLimit Gas limit for the message
     * @return fee Fee in native coin
     */
    function estimateFee(uint256 toChain, uint256 gasLimit) virtual public view returns (uint256) {
        return IWmbGateway(wmbGateway).estimateFee(toChain, gasLimit);
    }

    /**
     * @dev Function to receive a WMB message from the WMB Gateway
     * @param data Message data
     * @param messageId Message ID
     * @param fromChainId ID of the chain the message is from
     * @param from Address of the contract the message is from
     */
    function wmbReceive(
        bytes calldata data,
        bytes32 messageId,
        uint256 fromChainId,
        address from
    ) virtual external {
        // Only the WMB gateway can call this function
        require(msg.sender == wmbGateway, "WmbApp: Only WMB gateway can call this function");
        require(trustedRemotes[fromChainId][from], "WmbApp: Remote is not trusted");
        _wmbReceive(data, messageId, fromChainId, from);
    }

    /**
     * @dev Function to be implemented by the application to handle received WMB messages
     * @param data Message data
     * @param messageId Message ID
     * @param fromChainId ID of the chain the message is from
     * @param from Address of the contract the message is from
     */
    function _wmbReceive(
        bytes calldata data,
        bytes32 messageId,
        uint256 fromChainId,
        address from
    ) virtual internal;

    /**
     * @dev Function to send a WMB message to the WMB Gateway from this App
     * @param toChainId ID of the chain the message is to
     * @param to Address of the contract the message is to
     * @param data Message data
     * @return messageId Message ID
     */
    function _dispatchMessage(
        uint toChainId,
        address to,
        bytes memory data,
        uint fee
    ) virtual internal returns (bytes32) {
        return IWmbGateway(wmbGateway).dispatchMessage{value: fee}(toChainId, to, data);
    }

    /**
     * @dev Function to send batch WMB messages to the WMB Gateway from this App
     * @param toChainId ID of the chain the message is to
     * @param messages Messages data
     * @return messageId Message ID
     */
    function _dispatchMessageBatch(uint256 toChainId, Message[] memory messages, uint fee) virtual internal returns (bytes32) {
        return IWmbGateway(wmbGateway).dispatchMessageBatch{value: fee}(toChainId, messages);
    }
}

File 15 of 18 : IEIP5164.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// EIP-5164 defines a cross-chain execution interface for EVM-based blockchains. 
// Implementations of this specification will allow contracts on one chain to call contracts on another by sending a cross-chain message.
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-5164.md

struct Message {
    address to;
    bytes data;
}

interface MessageDispatcher {
  event MessageDispatched(
    bytes32 indexed messageId,
    address indexed from,
    uint256 indexed toChainId,
    address to,
    bytes data
  );

  event MessageBatchDispatched(
    bytes32 indexed messageId,
    address indexed from,
    uint256 indexed toChainId,
    Message[] messages
  );
}

interface SingleMessageDispatcher is MessageDispatcher {
    /**
     * @notice Sends a message to a specified chain and address with the given data.
     * @dev This function is used to dispatch a message to a specified chain and address with the given data.
     * @param toChainId The chain ID of the destination chain.
     * @param to The address of the destination contract on the destination chain.
     * @param data The data to be sent to the destination contract.
     * @return messageId A unique identifier for the dispatched message.
     */ 
    function dispatchMessage(uint256 toChainId, address to, bytes calldata data) external payable returns (bytes32 messageId);
}

interface BatchedMessageDispatcher is MessageDispatcher {
    /**
     * @notice Sends a batch of messages to a specified chain.
     * @dev This function is used to dispatch a batch of messages to a specified chain and returns a unique identifier for the dispatched batch.
     * @param toChainId The chain ID of the destination chain.
     * @param messages An array of Message struct objects containing the destination addresses and data to be sent to each destination contract.
     * @return messageId A unique identifier for the dispatched batch.
     */ 
    function dispatchMessageBatch(uint256 toChainId, Message[] calldata messages) external payable returns (bytes32 messageId);
}

/**
 * MessageExecutor
 *
 * MessageExecutors MUST append the ABI-packed (messageId, fromChainId, from) to the calldata for each message being executed.
 *
 * to: The address of the contract to call.
 * data: The data to cross-chain.
 * messageId: The unique identifier of the message being executed.
 * fromChainId: The ID of the chain the message originated from.
 * from: The address of the sender of the message.
 * to.call(abi.encodePacked(data, messageId, fromChainId, from));
 */
interface MessageExecutor {
    error MessageIdAlreadyExecuted(
        bytes32 messageId
    );

    error MessageFailure(
        bytes32 messageId,
        bytes errorData
    );

    error MessageBatchFailure(
        bytes32 messageId,
        uint256 messageIndex,
        bytes errorData
    );

    event MessageIdExecuted(
        uint256 indexed fromChainId,
        bytes32 indexed messageId
    );
}

interface IEIP5164 is SingleMessageDispatcher, BatchedMessageDispatcher, MessageExecutor {}

File 16 of 18 : IWmbGateway.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IEIP5164.sol";

/**
 * @title IWmbGateway
 * @dev Interface for the Wanchain Message Bridge Gateway contract
 * @dev This interface is used to send and receive messages between chains
 * @dev This interface is based on EIP-5164
 * @dev It extends the EIP-5164 interface, adding a custom gasLimit feature.
 */
interface IWmbGateway is IEIP5164 {
    /**
     * @dev Estimates the fee required to send a message to a target chain
     * @param targetChainId ID of the target chain
     * @param gasLimit Total Gas limit for the message call
     * @return fee The estimated fee for the message call
     */
    function estimateFee(
        uint256 targetChainId,
        uint256 gasLimit
    ) external view returns (uint256 fee);

    /**
     * @dev Receives a message sent from another chain and verifies the signature of the sender.
     * @param messageId Unique identifier of the message to prevent replay attacks
     * @param sourceChainId ID of the source chain
     * @param sourceContract Address of the source contract
     * @param targetContract Address of the target contract
     * @param messageData Data sent in the message
     * @param gasLimit Gas limit for the message call
     * @param smgID ID of the Wanchain Storeman Group that signs the message
     * @param r R component of the SMG MPC signature
     * @param s S component of the SMG MPC signature
     * 
     * This function receives a message sent from another chain and verifies the signature of the sender using the provided SMG ID and signature components (r and s). 
     * If the signature is verified successfully, the message is executed on the target contract. 
     * The nonce value is used to prevent replay attacks. 
     * The gas limit is used to limit the amount of gas that can be used for the message execution.
     */
    function receiveMessage(
        bytes32 messageId,
        uint256 sourceChainId,
        address sourceContract,
        address targetContract,
        bytes calldata messageData,
        uint256 gasLimit,
        bytes32 smgID, 
        bytes calldata r, 
        bytes32 s
    ) external;

    /**
     * @dev Receives a message sent from another chain and verifies the signature of the sender.
     * @param messageId Unique identifier of the message to prevent replay attacks
     * @param sourceChainId ID of the source chain
     * @param sourceContract Address of the source contract
     * @param messages Data sent in the message
     * @param gasLimit Gas limit for the message call
     * @param smgID ID of the Wanchain Storeman Group that signs the message
     * @param r R component of the SMG MPC signature
     * @param s S component of the SMG MPC signature
     * 
     * This function receives a message sent from another chain and verifies the signature of the sender using the provided SMG ID and signature components (r and s). 
     * If the signature is verified successfully, the message is executed on the target contract. 
     * The nonce value is used to prevent replay attacks. 
     * The gas limit is used to limit the amount of gas that can be used for the message execution.
     */
    function receiveBatchMessage(
        bytes32 messageId,
        uint256 sourceChainId,
        address sourceContract,
        Message[] calldata messages,
        uint256 gasLimit,
        bytes32 smgID,
        bytes calldata r, 
        bytes32 s
    ) external;

    error SignatureVerifyFailed(
        bytes32 smgID,
        bytes32 sigHash,
        bytes r,
        bytes32 s
    );

    error StoremanGroupNotReady(
        bytes32 smgID,
        uint256 status,
        uint256 timestamp,
        uint256 startTime,
        uint256 endTime
    );
}

File 17 of 18 : IWmbReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title IWmbReceiver
 * @dev Interface for contracts that can receive messages from the Wanchain Message Bridge (WMB).
 */
interface IWmbReceiver {
    /**
     * @dev Handles a message received from the WMB network
     * @param data The data contained within the message
     * @param messageId The unique identifier of the message
     * @param fromChainId The ID of the chain that sent the message
     * @param from The address of the contract that sent the message
     * 
     * This interface follows the EIP-5164 standard.
     */
    function wmbReceive(
        bytes calldata data,
        bytes32 messageId,
        uint256 fromChainId,
        address from
    ) external;
}

File 18 of 18 : IEnergiWanBridge.sol
// Copyright 2023 Energi Core

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// Energi Governance system is the fundamental part of Energi Core.

// NOTE: It's not allowed to change the compiler due to byte-to-byte
//       match requirement.

pragma solidity 0.8.20;

interface IEnergiWanBridge {
  function deposit(address _tokenAddress, uint256 _amount, address _to, uint256 _chainId) external;

  function receiveTokens(
    address _from,
    address _to,
    uint256 _amount,
    address _tokenAddress,
    uint256 _chainId
  ) external;

  function updateTokenLockPeriod(uint256 _newTokenLockPeriod) external;

  function initialize(address energiWmbAppAddress_) external;

  function addToken(address _tokenAddress, bool _isBlacklisted, uint256 _minAmount) external;

  function blacklistToken(address _tokenAddress, bool _blacklist) external;

  function updateTokenMaxAmount(address _tokenAddress, uint256 _newMaxAmount) external;

  function updateEnergiWmbApp(address _newEnergiWmbApp) external;

  function updateMinAmountOfToken(address _tokenAddress, uint256 _newMinAmount) external;

  function addSupportedChainId(uint256 _chainId, bool _isSupported) external;

  function pause() external;

  function unpause() external;

  function getEnergiWmbApp() external view returns (address);

  function getVaultIds() external view returns (uint256);

  function getTokenLockPeriod() external view returns (uint256);

  function getIsTokenBlacklisted(address _tokenAddress) external view returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"_wmbGateway","type":"address"},{"internalType":"address","name":"_energiBridgeProxy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldEnergiWanBridgeAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newEnergiWanBridgeAddress","type":"address"}],"name":"EnergiWanBridgeAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"}],"name":"MessegeReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_chainId","type":"uint256"}],"name":"MessgeSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"uint256","name":"_bip44ChainId","type":"uint256"}],"name":"addChainIdToBIP44ChainId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"address","name":"_wmbAppContractAddress","type":"address"}],"name":"addWmbAppContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"toChain","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"}],"name":"estimateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"}],"name":"getBIP44ChainIdForChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"address","name":"_sourceTokenAddress","type":"address"}],"name":"getDestinationTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEnergiWanBridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"}],"name":"getEnergiWmbAppAddressForChainId","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"getEstimatedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"_wmbGateway","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"}],"name":"sendMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newEnergiWanBridgeAddress","type":"address"}],"name":"setEnergiWanBridgeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sourceTokenAddress","type":"address"},{"internalType":"address","name":"_destinationTokenAddress","type":"address"},{"internalType":"uint256","name":"_destinationChainId","type":"uint256"}],"name":"setTokensWithChainId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"fromChainIds","type":"uint256[]"},{"internalType":"address[]","name":"froms","type":"address[]"},{"internalType":"bool[]","name":"trusted","type":"bool[]"}],"name":"setTrustedRemotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenAddressForChainId","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"trustedRemotes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wmbGateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint256","name":"fromChainId","type":"uint256"},{"internalType":"address","name":"from","type":"address"}],"name":"wmbReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060405162002169380380620021698339810160408190526200003491620002be565b6200003f3362000084565b6004805460ff19169055620000558383620000d4565b600480546001600160a01b0390921661010002610100600160a81b031990921691909117905550620003089050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600254610100900460ff1615808015620000f55750600254600160ff909116105b80620001115750303b15801562000111575060025460ff166001145b620001795760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6002805460ff1916600117905580156200019d576002805461ff0019166101001790555b620001aa60008462000218565b6002805462010000600160b01b031916620100006001600160a01b03851602179055801562000213576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff166200029d5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45b5050565b80516001600160a01b0381168114620002b957600080fd5b919050565b600080600060608486031215620002d457600080fd5b620002df84620002a1565b9250620002ef60208501620002a1565b9150620002ff60408501620002a1565b90509250925092565b611e5180620003186000396000f3fe6080604052600436106101d05760003560e01c8063519a8d43116100f75780638da5cb5b11610095578063d547741f11610064578063d547741f146105ae578063e3d4683b146105ce578063f2fde38b14610609578063f3a969df14610629576101d7565b80638da5cb5b1461051557806391d1485414610533578063a217fddf14610553578063b6c4eeb114610568576101d7565b8063750bd339116100d1578063750bd339146104a05780637cfc85ae146104c05780637f34071d146104e05780638456cb5914610500576101d7565b8063519a8d43146104465780635c975abb14610473578063715018a61461048b576101d7565b806329e156c61161016f57806336568abe1161013e57806336568abe146103d15780633a1a5b76146103f15780633f4ba83a14610411578063485cc95514610426576101d7565b806329e156c61461034b5780632cb536b81461036b5780632f2ff15d1461038b5780633088a5f9146103ab576101d7565b806308b50201116101ab57806308b50201146102a1578063189ae04f146102c15780631e8387fa146102f7578063248a9ca31461031a576101d7565b8062e1d8d0146101e557806301ffc9a71461021857806305c33eb314610248576101d7565b366101d757005b3480156101e357600080fd5b005b3480156101f157600080fd5b506102056102003660046118ab565b610649565b6040519081526020015b60405180910390f35b34801561022457600080fd5b506102386102333660046118cd565b6106cb565b604051901515815260200161020f565b34801561025457600080fd5b5061028961026336600461190c565b60076020908152600092835260408084209091529082529020546001600160a01b031681565b6040516001600160a01b03909116815260200161020f565b3480156102ad57600080fd5b506101e36102bc366004611938565b610700565b3480156102cd57600080fd5b506102896102dc36600461199d565b6000908152600560205260409020546001600160a01b031690565b34801561030357600080fd5b5060045461010090046001600160a01b0316610289565b34801561032657600080fd5b5061020561033536600461199d565b6000908152600160208190526040909120015490565b34801561035757600080fd5b506101e36103663660046119b6565b610900565b34801561037757600080fd5b506101e36103863660046119e6565b610a1c565b34801561039757600080fd5b506101e36103a63660046119b6565b610b3b565b3480156103b757600080fd5b50600254610289906201000090046001600160a01b031681565b3480156103dd57600080fd5b506101e36103ec3660046119b6565b610b66565b3480156103fd57600080fd5b506101e361040c366004611a27565b610be4565b34801561041d57600080fd5b506101e3610ce2565b34801561043257600080fd5b506101e3610441366004611abe565b610cfc565b34801561045257600080fd5b5061020561046136600461199d565b60009081526006602052604090205490565b34801561047f57600080fd5b5060045460ff16610238565b34801561049757600080fd5b506101e3610e33565b3480156104ac57600080fd5b506101e36104bb366004611aec565b610e45565b3480156104cc57600080fd5b506102056104db3660046118ab565b610fd6565b3480156104ec57600080fd5b506101e36104fb366004611b55565b610fef565b34801561050c57600080fd5b506101e361117d565b34801561052157600080fd5b506000546001600160a01b0316610289565b34801561053f57600080fd5b5061023861054e3660046119b6565b611195565b34801561055f57600080fd5b50610205600081565b34801561057457600080fd5b506102896105833660046119b6565b6001600160a01b03908116600090815260076020908152604080832094835293905291909120541690565b3480156105ba57600080fd5b506101e36105c93660046119b6565b6111c0565b3480156105da57600080fd5b506102386105e93660046119b6565b600360209081526000928352604080842090915290825290205460ff1681565b34801561061557600080fd5b506101e3610624366004611aec565b6111e6565b34801561063557600080fd5b506101e36106443660046118ab565b61125f565b600254604051620e1d8d60e41b815260048101849052602481018390526000916201000090046001600160a01b03169062e1d8d090604401602060405180830381865afa15801561069e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190611bef565b90505b92915050565b60006001600160e01b03198216637965db0b60e01b14806106c557506301ffc9a760e01b6001600160e01b03198316146106c5565b610708611279565b60045461010090046001600160a01b031633146107845760405162461bcd60e51b815260206004820152602f60248201527f456e65726769576d624170703a3a204d75737420626520456e6572676957616e60448201526e109c9a5919d94818dbdb9d1c9858dd608a1b60648201526084015b60405180910390fd5b6000828152600560205260409020546001600160a01b03166108055760405162461bcd60e51b815260206004820152603460248201527f456e65726769576d624170703a3a20576d6241707020616464726573732063616044820152736e6e6f742062652061646472657373207a65726f60601b606482015260840161077b565b60008281526006602052604081205461081e9083610649565b60008481526006602090815260408083205460058352818420546001600160a01b038a81168652600785528386208a87528552948390205483518e8716958101959095528c861693850193909352606084018b9052918416608084015293945061089d9392169060a001604051602081830303815290604052846112bf565b50604080516001600160a01b0389811682528881166020830152818301889052861660608201526080810185905290517f88063d5dbd6aca206a2eebba64c61f63fbc77862599ba784444f7ae3e8809d3d9181900360a00190a150505050505050565b610908611348565b6001600160a01b0381166109745760405162461bcd60e51b815260206004820152602d60248201527f456e65726769576d624170703a3a20416464726573732063616e6e6f7420626560448201526c207a65726f206164647265737360981b606482015260840161077b565b6000828152600560205260409020546001600160a01b038083169116036109ee5760405162461bcd60e51b815260206004820152602860248201527f456e65726769576d624170703a3a2043616e6e6f74206164642064757069636160448201526774652076616c756560c01b606482015260840161077b565b60009182526005602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b610a24611348565b6001600160a01b038316610a915760405162461bcd60e51b815260206004820152602e60248201527f456e65726769576d624170703a3a20536f7572636520746f6b656e206164647260448201526d195cdcc81a5cc81a5b9d985b1a5960921b606482015260840161077b565b6001600160a01b038216610b035760405162461bcd60e51b815260206004820152603360248201527f456e65726769576d624170703a3a2044657374696e6174696f6e20746f6b656e604482015272081859191c995cdcc81a5cc81a5b9d985b1a59606a1b606482015260840161077b565b6001600160a01b0392831660009081526007602090815260408083209383529290522080546001600160a01b03191691909216179055565b60008281526001602081905260409091200154610b57816113a2565b610b6183836113ac565b505050565b6001600160a01b0381163314610bd65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161077b565b610be08282611417565b5050565b6002546201000090046001600160a01b03163314610c5c5760405162461bcd60e51b815260206004820152602f60248201527f576d624170703a204f6e6c7920574d4220676174657761792063616e2063616c60448201526e36103a3434b990333ab731ba34b7b760891b606482015260840161077b565b60008281526003602090815260408083206001600160a01b038516845290915290205460ff16610cce5760405162461bcd60e51b815260206004820152601d60248201527f576d624170703a2052656d6f7465206973206e6f742074727573746564000000604482015260640161077b565b610cdb858585858561147e565b5050505050565b610cea61157c565b610cf2611348565b610cfa6115c5565b565b600254610100900460ff1615808015610d1c5750600254600160ff909116105b80610d365750303b158015610d36575060025460ff166001145b610d995760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161077b565b6002805460ff191660011790558015610dbc576002805461ff0019166101001790555b610dc76000846113ac565b6002805462010000600160b01b031916620100006001600160a01b038516021790558015610b61576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b610e3b611348565b610cfa6000611617565b610e4d611348565b600480546001600160a01b03838116610100818102610100600160a81b0319851617909455929091041690610ee25760405162461bcd60e51b815260206004820152603560248201527f456e65726769576d624170703a3a20456e6572676957616e4272696467652063604482015274616e6e6f74206265207a65726f206164647265737360581b606482015260840161077b565b816001600160a01b0316816001600160a01b031603610f8f5760405162461bcd60e51b815260206004820152605960248201527f456e65726769576d624170703a3a20456e6572676957616e427269646765206160448201527f6464726573732063616e6e6f742062652073616d652061732070726576696f7560648201527f7320456e6572676957616e427269646765206164647265737300000000000000608482015260a40161077b565b604080516001600160a01b038084168252841660208201527fb7129cc3336f0b2447625cdb29ef8a6cf6ca342837f1a5b0e303c63f2eedd611910160405180910390a15050565b6000828152600660205260408120546106c29083610649565b610ffa600033611195565b6110625760405162461bcd60e51b815260206004820152603360248201527f576d624170703a206d75737420686176652061646d696e20726f6c6520746f2060448201527273657420747275737465642072656d6f74657360681b606482015260840161077b565b848314801561107057508281145b6110b45760405162461bcd60e51b815260206004820152601560248201527415db58905c1c0e881a5b9d985b1a59081a5b9c1d5d605a1b604482015260640161077b565b60005b85811015611174578282828181106110d1576110d1611c08565b90506020020160208101906110e69190611c1e565b600360008989858181106110fc576110fc611c08565b905060200201358152602001908152602001600020600087878581811061112557611125611c08565b905060200201602081019061113a9190611aec565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061116c81611c56565b9150506110b7565b50505050505050565b611185611279565b61118d611348565b610cfa611667565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600082815260016020819052604090912001546111dc816113a2565b610b618383611417565b6111ee611348565b6001600160a01b0381166112535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161077b565b61125c81611617565b50565b611267611348565b60009182526006602052604090912055565b60045460ff1615610cfa5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161077b565b60025460405163fe39827b60e01b81526000916201000090046001600160a01b03169063fe39827b9084906112fc90899089908990600401611cbf565b60206040518083038185885af115801561131a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061133f9190611bef565b95945050505050565b6000546001600160a01b03163314610cfa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161077b565b61125c81336116a4565b6113b68282611195565b610be05760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6114218282611195565b15610be05760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080808061148f888a018a611ce9565b6004805460405163124cff7160e11b81526001600160a01b03808816938201939093528286166024820152604481018590528284166064820152608481018d905295995093975091955093506101009091041690632499fee29060a401600060405180830381600087803b15801561150657600080fd5b505af115801561151a573d6000803e3d6000fd5b5050604080516001600160a01b03888116825287811660208301528183018790528516606082015290517ff877ec0aa867a43299f1f3c0402fcdfcd7e4153de0e24af2def92b391fbd359a9350908190036080019150a1505050505050505050565b60045460ff16610cfa5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161077b565b6115cd61157c565b6004805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61166f611279565b6004805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115fa3390565b6116ae8282611195565b610be0576116bb816116fd565b6116c683602061170f565b6040516020016116d7929190611d3c565b60408051601f198184030181529082905262461bcd60e51b825261077b91600401611db1565b60606106c56001600160a01b03831660145b6060600061171e836002611dc4565b611729906002611ddb565b67ffffffffffffffff81111561174157611741611dee565b6040519080825280601f01601f19166020018201604052801561176b576020820181803683370190505b509050600360fc1b8160008151811061178657611786611c08565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117b5576117b5611c08565b60200101906001600160f81b031916908160001a90535060006117d9846002611dc4565b6117e4906001611ddb565b90505b600181111561185c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061181857611818611c08565b1a60f81b82828151811061182e5761182e611c08565b60200101906001600160f81b031916908160001a90535060049490941c9361185581611e04565b90506117e7565b5083156106c25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161077b565b600080604083850312156118be57600080fd5b50508035926020909101359150565b6000602082840312156118df57600080fd5b81356001600160e01b0319811681146106c257600080fd5b6001600160a01b038116811461125c57600080fd5b6000806040838503121561191f57600080fd5b823561192a816118f7565b946020939093013593505050565b60008060008060008060c0878903121561195157600080fd5b863561195c816118f7565b9550602087013561196c816118f7565b9450604087013593506060870135611983816118f7565b9598949750929560808101359460a0909101359350915050565b6000602082840312156119af57600080fd5b5035919050565b600080604083850312156119c957600080fd5b8235915060208301356119db816118f7565b809150509250929050565b6000806000606084860312156119fb57600080fd5b8335611a06816118f7565b92506020840135611a16816118f7565b929592945050506040919091013590565b600080600080600060808688031215611a3f57600080fd5b853567ffffffffffffffff80821115611a5757600080fd5b818801915088601f830112611a6b57600080fd5b813581811115611a7a57600080fd5b896020828501011115611a8c57600080fd5b602092830197509550508601359250604086013591506060860135611ab0816118f7565b809150509295509295909350565b60008060408385031215611ad157600080fd5b8235611adc816118f7565b915060208301356119db816118f7565b600060208284031215611afe57600080fd5b81356106c2816118f7565b60008083601f840112611b1b57600080fd5b50813567ffffffffffffffff811115611b3357600080fd5b6020830191508360208260051b8501011115611b4e57600080fd5b9250929050565b60008060008060008060608789031215611b6e57600080fd5b863567ffffffffffffffff80821115611b8657600080fd5b611b928a838b01611b09565b90985096506020890135915080821115611bab57600080fd5b611bb78a838b01611b09565b90965094506040890135915080821115611bd057600080fd5b50611bdd89828a01611b09565b979a9699509497509295939492505050565b600060208284031215611c0157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c3057600080fd5b813580151581146106c257600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c6857611c68611c40565b5060010190565b60005b83811015611c8a578181015183820152602001611c72565b50506000910152565b60008151808452611cab816020860160208601611c6f565b601f01601f19169290920160200192915050565b8381526001600160a01b038316602082015260606040820181905260009061133f90830184611c93565b60008060008060808587031215611cff57600080fd5b8435611d0a816118f7565b93506020850135611d1a816118f7565b9250604085013591506060850135611d31816118f7565b939692955090935050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611d74816017850160208801611c6f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611da5816028840160208801611c6f565b01602801949350505050565b6020815260006106c26020830184611c93565b80820281158282048414176106c5576106c5611c40565b808201808211156106c5576106c5611c40565b634e487b7160e01b600052604160045260246000fd5b600081611e1357611e13611c40565b50600019019056fea26469706673582212207ebaca9902ed0c24bedb0715ebf6562bec55def4d2b174804b39704a546e2dc864736f6c6343000814003300000000000000000000000080876c44f31fce49384dddb28b22a185aff3f2a30000000000000000000000007280e3b8c686c68207acb1a4d656b2fc8079c033000000000000000000000000fe9d15010a9a1f02881e42e1e96c4ca4663d91a2

Deployed Bytecode

0x6080604052600436106101d05760003560e01c8063519a8d43116100f75780638da5cb5b11610095578063d547741f11610064578063d547741f146105ae578063e3d4683b146105ce578063f2fde38b14610609578063f3a969df14610629576101d7565b80638da5cb5b1461051557806391d1485414610533578063a217fddf14610553578063b6c4eeb114610568576101d7565b8063750bd339116100d1578063750bd339146104a05780637cfc85ae146104c05780637f34071d146104e05780638456cb5914610500576101d7565b8063519a8d43146104465780635c975abb14610473578063715018a61461048b576101d7565b806329e156c61161016f57806336568abe1161013e57806336568abe146103d15780633a1a5b76146103f15780633f4ba83a14610411578063485cc95514610426576101d7565b806329e156c61461034b5780632cb536b81461036b5780632f2ff15d1461038b5780633088a5f9146103ab576101d7565b806308b50201116101ab57806308b50201146102a1578063189ae04f146102c15780631e8387fa146102f7578063248a9ca31461031a576101d7565b8062e1d8d0146101e557806301ffc9a71461021857806305c33eb314610248576101d7565b366101d757005b3480156101e357600080fd5b005b3480156101f157600080fd5b506102056102003660046118ab565b610649565b6040519081526020015b60405180910390f35b34801561022457600080fd5b506102386102333660046118cd565b6106cb565b604051901515815260200161020f565b34801561025457600080fd5b5061028961026336600461190c565b60076020908152600092835260408084209091529082529020546001600160a01b031681565b6040516001600160a01b03909116815260200161020f565b3480156102ad57600080fd5b506101e36102bc366004611938565b610700565b3480156102cd57600080fd5b506102896102dc36600461199d565b6000908152600560205260409020546001600160a01b031690565b34801561030357600080fd5b5060045461010090046001600160a01b0316610289565b34801561032657600080fd5b5061020561033536600461199d565b6000908152600160208190526040909120015490565b34801561035757600080fd5b506101e36103663660046119b6565b610900565b34801561037757600080fd5b506101e36103863660046119e6565b610a1c565b34801561039757600080fd5b506101e36103a63660046119b6565b610b3b565b3480156103b757600080fd5b50600254610289906201000090046001600160a01b031681565b3480156103dd57600080fd5b506101e36103ec3660046119b6565b610b66565b3480156103fd57600080fd5b506101e361040c366004611a27565b610be4565b34801561041d57600080fd5b506101e3610ce2565b34801561043257600080fd5b506101e3610441366004611abe565b610cfc565b34801561045257600080fd5b5061020561046136600461199d565b60009081526006602052604090205490565b34801561047f57600080fd5b5060045460ff16610238565b34801561049757600080fd5b506101e3610e33565b3480156104ac57600080fd5b506101e36104bb366004611aec565b610e45565b3480156104cc57600080fd5b506102056104db3660046118ab565b610fd6565b3480156104ec57600080fd5b506101e36104fb366004611b55565b610fef565b34801561050c57600080fd5b506101e361117d565b34801561052157600080fd5b506000546001600160a01b0316610289565b34801561053f57600080fd5b5061023861054e3660046119b6565b611195565b34801561055f57600080fd5b50610205600081565b34801561057457600080fd5b506102896105833660046119b6565b6001600160a01b03908116600090815260076020908152604080832094835293905291909120541690565b3480156105ba57600080fd5b506101e36105c93660046119b6565b6111c0565b3480156105da57600080fd5b506102386105e93660046119b6565b600360209081526000928352604080842090915290825290205460ff1681565b34801561061557600080fd5b506101e3610624366004611aec565b6111e6565b34801561063557600080fd5b506101e36106443660046118ab565b61125f565b600254604051620e1d8d60e41b815260048101849052602481018390526000916201000090046001600160a01b03169062e1d8d090604401602060405180830381865afa15801561069e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c29190611bef565b90505b92915050565b60006001600160e01b03198216637965db0b60e01b14806106c557506301ffc9a760e01b6001600160e01b03198316146106c5565b610708611279565b60045461010090046001600160a01b031633146107845760405162461bcd60e51b815260206004820152602f60248201527f456e65726769576d624170703a3a204d75737420626520456e6572676957616e60448201526e109c9a5919d94818dbdb9d1c9858dd608a1b60648201526084015b60405180910390fd5b6000828152600560205260409020546001600160a01b03166108055760405162461bcd60e51b815260206004820152603460248201527f456e65726769576d624170703a3a20576d6241707020616464726573732063616044820152736e6e6f742062652061646472657373207a65726f60601b606482015260840161077b565b60008281526006602052604081205461081e9083610649565b60008481526006602090815260408083205460058352818420546001600160a01b038a81168652600785528386208a87528552948390205483518e8716958101959095528c861693850193909352606084018b9052918416608084015293945061089d9392169060a001604051602081830303815290604052846112bf565b50604080516001600160a01b0389811682528881166020830152818301889052861660608201526080810185905290517f88063d5dbd6aca206a2eebba64c61f63fbc77862599ba784444f7ae3e8809d3d9181900360a00190a150505050505050565b610908611348565b6001600160a01b0381166109745760405162461bcd60e51b815260206004820152602d60248201527f456e65726769576d624170703a3a20416464726573732063616e6e6f7420626560448201526c207a65726f206164647265737360981b606482015260840161077b565b6000828152600560205260409020546001600160a01b038083169116036109ee5760405162461bcd60e51b815260206004820152602860248201527f456e65726769576d624170703a3a2043616e6e6f74206164642064757069636160448201526774652076616c756560c01b606482015260840161077b565b60009182526005602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b610a24611348565b6001600160a01b038316610a915760405162461bcd60e51b815260206004820152602e60248201527f456e65726769576d624170703a3a20536f7572636520746f6b656e206164647260448201526d195cdcc81a5cc81a5b9d985b1a5960921b606482015260840161077b565b6001600160a01b038216610b035760405162461bcd60e51b815260206004820152603360248201527f456e65726769576d624170703a3a2044657374696e6174696f6e20746f6b656e604482015272081859191c995cdcc81a5cc81a5b9d985b1a59606a1b606482015260840161077b565b6001600160a01b0392831660009081526007602090815260408083209383529290522080546001600160a01b03191691909216179055565b60008281526001602081905260409091200154610b57816113a2565b610b6183836113ac565b505050565b6001600160a01b0381163314610bd65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161077b565b610be08282611417565b5050565b6002546201000090046001600160a01b03163314610c5c5760405162461bcd60e51b815260206004820152602f60248201527f576d624170703a204f6e6c7920574d4220676174657761792063616e2063616c60448201526e36103a3434b990333ab731ba34b7b760891b606482015260840161077b565b60008281526003602090815260408083206001600160a01b038516845290915290205460ff16610cce5760405162461bcd60e51b815260206004820152601d60248201527f576d624170703a2052656d6f7465206973206e6f742074727573746564000000604482015260640161077b565b610cdb858585858561147e565b5050505050565b610cea61157c565b610cf2611348565b610cfa6115c5565b565b600254610100900460ff1615808015610d1c5750600254600160ff909116105b80610d365750303b158015610d36575060025460ff166001145b610d995760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161077b565b6002805460ff191660011790558015610dbc576002805461ff0019166101001790555b610dc76000846113ac565b6002805462010000600160b01b031916620100006001600160a01b038516021790558015610b61576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b610e3b611348565b610cfa6000611617565b610e4d611348565b600480546001600160a01b03838116610100818102610100600160a81b0319851617909455929091041690610ee25760405162461bcd60e51b815260206004820152603560248201527f456e65726769576d624170703a3a20456e6572676957616e4272696467652063604482015274616e6e6f74206265207a65726f206164647265737360581b606482015260840161077b565b816001600160a01b0316816001600160a01b031603610f8f5760405162461bcd60e51b815260206004820152605960248201527f456e65726769576d624170703a3a20456e6572676957616e427269646765206160448201527f6464726573732063616e6e6f742062652073616d652061732070726576696f7560648201527f7320456e6572676957616e427269646765206164647265737300000000000000608482015260a40161077b565b604080516001600160a01b038084168252841660208201527fb7129cc3336f0b2447625cdb29ef8a6cf6ca342837f1a5b0e303c63f2eedd611910160405180910390a15050565b6000828152600660205260408120546106c29083610649565b610ffa600033611195565b6110625760405162461bcd60e51b815260206004820152603360248201527f576d624170703a206d75737420686176652061646d696e20726f6c6520746f2060448201527273657420747275737465642072656d6f74657360681b606482015260840161077b565b848314801561107057508281145b6110b45760405162461bcd60e51b815260206004820152601560248201527415db58905c1c0e881a5b9d985b1a59081a5b9c1d5d605a1b604482015260640161077b565b60005b85811015611174578282828181106110d1576110d1611c08565b90506020020160208101906110e69190611c1e565b600360008989858181106110fc576110fc611c08565b905060200201358152602001908152602001600020600087878581811061112557611125611c08565b905060200201602081019061113a9190611aec565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061116c81611c56565b9150506110b7565b50505050505050565b611185611279565b61118d611348565b610cfa611667565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600082815260016020819052604090912001546111dc816113a2565b610b618383611417565b6111ee611348565b6001600160a01b0381166112535760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161077b565b61125c81611617565b50565b611267611348565b60009182526006602052604090912055565b60045460ff1615610cfa5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161077b565b60025460405163fe39827b60e01b81526000916201000090046001600160a01b03169063fe39827b9084906112fc90899089908990600401611cbf565b60206040518083038185885af115801561131a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061133f9190611bef565b95945050505050565b6000546001600160a01b03163314610cfa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161077b565b61125c81336116a4565b6113b68282611195565b610be05760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6114218282611195565b15610be05760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080808061148f888a018a611ce9565b6004805460405163124cff7160e11b81526001600160a01b03808816938201939093528286166024820152604481018590528284166064820152608481018d905295995093975091955093506101009091041690632499fee29060a401600060405180830381600087803b15801561150657600080fd5b505af115801561151a573d6000803e3d6000fd5b5050604080516001600160a01b03888116825287811660208301528183018790528516606082015290517ff877ec0aa867a43299f1f3c0402fcdfcd7e4153de0e24af2def92b391fbd359a9350908190036080019150a1505050505050505050565b60045460ff16610cfa5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161077b565b6115cd61157c565b6004805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61166f611279565b6004805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115fa3390565b6116ae8282611195565b610be0576116bb816116fd565b6116c683602061170f565b6040516020016116d7929190611d3c565b60408051601f198184030181529082905262461bcd60e51b825261077b91600401611db1565b60606106c56001600160a01b03831660145b6060600061171e836002611dc4565b611729906002611ddb565b67ffffffffffffffff81111561174157611741611dee565b6040519080825280601f01601f19166020018201604052801561176b576020820181803683370190505b509050600360fc1b8160008151811061178657611786611c08565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106117b5576117b5611c08565b60200101906001600160f81b031916908160001a90535060006117d9846002611dc4565b6117e4906001611ddb565b90505b600181111561185c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061181857611818611c08565b1a60f81b82828151811061182e5761182e611c08565b60200101906001600160f81b031916908160001a90535060049490941c9361185581611e04565b90506117e7565b5083156106c25760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161077b565b600080604083850312156118be57600080fd5b50508035926020909101359150565b6000602082840312156118df57600080fd5b81356001600160e01b0319811681146106c257600080fd5b6001600160a01b038116811461125c57600080fd5b6000806040838503121561191f57600080fd5b823561192a816118f7565b946020939093013593505050565b60008060008060008060c0878903121561195157600080fd5b863561195c816118f7565b9550602087013561196c816118f7565b9450604087013593506060870135611983816118f7565b9598949750929560808101359460a0909101359350915050565b6000602082840312156119af57600080fd5b5035919050565b600080604083850312156119c957600080fd5b8235915060208301356119db816118f7565b809150509250929050565b6000806000606084860312156119fb57600080fd5b8335611a06816118f7565b92506020840135611a16816118f7565b929592945050506040919091013590565b600080600080600060808688031215611a3f57600080fd5b853567ffffffffffffffff80821115611a5757600080fd5b818801915088601f830112611a6b57600080fd5b813581811115611a7a57600080fd5b896020828501011115611a8c57600080fd5b602092830197509550508601359250604086013591506060860135611ab0816118f7565b809150509295509295909350565b60008060408385031215611ad157600080fd5b8235611adc816118f7565b915060208301356119db816118f7565b600060208284031215611afe57600080fd5b81356106c2816118f7565b60008083601f840112611b1b57600080fd5b50813567ffffffffffffffff811115611b3357600080fd5b6020830191508360208260051b8501011115611b4e57600080fd5b9250929050565b60008060008060008060608789031215611b6e57600080fd5b863567ffffffffffffffff80821115611b8657600080fd5b611b928a838b01611b09565b90985096506020890135915080821115611bab57600080fd5b611bb78a838b01611b09565b90965094506040890135915080821115611bd057600080fd5b50611bdd89828a01611b09565b979a9699509497509295939492505050565b600060208284031215611c0157600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c3057600080fd5b813580151581146106c257600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c6857611c68611c40565b5060010190565b60005b83811015611c8a578181015183820152602001611c72565b50506000910152565b60008151808452611cab816020860160208601611c6f565b601f01601f19169290920160200192915050565b8381526001600160a01b038316602082015260606040820181905260009061133f90830184611c93565b60008060008060808587031215611cff57600080fd5b8435611d0a816118f7565b93506020850135611d1a816118f7565b9250604085013591506060850135611d31816118f7565b939692955090935050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611d74816017850160208801611c6f565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611da5816028840160208801611c6f565b01602801949350505050565b6020815260006106c26020830184611c93565b80820281158282048414176106c5576106c5611c40565b808201808211156106c5576106c5611c40565b634e487b7160e01b600052604160045260246000fd5b600081611e1357611e13611c40565b50600019019056fea26469706673582212207ebaca9902ed0c24bedb0715ebf6562bec55def4d2b174804b39704a546e2dc864736f6c63430008140033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000080876c44f31fce49384dddb28b22a185aff3f2a30000000000000000000000007280e3b8c686c68207acb1a4d656b2fc8079c033000000000000000000000000fe9d15010a9a1f02881e42e1e96c4ca4663d91a2

-----Decoded View---------------
Arg [0] : admin (address): 0x80876c44F31fce49384DdDb28B22a185AFF3f2a3
Arg [1] : _wmbGateway (address): 0x7280E3b8c686c68207aCb1A4D656b2FC8079c033
Arg [2] : _energiBridgeProxy (address): 0xfE9D15010A9a1F02881E42e1e96c4cA4663D91A2

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000080876c44f31fce49384dddb28b22a185aff3f2a3
Arg [1] : 0000000000000000000000007280e3b8c686c68207acb1a4d656b2fc8079c033
Arg [2] : 000000000000000000000000fe9d15010a9a1f02881e42e1e96c4ca4663d91a2


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.