GLMR Price: $0.020825 (-2.08%)

Contract

0x6372aEc6263AA93EAceDC994D38aa9117B6b95B5

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo201.039375657762215992 GLMR

GLMR Value

$4.19 (@ $0.02/GLMR)

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Smg Mint134052802025-11-19 16:57:5467 days ago1763571474IN
0x6372aEc6...17B6b95B5
0 GLMR0.0212160531.40625
User Lock120252182025-08-04 19:52:42174 days ago1754337162IN
0x6372aEc6...17B6b95B5
1 GLMR0.0176304433
Smg Mint119876352025-08-02 4:28:18177 days ago1754108898IN
0x6372aEc6...17B6b95B5
0 GLMR0.021215831.40625
User Burn116688082025-07-10 16:13:48199 days ago1752164028IN
0x6372aEc6...17B6b95B5
0 GLMR0.0204106333
Smg Mint116677442025-07-10 14:26:00199 days ago1752157560IN
0x6372aEc6...17B6b95B5
0 GLMR0.021215831.40625
User Lock115434312025-07-01 19:10:18208 days ago1751397018IN
0x6372aEc6...17B6b95B5
159 GLMR0.016703531.25
Config Operator104783942025-04-16 9:22:36285 days ago1744795356IN
0x6372aEc6...17B6b95B5
0 GLMR0.0108226532
User Burn101482122025-03-24 0:48:36308 days ago1742777316IN
0x6372aEc6...17B6b95B5
0.056 GLMR0.0520201540.625
Smg Release100450062025-03-16 17:38:24315 days ago1742146704IN
0x6372aEc6...17B6b95B5
0 GLMR0.0245677231.40625
User Burn100194842025-03-14 22:05:54317 days ago1741989954IN
0x6372aEc6...17B6b95B5
0.056 GLMR0.04219333
Smg Mint100193542025-03-14 21:52:12317 days ago1741989132IN
0x6372aEc6...17B6b95B5
0 GLMR0.0435024331.40625
User Lock99879302025-03-12 16:25:36319 days ago1741796736IN
0x6372aEc6...17B6b95B5
520 GLMR0.034441531.25
Smg Release99876042025-03-12 15:52:18319 days ago1741794738IN
0x6372aEc6...17B6b95B5
0 GLMR0.0245774631.41869872
User Lock99873202025-03-12 15:22:24319 days ago1741792944IN
0x6372aEc6...17B6b95B5
270 GLMR0.0378856534.375
User Lock99759422025-03-11 19:56:30320 days ago1741722990IN
0x6372aEc6...17B6b95B5
253 GLMR0.034441531.25
User Burn97146072025-02-21 9:41:06339 days ago1740130866IN
0x6372aEc6...17B6b95B5
0.056 GLMR0.039971531.25
Smg Mint97144752025-02-21 9:27:12339 days ago1740130032IN
0x6372aEc6...17B6b95B5
0 GLMR0.0435024331.40625
Smg Release97123772025-02-21 5:54:36339 days ago1740117276IN
0x6372aEc6...17B6b95B5
0 GLMR0.0245677231.40625
Smg Mint94500762025-02-02 18:30:00357 days ago1738521000IN
0x6372aEc6...17B6b95B5
0 GLMR0.0435024331.40625
Smg Release92992732025-01-23 3:13:48368 days ago1737602028IN
0x6372aEc6...17B6b95B5
0 GLMR0.09827091125.625
User Lock92991052025-01-23 2:56:54368 days ago1737601014IN
0x6372aEc6...17B6b95B5
1,616.1557 GLMR0.137766125
User Burn90560452025-01-05 22:01:24385 days ago1736114484IN
0x6372aEc6...17B6b95B5
0.056 GLMR0.16110057126
Smg Mint90294892025-01-04 1:00:48387 days ago1735952448IN
0x6372aEc6...17B6b95B5
0 GLMR0.17400972125.625
Smg Mint90224252025-01-03 13:05:54387 days ago1735909554IN
0x6372aEc6...17B6b95B5
0 GLMR0.17400972125.625
Smg Mint88530582024-12-22 14:13:36399 days ago1734876816IN
0x6372aEc6...17B6b95B5
0 GLMR0.17400972125.625
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
134052802025-11-19 16:57:5467 days ago1763571474
0x6372aEc6...17B6b95B5
0 GLMR
126399722025-09-18 7:37:06130 days ago1758181026
0x6372aEc6...17B6b95B5
0 GLMR
126399722025-09-18 7:37:06130 days ago1758181026
0x6372aEc6...17B6b95B5
0 GLMR
120252182025-08-04 19:52:42174 days ago1754337162
0x6372aEc6...17B6b95B5
1 GLMR
119876352025-08-02 4:28:18177 days ago1754108898
0x6372aEc6...17B6b95B5
0 GLMR
116688082025-07-10 16:13:48199 days ago1752164028
0x6372aEc6...17B6b95B5
0 GLMR
116677442025-07-10 14:26:00199 days ago1752157560
0x6372aEc6...17B6b95B5
0 GLMR
115434312025-07-01 19:10:18208 days ago1751397018
0x6372aEc6...17B6b95B5
159 GLMR
104783942025-04-16 9:22:36285 days ago1744795356
0x6372aEc6...17B6b95B5
0 GLMR
103513922025-04-07 9:21:18294 days ago1744017678
0x6372aEc6...17B6b95B5
0 GLMR
101482122025-03-24 0:48:36308 days ago1742777316
0x6372aEc6...17B6b95B5
0.056 GLMR
100450062025-03-16 17:38:24315 days ago1742146704
0x6372aEc6...17B6b95B5
0 GLMR
100194842025-03-14 22:05:54317 days ago1741989954
0x6372aEc6...17B6b95B5
0.056 GLMR
100193542025-03-14 21:52:12317 days ago1741989132
0x6372aEc6...17B6b95B5
0 GLMR
99879302025-03-12 16:25:36319 days ago1741796736
0x6372aEc6...17B6b95B5
520 GLMR
99876042025-03-12 15:52:18319 days ago1741794738
0x6372aEc6...17B6b95B5
0 GLMR
99873202025-03-12 15:22:24319 days ago1741792944
0x6372aEc6...17B6b95B5
270 GLMR
99759422025-03-11 19:56:30320 days ago1741722990
0x6372aEc6...17B6b95B5
253 GLMR
97146072025-02-21 9:41:06339 days ago1740130866
0x6372aEc6...17B6b95B5
0.056 GLMR
97144752025-02-21 9:27:12339 days ago1740130032
0x6372aEc6...17B6b95B5
0 GLMR
97123772025-02-21 5:54:36339 days ago1740117276
0x6372aEc6...17B6b95B5
0 GLMR
94500762025-02-02 18:30:00357 days ago1738521000
0x6372aEc6...17B6b95B5
0 GLMR
92992732025-01-23 3:13:48368 days ago1737602028
0x6372aEc6...17B6b95B5
0 GLMR
92991052025-01-23 2:56:54368 days ago1737601014
0x6372aEc6...17B6b95B5
1,616.1557 GLMR
90560452025-01-05 22:01:24385 days ago1736114484
0x6372aEc6...17B6b95B5
0.056 GLMR
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CrossProxy

