Bokuto Testnet

Contract

0x08bad1A48b0B08Bf769f83ba30c1DaD0F8Bb8b6B
Source Code Source Code

Overview

ETH Balance

0.00012 ETH

More Info

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Amount
User Lock186689672025-12-30 7:35:3910 days ago1767080139IN
0x08bad1A4...0F8Bb8b6B
0.00036 ETH0.00000010.00100026
Set Fees186672602025-12-30 7:07:1210 days ago1767078432IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000000030.00100026
Set Fees186585122025-12-30 4:41:2410 days ago1767069684IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000000050.00100026
Smg Release186522862025-12-30 2:57:3810 days ago1767063458IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000000190.00100026
User Lock186500112025-12-30 2:19:4310 days ago1767061183IN
0x08bad1A4...0F8Bb8b6B
0.0002 ETH0.000000110.00120031
Set Admin175435292025-12-17 6:58:2123 days ago1765954701IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000006720.0012
Set Chain ID175435272025-12-17 6:58:1923 days ago1765954699IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000006740.0012
Config Operator175435252025-12-17 6:58:1723 days ago1765954697IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000006750.0012
Set Admin175435222025-12-17 6:58:1423 days ago1765954694IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000006740.0012
Set Partners175435202025-12-17 6:58:1223 days ago1765954692IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000009430.0012
Upgrade To175434952025-12-17 6:57:4723 days ago1765954667IN
0x08bad1A4...0F8Bb8b6B
0 ETH0.000006290.0012

Latest 2 internal transactions

Parent Transaction Hash Block From To Amount
186689672025-12-30 7:35:3910 days ago1767080139
0x08bad1A4...0F8Bb8b6B
0.00034 ETH
186522862025-12-30 2:57:3810 days ago1767063458
0x08bad1A4...0F8Bb8b6B
0.0001 ETH

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CrossProxy

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity 0.8.18;

/**
 * Math operations with safety checks
 */

import "../components/Proxy.sol";
import "../components/Halt.sol";
import "../components/ReentrancyGuard.sol";
import "./CrossStorage.sol";

/**
 * @title CrossProxy
 * @dev Proxy contract for cross-chain functionality that allows for implementation upgrades
 * This contract inherits from:
 * - CrossStorage: For storing cross-chain related data
 * - ReentrancyGuard: To prevent reentrancy attacks
 * - Halt: To provide emergency stop functionality
 * - Proxy: To enable implementation upgrades
 */
contract CrossProxy is CrossStorage, ReentrancyGuard, Halt, Proxy {

    /**
     * @dev Updates the implementation address of the CrossDelegate contract
     * @param impl The address of the new CrossDelegate contract implementation
     * Requirements:
     * - Caller must be the owner
     * - New implementation address cannot be zero
     * - New implementation address must be different from current implementation
     * Emits:
     * - Upgraded event with the new implementation address
     */
    function upgradeTo(address impl) public onlyOwner {
        require(impl != address(0), "Cannot upgrade to invalid address");
        require(impl != _implementation, "Cannot upgrade to the same implementation");
        _implementation = impl;
        emit Upgraded(impl);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 3 of 17 : BasicStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import "../lib/BasicStorageLib.sol";

/**
 * @title BasicStorage
 * @dev Base contract for managing different types of storage data
 * This contract provides basic storage functionality for various data types
 * using the BasicStorageLib library
 * 
 * Key features:
 * - Multiple data type storage support
 * - Library-based storage management
 * - Internal storage access
 * 
 * @custom:usage
 * - Used as base contract for storage functionality
 * - Provides structured storage for different data types
 * - Supports inheritance for storage management
 */
contract BasicStorage {
    /************************************************************
     **
     ** VARIABLES
     **
     ************************************************************/

    //// basic variables
    /**
     * @dev Library usage declarations for different data types
     * 
     * @custom:usage
     * - UintData: For unsigned integer storage
     * - BoolData: For boolean storage
     * - AddressData: For address storage
     * - BytesData: For bytes storage
     * - StringData: For string storage
     */
    using BasicStorageLib for BasicStorageLib.UintData;
    using BasicStorageLib for BasicStorageLib.BoolData;
    using BasicStorageLib for BasicStorageLib.AddressData;
    using BasicStorageLib for BasicStorageLib.BytesData;
    using BasicStorageLib for BasicStorageLib.StringData;

    /**
     * @dev Internal storage variables for different data types
     * 
     * @custom:usage
     * - uintData: Stores unsigned integers
     * - boolData: Stores boolean values
     * - addressData: Stores addresses
     * - bytesData: Stores bytes data
     * - stringData: Stores strings
     * 
     * @custom:security
     * - Internal visibility for controlled access
     * - Library-based storage management
     */
    BasicStorageLib.UintData    internal uintData;
    BasicStorageLib.BoolData    internal boolData;
    BasicStorageLib.AddressData internal addressData;
    BasicStorageLib.BytesData   internal bytesData;
    BasicStorageLib.StringData  internal stringData;
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;
import './Owned.sol';

/**
 * @title Halt
 * @dev Contract for emergency stop functionality
 * This contract provides functionality to halt and resume contract operations
 * in emergency situations
 * 
 * Key features:
 * - Emergency stop mechanism
 * - Access control through ownership
 * - Modifiers for halted state checks
 * 
 * @custom:security
 * - Inherits Owned contract for ownership management
 * - Only owner can halt/resume operations
 * - State checks through modifiers
 */
contract Halt is Owned {

    /**
     * @dev Public state variable indicating if contract is halted
     * 
     * @custom:usage
     * - Controls contract operation state
     * - Accessible for external queries
     * - Modified through setHalt function
     */
    bool public halted = false;

    /**
     * @dev Modifier to ensure contract is not halted
     * 
     * @custom:requirements
     * - Contract must not be in halted state
     * 
     * @custom:reverts
     * - If contract is halted
     */
    modifier notHalted() {
        require(!halted, "Smart contract is halted");
        _;
    }

    /**
     * @dev Modifier to ensure contract is halted
     * 
     * @custom:requirements
     * - Contract must be in halted state
     * 
     * @custom:reverts
     * - If contract is not halted
     */
    modifier isHalted() {
        require(halted, "Smart contract is not halted");
        _;
    }

    /**
     * @dev Sets the halted state of the contract
     * 
     * @param halt Boolean indicating desired halted state
     * 
     * @custom:requirements
     * - Caller must be the contract owner
     * 
     * @custom:effects
     * - Updates halted state
     * - Controls contract operation availability
     */
    function setHalt(bool halt)
        public
        onlyOwner
    {
        halted = halt;
    }
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

/**
 * @title Owned
 * @dev Base contract for ownership management
 * This contract provides functionality for managing contract ownership
 * with support for ownership transfer and renunciation
 * 
 * Key features:
 * - Ownership assignment
 * - Ownership transfer
 * - Ownership renunciation
 * - Two-step ownership transfer
 * 
 * @custom:security
 * - Owner-only access control
 * - Safe ownership transfer
 * - Ownership renunciation capability
 */
contract Owned {

    /**
     * @dev Emitted when ownership is transferred
     * 
     * @param previousOwner Address of the previous owner
     * @param newOwner Address of the new owner
     */
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Modifier to restrict function access to owner only
     * 
     * @custom:requirements
     * - Caller must be the contract owner
     * 
     * @custom:reverts
     * - If caller is not the owner
     */
    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    /**
     * @dev Public state variable for contract owner
     * 
     * @custom:usage
     * - Stores current owner address
     * - Accessible for external queries
     * - Modified through ownership functions
     */
    address public owner;

    /**
     * @dev Constructor assigns initial owner
     * 
     * @custom:effects
     * - Sets initial owner to contract deployer
     */
    constructor() {
        owner = msg.sender;
    }

    /**
     * @dev Public state variable for pending owner
     * 
     * @custom:usage
     * - Stores address of pending owner
     * - Used in two-step ownership transfer
     */
    address public newOwner;

    /**
     * @dev Transfers ownership to a new address
     * 
     * @param _newOwner Address of the new owner
     * 
     * @custom:requirements
     * - Caller must be the current owner
     * - New owner address must not be zero
     * 
     * @custom:effects
     * - Updates owner address
     * - Emits OwnershipTransferred event
     */
    function transferOwner(address _newOwner) public onlyOwner {
        require(_newOwner != address(0), "New owner is the zero address");
        emit OwnershipTransferred(owner, _newOwner);
        owner = _newOwner;
    }

    /**
     * @dev Initiates two-step ownership transfer
     * 
     * @param _newOwner Address of the new owner
     * 
     * @custom:requirements
     * - Caller must be the current owner
     * 
     * @custom:effects
     * - Sets pending owner address
     */
    function changeOwner(address _newOwner) public onlyOwner {
        newOwner = _newOwner;
    }

    /**
     * @dev Accepts pending ownership transfer
     * 
     * @custom:requirements
     * - Caller must be the pending owner
     * 
     * @custom:effects
     * - Updates owner address to pending owner
     */
    function acceptOwnership() public {
        if (msg.sender == newOwner) {
            owner = newOwner;
        }
    }

    /**
     * @dev Renounces ownership of the contract
     * 
     * @custom:requirements
     * - Caller must be the current owner
     * 
     * @custom:effects
     * - Sets owner to zero address
     * - Makes contract unowned
     */
    function renounceOwnership() public onlyOwner {
        owner = address(0);
    }
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

/**
 * @title Proxy
 * @dev Base contract for proxy pattern implementation
 * This contract provides functionality for delegating calls to implementation contracts
 * and supports contract upgradeability
 * 
 * Key features:
 * - Implementation contract delegation
 * - Contract upgrade support
 * - Fallback handling
 * - Receive function support
 * 
 * @custom:security
 * - Implementation address validation
 * - Safe delegatecall execution
 * - Proper return data handling
 */
contract Proxy {

    /**
     * @dev Emitted when the implementation contract is upgraded
     * 
     * @param implementation Address of the new implementation contract
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Internal storage for implementation contract address
     * 
     * @custom:usage
     * - Stores current implementation address
     * - Used for delegatecall operations
     * - Modified through upgrade operations
     */
    address internal _implementation;

    /**
     * @dev Returns the current implementation contract address
     * 
     * @return Address of the current implementation contract
     */
    function implementation() public view returns (address) {
        return _implementation;
    }

    /**
     * @dev Internal function to handle fallback calls
     * Delegates all calls to the implementation contract
     * 
     * @custom:requirements
     * - Implementation contract must be set
     * 
     * @custom:effects
     * - Executes delegatecall to implementation
     * - Handles return data
     * 
     * @custom:reverts
     * - If implementation contract is not set
     * - If delegatecall fails
     */
    function _fallback() internal {
        address _impl = _implementation;
        require(_impl != address(0), "implementation contract not set");

        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize())
            let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(ptr, 0, size)

            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
        }
    }

    /**
     * @dev Fallback function to handle unknown function calls
     * Delegates all calls to the implementation contract
     * 
     * @custom:effects
     * - Forwards call to _fallback
     */
    fallback() external payable {
        return _fallback();
    }

    /**
     * @dev Receive function to handle incoming ETH
     * Delegates all calls to the implementation contract
     * 
     * @custom:effects
     * - Forwards call to _fallback
     */
    receive() external payable {
        return _fallback();
    }
}

File 7 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

/**
 * @title ReentrancyGuard
 * @dev Abstract contract module that helps prevent reentrant calls to a function
 *
 * Key features:
 * - Prevents reentrant function calls
 * - Gas optimization for refunds
 * - Support for nested function protection
 *
 * @custom:security
 * - Prevents reentrancy attacks
 * - Optimizes gas refunds
 * - Supports private function calls
 * 
 * @custom:usage
 * - Inherit this contract to use nonReentrant modifier
 * - Apply nonReentrant modifier to functions that need protection
 * - Use private functions for nested calls
 */
abstract contract ReentrancyGuard {
    /**
     * @dev Private state variable to track reentrancy status
     * 
     * @custom:usage
     * - true: Function can be entered
     * - false: Function is currently executing
     * 
     * @custom:security
     * - Prevents reentrant calls
     * - Optimizes gas refunds
     */
    bool private _notEntered;

    /**
     * @dev Constructor initializes the reentrancy guard
     * 
     * @custom:effects
     * - Sets initial state to true
     * - Optimizes gas refunds
     * 
     * @custom:security
     * - Ensures proper initialization
     * - Prevents initial reentrancy
     */
    constructor () {
        // Storing an initial non-zero value makes deployment a bit more
        // expensive, but in exchange the refund on every call to nonReentrant
        // will be lower in amount. Since refunds are capped to a percetange of
        // the total transaction's gas, it is best to keep them low in cases
        // like this one, to increase the likelihood of the full refund coming
        // into effect.
        _notEntered = true;
    }

    /**
     * @dev Modifier to prevent reentrant calls to a function
     * 
     * @custom:requirements
     * - Function must not be currently executing
     * 
     * @custom:effects
     * - Sets _notEntered to false during execution
     * - Restores _notEntered to true after execution
     * 
     * @custom:reverts
     * - If function is already executing
     * 
     * @custom:usage
     * - Apply to functions that need reentrancy protection
     * - Use with private functions for nested calls
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_notEntered, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _notEntered = false;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _notEntered = true;
    }
}

File 8 of 17 : CrossStorage.sol
// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

import "../components/BasicStorage.sol";
import "./lib/CrossTypes.sol";
import "./lib/HTLCTxLib.sol";
import "./lib/RapidityTxLib.sol";

/**
 * @title CrossStorage
 * @dev Storage contract for cross-chain functionality that manages cross-chain related data
 * This contract inherits from BasicStorage and provides storage for:
 * - HTLC (Hash Time-Locked Contract) transactions
 * - Rapidity transactions
 * - Cross-chain types and data
 */
contract CrossStorage is BasicStorage {
    using HTLCTxLib for HTLCTxLib.Data;
    using RapidityTxLib for RapidityTxLib.Data;

    /************************************************************
     **
     ** VARIABLES
     **
     ************************************************************/

    /**
     * @dev Internal storage for cross-chain related data
     */
    CrossTypes.Data internal storageData;

    /**
     * @notice Time period for which assets are locked in HTLC transactions
     * @dev Default value is 36 hours (3600*36 seconds)
     */
    uint public lockedTime = uint(3600*36);

    /**
     * @notice Timeout period for storeman group fee receiver address changes
     * @dev Since storeman group admin receiver address may be changed, system ensures:
     * - New address becomes valid after this timeout
     * - Old address becomes invalid after this timeout
     * Default value is 10 minutes (10*60 seconds)
     */
    uint public smgFeeReceiverTimeout = uint(10*60);

    /**
     * @notice Enumeration of possible states for a storeman group
     * @dev States:
     * - none: Initial state
     * - initial: Group has been initialized
     * - curveSeted: Curve parameters have been set
     * - failed: Group setup has failed
     * - selected: Group has been selected
     * - ready: Group is ready for operations
     * - unregistered: Group has been unregistered
     * - dismissed: Group has been dismissed
     */
    enum GroupStatus { none, initial, curveSeted, failed, selected, ready, unregistered, dismissed }

}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

import "../../interfaces/IRC20Protocol.sol";
import "../../interfaces/IQuota.sol";
import "../../interfaces/IStoremanGroup.sol";
import "../../interfaces/ITokenManager.sol";
import "../../interfaces/ISignatureVerifier.sol";
import "./HTLCTxLib.sol";
import "./RapidityTxLib.sol";

/**
 * @title CrossTypes
 * @dev Library containing common types and utilities for cross-chain operations
 * This library provides:
 * - Data structures for cross-chain transactions
 * - Utility functions for address and token operations
 */
library CrossTypes {
    using SafeMath for uint;

    /**
     * @notice Main data structure for cross-chain operations
     * @dev Contains all necessary data and mappings for cross-chain functionality
     */
    struct Data {
        /**
         * @notice HTLC transaction data storage
         * @dev Stores information about Hash Time-Locked Contract transactions
         */
        HTLCTxLib.Data htlcTxData;

        /**
         * @notice Rapidity transaction data storage
         * @dev Stores information about rapid cross-chain transactions
         */
        RapidityTxLib.Data rapidityTxData;

        /**
         * @notice Quota management interface for storeman group
         * @dev Handles quota allocation and management for storeman groups
         */
        IQuota quota;

        /**
         * @notice Token management interface
         * @dev Handles token pair management and cross-chain token operations
         */
        ITokenManager tokenManager;

        /**
         * @notice Storeman group admin interface
         * @dev Manages storeman group administration and configuration
         */
        IStoremanGroup smgAdminProxy;

        /**
         * @notice Storeman group fee admin address
         * @dev Address responsible for managing storeman group fees
         */
        address smgFeeProxy;

        /**
         * @notice Signature verification interface
         * @dev Handles signature verification for cross-chain transactions
         */
        ISignatureVerifier sigVerifier;

        /**
         * @notice Mapping of storeman group fees
         * @dev Maps storeman group IDs to their respective fees
         */
        mapping(bytes32 => uint) mapStoremanFee;

        /**
         * @notice Mapping of contract fees between chains
         * @dev Maps source chain ID and destination chain ID to contract fees
         */
        mapping(uint => mapping(uint =>uint)) mapContractFee;

        /**
         * @notice Mapping of agent fees between chains
         * @dev Maps source chain ID and destination chain ID to agent fees
         */
        mapping(uint => mapping(uint =>uint)) mapAgentFee;
    }

    /**
     * @notice Converts bytes to address
     * @dev Uses assembly to efficiently convert bytes to address
     * @param b Bytes to convert
     * @return addr The converted address
     */
    function bytesToAddress(bytes memory b) internal pure returns (address addr) {
        assembly {
            addr := mload(add(b,20))
        }
    }

    /**
     * @notice Transfers tokens from the contract to a specified address
     * @dev Verifies the transfer was successful by checking balance changes
     * @param tokenScAddr Address of the token contract
     * @param to Address to receive the tokens
     * @param value Amount of tokens to transfer
     * @return bool True if transfer was successful
     * Requirements:
     * - Transfer must succeed
     * - Balance change must match the transfer amount
     */
    function transfer(address tokenScAddr, address to, uint value)
        internal
        returns(bool)
    {
        uint beforeBalance;
        uint afterBalance;
        IRC20Protocol token = IRC20Protocol(tokenScAddr);
        beforeBalance = token.balanceOf(to);
        (bool success,) = tokenScAddr.call(abi.encodeWithSelector(token.transfer.selector, to, value));
        require(success, "transfer failed");
        afterBalance = token.balanceOf(to);
        return afterBalance == beforeBalance.add(value);
    }

    /**
     * @notice Transfers tokens from one address to another
     * @dev Verifies the transfer was successful by checking balance changes
     * @param tokenScAddr Address of the token contract
     * @param from Address to transfer tokens from
     * @param to Address to receive the tokens
     * @param value Amount of tokens to transfer
     * @return bool True if transfer was successful
     * Requirements:
     * - Transfer must succeed
     * - Balance change must match the transfer amount
     */
    function transferFrom(address tokenScAddr, address from, address to, uint value)
        internal
        returns(bool)
    {
        uint beforeBalance;
        uint afterBalance;
        IRC20Protocol token = IRC20Protocol(tokenScAddr);
        beforeBalance = token.balanceOf(to);
        (bool success,) = tokenScAddr.call(abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
        require(success, "transferFrom failed");
        afterBalance = token.balanceOf(to);
        return afterBalance == beforeBalance.add(value);
    }
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";

/**
 * @title HTLCTxLib
 * @dev Library for managing Hash Time-Locked Contract (HTLC) transactions
 * This library provides functionality for:
 * - User and storeman transaction management
 * - Debt management between storeman groups
 * - Transaction status tracking and verification
 */
library HTLCTxLib {
    using SafeMath for uint;

    /**
     * @notice Enumeration of possible transaction statuses
     * @dev Status flow:
     * - None: Initial state
     * - Locked: Transaction is locked and pending
     * - Redeemed: Transaction has been completed
     * - Revoked: Transaction has been cancelled
     * - AssetLocked: Asset is locked in debt management
     * - DebtLocked: Debt is locked in debt management
     */
    enum TxStatus {None, Locked, Redeemed, Revoked, AssetLocked, DebtLocked}

    /**
     * @notice Parameters for user-initiated HTLC transactions
     * @dev Used when creating new user transactions
     * @param xHash Hash of the HTLC random number
     * @param smgID ID of the selected storeman group
     * @param tokenPairID ID of the token pair for cross-chain transfer
     * @param value Amount of tokens to transfer
     * @param lockFee Fee for the lock operation
     * @param lockedTime Duration for which the transaction is locked
     */
    struct HTLCUserParams {
        bytes32 xHash;
        bytes32 smgID;
        uint tokenPairID;
        uint value;
        uint lockFee;
        uint lockedTime;
    }

    /**
     * @notice Base structure for all HTLC transactions
     * @dev Contains common fields for all transaction types
     * @param smgID ID of the storeman group
     * @param lockedTime Duration for which the transaction is locked
     * @param beginLockedTime Timestamp when the transaction was locked
     * @param status Current status of the transaction
     */
    struct BaseTx {
        bytes32 smgID;
        uint lockedTime;
        uint beginLockedTime;
        TxStatus status;
    }

    /**
     * @notice Structure for user-initiated transactions
     * @dev Extends BaseTx with user-specific information
     * @param baseTx Base transaction information
     * @param tokenPairID ID of the token pair
     * @param value Amount of tokens
     * @param fee Transaction fee
     * @param userAccount Address of the user initiating the transaction
     */
    struct UserTx {
        BaseTx baseTx;
        uint tokenPairID;
        uint value;
        uint fee;
        address userAccount;
    }

    /**
     * @notice Structure for storeman-initiated transactions
     * @dev Extends BaseTx with storeman-specific information
     * @param baseTx Base transaction information
     * @param tokenPairID ID of the token pair
     * @param value Amount of tokens
     * @param userAccount Address of the user to receive tokens
     */
    struct SmgTx {
        BaseTx baseTx;
        uint tokenPairID;
        uint value;
        address userAccount;
    }

    /**
     * @notice Structure for storeman debt transactions
     * @dev Extends BaseTx with debt-specific information
     * @param baseTx Base transaction information
     * @param srcSmgID ID of the source storeman group
     */
    struct DebtTx {
        BaseTx baseTx;
        bytes32 srcSmgID;
    }

    /**
     * @notice Main data structure for HTLC transactions
     * @dev Contains mappings for all transaction types
     * @param mapHashXUserTxs Mapping of transaction hashes to user transactions
     * @param mapHashXSmgTxs Mapping of transaction hashes to storeman transactions
     * @param mapHashXDebtTxs Mapping of transaction hashes to debt transactions
     */
    struct Data {
        mapping(bytes32 => UserTx) mapHashXUserTxs;
        mapping(bytes32 => SmgTx) mapHashXSmgTxs;
        mapping(bytes32 => DebtTx) mapHashXDebtTxs;
    }

    /**
     * @notice Adds a new user transaction
     * @dev Creates a new user transaction with the provided parameters
     * @param self The storage data structure
     * @param params Parameters for the new transaction
     * Requirements:
     * - Transaction must not already exist
     */
    function addUserTx(Data storage self, HTLCUserParams memory params)
        public
    {
        UserTx memory userTx = self.mapHashXUserTxs[params.xHash];
        // UserTx storage userTx = self.mapHashXUserTxs[params.xHash];
        // require(params.value != 0, "Value is invalid");
        require(userTx.baseTx.status == TxStatus.None, "User tx exists");

        userTx.baseTx.smgID = params.smgID;
        userTx.baseTx.lockedTime = params.lockedTime;
        userTx.baseTx.beginLockedTime = block.timestamp;
        userTx.baseTx.status = TxStatus.Locked;
        userTx.tokenPairID = params.tokenPairID;
        userTx.value = params.value;
        userTx.fee = params.lockFee;
        userTx.userAccount = msg.sender;

        self.mapHashXUserTxs[params.xHash] = userTx;
    }

    /**
     * @notice Redeems a user transaction
     * @dev Used for storeman redeem (outbound) operations
     * @param self The storage data structure
     * @param x The HTLC random number
     * @return xHash The hash of the random number
     * Requirements:
     * - Transaction must be in Locked status
     * - Transaction must not be expired
     */
    function redeemUserTx(Data storage self, bytes32 x)
        external
        returns(bytes32 xHash)
    {
        xHash = sha256(abi.encodePacked(x));

        UserTx storage userTx = self.mapHashXUserTxs[xHash];
        require(userTx.baseTx.status == TxStatus.Locked, "Status is not locked");
        require(block.timestamp < userTx.baseTx.beginLockedTime.add(userTx.baseTx.lockedTime), "Redeem timeout");

        userTx.baseTx.status = TxStatus.Redeemed;

        return xHash;
    }

    /**
     * @notice Revokes a user transaction
     * @dev Allows cancellation of expired transactions
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * Requirements:
     * - Transaction must be in Locked status
     * - Transaction must be expired
     */
    function revokeUserTx(Data storage self, bytes32 xHash)
        external
    {
        UserTx storage userTx = self.mapHashXUserTxs[xHash];
        require(userTx.baseTx.status == TxStatus.Locked, "Status is not locked");
        require(block.timestamp >= userTx.baseTx.beginLockedTime.add(userTx.baseTx.lockedTime), "Revoke is not permitted");

        userTx.baseTx.status = TxStatus.Revoked;
    }

    /**
     * @notice Retrieves user transaction information
     * @dev Returns all relevant information about a user transaction
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * @return smgID ID of the storeman group
     * @return tokenPairID ID of the token pair
     * @return value Amount of tokens
     * @return fee Transaction fee
     * @return userAccount Address of the user
     */
    function getUserTx(Data storage self, bytes32 xHash)
        external
        view
        returns (bytes32, uint, uint, uint, address)
    {
        UserTx storage userTx = self.mapHashXUserTxs[xHash];
        return (userTx.baseTx.smgID, userTx.tokenPairID, userTx.value, userTx.fee, userTx.userAccount);
    }

    /**
     * @notice Adds a new storeman transaction
     * @dev Creates a new storeman transaction with the provided parameters
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * @param smgID ID of the storeman group
     * @param tokenPairID ID of the token pair
     * @param value Amount of tokens
     * @param userAccount Address of the user to receive tokens
     * @param lockedTime Duration for which the transaction is locked
     * Requirements:
     * - Value must be non-zero
     * - Transaction must not already exist
     */
    function addSmgTx(Data storage self, bytes32 xHash, bytes32 smgID, uint tokenPairID, uint value, address userAccount, uint lockedTime)
        external
    {
        SmgTx memory smgTx = self.mapHashXSmgTxs[xHash];
        // SmgTx storage smgTx = self.mapHashXSmgTxs[xHash];
        require(value != 0, "Value is invalid");
        require(smgTx.baseTx.status == TxStatus.None, "Smg tx exists");

        smgTx.baseTx.smgID = smgID;
        smgTx.baseTx.status = TxStatus.Locked;
        smgTx.baseTx.lockedTime = lockedTime;
        smgTx.baseTx.beginLockedTime = block.timestamp;
        smgTx.tokenPairID = tokenPairID;
        smgTx.value = value;
        smgTx.userAccount = userAccount;

        self.mapHashXSmgTxs[xHash] = smgTx;
    }

    /**
     * @notice Redeems a storeman transaction
     * @dev Used for user redeem (inbound) operations
     * @param self The storage data structure
     * @param x The HTLC random number
     * @return xHash The hash of the random number
     * Requirements:
     * - Transaction must be in Locked status
     * - Transaction must not be expired
     */
    function redeemSmgTx(Data storage self, bytes32 x)
        external
        returns(bytes32 xHash)
    {
        xHash = sha256(abi.encodePacked(x));

        SmgTx storage smgTx = self.mapHashXSmgTxs[xHash];
        require(smgTx.baseTx.status == TxStatus.Locked, "Status is not locked");
        require(block.timestamp < smgTx.baseTx.beginLockedTime.add(smgTx.baseTx.lockedTime), "Redeem timeout");

        smgTx.baseTx.status = TxStatus.Redeemed;

        return xHash;
    }

    /**
     * @notice Revokes a storeman transaction
     * @dev Allows cancellation of expired transactions
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * Requirements:
     * - Transaction must be in Locked status
     * - Transaction must be expired
     */
    function revokeSmgTx(Data storage self, bytes32 xHash)
        external
    {
        SmgTx storage smgTx = self.mapHashXSmgTxs[xHash];
        require(smgTx.baseTx.status == TxStatus.Locked, "Status is not locked");
        require(block.timestamp >= smgTx.baseTx.beginLockedTime.add(smgTx.baseTx.lockedTime), "Revoke is not permitted");

        smgTx.baseTx.status = TxStatus.Revoked;
    }

    /**
     * @notice Retrieves storeman transaction information
     * @dev Returns all relevant information about a storeman transaction
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * @return smgID ID of the storeman group
     * @return tokenPairID ID of the token pair
     * @return value Amount of tokens
     * @return userAccount Address of the user to receive tokens
     */
    function getSmgTx(Data storage self, bytes32 xHash)
        external
        view
        returns (bytes32, uint, uint, address)
    {
        SmgTx storage smgTx = self.mapHashXSmgTxs[xHash];
        return (smgTx.baseTx.smgID, smgTx.tokenPairID, smgTx.value, smgTx.userAccount);
    }

    /**
     * @notice Adds a new debt transaction
     * @dev Creates a new debt transaction between storeman groups
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * @param srcSmgID ID of the source storeman group
     * @param destSmgID ID of the destination storeman group
     * @param lockedTime Duration for which the transaction is locked
     * @param status Initial status of the transaction
     * Requirements:
     * - Transaction must not already exist
     * - Status must be either Locked or DebtLocked
     */
    function addDebtTx(Data storage self, bytes32 xHash, bytes32 srcSmgID, bytes32 destSmgID, uint lockedTime, TxStatus status)
        external
    {
        DebtTx memory debtTx = self.mapHashXDebtTxs[xHash];
        // DebtTx storage debtTx = self.mapHashXDebtTxs[xHash];
        require(debtTx.baseTx.status == TxStatus.None, "Debt tx exists");

        debtTx.baseTx.smgID = destSmgID;
        debtTx.baseTx.status = status;//TxStatus.Locked;
        debtTx.baseTx.lockedTime = lockedTime;
        debtTx.baseTx.beginLockedTime = block.timestamp;
        debtTx.srcSmgID = srcSmgID;

        self.mapHashXDebtTxs[xHash] = debtTx;
    }

    /**
     * @notice Redeems a debt transaction
     * @dev Used to complete debt transfer between storeman groups
     * @param self The storage data structure
     * @param x The HTLC random number
     * @return xHash The hash of the random number
     * Requirements:
     * - Transaction must be in Locked or DebtLocked status
     * - Transaction must not be expired
     */
    function redeemDebtTx(Data storage self, bytes32 x, TxStatus status)
        external
        returns(bytes32 xHash)
    {
        xHash = sha256(abi.encodePacked(x));

        DebtTx storage debtTx = self.mapHashXDebtTxs[xHash];
        // require(debtTx.baseTx.status == TxStatus.Locked, "Status is not locked");
        require(debtTx.baseTx.status == status, "Status is not locked");
        require(block.timestamp < debtTx.baseTx.beginLockedTime.add(debtTx.baseTx.lockedTime), "Redeem timeout");

        debtTx.baseTx.status = TxStatus.Redeemed;

        return xHash;
    }

    /**
     * @notice Revokes a debt transaction
     * @dev Allows cancellation of expired debt transactions
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * Requirements:
     * - Transaction must be in Locked or DebtLocked status
     * - Transaction must be expired
     */
    function revokeDebtTx(Data storage self, bytes32 xHash, TxStatus status)
        external
    {
        DebtTx storage debtTx = self.mapHashXDebtTxs[xHash];
        // require(debtTx.baseTx.status == TxStatus.Locked, "Status is not locked");
        require(debtTx.baseTx.status == status, "Status is not locked");
        require(block.timestamp >= debtTx.baseTx.beginLockedTime.add(debtTx.baseTx.lockedTime), "Revoke is not permitted");

        debtTx.baseTx.status = TxStatus.Revoked;
    }

    /**
     * @notice Retrieves debt transaction information
     * @dev Returns all relevant information about a debt transaction
     * @param self The storage data structure
     * @param xHash Hash of the HTLC random number
     * @return smgID ID of the storeman group
     * @return srcSmgID ID of the source storeman group
     */
    function getDebtTx(Data storage self, bytes32 xHash)
        external
        view
        returns (bytes32, bytes32)
    {
        DebtTx storage debtTx = self.mapHashXDebtTxs[xHash];
        return (debtTx.srcSmgID, debtTx.baseTx.smgID);
    }

    function getLeftTime(uint endTime) private view returns (uint) {
        if (block.timestamp < endTime) {
            return endTime.sub(block.timestamp);
        }
        return 0;
    }

    /// @notice                     function for get debt info
    /// @param xHash                hash of HTLC random number
    /// @return leftTime            the left lock time
    function getLeftLockedTime(Data storage self, bytes32 xHash)
        external
        view
        returns (uint leftTime)
    {
        UserTx storage userTx = self.mapHashXUserTxs[xHash];
        if (userTx.baseTx.status != TxStatus.None) {
            return getLeftTime(userTx.baseTx.beginLockedTime.add(userTx.baseTx.lockedTime));
        }
        SmgTx storage smgTx = self.mapHashXSmgTxs[xHash];
        if (smgTx.baseTx.status != TxStatus.None) {
            return getLeftTime(smgTx.baseTx.beginLockedTime.add(smgTx.baseTx.lockedTime));
        }
        DebtTx storage debtTx = self.mapHashXDebtTxs[xHash];
        if (debtTx.baseTx.status != TxStatus.None) {
            return getLeftTime(debtTx.baseTx.beginLockedTime.add(debtTx.baseTx.lockedTime));
        }
        require(false, 'invalid xHash');
    }
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

/**
 * @title RapidityTxLib
 * @dev Library for managing rapid cross-chain transaction status
 * This library provides functionality for:
 * - Tracking transaction status
 * - Managing rapid cross-chain transactions
 */
library RapidityTxLib {

    /**
     * @notice Enumeration of possible transaction statuses
     * @dev Defines the states a rapidity transaction can be in
     * - None: Initial state, transaction not yet processed
     * - Redeemed: Transaction has been completed
     */
    enum TxStatus {None, Redeemed}

    /**
     * @notice Main data structure for rapidity transactions
     * @dev Contains mappings for tracking transaction statuses
     * @param mapTxStatus Mapping of transaction unique IDs to their status
     */
    struct Data {
        mapping(bytes32 => TxStatus) mapTxStatus;
    }

    /**
     * @notice Adds a new rapidity transaction
     * @dev Marks a transaction as redeemed when it is added
     * @param self The storage data structure
     * @param uniqueID Unique identifier for the rapidity transaction
     * Requirements:
     * - Transaction must not already exist
     */
    function addRapidityTx(Data storage self, bytes32 uniqueID)
        internal
    {
        TxStatus status = self.mapTxStatus[uniqueID];
        require(status == TxStatus.None, "Rapidity tx exists");
        self.mapTxStatus[uniqueID] = TxStatus.Redeemed;
    }
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

interface IQuota {
  function userLock(uint tokenId, bytes32 storemanGroupId, uint value) external;
  function userBurn(uint tokenId, bytes32 storemanGroupId, uint value) external;

  function smgRelease(uint tokenId, bytes32 storemanGroupId, uint value) external;
  function smgMint(uint tokenId, bytes32 storemanGroupId, uint value) external;

  function upgrade(bytes32 storemanGroupId) external;

  function transferAsset(bytes32 srcStoremanGroupId, bytes32 dstStoremanGroupId) external;
  function receiveDebt(bytes32 srcStoremanGroupId, bytes32 dstStoremanGroupId) external;

  function getUserMintQuota(uint tokenId, bytes32 storemanGroupId) external view returns (uint);
  function getSmgMintQuota(uint tokenId, bytes32 storemanGroupId) external view returns (uint);

  function getUserBurnQuota(uint tokenId, bytes32 storemanGroupId) external view returns (uint);
  function getSmgBurnQuota(uint tokenId, bytes32 storemanGroupId) external view returns (uint);

  function getAsset(uint tokenId, bytes32 storemanGroupId) external view returns (uint asset, uint asset_receivable, uint asset_payable);
  function getDebt(uint tokenId, bytes32 storemanGroupId) external view returns (uint debt, uint debt_receivable, uint debt_payable);

  function isDebtClean(bytes32 storemanGroupId) external view returns (bool);
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

interface IRC20Protocol {
    function transfer(address, uint) external returns (bool);
    function transferFrom(address, address, uint) external returns (bool);
    function balanceOf(address _owner) external view returns (uint);
}

File 14 of 17 : ISignatureVerifier.sol
// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

interface ISignatureVerifier {
  function verify(
        uint curveId,
        bytes32 signature,
        bytes32 groupKeyX,
        bytes32 groupKeyY,
        bytes32 randomPointX,
        bytes32 randomPointY,
        bytes32 message
    ) external returns (bool);
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

interface IStoremanGroup {
    function getSelectedSmNumber(bytes32 groupId) external view returns(uint number);
    function getStoremanGroupConfig(bytes32 id) external view returns(bytes32 groupId, uint8 status, uint deposit, uint chain1, uint chain2, uint curve1, uint curve2,  bytes memory gpk1, bytes memory gpk2, uint startTime, uint endTime);
    function getDeposit(bytes32 id) external view returns(uint);
    function getStoremanGroupStatus(bytes32 id) external view returns(uint8 status, uint startTime, uint endTime);
    function setGpk(bytes32 groupId, bytes memory gpk1, bytes memory gpk2) external;
    function setInvalidSm(bytes32 groupId, uint[] memory indexs, uint8[] memory slashTypes) external returns(bool isContinue);
    function getThresholdByGrpId(bytes32 groupId) external view returns (uint);
    function getSelectedSmInfo(bytes32 groupId, uint index) external view returns(address wkAddr, bytes memory PK, bytes memory enodeId);
    function recordSmSlash(address wk) external;
}

// SPDX-License-Identifier: MIT

/*

  Copyright 2023 Wanchain Foundation.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

*/

//                            _           _           _
//  __      ____ _ _ __   ___| |__   __ _(_)_ __   __| | _____   __
//  \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / /
//   \ V  V / (_| | | | | (__| | | | (_| | | | | | (_| |  __/\ V /
//    \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/
//
//

pragma solidity ^0.8.18;

interface ITokenManager {
    function getTokenPairInfo(uint id) external view
      returns (uint origChainID, bytes memory tokenOrigAccount, uint shadowChainID, bytes memory tokenShadowAccount);

    function getTokenPairInfoSlim(uint id) external view
      returns (uint origChainID, bytes memory tokenOrigAccount, uint shadowChainID);

    function getAncestorInfo(uint id) external view
      returns (bytes memory account, string memory name, string memory symbol, uint8 decimals, uint chainId);

    function mintToken(address tokenAddress, address to, uint value) external;

    function burnToken(address tokenAddress, address from, uint value) external;

    function mapTokenPairType(uint tokenPairID) external view
      returns (uint8 tokenPairType);

    // erc1155
    function mintNFT(uint tokenCrossType, address tokenAddress, address to, uint[] calldata ids, uint[] calldata values, bytes calldata data) external;
    function burnNFT(uint tokenCrossType, address tokenAddress, address from, uint[] calldata ids, uint[] calldata values) external;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

/**
 * @title BasicStorageLib
 * @dev Library for basic storage operations with support for multiple data types
 * This library provides a structured approach to contract storage with a two-level key system
 * 
 * Key features:
 * - Support for multiple data types (uint, bool, address, bytes, string)
 * - Two-level key storage system for flexible data organization
 * - CRUD operations for each data type with consistent interface
 * - Gas-efficient storage patterns
 * 
 * @custom:security
 * - Internal access only to prevent unauthorized storage manipulation
 * - Safe storage operations with proper type enforcement
 * - Type-specific operations to prevent type confusion
 * - Consistent interface reduces likelihood of implementation errors
 * 
 * @custom:usage
 * - Used as a foundation for complex contract storage patterns
 * - Enables modular and organized data storage in contracts
 * - Simplifies storage access with standardized methods
 * - Perfect for contracts with diverse data storage needs
 */
library BasicStorageLib {

    /**
     * @dev Structure for storing uint values
     * Provides a two-level nested mapping for uint storage
     * 
     * @custom:usage
     * - Stores uint values with two-level key system for hierarchical data
     * - Used for numeric data storage such as balances, timestamps, amounts
     * - Primary key often represents a category, while innerKey represents specific item
     * - Essential for tracking numeric values in complex systems
     */
    struct UintData {
        mapping(bytes => mapping(bytes => uint))           _storage;
    }

    /**
     * @dev Structure for storing boolean values
     * Provides a two-level nested mapping for boolean storage
     * 
     * @custom:usage
     * - Stores boolean values with two-level key system for hierarchical data
     * - Used for flag and state storage such as activation status or permissions
     * - Efficient for representing binary states (true/false)
     * - Perfect for access control and feature toggles
     */
    struct BoolData {
        mapping(bytes => mapping(bytes => bool))           _storage;
    }

    /**
     * @dev Structure for storing address values
     * Provides a two-level nested mapping for address storage
     * 
     * @custom:usage
     * - Stores address values with two-level key system for hierarchical data
     * - Used for contract and account address storage
     * - Essential for tracking ownership, relationships between entities
     * - Enables role-based systems and contract registries
     */
    struct AddressData {
        mapping(bytes => mapping(bytes => address))        _storage;
    }

    /**
     * @dev Structure for storing bytes values
     * Provides a two-level nested mapping for bytes storage
     * 
     * @custom:usage
     * - Stores bytes values with two-level key system for hierarchical data
     * - Used for raw data storage such as cryptographic proofs, signatures
     * - Perfect for storing variable-length binary data
     * - Enables storage of complex serialized structures
     */
    struct BytesData {
        mapping(bytes => mapping(bytes => bytes))          _storage;
    }

    /**
     * @dev Structure for storing string values
     * Provides a two-level nested mapping for string storage
     * 
     * @custom:usage
     * - Stores string values with two-level key system for hierarchical data
     * - Used for text data storage such as names, descriptions, metadata
     * - Human-readable information storage
     * - Suitable for configuration parameters and user-facing content
     */
    struct StringData {
        mapping(bytes => mapping(bytes => string))         _storage;
    }

    /**
     * @dev Set uint value in storage
     * Assigns a uint value to a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization (e.g., user ID, token type)
     * @param innerKey Secondary key for specific attribute (e.g., balance, timestamp)
     * @param value Unsigned integer value to store
     * 
     * @custom:effects
     * - Updates storage with new value, overwriting any existing value
     * - Gas usage scales with key sizes, not with value size
     * - Optimized for single-slot storage operations
     */
    function setStorage(UintData storage self, bytes memory key, bytes memory innerKey, uint value) internal {
        self._storage[key][innerKey] = value;
    }

    /**
     * @dev Get uint value from storage
     * Retrieves a uint value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific attribute
     * @return Stored uint value, or 0 if no value has been set
     * 
     * @custom:effects
     * - Read-only operation that doesn't modify state
     * - Returns default value (0) if entry doesn't exist
     * - Gas cost is constant regardless of value stored
     */
    function getStorage(UintData storage self, bytes memory key, bytes memory innerKey) internal view returns (uint) {
        return self._storage[key][innerKey];
    }

    /**
     * @dev Delete uint value from storage
     * Removes a uint value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific attribute
     * 
     * @custom:effects
     * - Removes value from storage, setting it to default value (0)
     * - Gas refund is provided when clearing storage to zero
     * - Frees up storage space, potentially reducing contract storage costs
     */
    function delStorage(UintData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /**
     * @dev Set boolean value in storage
     * Assigns a boolean value to a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization (e.g., feature name, user ID)
     * @param innerKey Secondary key for specific flag (e.g., active, approved)
     * @param value Boolean value to store
     * 
     * @custom:effects
     * - Updates storage with new value, overwriting any existing value
     * - Gas efficient for storing binary state information
     * - Packs values efficiently in storage
     */
    function setStorage(BoolData storage self, bytes memory key, bytes memory innerKey, bool value) internal {
        self._storage[key][innerKey] = value;
    }

    /**
     * @dev Get boolean value from storage
     * Retrieves a boolean value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific flag
     * @return Stored boolean value, or false if no value has been set
     * 
     * @custom:effects
     * - Read-only operation that doesn't modify state
     * - Returns default value (false) if entry doesn't exist
     * - Gas efficient for checking state conditions
     */
    function getStorage(BoolData storage self, bytes memory key, bytes memory innerKey) internal view returns (bool) {
        return self._storage[key][innerKey];
    }

    /**
     * @dev Delete boolean value from storage
     * Removes a boolean value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific flag
     * 
     * @custom:effects
     * - Removes value from storage, setting it to default value (false)
     * - Gas refund is provided when clearing storage to zero
     * - Particularly efficient for boolean values
     */
    function delStorage(BoolData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /**
     * @dev Set address value in storage
     * Assigns an address value to a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization (e.g., role name, contract type)
     * @param innerKey Secondary key for specific relationship (e.g., owner, delegate)
     * @param value Ethereum address to store
     * 
     * @custom:effects
     * - Updates storage with new address, overwriting any existing value
     * - Stores full 20-byte Ethereum addresses
     * - Critical for tracking contract relationships and ownership
     */
    function setStorage(AddressData storage self, bytes memory key, bytes memory innerKey, address value) internal {
        self._storage[key][innerKey] = value;
    }

    /**
     * @dev Get address value from storage
     * Retrieves an address value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific relationship
     * @return Stored address value, or address(0) if no value has been set
     * 
     * @custom:effects
     * - Read-only operation that doesn't modify state
     * - Returns default value (address(0)) if entry doesn't exist
     * - Used for permission checks and relationship verification
     */
    function getStorage(AddressData storage self, bytes memory key, bytes memory innerKey) internal view returns (address) {
        return self._storage[key][innerKey];
    }

    /**
     * @dev Delete address value from storage
     * Removes an address value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific relationship
     * 
     * @custom:effects
     * - Removes value from storage, setting it to default value (address(0))
     * - Gas refund is provided when clearing storage to zero
     * - Important for revoking permissions or updating relationships
     */
    function delStorage(AddressData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /**
     * @dev Set bytes value in storage
     * Assigns a bytes value to a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization (e.g., data type, record ID)
     * @param innerKey Secondary key for specific data (e.g., signature, hash)
     * @param value Bytes data to store
     * 
     * @custom:effects
     * - Updates storage with new bytes data, overwriting any existing value
     * - Dynamically sized data is stored with length prefix
     * - Gas cost scales with the size of the bytes array
     * - Suitable for arbitrary binary data storage
     */
    function setStorage(BytesData storage self, bytes memory key, bytes memory innerKey, bytes memory value) internal {
        self._storage[key][innerKey] = value;
    }

    /**
     * @dev Get bytes value from storage
     * Retrieves a bytes value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific data
     * @return Stored bytes value, or empty bytes if no value has been set
     * 
     * @custom:effects
     * - Read-only operation that doesn't modify state
     * - Returns default value (empty bytes) if entry doesn't exist
     * - Gas cost scales with the size of the retrieved data
     * - Used for retrieving serialized data, proofs, or signatures
     */
    function getStorage(BytesData storage self, bytes memory key, bytes memory innerKey) internal view returns (bytes memory) {
        return self._storage[key][innerKey];
    }

    /**
     * @dev Delete bytes value from storage
     * Removes a bytes value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific data
     * 
     * @custom:effects
     * - Removes value from storage, setting it to default value (empty bytes)
     * - Gas refund is provided when clearing storage
     * - More gas efficient for larger data due to storage refunds
     * - Complete removal of variable-length data
     */
    function delStorage(BytesData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /**
     * @dev Set string value in storage
     * Assigns a string value to a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization (e.g., metadata type, record ID)
     * @param innerKey Secondary key for specific text (e.g., name, description)
     * @param value String data to store
     * 
     * @custom:effects
     * - Updates storage with new string, overwriting any existing value
     * - Strings are stored as UTF-8 encoded bytes with length prefix
     * - Gas cost scales with the length of the string
     * - Ideal for human-readable text storage
     */
    function setStorage(StringData storage self, bytes memory key, bytes memory innerKey, string memory value) internal {
        self._storage[key][innerKey] = value;
    }

    /**
     * @dev Get string value from storage
     * Retrieves a string value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific text
     * @return Stored string value, or empty string if no value has been set
     * 
     * @custom:effects
     * - Read-only operation that doesn't modify state
     * - Returns default value (empty string) if entry doesn't exist
     * - Gas cost scales with the length of the retrieved string
     * - Used for retrieving human-readable configuration and metadata
     */
    function getStorage(StringData storage self, bytes memory key, bytes memory innerKey) internal view returns (string memory) {
        return self._storage[key][innerKey];
    }

    /**
     * @dev Delete string value from storage
     * Removes a string value from a specific key pair in storage
     * 
     * @param self Storage structure reference
     * @param key Primary key for categorization
     * @param innerKey Secondary key for specific text
     * 
     * @custom:effects
     * - Removes value from storage, setting it to default value (empty string)
     * - Gas refund is provided when clearing storage
     * - More gas efficient for longer strings due to storage refunds
     * - Complete removal of variable-length text data
     */
    function delStorage(StringData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

}

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

Contract ABI

API
[{"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":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"changeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"halted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"newOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"halt","type":"bool"}],"name":"setHalt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smgFeeReceiverTimeout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"impl","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526201fa406011556102586012556014805460ff60a01b1916905534801561002a57600080fd5b506013805433610100026001600160a81b03199091161760011790556106d4806100556000396000f3fe6080604052600436106100ab5760003560e01c8063a6f9dae111610064578063a6f9dae114610188578063a8b38205146101a8578063b9b8af0b146101cc578063d4ee1d90146101fd578063e92e2c1b1461021d578063f495438714610233576100ba565b80633659cfe6146100c25780634fb2e45d146100e25780635c60da1b14610102578063715018a61461013957806379ba50971461014e5780638da5cb5b14610163576100ba565b366100ba576100b8610253565b005b6100b8610253565b3480156100ce57600080fd5b506100b86100dd366004610629565b6102d6565b3480156100ee57600080fd5b506100b86100fd366004610629565b61041f565b34801561010e57600080fd5b506015546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014557600080fd5b506100b861050b565b34801561015a57600080fd5b506100b861054d565b34801561016f57600080fd5b5060135461011c9061010090046001600160a01b031681565b34801561019457600080fd5b506100b86101a3366004610629565b61058b565b3480156101b457600080fd5b506101be60115481565b604051908152602001610130565b3480156101d857600080fd5b506014546101ed90600160a01b900460ff1681565b6040519015158152602001610130565b34801561020957600080fd5b5060145461011c906001600160a01b031681565b34801561022957600080fd5b506101be60125481565b34801561023f57600080fd5b506100b861024e366004610659565b6105dc565b6015546001600160a01b0316806102b15760405162461bcd60e51b815260206004820152601f60248201527f696d706c656d656e746174696f6e20636f6e7472616374206e6f74207365740060448201526064015b60405180910390fd5b60405136600082376000803683855af43d806000843e8180156102d2578184f35b8184fd5b60135461010090046001600160a01b031633146103055760405162461bcd60e51b81526004016102a89061067b565b6001600160a01b0381166103655760405162461bcd60e51b815260206004820152602160248201527f43616e6e6f74207570677261646520746f20696e76616c6964206164647265736044820152607360f81b60648201526084016102a8565b6015546001600160a01b03908116908216036103d55760405162461bcd60e51b815260206004820152602960248201527f43616e6e6f74207570677261646520746f207468652073616d6520696d706c6560448201526836b2b73a30ba34b7b760b91b60648201526084016102a8565b601580546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60135461010090046001600160a01b0316331461044e5760405162461bcd60e51b81526004016102a89061067b565b6001600160a01b0381166104a45760405162461bcd60e51b815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016102a8565b6013546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3601380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60135461010090046001600160a01b0316331461053a5760405162461bcd60e51b81526004016102a89061067b565b60138054610100600160a81b0319169055565b6014546001600160a01b0316330361058957601454601380546001600160a01b0390921661010002610100600160a81b03199092169190911790555b565b60135461010090046001600160a01b031633146105ba5760405162461bcd60e51b81526004016102a89061067b565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b60135461010090046001600160a01b0316331461060b5760405162461bcd60e51b81526004016102a89061067b565b60148054911515600160a01b0260ff60a01b19909216919091179055565b60006020828403121561063b57600080fd5b81356001600160a01b038116811461065257600080fd5b9392505050565b60006020828403121561066b57600080fd5b8135801515811461065257600080fd5b6020808252600990820152682737ba1037bbb732b960b91b60408201526060019056fea2646970667358221220d55c23de1948a949ee0c81fc72e9b09fc00c51c2627eb5157b24ff6776ea743b64736f6c63430008120033

Deployed Bytecode

0x6080604052600436106100ab5760003560e01c8063a6f9dae111610064578063a6f9dae114610188578063a8b38205146101a8578063b9b8af0b146101cc578063d4ee1d90146101fd578063e92e2c1b1461021d578063f495438714610233576100ba565b80633659cfe6146100c25780634fb2e45d146100e25780635c60da1b14610102578063715018a61461013957806379ba50971461014e5780638da5cb5b14610163576100ba565b366100ba576100b8610253565b005b6100b8610253565b3480156100ce57600080fd5b506100b86100dd366004610629565b6102d6565b3480156100ee57600080fd5b506100b86100fd366004610629565b61041f565b34801561010e57600080fd5b506015546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014557600080fd5b506100b861050b565b34801561015a57600080fd5b506100b861054d565b34801561016f57600080fd5b5060135461011c9061010090046001600160a01b031681565b34801561019457600080fd5b506100b86101a3366004610629565b61058b565b3480156101b457600080fd5b506101be60115481565b604051908152602001610130565b3480156101d857600080fd5b506014546101ed90600160a01b900460ff1681565b6040519015158152602001610130565b34801561020957600080fd5b5060145461011c906001600160a01b031681565b34801561022957600080fd5b506101be60125481565b34801561023f57600080fd5b506100b861024e366004610659565b6105dc565b6015546001600160a01b0316806102b15760405162461bcd60e51b815260206004820152601f60248201527f696d706c656d656e746174696f6e20636f6e7472616374206e6f74207365740060448201526064015b60405180910390fd5b60405136600082376000803683855af43d806000843e8180156102d2578184f35b8184fd5b60135461010090046001600160a01b031633146103055760405162461bcd60e51b81526004016102a89061067b565b6001600160a01b0381166103655760405162461bcd60e51b815260206004820152602160248201527f43616e6e6f74207570677261646520746f20696e76616c6964206164647265736044820152607360f81b60648201526084016102a8565b6015546001600160a01b03908116908216036103d55760405162461bcd60e51b815260206004820152602960248201527f43616e6e6f74207570677261646520746f207468652073616d6520696d706c6560448201526836b2b73a30ba34b7b760b91b60648201526084016102a8565b601580546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60135461010090046001600160a01b0316331461044e5760405162461bcd60e51b81526004016102a89061067b565b6001600160a01b0381166104a45760405162461bcd60e51b815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f206164647265737300000060448201526064016102a8565b6013546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3601380546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60135461010090046001600160a01b0316331461053a5760405162461bcd60e51b81526004016102a89061067b565b60138054610100600160a81b0319169055565b6014546001600160a01b0316330361058957601454601380546001600160a01b0390921661010002610100600160a81b03199092169190911790555b565b60135461010090046001600160a01b031633146105ba5760405162461bcd60e51b81526004016102a89061067b565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b60135461010090046001600160a01b0316331461060b5760405162461bcd60e51b81526004016102a89061067b565b60148054911515600160a01b0260ff60a01b19909216919091179055565b60006020828403121561063b57600080fd5b81356001600160a01b038116811461065257600080fd5b9392505050565b60006020828403121561066b57600080fd5b8135801515811461065257600080fd5b6020808252600990820152682737ba1037bbb732b960b91b60408201526060019056fea2646970667358221220d55c23de1948a949ee0c81fc72e9b09fc00c51c2627eb5157b24ff6776ea743b64736f6c63430008120033

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
0x08bad1A48b0B08Bf769f83ba30c1DaD0F8Bb8b6B
Loading...
Loading
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.