Compiler Version
v0.4.26+commit.4563c3fc

Optimization Enabled:
Yes with 200 runs

Other Settings:
byzantium EvmVersion, MIT license
/*

  Copyright 2019 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.4.26;

/**
 * Math operations with safety checks
 */

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


contract CrossProxy is CrossStorage, ReentrancyGuard, Halt, Proxy {

    ///@dev                   update the address of CrossDelegate contract
    ///@param impl            the address of the new CrossDelegate contract
    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);
    }
}

File 2 of 17 : CrossStorage.sol
/*

  Copyright 2019 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.4.26;

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

contract CrossStorage is BasicStorage {
    using HTLCTxLib for HTLCTxLib.Data;
    using RapidityTxLib for RapidityTxLib.Data;

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

    CrossTypes.Data internal storageData;

    /// @notice locked time(in seconds)
    uint public lockedTime = uint(3600*36);

    /// @notice Since storeman group admin receiver address may be changed, system should make sure the new address
    /// @notice can be used, and the old address can not be used. The solution is add timestamp.
    /// @notice unit: second
    uint public smgFeeReceiverTimeout = uint(10*60);

    enum GroupStatus { none, initial, curveSeted, failed, selected, ready, unregistered, dismissed }

}

File 3 of 17 : ReentrancyGuard.sol
pragma solidity 0.4.26;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
contract ReentrancyGuard {
    bool private _notEntered;

    constructor () internal {
        // 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 Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    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;
    }
}

/*

  Copyright 2019 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.4.24;
import './Owned.sol';

contract Halt is Owned {

    bool public halted = false;

    modifier notHalted() {
        require(!halted, "Smart contract is halted");
        _;
    }

    modifier isHalted() {
        require(halted, "Smart contract is not halted");
        _;
    }

    /// @notice function Emergency situation that requires
    /// @notice contribution period to stop or not.
    function setHalt(bool halt)
        public
        onlyOwner
    {
        halted = halt;
    }
}

/*

  Copyright 2019 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.4.24;

/**
 * Math operations with safety checks
 */


contract Proxy {

    event Upgraded(address indexed implementation);

    address internal _implementation;

    function implementation() public view returns (address) {
        return _implementation;
    }

    function () external payable {
        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) }
        }
    }
}

/*

  Copyright 2019 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.4.26;

library RapidityTxLib {

    /**
     *
     * ENUMS
     *
     */

    /// @notice tx info status
    /// @notice uninitialized,Redeemed
    enum TxStatus {None, Redeemed}

    /**
     *
     * STRUCTURES
     *
     */
    struct Data {
        /// @notice mapping of uniqueID to TxStatus -- uniqueID->TxStatus
        mapping(bytes32 => TxStatus) mapTxStatus;

    }

    /**
     *
     * MANIPULATIONS
     *
     */

    /// @notice                     add user transaction info
    /// @param  uniqueID            Rapidity random number
    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;
    }
}

/*

  Copyright 2019 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.4.26;
pragma experimental ABIEncoderV2;

import 'openzeppelin-eth/contracts/math/SafeMath.sol';

library HTLCTxLib {
    using SafeMath for uint;

    /**
     *
     * ENUMS
     *
     */

    /// @notice tx info status
    /// @notice uninitialized,locked,redeemed,revoked
    enum TxStatus {None, Locked, Redeemed, Revoked, AssetLocked, DebtLocked}

    /**
     *
     * STRUCTURES
     *
     */

    /// @notice struct of HTLC user mint lock parameters
    struct HTLCUserParams {
        bytes32 xHash;                  /// hash of HTLC random number
        bytes32 smgID;                  /// ID of storeman group which user has selected
        uint tokenPairID;               /// token pair id on cross chain
        uint value;                     /// exchange token value
        uint lockFee;                   /// exchange token value
        uint lockedTime;                /// HTLC lock time
    }

    /// @notice HTLC(Hashed TimeLock Contract) tx info
    struct BaseTx {
        bytes32 smgID;                  /// HTLC transaction storeman ID
        uint lockedTime;                /// HTLC transaction locked time
        uint beginLockedTime;           /// HTLC transaction begin locked time
        TxStatus status;                /// HTLC transaction status
    }

    /// @notice user  tx info
    struct UserTx {
        BaseTx baseTx;
        uint tokenPairID;
        uint value;
        uint fee;
        address userAccount;            /// HTLC transaction sender address for the security check while user's revoke
    }
    /// @notice storeman  tx info
    struct SmgTx {
        BaseTx baseTx;
        uint tokenPairID;
        uint value;
        address  userAccount;          /// HTLC transaction user address for the security check while user's redeem
    }
    /// @notice storeman  debt tx info
    struct DebtTx {
        BaseTx baseTx;
        bytes32 srcSmgID;              /// HTLC transaction sender(source storeman) ID
    }

    struct Data {
        /// @notice mapping of hash(x) to UserTx -- xHash->htlcUserTxData
        mapping(bytes32 => UserTx) mapHashXUserTxs;

        /// @notice mapping of hash(x) to SmgTx -- xHash->htlcSmgTxData
        mapping(bytes32 => SmgTx) mapHashXSmgTxs;

        /// @notice mapping of hash(x) to DebtTx -- xHash->htlcDebtTxData
        mapping(bytes32 => DebtTx) mapHashXDebtTxs;

    }

    /**
     *
     * MANIPULATIONS
     *
     */

    /// @notice                     add user transaction info
    /// @param params               parameters for user tx
    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 = now;
        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                     refund coins from HTLC transaction, which is used for storeman redeem(outbound)
    /// @param x                    HTLC random number
    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(now < userTx.baseTx.beginLockedTime.add(userTx.baseTx.lockedTime), "Redeem timeout");

        userTx.baseTx.status = TxStatus.Redeemed;

        return xHash;
    }

    /// @notice                     revoke user transaction
    /// @param  xHash               hash of HTLC random number
    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(now >= userTx.baseTx.beginLockedTime.add(userTx.baseTx.lockedTime), "Revoke is not permitted");

        userTx.baseTx.status = TxStatus.Revoked;
    }

    /// @notice                    function for get user info
    /// @param xHash               hash of HTLC random number
    /// @return smgID              ID of storeman which user has selected
    /// @return tokenPairID        token pair ID of cross chain
    /// @return value              exchange value
    /// @return fee                exchange fee
    /// @return userAccount        HTLC transaction sender address for the security check while user's revoke
    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                     add storeman transaction info
    /// @param  xHash               hash of HTLC random number
    /// @param  smgID               ID of the storeman which user has selected
    /// @param  tokenPairID         token pair ID of cross chain
    /// @param  value               HTLC transfer value of token
    /// @param  userAccount            user account address on the destination chain, which is used to redeem token
    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 = now;
        smgTx.tokenPairID = tokenPairID;
        smgTx.value = value;
        smgTx.userAccount = userAccount;

        self.mapHashXSmgTxs[xHash] = smgTx;
    }

    /// @notice                     refund coins from HTLC transaction, which is used for users redeem(inbound)
    /// @param x                    HTLC random number
    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(now < smgTx.baseTx.beginLockedTime.add(smgTx.baseTx.lockedTime), "Redeem timeout");

        smgTx.baseTx.status = TxStatus.Redeemed;

        return xHash;
    }

    /// @notice                     revoke storeman transaction
    /// @param  xHash               hash of HTLC random number
    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(now >= smgTx.baseTx.beginLockedTime.add(smgTx.baseTx.lockedTime), "Revoke is not permitted");

        smgTx.baseTx.status = TxStatus.Revoked;
    }

    /// @notice                     function for get smg info
    /// @param xHash                hash of HTLC random number
    /// @return smgID               ID of storeman which user has selected
    /// @return tokenPairID         token pair ID of cross chain
    /// @return value               exchange value
    /// @return userAccount            user account address for redeem
    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                     add storeman transaction info
    /// @param  xHash               hash of HTLC random number
    /// @param  srcSmgID            ID of source storeman group
    /// @param  destSmgID           ID of the storeman which will take over of the debt of source storeman group
    /// @param  lockedTime          HTLC lock time
    /// @param  status              Status, should be 'Locked' for asset or 'DebtLocked' for debt
    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 = now;
        debtTx.srcSmgID = srcSmgID;

        self.mapHashXDebtTxs[xHash] = debtTx;
    }

    /// @notice                     refund coins from HTLC transaction
    /// @param x                    HTLC random number
    /// @param status               Status, should be 'Locked' for asset or 'DebtLocked' for debt
    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(now < debtTx.baseTx.beginLockedTime.add(debtTx.baseTx.lockedTime), "Redeem timeout");

        debtTx.baseTx.status = TxStatus.Redeemed;

        return xHash;
    }

    /// @notice                     revoke debt transaction, which is used for source storeman group
    /// @param  xHash               hash of HTLC random number
    /// @param  status              Status, should be 'Locked' for asset or 'DebtLocked' for debt
    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(now >= debtTx.baseTx.beginLockedTime.add(debtTx.baseTx.lockedTime), "Revoke is not permitted");

        debtTx.baseTx.status = TxStatus.Revoked;
    }

    /// @notice                     function for get debt info
    /// @param xHash                hash of HTLC random number
    /// @return srcSmgID            ID of source storeman
    /// @return destSmgID           ID of destination storeman
    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 (now < endTime) {
            return endTime.sub(now);
        }
        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)
    {
        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');
    }
}

/*

  Copyright 2019 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.4.26;

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";

library CrossTypes {
    using SafeMath for uint;

    /**
     *
     * STRUCTURES
     *
     */

    struct Data {

        /// map of the htlc transaction info
        HTLCTxLib.Data htlcTxData;

        /// map of the rapidity transaction info
        RapidityTxLib.Data rapidityTxData;

        /// quota data of storeman group
        IQuota quota;

        /// token manager instance interface
        ITokenManager tokenManager;

        /// storemanGroup admin instance interface
        IStoremanGroup smgAdminProxy;

        /// storemanGroup fee admin instance address
        address smgFeeProxy;

        ISignatureVerifier sigVerifier;

        /// @notice transaction fee, smgID => fee
        mapping(bytes32 => uint) mapStoremanFee;

        /// @notice transaction fee, origChainID => shadowChainID => fee
        mapping(uint => mapping(uint =>uint)) mapLockFee;

        /// @notice transaction fee, origChainID => shadowChainID => fee
        mapping(uint => mapping(uint =>uint)) mapRevokeFee;

    }

    /**
     *
     * MANIPULATIONS
     *
     */

    // /// @notice       convert bytes32 to address
    // /// @param b      bytes32
    // function bytes32ToAddress(bytes32 b) internal pure returns (address) {
    //     return address(uint160(bytes20(b))); // high
    //     // return address(uint160(uint256(b))); // low
    // }

    /// @notice       convert bytes to address
    /// @param b      bytes
    function bytesToAddress(bytes b) internal pure returns (address addr) {
        assembly {
            addr := mload(add(b,20))
        }
    }

    function transfer(address tokenScAddr, address to, uint value)
        internal
        returns(bool)
    {
        uint beforeBalance;
        uint afterBalance;
        beforeBalance = IRC20Protocol(tokenScAddr).balanceOf(to);
        // IRC20Protocol(tokenScAddr).transfer(to, value);
        tokenScAddr.call(bytes4(keccak256("transfer(address,uint256)")), to, value);
        afterBalance = IRC20Protocol(tokenScAddr).balanceOf(to);
        return afterBalance == beforeBalance.add(value);
    }

    function transferFrom(address tokenScAddr, address from, address to, uint value)
        internal
        returns(bool)
    {
        uint beforeBalance;
        uint afterBalance;
        beforeBalance = IRC20Protocol(tokenScAddr).balanceOf(to);
        // IRC20Protocol(tokenScAddr).transferFrom(from, to, value);
        tokenScAddr.call(bytes4(keccak256("transferFrom(address,address,uint256)")), from, to, value);
        afterBalance = IRC20Protocol(tokenScAddr).balanceOf(to);
        return afterBalance == beforeBalance.add(value);
    }
}

File 9 of 17 : BasicStorage.sol
pragma solidity ^0.4.24;

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

contract BasicStorage {
    /************************************************************
     **
     ** VARIABLES
     **
     ************************************************************/

    //// basic variables
    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;

    BasicStorageLib.UintData    internal uintData;
    BasicStorageLib.BoolData    internal boolData;
    BasicStorageLib.AddressData internal addressData;
    BasicStorageLib.BytesData   internal bytesData;
    BasicStorageLib.StringData  internal stringData;
}

/*

  Copyright 2019 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.4.24;

/// @dev `Owned` is a base level contract that assigns an `owner` that can be
///  later changed
contract Owned {

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @dev `owner` is the only address that can call a function with this
    /// modifier
    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    address public owner;

    /// @notice The Constructor assigns the message sender to be `owner`
    constructor() public {
        owner = msg.sender;
    }

    address public newOwner;

    function transferOwner(address _newOwner) public onlyOwner {
        require(_newOwner != address(0), "New owner is the zero address");
        emit OwnershipTransferred(owner, _newOwner);
        owner = _newOwner;
    }

    /// @notice `owner` can step down and assign some other address to this role
    /// @param _newOwner The address of the new owner. 0x0 can be used to create
    ///  an unowned neutral vault, however that cannot be undone
    function changeOwner(address _newOwner) public onlyOwner {
        newOwner = _newOwner;
    }

    function acceptOwnership() public {
        if (msg.sender == newOwner) {
            owner = newOwner;
        }
    }

    function renounceOwnership() public onlyOwner {
        owner = address(0);
    }
}

pragma solidity ^0.4.24;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that revert on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // 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-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold

    return c;
  }

  /**
  * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

  /**
  * @dev Adds two numbers, reverts on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a);

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}

File 12 of 17 : ISignatureVerifier.sol
/*

  Copyright 2019 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.4.26;

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

/*

  Copyright 2019 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.4.26;

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

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

    function getAncestorInfo(uint id) external view
      returns (bytes account, string name, string 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[] ids, uint[] values, bytes data) public;
    function burnNFT(uint tokenCrossType, address tokenAddress, address from, uint[] ids, uint[] values) public;
}

/*

  Copyright 2019 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.4.24;

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 gpk1, bytes 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 gpk1, bytes gpk2) external;
    function setInvalidSm(bytes32 groupId, uint[] indexs, uint8[] 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 PK, bytes enodeId);
    function recordSmSlash(address wk) external;
}

/*

  Copyright 2019 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.4.26;

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);
}

/*

  Copyright 2019 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.4.26;

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);
}

pragma solidity ^0.4.24;

library BasicStorageLib {

    struct UintData {
        mapping(bytes => mapping(bytes => uint))           _storage;
    }

    struct BoolData {
        mapping(bytes => mapping(bytes => bool))           _storage;
    }

    struct AddressData {
        mapping(bytes => mapping(bytes => address))        _storage;
    }

    struct BytesData {
        mapping(bytes => mapping(bytes => bytes))          _storage;
    }

    struct StringData {
        mapping(bytes => mapping(bytes => string))         _storage;
    }

    /* uintStorage */

    function setStorage(UintData storage self, bytes memory key, bytes memory innerKey, uint value) internal {
        self._storage[key][innerKey] = value;
    }

    function getStorage(UintData storage self, bytes memory key, bytes memory innerKey) internal view returns (uint) {
        return self._storage[key][innerKey];
    }

    function delStorage(UintData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /* boolStorage */

    function setStorage(BoolData storage self, bytes memory key, bytes memory innerKey, bool value) internal {
        self._storage[key][innerKey] = value;
    }

    function getStorage(BoolData storage self, bytes memory key, bytes memory innerKey) internal view returns (bool) {
        return self._storage[key][innerKey];
    }

    function delStorage(BoolData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /* addressStorage */

    function setStorage(AddressData storage self, bytes memory key, bytes memory innerKey, address value) internal {
        self._storage[key][innerKey] = value;
    }

    function getStorage(AddressData storage self, bytes memory key, bytes memory innerKey) internal view returns (address) {
        return self._storage[key][innerKey];
    }

    function delStorage(AddressData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /* bytesStorage */

    function setStorage(BytesData storage self, bytes memory key, bytes memory innerKey, bytes memory value) internal {
        self._storage[key][innerKey] = value;
    }

    function getStorage(BytesData storage self, bytes memory key, bytes memory innerKey) internal view returns (bytes memory) {
        return self._storage[key][innerKey];
    }

    function delStorage(BytesData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

    /* stringStorage */

    function setStorage(StringData storage self, bytes memory key, bytes memory innerKey, string memory value) internal {
        self._storage[key][innerKey] = value;
    }

    function getStorage(StringData storage self, bytes memory key, bytes memory innerKey) internal view returns (string memory) {
        return self._storage[key][innerKey];
    }

    function delStorage(StringData storage self, bytes memory key, bytes memory innerKey) internal {
        delete self._storage[key][innerKey];
    }

}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "remappings": [],
  "evmVersion": "byzantium"
}

Contract Security Audit

Contract ABI

API
[{"constant":false,"inputs":[{"name":"impl","type":"address"}],"name":"upgradeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"implementation","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"changeOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"lockedTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"halted","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"smgFeeReceiverTimeout","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"halt","type":"bool"}],"name":"setHalt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

60806040526201fa406011556102586012556014805460a060020a60ff02191690556013805460ff191660011761010060a860020a03191661010033021790556108168061004e6000396000f3006080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633659cfe681146101415780634fb2e45d146101645780635c60da1b14610185578063715018a6146101b657806379ba5097146101cb5780638da5cb5b146101e0578063a6f9dae1146101f5578063a8b3820514610216578063b9b8af0b1461023d578063d4ee1d9014610266578063e92e2c1b1461027b578063f495438714610290575b601554600160a060020a031680151561011c576040805160e560020a62461bcd02815260206004820152601f60248201527f696d706c656d656e746174696f6e20636f6e7472616374206e6f742073657400604482015290519081900360640190fd5b60405136600082376000803683855af43d806000843e81801561013d578184f35b8184fd5b34801561014d57600080fd5b50610162600160a060020a03600435166102aa565b005b34801561017057600080fd5b50610162600160a060020a0360043516610468565b34801561019157600080fd5b5061019a610591565b60408051600160a060020a039092168252519081900360200190f35b3480156101c257600080fd5b506101626105a0565b3480156101d757600080fd5b50610162610615565b3480156101ec57600080fd5b5061019a610661565b34801561020157600080fd5b50610162600160a060020a0360043516610675565b34801561022257600080fd5b5061022b6106f9565b60408051918252519081900360200190f35b34801561024957600080fd5b506102526106ff565b604080519115158252519081900360200190f35b34801561027257600080fd5b5061019a610720565b34801561028757600080fd5b5061022b61072f565b34801561029c57600080fd5b506101626004351515610735565b6013546101009004600160a060020a031633146102ff576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b600160a060020a0381161515610385576040805160e560020a62461bcd02815260206004820152602160248201527f43616e6e6f74207570677261646520746f20696e76616c69642061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b601554600160a060020a0382811691161415610411576040805160e560020a62461bcd02815260206004820152602960248201527f43616e6e6f74207570677261646520746f207468652073616d6520696d706c6560448201527f6d656e746174696f6e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6015805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6013546101009004600160a060020a031633146104bd576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b600160a060020a038116151561051d576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015290519081900360640190fd5b601354604051600160a060020a0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360138054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b601554600160a060020a031690565b6013546101009004600160a060020a031633146105f5576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b6013805474ffffffffffffffffffffffffffffffffffffffff0019169055565b601454600160a060020a031633141561065f5760145460138054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff00199092169190911790555b565b6013546101009004600160a060020a031681565b6013546101009004600160a060020a031633146106ca576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b6014805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60115481565b60145474010000000000000000000000000000000000000000900460ff1681565b601454600160a060020a031681565b60125481565b6013546101009004600160a060020a0316331461078a576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b60148054911515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001990921691909117905556004e6f74206f776e65720000000000000000000000000000000000000000000000a165627a7a72305820f13b30664901423936885f1ac29e022c65c95c7c0c3a069720f59e7aaf713ca50029

Deployed Bytecode

0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633659cfe681146101415780634fb2e45d146101645780635c60da1b14610185578063715018a6146101b657806379ba5097146101cb5780638da5cb5b146101e0578063a6f9dae1146101f5578063a8b3820514610216578063b9b8af0b1461023d578063d4ee1d9014610266578063e92e2c1b1461027b578063f495438714610290575b601554600160a060020a031680151561011c576040805160e560020a62461bcd02815260206004820152601f60248201527f696d706c656d656e746174696f6e20636f6e7472616374206e6f742073657400604482015290519081900360640190fd5b60405136600082376000803683855af43d806000843e81801561013d578184f35b8184fd5b34801561014d57600080fd5b50610162600160a060020a03600435166102aa565b005b34801561017057600080fd5b50610162600160a060020a0360043516610468565b34801561019157600080fd5b5061019a610591565b60408051600160a060020a039092168252519081900360200190f35b3480156101c257600080fd5b506101626105a0565b3480156101d757600080fd5b50610162610615565b3480156101ec57600080fd5b5061019a610661565b34801561020157600080fd5b50610162600160a060020a0360043516610675565b34801561022257600080fd5b5061022b6106f9565b60408051918252519081900360200190f35b34801561024957600080fd5b506102526106ff565b604080519115158252519081900360200190f35b34801561027257600080fd5b5061019a610720565b34801561028757600080fd5b5061022b61072f565b34801561029c57600080fd5b506101626004351515610735565b6013546101009004600160a060020a031633146102ff576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b600160a060020a0381161515610385576040805160e560020a62461bcd02815260206004820152602160248201527f43616e6e6f74207570677261646520746f20696e76616c69642061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b601554600160a060020a0382811691161415610411576040805160e560020a62461bcd02815260206004820152602960248201527f43616e6e6f74207570677261646520746f207468652073616d6520696d706c6560448201527f6d656e746174696f6e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6015805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6013546101009004600160a060020a031633146104bd576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b600160a060020a038116151561051d576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015290519081900360640190fd5b601354604051600160a060020a0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360138054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b601554600160a060020a031690565b6013546101009004600160a060020a031633146105f5576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b6013805474ffffffffffffffffffffffffffffffffffffffff0019169055565b601454600160a060020a031633141561065f5760145460138054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff00199092169190911790555b565b6013546101009004600160a060020a031681565b6013546101009004600160a060020a031633146106ca576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b6014805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60115481565b60145474010000000000000000000000000000000000000000900460ff1681565b601454600160a060020a031681565b60125481565b6013546101009004600160a060020a0316331461078a576040805160e560020a62461bcd02815260206004820152600960248201526000805160206107cb833981519152604482015290519081900360640190fd5b60148054911515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001990921691909117905556004e6f74206f776e65720000000000000000000000000000000000000000000000a165627a7a72305820f13b30664901423936885f1ac29e022c65c95c7c0c3a069720f59e7aaf713ca50029

Deployed Bytecode Sourcemap

1133:505:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1262:15:3;;-1:-1:-1;;;;;1262:15:3;1295:19;;;1287:63;;;;;-1:-1:-1;;;;;1287:63:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;1401:4;1395:11;1440:12;1437:1;1432:3;1419:34;1527:1;1524;1510:12;1505:3;1498:5;1493:3;1480:49;1554:14;1604:4;1601:1;1596:3;1581:28;1630:6;1649:28;;;;1712:4;1707:3;1700:17;1649:28;1670:4;1665:3;1658:17;1357:279:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1357:279:5;-1:-1:-1;;;;;1357:279:5;;;;;;;1534:221:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1534:221:2;-1:-1:-1;;;;;1534:221:2;;;;;1106:95:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1106:95:3;;;;;;;;-1:-1:-1;;;;;1106:95:3;;;;;;;;;;;;;;2213:81:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2213:81:2;;;;2088:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2088:119:2;;;;1342:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1342:20:2;;;;1988:94;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1988:94:2;-1:-1:-1;;;;;1988:94:2;;;;;1465:38:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1465:38:6;;;;;;;;;;;;;;;;;;;;996:26:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;996:26:1;;;;;;;;;;;;;;;;;;;;;;1504:23:2;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1504:23:2;;;;1752:47:6;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1752:47:6;;;;1340:95:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1340:95:1;;;;;;;1357:279:5;1299:5:2;;;;;-1:-1:-1;;;;;1299:5:2;1285:10;:19;1277:41;;;;;-1:-1:-1;;;;;1277:41:2;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1277:41:2;;;;;;;;;;;;;;;-1:-1:-1;;;;;1425:18:5;;;;1417:64;;;;;-1:-1:-1;;;;;1417:64:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1507:15;;-1:-1:-1;;;;;1499:23:5;;;1507:15;;1499:23;;1491:77;;;;;-1:-1:-1;;;;;1491:77:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1578:15;:22;;-1:-1:-1;;1578:22:5;-1:-1:-1;;;;;1578:22:5;;;;;;;;1615:14;;;;-1:-1:-1;;1615:14:5;1357:279;:::o;1534:221:2:-;1299:5;;;;;-1:-1:-1;;;;;1299:5:2;1285:10;:19;1277:41;;;;;-1:-1:-1;;;;;1277:41:2;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1277:41:2;;;;;;;;;;;;;;;-1:-1:-1;;;;;1611:23:2;;;;1603:65;;;;;-1:-1:-1;;;;;1603:65:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;1704:5;;1683:38;;-1:-1:-1;;;;;1683:38:2;;;;1704:5;;;;;1683:38;;;;;1731:5;:17;;-1:-1:-1;;;;;1731:17:2;;;;;-1:-1:-1;;1731:17:2;;;;;;;;;1534:221::o;1106:95:3:-;1179:15;;-1:-1:-1;;;;;1179:15:3;1106:95;:::o;2213:81:2:-;1299:5;;;;;-1:-1:-1;;;;;1299:5:2;1285:10;:19;1277:41;;;;;-1:-1:-1;;;;;1277:41:2;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1277:41:2;;;;;;;;;;;;;;;2269:5;:18;;-1:-1:-1;;2269:18:2;;;2213:81::o;2088:119::-;2150:8;;-1:-1:-1;;;;;2150:8:2;2136:10;:22;2132:69;;;2182:8;;2174:5;:16;;-1:-1:-1;;;;;2182:8:2;;;;2174:16;-1:-1:-1;;2174:16:2;;;;;;;;;2132:69;2088:119::o;1342:20::-;;;;;;-1:-1:-1;;;;;1342:20:2;;:::o;1988:94::-;1299:5;;;;;-1:-1:-1;;;;;1299:5:2;1285:10;:19;1277:41;;;;;-1:-1:-1;;;;;1277:41:2;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1277:41:2;;;;;;;;;;;;;;;2055:8;:20;;-1:-1:-1;;2055:20:2;-1:-1:-1;;;;;2055:20:2;;;;;;;;;;1988:94::o;1465:38:6:-;;;;:::o;996:26:1:-;;;;;;;;;:::o;1504:23:2:-;;;-1:-1:-1;;;;;1504:23:2;;:::o;1752:47:6:-;;;;:::o;1340:95:1:-;1299:5:2;;;;;-1:-1:-1;;;;;1299:5:2;1285:10;:19;1277:41;;;;;-1:-1:-1;;;;;1277:41:2;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1277:41:2;;;;;;;;;;;;;;;1415:6:1;:13;;;;;;;-1:-1:-1;;1415:13:1;;;;;;;;;1340:95::o

Swarm Source

bzzr://f13b30664901423936885f1ac29e022c65c95c7c0c3a069720f59e7aaf713ca5

Block Transaction Gas Used Reward
view all blocks collator

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
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  ]

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.