ETH Price: $1,880.17 (+1.07%)

Transaction Decoder

Block:
21664356 at Jan-20-2025 07:57:35 AM +UTC
Transaction Fee:
0.010086991867943536 ETH $18.97
Gas Used:
237,176 Gas / 42.529563986 Gwei

Emitted Events:

284 FiatTokenProxy.0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef( 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, 0x0000000000000000000000001715a3e4a142d8b698131108995174f37aeba10d, 0x000000000000000000000000131e18f1cacaf72b55eddf4491e0499164346bc2, 0000000000000000000000000000000000000000000000000000000602ca1a1d )
285 EternalStorageProxy.0x9afd47907e25028cdaca89d193518c302bbb128617d5a992c5abd45815526593( 0x9afd47907e25028cdaca89d193518c302bbb128617d5a992c5abd45815526593, 0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 0x000000000000000000000000131e18f1cacaf72b55eddf4491e0499164346bc2, 0x00050000eb21bb7b72d1042c471c6a52c971da8152d66d7a000000000003c1ec, 0000000000000000000000000000000000000000000000000000000602ca1a1d )
286 EternalStorageProxy.0x27333edb8bdcd40a0ae944fb121b5e2d62ea782683946654a0f5e607a908d578( 0x27333edb8bdcd40a0ae944fb121b5e2d62ea782683946654a0f5e607a908d578, 0x0000000000000000000000004fd0aaa7506f3d9cb8274bdb946ec42a1b8751ef, 0x0000000000000000000000001715a3e4a142d8b698131108995174f37aeba10d, 0x00050000eb21bb7b72d1042c471c6a52c971da8152d66d7a000000000003c1ec, 0000000000000000000000000000000000000000000000000000000000000001 )

Account State Difference:

  Address   Before After State Difference Code
0x131E18f1...164346bc2
0.112503969406301879 Eth
Nonce: 58
0.102416977538358343 Eth
Nonce: 59
0.010086991867943536
0x1715a3E4...37aEBA10D
(PulseChain: Omnibridge Proxy)
(beaverbuild)
9.615616042764667987 Eth9.616035105835294579 Eth0.000419063070626592
0xA0b86991...E3606eB48
0xd0764FAe...456D5636c
(PulseChain: Foreign AMB Proxy)

Execution Trace

EternalStorageProxy.23caab49( )
  • ForeignAMB.safeExecuteSignaturesWithAutoGasLimit( _data=0x00050000EB21BB7B72D1042C471C6A52C971DA8152D66D7A000000000003C1EC4FD0AAA7506F3D9CB8274BDB946EC42A1B8751EF1715A3E4A142D8B698131108995174F37AEBA10D001E8480020100017101272255BB000000000000000000000000A0B86991C6218B36C1D19D4A2E9EB0CE3606EB48000000000000000000000000131E18F1CACAF72B55EDDF4491E0499164346BC20000000000000000000000000000000000000000000000000000000602CA1A1D, _signatures=0x051C1B1B1C1CB3AAFA76EF0842995DDDF469389D35713212A0D458D50C580534A402915BCBD47B415A06482D3ECC3FFB6C591EB71333A889874AB715AB7DC15D9F6D85F2884462B711A6142DD3E2CF82E1FD4317CB2CCCEA67CA114AAE4BE8FE33BEDBF0CA96F59D157B755539D71A533F1979F06EAB650B2F21B6371AC00513BB9FD50B1518D6FC3E4E810E346DFAD2A2DFAF1083522D0A8715EDD3283E1F2D12324F940FBD5BB0351566F4F598B1EB97DE6F7B89ACF3E503A69DDAE11DF9343A18DF4544A557FDF9725D1F34557F76D1A3F961F904DFF72C3B5351ACC61E7401373EE952B611AE41D0E7C18F6258DDC60F26A6034ACE601AB9181824D2EFCD8FD29AB15CC95F8530E446B9FE9D13EFBB70053CAED4510EC374285A8485A32B10794B49078B118A363B73C92211443F031D8417E1429C5BD175C86AFBD9987BFEF763769656 )
    • EternalStorageProxy.CALL( )
      • BridgeValidators.DELEGATECALL( )
      • Null: 0x000...001.a3a7dddd( )
      • EternalStorageProxy.facd743b( )
        • BridgeValidators.isValidator( _validator=0xd4Aa3dFe78D2B77C5A5618B9E85D1141f2b48fbD ) => ( True )
        • Null: 0x000...001.a3a7dddd( )
        • EternalStorageProxy.facd743b( )
          • BridgeValidators.isValidator( _validator=0xe158313e347ED8d52e9FBfF7aE5000aEAbDDbeDa ) => ( True )
          • Null: 0x000...001.a3a7dddd( )
          • EternalStorageProxy.facd743b( )
            • BridgeValidators.isValidator( _validator=0xe3B95d0143956A8E643FA29a0795FC4162A41F69 ) => ( True )
            • Null: 0x000...001.a3a7dddd( )
            • EternalStorageProxy.facd743b( )
              • BridgeValidators.isValidator( _validator=0xFE9a08BB3ce6C1946c40b8767feF2F97B400dd2C ) => ( True )
              • Null: 0x000...001.a3a7dddd( )
              • EternalStorageProxy.facd743b( )
                • BridgeValidators.isValidator( _validator=0x1daD947dD181fAa6c751ec14e2683e0A8fE2bf8c ) => ( True )
                • EternalStorageProxy.272255bb( )
                  • ForeignOmnibridge.handleNativeTokens( _token=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, _recipient=0x131E18f1caCAf72B55Eddf4491E0499164346bc2, _value=25816603165 )
                    • EternalStorageProxy.STATICCALL( )
                      • ForeignAMB.DELEGATECALL( )
                      • FiatTokenProxy.a9059cbb( )
                        • FiatTokenV2_2.transfer( to=0x131E18f1caCAf72B55Eddf4491E0499164346bc2, value=25816603165 ) => ( True )
                        • EternalStorageProxy.STATICCALL( )
                          • ForeignAMB.DELEGATECALL( )
                            safeExecuteSignaturesWithAutoGasLimit[BasicForeignAMB (ln:1568)]
                            File 1 of 8: EternalStorageProxy
                            // File: contracts/upgradeability/EternalStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title EternalStorage
                             * @dev This contract holds all the necessary state variables to carry out the storage of any contract.
                             */
                            contract EternalStorage {
                                mapping(bytes32 => uint256) internal uintStorage;
                                mapping(bytes32 => string) internal stringStorage;
                                mapping(bytes32 => address) internal addressStorage;
                                mapping(bytes32 => bytes) internal bytesStorage;
                                mapping(bytes32 => bool) internal boolStorage;
                                mapping(bytes32 => int256) internal intStorage;
                            
                            }
                            
                            // File: openzeppelin-solidity/contracts/AddressUtils.sol
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * Utility library of inline functions on addresses
                             */
                            library AddressUtils {
                            
                              /**
                               * Returns whether the target address is a contract
                               * @dev This function will return false if invoked during the constructor of a contract,
                               * as the code is not actually created until after the constructor finishes.
                               * @param _addr address to check
                               * @return whether the target address is a contract
                               */
                              function isContract(address _addr) internal view returns (bool) {
                                uint256 size;
                                // XXX Currently there is no better way to check if there is a contract in an address
                                // than to check the size of the code at that address.
                                // See https://ethereum.stackexchange.com/a/14016/36603
                                // for more details about how this works.
                                // TODO Check this again before the Serenity release, because all addresses will be
                                // contracts then.
                                // solium-disable-next-line security/no-inline-assembly
                                assembly { size := extcodesize(_addr) }
                                return size > 0;
                              }
                            
                            }
                            
                            // File: contracts/upgradeability/Proxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title Proxy
                             * @dev Gives the possibility to delegate any call to a foreign implementation.
                             */
                            contract Proxy {
                                /**
                                * @dev Tells the address of the implementation where every call will be delegated.
                                * @return address of the implementation to which it will be delegated
                                */
                                /* solcov ignore next */
                                function implementation() public view returns (address);
                            
                                /**
                                * @dev Fallback function allowing to perform a delegatecall to the given implementation.
                                * This function will return whatever the implementation call returns
                                */
                                function() public payable {
                                    // solhint-disable-previous-line no-complex-fallback
                                    address _impl = implementation();
                                    require(_impl != address(0));
                                    assembly {
                                        /*
                                            0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40)
                                            loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty
                                            memory. It's needed because we're going to write the return data of delegatecall to the
                                            free memory slot.
                                        */
                                        let ptr := mload(0x40)
                                        /*
                                            `calldatacopy` is copy calldatasize bytes from calldata
                                            First argument is the destination to which data is copied(ptr)
                                            Second argument specifies the start position of the copied data.
                                                Since calldata is sort of its own unique location in memory,
                                                0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata.
                                                That's always going to be the zeroth byte of the function selector.
                                            Third argument, calldatasize, specifies how much data will be copied.
                                                calldata is naturally calldatasize bytes long (same thing as msg.data.length)
                                        */
                                        calldatacopy(ptr, 0, calldatasize)
                                        /*
                                            delegatecall params explained:
                                            gas: the amount of gas to provide for the call. `gas` is an Opcode that gives
                                                us the amount of gas still available to execution
                            
                                            _impl: address of the contract to delegate to
                            
                                            ptr: to pass copied data
                            
                                            calldatasize: loads the size of `bytes memory data`, same as msg.data.length
                            
                                            0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic,
                                                    these are set to 0, 0 so the output data will not be written to memory. The output
                                                    data will be read using `returndatasize` and `returdatacopy` instead.
                            
                                            result: This will be 0 if the call fails and 1 if it succeeds
                                        */
                                        let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
                                        /*
                            
                                        */
                                        /*
                                            ptr current points to the value stored at 0x40,
                                            because we assigned it like ptr := mload(0x40).
                                            Because we use 0x40 as a free memory pointer,
                                            we want to make sure that the next time we want to allocate memory,
                                            we aren't overwriting anything important.
                                            So, by adding ptr and returndatasize,
                                            we get a memory location beyond the end of the data we will be copying to ptr.
                                            We place this in at 0x40, and any reads from 0x40 will now read from free memory
                                        */
                                        mstore(0x40, add(ptr, returndatasize))
                                        /*
                                            `returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the
                                                slot it will copy to, 0 means copy from the beginning of the return data, and size is
                                                the amount of data to copy.
                                            `returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall
                                        */
                                        returndatacopy(ptr, 0, returndatasize)
                            
                                        /*
                                            if `result` is 0, revert.
                                            if `result` is 1, return `size` amount of data from `ptr`. This is the data that was
                                            copied to `ptr` from the delegatecall return data
                                        */
                                        switch result
                                            case 0 {
                                                revert(ptr, returndatasize)
                                            }
                                            default {
                                                return(ptr, returndatasize)
                                            }
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title UpgradeabilityStorage
                             * @dev This contract holds all the necessary state variables to support the upgrade functionality
                             */
                            contract UpgradeabilityStorage {
                                // Version name of the current implementation
                                uint256 internal _version;
                            
                                // Address of the current implementation
                                address internal _implementation;
                            
                                /**
                                * @dev Tells the version name of the current implementation
                                * @return uint256 representing the name of the current version
                                */
                                function version() external view returns (uint256) {
                                    return _version;
                                }
                            
                                /**
                                * @dev Tells the address of the current implementation
                                * @return address of the current implementation
                                */
                                function implementation() public view returns (address) {
                                    return _implementation;
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityProxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            
                            /**
                             * @title UpgradeabilityProxy
                             * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded
                             */
                            contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage {
                                /**
                                * @dev This event will be emitted every time the implementation gets upgraded
                                * @param version representing the version name of the upgraded implementation
                                * @param implementation representing the address of the upgraded implementation
                                */
                                event Upgraded(uint256 version, address indexed implementation);
                            
                                /**
                                * @dev Upgrades the implementation address
                                * @param version representing the version name of the new implementation to be set
                                * @param implementation representing the address of the new implementation to be set
                                */
                                function _upgradeTo(uint256 version, address implementation) internal {
                                    require(_implementation != implementation);
                            
                                    // This additional check verifies that provided implementation is at least a contract
                                    require(AddressUtils.isContract(implementation));
                            
                                    // This additional check guarantees that new version will be at least greater than the privios one,
                                    // so it is impossible to reuse old versions, or use the last version twice
                                    require(version > _version);
                            
                                    _version = version;
                                    _implementation = implementation;
                                    emit Upgraded(version, implementation);
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityOwnerStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title UpgradeabilityOwnerStorage
                             * @dev This contract keeps track of the upgradeability owner
                             */
                            contract UpgradeabilityOwnerStorage {
                                // Owner of the contract
                                address internal _upgradeabilityOwner;
                            
                                /**
                                * @dev Tells the address of the owner
                                * @return the address of the owner
                                */
                                function upgradeabilityOwner() public view returns (address) {
                                    return _upgradeabilityOwner;
                                }
                            
                                /**
                                * @dev Sets the address of the owner
                                */
                                function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
                                    _upgradeabilityOwner = newUpgradeabilityOwner;
                                }
                            }
                            
                            // File: contracts/upgradeability/OwnedUpgradeabilityProxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            /**
                             * @title OwnedUpgradeabilityProxy
                             * @dev This contract combines an upgradeability proxy with basic authorization control functionalities
                             */
                            contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityProxy {
                                /**
                                * @dev Event to show ownership has been transferred
                                * @param previousOwner representing the address of the previous owner
                                * @param newOwner representing the address of the new owner
                                */
                                event ProxyOwnershipTransferred(address previousOwner, address newOwner);
                            
                                /**
                                * @dev the constructor sets the original owner of the contract to the sender account.
                                */
                                constructor() public {
                                    setUpgradeabilityOwner(msg.sender);
                                }
                            
                                /**
                                * @dev Throws if called by any account other than the owner.
                                */
                                modifier onlyUpgradeabilityOwner() {
                                    require(msg.sender == upgradeabilityOwner());
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                /**
                                * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                * @param newOwner The address to transfer ownership to.
                                */
                                function transferProxyOwnership(address newOwner) external onlyUpgradeabilityOwner {
                                    require(newOwner != address(0));
                                    emit ProxyOwnershipTransferred(upgradeabilityOwner(), newOwner);
                                    setUpgradeabilityOwner(newOwner);
                                }
                            
                                /**
                                * @dev Allows the upgradeability owner to upgrade the current version of the proxy.
                                * @param version representing the version name of the new implementation to be set.
                                * @param implementation representing the address of the new implementation to be set.
                                */
                                function upgradeTo(uint256 version, address implementation) public onlyUpgradeabilityOwner {
                                    _upgradeTo(version, implementation);
                                }
                            
                                /**
                                * @dev Allows the upgradeability owner to upgrade the current version of the proxy and call the new implementation
                                * to initialize whatever is needed through a low level call.
                                * @param version representing the version name of the new implementation to be set.
                                * @param implementation representing the address of the new implementation to be set.
                                * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
                                * signature of the implementation to be called with the needed payload
                                */
                                function upgradeToAndCall(uint256 version, address implementation, bytes data)
                                    external
                                    payable
                                    onlyUpgradeabilityOwner
                                {
                                    upgradeTo(version, implementation);
                                    // solhint-disable-next-line avoid-call-value
                                    require(address(this).call.value(msg.value)(data));
                                }
                            }
                            
                            // File: contracts/upgradeability/EternalStorageProxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            /**
                             * @title EternalStorageProxy
                             * @dev This proxy holds the storage of the token contract and delegates every call to the current implementation set.
                             * Besides, it allows to upgrade the token's behaviour towards further implementations, and provides basic
                             * authorization control functionalities
                             */
                            // solhint-disable-next-line no-empty-blocks
                            contract EternalStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {}

                            File 2 of 8: FiatTokenProxy
                            pragma solidity ^0.4.24;
                            
                            // File: zos-lib/contracts/upgradeability/Proxy.sol
                            
                            /**
                             * @title Proxy
                             * @dev Implements delegation of calls to other contracts, with proper
                             * forwarding of return values and bubbling of failures.
                             * It defines a fallback function that delegates all calls to the address
                             * returned by the abstract _implementation() internal function.
                             */
                            contract Proxy {
                              /**
                               * @dev Fallback function.
                               * Implemented entirely in `_fallback`.
                               */
                              function () payable external {
                                _fallback();
                              }
                            
                              /**
                               * @return The Address of the implementation.
                               */
                              function _implementation() internal view returns (address);
                            
                              /**
                               * @dev Delegates execution to an implementation contract.
                               * This is a low level function that doesn't return to its internal call site.
                               * It will return to the external caller whatever the implementation returns.
                               * @param implementation Address to delegate.
                               */
                              function _delegate(address implementation) internal {
                                assembly {
                                  // Copy msg.data. We take full control of memory in this inline assembly
                                  // block because it will not return to Solidity code. We overwrite the
                                  // Solidity scratch pad at memory position 0.
                                  calldatacopy(0, 0, calldatasize)
                            
                                  // Call the implementation.
                                  // out and outsize are 0 because we don't know the size yet.
                                  let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0)
                            
                                  // Copy the returned data.
                                  returndatacopy(0, 0, returndatasize)
                            
                                  switch result
                                  // delegatecall returns 0 on error.
                                  case 0 { revert(0, returndatasize) }
                                  default { return(0, returndatasize) }
                                }
                              }
                            
                              /**
                               * @dev Function that is run as the first thing in the fallback function.
                               * Can be redefined in derived contracts to add functionality.
                               * Redefinitions must call super._willFallback().
                               */
                              function _willFallback() internal {
                              }
                            
                              /**
                               * @dev fallback implementation.
                               * Extracted to enable manual triggering.
                               */
                              function _fallback() internal {
                                _willFallback();
                                _delegate(_implementation());
                              }
                            }
                            
                            // File: openzeppelin-solidity/contracts/AddressUtils.sol
                            
                            /**
                             * Utility library of inline functions on addresses
                             */
                            library AddressUtils {
                            
                              /**
                               * Returns whether the target address is a contract
                               * @dev This function will return false if invoked during the constructor of a contract,
                               * as the code is not actually created until after the constructor finishes.
                               * @param addr address to check
                               * @return whether the target address is a contract
                               */
                              function isContract(address addr) internal view returns (bool) {
                                uint256 size;
                                // XXX Currently there is no better way to check if there is a contract in an address
                                // than to check the size of the code at that address.
                                // See https://ethereum.stackexchange.com/a/14016/36603
                                // for more details about how this works.
                                // TODO Check this again before the Serenity release, because all addresses will be
                                // contracts then.
                                // solium-disable-next-line security/no-inline-assembly
                                assembly { size := extcodesize(addr) }
                                return size > 0;
                              }
                            
                            }
                            
                            // File: zos-lib/contracts/upgradeability/UpgradeabilityProxy.sol
                            
                            /**
                             * @title UpgradeabilityProxy
                             * @dev This contract implements a proxy that allows to change the
                             * implementation address to which it will delegate.
                             * Such a change is called an implementation upgrade.
                             */
                            contract UpgradeabilityProxy is Proxy {
                              /**
                               * @dev Emitted when the implementation is upgraded.
                               * @param implementation Address of the new implementation.
                               */
                              event Upgraded(address implementation);
                            
                              /**
                               * @dev Storage slot with the address of the current implementation.
                               * This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and is
                               * validated in the constructor.
                               */
                              bytes32 private constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
                            
                              /**
                               * @dev Contract constructor.
                               * @param _implementation Address of the initial implementation.
                               */
                              constructor(address _implementation) public {
                                assert(IMPLEMENTATION_SLOT == keccak256("org.zeppelinos.proxy.implementation"));
                            
                                _setImplementation(_implementation);
                              }
                            
                              /**
                               * @dev Returns the current implementation.
                               * @return Address of the current implementation
                               */
                              function _implementation() internal view returns (address impl) {
                                bytes32 slot = IMPLEMENTATION_SLOT;
                                assembly {
                                  impl := sload(slot)
                                }
                              }
                            
                              /**
                               * @dev Upgrades the proxy to a new implementation.
                               * @param newImplementation Address of the new implementation.
                               */
                              function _upgradeTo(address newImplementation) internal {
                                _setImplementation(newImplementation);
                                emit Upgraded(newImplementation);
                              }
                            
                              /**
                               * @dev Sets the implementation address of the proxy.
                               * @param newImplementation Address of the new implementation.
                               */
                              function _setImplementation(address newImplementation) private {
                                require(AddressUtils.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
                            
                                bytes32 slot = IMPLEMENTATION_SLOT;
                            
                                assembly {
                                  sstore(slot, newImplementation)
                                }
                              }
                            }
                            
                            // File: zos-lib/contracts/upgradeability/AdminUpgradeabilityProxy.sol
                            
                            /**
                             * @title AdminUpgradeabilityProxy
                             * @dev This contract combines an upgradeability proxy with an authorization
                             * mechanism for administrative tasks.
                             * All external functions in this contract must be guarded by the
                             * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
                             * feature proposal that would enable this to be done automatically.
                             */
                            contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
                              /**
                               * @dev Emitted when the administration has been transferred.
                               * @param previousAdmin Address of the previous admin.
                               * @param newAdmin Address of the new admin.
                               */
                              event AdminChanged(address previousAdmin, address newAdmin);
                            
                              /**
                               * @dev Storage slot with the admin of the contract.
                               * This is the keccak-256 hash of "org.zeppelinos.proxy.admin", and is
                               * validated in the constructor.
                               */
                              bytes32 private constant ADMIN_SLOT = 0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b;
                            
                              /**
                               * @dev Modifier to check whether the `msg.sender` is the admin.
                               * If it is, it will run the function. Otherwise, it will delegate the call
                               * to the implementation.
                               */
                              modifier ifAdmin() {
                                if (msg.sender == _admin()) {
                                  _;
                                } else {
                                  _fallback();
                                }
                              }
                            
                              /**
                               * Contract constructor.
                               * It sets the `msg.sender` as the proxy administrator.
                               * @param _implementation address of the initial implementation.
                               */
                              constructor(address _implementation) UpgradeabilityProxy(_implementation) public {
                                assert(ADMIN_SLOT == keccak256("org.zeppelinos.proxy.admin"));
                            
                                _setAdmin(msg.sender);
                              }
                            
                              /**
                               * @return The address of the proxy admin.
                               */
                              function admin() external view ifAdmin returns (address) {
                                return _admin();
                              }
                            
                              /**
                               * @return The address of the implementation.
                               */
                              function implementation() external view ifAdmin returns (address) {
                                return _implementation();
                              }
                            
                              /**
                               * @dev Changes the admin of the proxy.
                               * Only the current admin can call this function.
                               * @param newAdmin Address to transfer proxy administration to.
                               */
                              function changeAdmin(address newAdmin) external ifAdmin {
                                require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
                                emit AdminChanged(_admin(), newAdmin);
                                _setAdmin(newAdmin);
                              }
                            
                              /**
                               * @dev Upgrade the backing implementation of the proxy.
                               * Only the admin can call this function.
                               * @param newImplementation Address of the new implementation.
                               */
                              function upgradeTo(address newImplementation) external ifAdmin {
                                _upgradeTo(newImplementation);
                              }
                            
                              /**
                               * @dev Upgrade the backing implementation of the proxy and call a function
                               * on the new implementation.
                               * This is useful to initialize the proxied contract.
                               * @param newImplementation Address of the new implementation.
                               * @param data Data to send as msg.data in the low level call.
                               * It should include the signature and the parameters of the function to be
                               * called, as described in
                               * https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector-and-argument-encoding.
                               */
                              function upgradeToAndCall(address newImplementation, bytes data) payable external ifAdmin {
                                _upgradeTo(newImplementation);
                                require(address(this).call.value(msg.value)(data));
                              }
                            
                              /**
                               * @return The admin slot.
                               */
                              function _admin() internal view returns (address adm) {
                                bytes32 slot = ADMIN_SLOT;
                                assembly {
                                  adm := sload(slot)
                                }
                              }
                            
                              /**
                               * @dev Sets the address of the proxy admin.
                               * @param newAdmin Address of the new proxy admin.
                               */
                              function _setAdmin(address newAdmin) internal {
                                bytes32 slot = ADMIN_SLOT;
                            
                                assembly {
                                  sstore(slot, newAdmin)
                                }
                              }
                            
                              /**
                               * @dev Only fall back when the sender is not the admin.
                               */
                              function _willFallback() internal {
                                require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
                                super._willFallback();
                              }
                            }
                            
                            // File: contracts/FiatTokenProxy.sol
                            
                            /**
                            * Copyright CENTRE SECZ 2018
                            *
                            * Permission is hereby granted, free of charge, to any person obtaining a copy 
                            * of this software and associated documentation files (the "Software"), to deal 
                            * in the Software without restriction, including without limitation the rights 
                            * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
                            * copies of the Software, and to permit persons to whom the Software is furnished to 
                            * do so, subject to the following conditions:
                            *
                            * The above copyright notice and this permission notice shall be included in all 
                            * copies or substantial portions of the Software.
                            *
                            * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
                            * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
                            * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
                            * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
                            * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
                            * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
                            */
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * @title FiatTokenProxy
                             * @dev This contract proxies FiatToken calls and enables FiatToken upgrades
                            */ 
                            contract FiatTokenProxy is AdminUpgradeabilityProxy {
                                constructor(address _implementation) public AdminUpgradeabilityProxy(_implementation) {
                                }
                            }

                            File 3 of 8: EternalStorageProxy
                            // File: contracts/upgradeability/EternalStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title EternalStorage
                             * @dev This contract holds all the necessary state variables to carry out the storage of any contract.
                             */
                            contract EternalStorage {
                                mapping(bytes32 => uint256) internal uintStorage;
                                mapping(bytes32 => string) internal stringStorage;
                                mapping(bytes32 => address) internal addressStorage;
                                mapping(bytes32 => bytes) internal bytesStorage;
                                mapping(bytes32 => bool) internal boolStorage;
                                mapping(bytes32 => int256) internal intStorage;
                            }
                            
                            // File: @openzeppelin/contracts/utils/Address.sol
                            
                            
                            pragma solidity ^0.7.0;
                            
                            /**
                             * @dev Collection of functions related to the address type
                             */
                            library Address {
                                /**
                                 * @dev Returns true if `account` is a contract.
                                 *
                                 * [IMPORTANT]
                                 * ====
                                 * It is unsafe to assume that an address for which this function returns
                                 * false is an externally-owned account (EOA) and not a contract.
                                 *
                                 * Among others, `isContract` will return false for the following
                                 * types of addresses:
                                 *
                                 *  - an externally-owned account
                                 *  - a contract in construction
                                 *  - an address where a contract will be created
                                 *  - an address where a contract lived, but was destroyed
                                 * ====
                                 */
                                function isContract(address account) internal view returns (bool) {
                                    // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
                                    // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
                                    // for accounts without code, i.e. `keccak256('')`
                                    bytes32 codehash;
                                    bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
                                    // solhint-disable-next-line no-inline-assembly
                                    assembly { codehash := extcodehash(account) }
                                    return (codehash != accountHash && codehash != 0x0);
                                }
                            
                                /**
                                 * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                                 * `recipient`, forwarding all available gas and reverting on errors.
                                 *
                                 * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                                 * of certain opcodes, possibly making contracts go over the 2300 gas limit
                                 * imposed by `transfer`, making them unable to receive funds via
                                 * `transfer`. {sendValue} removes this limitation.
                                 *
                                 * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                                 *
                                 * IMPORTANT: because control is transferred to `recipient`, care must be
                                 * taken to not create reentrancy vulnerabilities. Consider using
                                 * {ReentrancyGuard} or the
                                 * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                                 */
                                function sendValue(address payable recipient, uint256 amount) internal {
                                    require(address(this).balance >= amount, "Address: insufficient balance");
                            
                                    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
                                    (bool success, ) = recipient.call{ value: amount }("");
                                    require(success, "Address: unable to send value, recipient may have reverted");
                                }
                            
                                /**
                                 * @dev Performs a Solidity function call using a low level `call`. A
                                 * plain`call` is an unsafe replacement for a function call: use this
                                 * function instead.
                                 *
                                 * If `target` reverts with a revert reason, it is bubbled up by this
                                 * function (like regular Solidity function calls).
                                 *
                                 * Returns the raw returned data. To convert to the expected return value,
                                 * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
                                 *
                                 * Requirements:
                                 *
                                 * - `target` must be a contract.
                                 * - calling `target` with `data` must not revert.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCall(address target, bytes memory data) internal returns (bytes memory) {
                                  return functionCall(target, data, "Address: low-level call failed");
                                }
                            
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
                                 * `errorMessage` as a fallback revert reason when `target` reverts.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
                                    return _functionCallWithValue(target, data, 0, errorMessage);
                                }
                            
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                                 * but also transferring `value` wei to `target`.
                                 *
                                 * Requirements:
                                 *
                                 * - the calling contract must have an ETH balance of at least `value`.
                                 * - the called Solidity function must be `payable`.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
                                    return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
                                }
                            
                                /**
                                 * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
                                 * with `errorMessage` as a fallback revert reason when `target` reverts.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
                                    require(address(this).balance >= value, "Address: insufficient balance for call");
                                    return _functionCallWithValue(target, data, value, errorMessage);
                                }
                            
                                function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
                                    require(isContract(target), "Address: call to non-contract");
                            
                                    // solhint-disable-next-line avoid-low-level-calls
                                    (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
                                    if (success) {
                                        return returndata;
                                    } else {
                                        // Look for revert reason and bubble it up if present
                                        if (returndata.length > 0) {
                                            // The easiest way to bubble the revert reason is using memory via assembly
                            
                                            // solhint-disable-next-line no-inline-assembly
                                            assembly {
                                                let returndata_size := mload(returndata)
                                                revert(add(32, returndata), returndata_size)
                                            }
                                        } else {
                                            revert(errorMessage);
                                        }
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeability/Proxy.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title Proxy
                             * @dev Gives the possibility to delegate any call to a foreign implementation.
                             */
                            abstract contract Proxy {
                                /**
                                 * @dev Tells the address of the implementation where every call will be delegated.
                                 * @return address of the implementation to which it will be delegated
                                 */
                                function implementation() public view virtual returns (address);
                            
                                /**
                                 * @dev Fallback function allowing to perform a delegatecall to the given implementation.
                                 * This function will return whatever the implementation call returns
                                 */
                                fallback() external payable {
                                    // solhint-disable-previous-line no-complex-fallback
                                    address _impl = implementation();
                                    require(_impl != address(0));
                                    assembly {
                                        /*
                                            0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40)
                                            loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty
                                            memory. It's needed because we're going to write the return data of delegatecall to the
                                            free memory slot.
                                        */
                                        let ptr := mload(0x40)
                                        /*
                                            `calldatacopy` is copy calldatasize bytes from calldata
                                            First argument is the destination to which data is copied(ptr)
                                            Second argument specifies the start position of the copied data.
                                                Since calldata is sort of its own unique location in memory,
                                                0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata.
                                                That's always going to be the zeroth byte of the function selector.
                                            Third argument, calldatasize, specifies how much data will be copied.
                                                calldata is naturally calldatasize bytes long (same thing as msg.data.length)
                                        */
                                        calldatacopy(ptr, 0, calldatasize())
                                        /*
                                            delegatecall params explained:
                                            gas: the amount of gas to provide for the call. `gas` is an Opcode that gives
                                                us the amount of gas still available to execution
                            
                                            _impl: address of the contract to delegate to
                            
                                            ptr: to pass copied data
                            
                                            calldatasize: loads the size of `bytes memory data`, same as msg.data.length
                            
                                            0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic,
                                                    these are set to 0, 0 so the output data will not be written to memory. The output
                                                    data will be read using `returndatasize` and `returdatacopy` instead.
                            
                                            result: This will be 0 if the call fails and 1 if it succeeds
                                        */
                                        let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
                                        /*
                            
                                        */
                                        /*
                                            ptr current points to the value stored at 0x40,
                                            because we assigned it like ptr := mload(0x40).
                                            Because we use 0x40 as a free memory pointer,
                                            we want to make sure that the next time we want to allocate memory,
                                            we aren't overwriting anything important.
                                            So, by adding ptr and returndatasize,
                                            we get a memory location beyond the end of the data we will be copying to ptr.
                                            We place this in at 0x40, and any reads from 0x40 will now read from free memory
                                        */
                                        mstore(0x40, add(ptr, returndatasize()))
                                        /*
                                            `returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the
                                                slot it will copy to, 0 means copy from the beginning of the return data, and size is
                                                the amount of data to copy.
                                            `returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall
                                        */
                                        returndatacopy(ptr, 0, returndatasize())
                            
                                        /*
                                            if `result` is 0, revert.
                                            if `result` is 1, return `size` amount of data from `ptr`. This is the data that was
                                            copied to `ptr` from the delegatecall return data
                                        */
                                        switch result
                                            case 0 {
                                                revert(ptr, returndatasize())
                                            }
                                            default {
                                                return(ptr, returndatasize())
                                            }
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title UpgradeabilityStorage
                             * @dev This contract holds all the necessary state variables to support the upgrade functionality
                             */
                            contract UpgradeabilityStorage {
                                // Version name of the current implementation
                                uint256 internal _version;
                            
                                // Address of the current implementation
                                address internal _implementation;
                            
                                /**
                                 * @dev Tells the version name of the current implementation
                                 * @return uint256 representing the name of the current version
                                 */
                                function version() external view returns (uint256) {
                                    return _version;
                                }
                            
                                /**
                                 * @dev Tells the address of the current implementation
                                 * @return address of the current implementation
                                 */
                                function implementation() public view virtual returns (address) {
                                    return _implementation;
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityProxy.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            /**
                             * @title UpgradeabilityProxy
                             * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded
                             */
                            contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage {
                                /**
                                 * @dev This event will be emitted every time the implementation gets upgraded
                                 * @param version representing the version name of the upgraded implementation
                                 * @param implementation representing the address of the upgraded implementation
                                 */
                                event Upgraded(uint256 version, address indexed implementation);
                            
                                /**
                                 * @dev Tells the address of the current implementation
                                 * @return address of the current implementation
                                 */
                                function implementation() public view override(Proxy, UpgradeabilityStorage) returns (address) {
                                    return UpgradeabilityStorage.implementation();
                                }
                            
                                /**
                                 * @dev Upgrades the implementation address
                                 * @param version representing the version name of the new implementation to be set
                                 * @param implementation representing the address of the new implementation to be set
                                 */
                                function _upgradeTo(uint256 version, address implementation) internal {
                                    require(_implementation != implementation);
                            
                                    // This additional check verifies that provided implementation is at least a contract
                                    require(Address.isContract(implementation));
                            
                                    // This additional check guarantees that new version will be at least greater than the previous one,
                                    // so it is impossible to reuse old versions, or use the last version twice
                                    require(version > _version);
                            
                                    _version = version;
                                    _implementation = implementation;
                                    emit Upgraded(version, implementation);
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityOwnerStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title UpgradeabilityOwnerStorage
                             * @dev This contract keeps track of the upgradeability owner
                             */
                            contract UpgradeabilityOwnerStorage {
                                // Owner of the contract
                                address internal _upgradeabilityOwner;
                            
                                /**
                                 * @dev Tells the address of the owner
                                 * @return the address of the owner
                                 */
                                function upgradeabilityOwner() public view returns (address) {
                                    return _upgradeabilityOwner;
                                }
                            
                                /**
                                 * @dev Sets the address of the owner
                                 */
                                function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
                                    _upgradeabilityOwner = newUpgradeabilityOwner;
                                }
                            }
                            
                            // File: contracts/upgradeability/OwnedUpgradeabilityProxy.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title OwnedUpgradeabilityProxy
                             * @dev This contract combines an upgradeability proxy with basic authorization control functionalities
                             */
                            contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityProxy {
                                /**
                                 * @dev Event to show ownership has been transferred
                                 * @param previousOwner representing the address of the previous owner
                                 * @param newOwner representing the address of the new owner
                                 */
                                event ProxyOwnershipTransferred(address previousOwner, address newOwner);
                            
                                /**
                                 * @dev the constructor sets the original owner of the contract to the sender account.
                                 */
                                constructor() {
                                    setUpgradeabilityOwner(msg.sender);
                                }
                            
                                /**
                                 * @dev Throws if called by any account other than the owner.
                                 */
                                modifier onlyUpgradeabilityOwner() {
                                    require(msg.sender == upgradeabilityOwner());
                                    _;
                                }
                            
                                /**
                                 * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                 * @param newOwner The address to transfer ownership to.
                                 */
                                function transferProxyOwnership(address newOwner) external onlyUpgradeabilityOwner {
                                    require(newOwner != address(0));
                                    emit ProxyOwnershipTransferred(upgradeabilityOwner(), newOwner);
                                    setUpgradeabilityOwner(newOwner);
                                }
                            
                                /**
                                 * @dev Allows the upgradeability owner to upgrade the current version of the proxy.
                                 * @param version representing the version name of the new implementation to be set.
                                 * @param implementation representing the address of the new implementation to be set.
                                 */
                                function upgradeTo(uint256 version, address implementation) public onlyUpgradeabilityOwner {
                                    _upgradeTo(version, implementation);
                                }
                            
                                /**
                                 * @dev Allows the upgradeability owner to upgrade the current version of the proxy and call the new implementation
                                 * to initialize whatever is needed through a low level call.
                                 * @param version representing the version name of the new implementation to be set.
                                 * @param implementation representing the address of the new implementation to be set.
                                 * @param data represents the msg.data to be sent in the low level call. This parameter may include the function
                                 * signature of the implementation to be called with the needed payload
                                 */
                                function upgradeToAndCall(
                                    uint256 version,
                                    address implementation,
                                    bytes calldata data
                                ) external payable onlyUpgradeabilityOwner {
                                    upgradeTo(version, implementation);
                                    // solhint-disable-next-line avoid-call-value
                                    (bool status, ) = address(this).call{ value: msg.value }(data);
                                    require(status);
                                }
                            }
                            
                            // File: contracts/upgradeability/EternalStorageProxy.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title EternalStorageProxy
                             * @dev This proxy holds the storage of the token contract and delegates every call to the current implementation set.
                             * Besides, it allows to upgrade the token's behaviour towards further implementations, and provides basic
                             * authorization control functionalities
                             */
                            contract EternalStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {
                            
                            }
                            

                            File 4 of 8: ForeignAMB
                            // File: contracts/interfaces/IBridgeValidators.sol
                            
                            pragma solidity 0.4.24;
                            
                            interface IBridgeValidators {
                                function isValidator(address _validator) external view returns (bool);
                                function requiredSignatures() external view returns (uint256);
                                function owner() external view returns (address);
                            }
                            
                            // File: contracts/libraries/Message.sol
                            
                            pragma solidity 0.4.24;
                            
                            library Message {
                                function addressArrayContains(address[] array, address value) internal pure returns (bool) {
                                    for (uint256 i = 0; i < array.length; i++) {
                                        if (array[i] == value) {
                                            return true;
                                        }
                                    }
                                    return false;
                                }
                                // layout of message :: bytes:
                                // offset  0: 32 bytes :: uint256 - message length
                                // offset 32: 20 bytes :: address - recipient address
                                // offset 52: 32 bytes :: uint256 - value
                                // offset 84: 32 bytes :: bytes32 - transaction hash
                                // offset 116: 20 bytes :: address - contract address to prevent double spending
                            
                                // mload always reads 32 bytes.
                                // so we can and have to start reading recipient at offset 20 instead of 32.
                                // if we were to read at 32 the address would contain part of value and be corrupted.
                                // when reading from offset 20 mload will read 12 bytes (most of them zeros) followed
                                // by the 20 recipient address bytes and correctly convert it into an address.
                                // this saves some storage/gas over the alternative solution
                                // which is padding address to 32 bytes and reading recipient at offset 32.
                                // for more details see discussion in:
                                // https://github.com/paritytech/parity-bridge/issues/61
                                function parseMessage(bytes message)
                                    internal
                                    pure
                                    returns (address recipient, uint256 amount, bytes32 txHash, address contractAddress)
                                {
                                    require(isMessageValid(message));
                                    assembly {
                                        recipient := mload(add(message, 20))
                                        amount := mload(add(message, 52))
                                        txHash := mload(add(message, 84))
                                        contractAddress := mload(add(message, 104))
                                    }
                                }
                            
                                function isMessageValid(bytes _msg) internal pure returns (bool) {
                                    return _msg.length == requiredMessageLength();
                                }
                            
                                function requiredMessageLength() internal pure returns (uint256) {
                                    return 104;
                                }
                            
                                function recoverAddressFromSignedMessage(bytes signature, bytes message, bool isAMBMessage)
                                    internal
                                    pure
                                    returns (address)
                                {
                                    require(signature.length == 65);
                                    bytes32 r;
                                    bytes32 s;
                                    bytes1 v;
                            
                                    assembly {
                                        r := mload(add(signature, 0x20))
                                        s := mload(add(signature, 0x40))
                                        v := mload(add(signature, 0x60))
                                    }
                                    require(uint8(v) == 27 || uint8(v) == 28);
                                    require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0);
                            
                                    return ecrecover(hashMessage(message, isAMBMessage), uint8(v), r, s);
                                }
                            
                                function hashMessage(bytes message, bool isAMBMessage) internal pure returns (bytes32) {
                                    bytes memory prefix = "\x19Ethereum Signed Message:\n";
                                    if (isAMBMessage) {
                                        return keccak256(abi.encodePacked(prefix, uintToString(message.length), message));
                                    } else {
                                        string memory msgLength = "104";
                                        return keccak256(abi.encodePacked(prefix, msgLength, message));
                                    }
                                }
                            
                                /**
                                * @dev Validates provided signatures, only first requiredSignatures() number
                                * of signatures are going to be validated, these signatures should be from different validators.
                                * @param _message bytes message used to generate signatures
                                * @param _signatures bytes blob with signatures to be validated.
                                * First byte X is a number of signatures in a blob,
                                * next X bytes are v components of signatures,
                                * next 32 * X bytes are r components of signatures,
                                * next 32 * X bytes are s components of signatures.
                                * @param _validatorContract contract, which conforms to the IBridgeValidators interface,
                                * where info about current validators and required signatures is stored.
                                * @param isAMBMessage true if _message is an AMB message with arbitrary length.
                                */
                                function hasEnoughValidSignatures(
                                    bytes _message,
                                    bytes _signatures,
                                    IBridgeValidators _validatorContract,
                                    bool isAMBMessage
                                ) internal view {
                                    require(isAMBMessage || isMessageValid(_message));
                                    uint256 requiredSignatures = _validatorContract.requiredSignatures();
                                    uint256 amount;
                                    assembly {
                                        amount := and(mload(add(_signatures, 1)), 0xff)
                                    }
                                    require(amount >= requiredSignatures);
                                    bytes32 hash = hashMessage(_message, isAMBMessage);
                                    address[] memory encounteredAddresses = new address[](requiredSignatures);
                            
                                    for (uint256 i = 0; i < requiredSignatures; i++) {
                                        uint8 v;
                                        bytes32 r;
                                        bytes32 s;
                                        uint256 posr = 33 + amount + 32 * i;
                                        uint256 poss = posr + 32 * amount;
                                        assembly {
                                            v := mload(add(_signatures, add(2, i)))
                                            r := mload(add(_signatures, posr))
                                            s := mload(add(_signatures, poss))
                                        }
                            
                                        address recoveredAddress = ecrecover(hash, v, r, s);
                                        require(_validatorContract.isValidator(recoveredAddress));
                                        require(!addressArrayContains(encounteredAddresses, recoveredAddress));
                                        encounteredAddresses[i] = recoveredAddress;
                                    }
                                }
                            
                                function uintToString(uint256 i) internal pure returns (string) {
                                    if (i == 0) return "0";
                                    uint256 j = i;
                                    uint256 length;
                                    while (j != 0) {
                                        length++;
                                        j /= 10;
                                    }
                                    bytes memory bstr = new bytes(length);
                                    uint256 k = length - 1;
                                    while (i != 0) {
                                        bstr[k--] = bytes1(48 + (i % 10));
                                        i /= 10;
                                    }
                                    return string(bstr);
                                }
                            }
                            
                            // File: contracts/libraries/ArbitraryMessage.sol
                            
                            pragma solidity 0.4.24;
                            
                            library ArbitraryMessage {
                                /**
                                * @dev Unpacks data fields from AMB message
                                * layout of message :: bytes:
                                * offset  0              : 32 bytes :: uint256 - message length
                                * offset 32              : 32 bytes :: bytes32 - messageId
                                * offset 64              : 20 bytes :: address - sender address
                                * offset 84              : 20 bytes :: address - executor contract
                                * offset 104             : 4 bytes  :: uint32  - gasLimit
                                * offset 108             : 1 bytes  :: uint8   - source chain id length (X)
                                * offset 109             : 1 bytes  :: uint8   - destination chain id length (Y)
                                * offset 110             : 1 bytes  :: uint8   - dataType
                                * offset 111             : X bytes  :: bytes   - source chain id
                                * offset 111 + X         : Y bytes  :: bytes   - destination chain id
                            
                                * NOTE: when message structure is changed, make sure that MESSAGE_PACKING_VERSION from VersionableAMB is updated as well
                                * NOTE: assembly code uses calldatacopy, make sure that message is passed as the first argument in the calldata
                                * @param _data encoded message
                                */
                                function unpackData(bytes _data)
                                    internal
                                    pure
                                    returns (
                                        bytes32 messageId,
                                        address sender,
                                        address executor,
                                        uint32 gasLimit,
                                        uint8 dataType,
                                        uint256[2] chainIds,
                                        bytes memory data
                                    )
                                {
                                    // 32 (message id) + 20 (sender) + 20 (executor) + 4 (gasLimit) + 1 (source chain id length) + 1 (destination chain id length) + 1 (dataType)
                                    uint256 srcdataptr = 32 + 20 + 20 + 4 + 1 + 1 + 1;
                                    uint256 datasize;
                            
                                    assembly {
                                        messageId := mload(add(_data, 32)) // 32 bytes
                                        sender := and(mload(add(_data, 52)), 0xffffffffffffffffffffffffffffffffffffffff) // 20 bytes
                            
                                        // executor (20 bytes) + gasLimit (4 bytes) + srcChainIdLength (1 byte) + dstChainIdLength (1 bytes) + dataType (1 byte) + remainder (5 bytes)
                                        let blob := mload(add(_data, 84))
                            
                                        // after bit shift left 12 bytes are zeros automatically
                                        executor := shr(96, blob)
                                        gasLimit := and(shr(64, blob), 0xffffffff)
                            
                                        dataType := byte(26, blob)
                            
                                        // load source chain id length
                                        let chainIdLength := byte(24, blob)
                            
                                        // at this moment srcdataptr points to sourceChainId
                            
                                        // mask for sourceChainId
                                        // e.g. length X -> (1 << (X * 8)) - 1
                                        let mask := sub(shl(shl(3, chainIdLength), 1), 1)
                            
                                        // increase payload offset by length of source chain id
                                        srcdataptr := add(srcdataptr, chainIdLength)
                            
                                        // write sourceChainId
                                        mstore(chainIds, and(mload(add(_data, srcdataptr)), mask))
                            
                                        // at this moment srcdataptr points to destinationChainId
                            
                                        // load destination chain id length
                                        chainIdLength := byte(25, blob)
                            
                                        // mask for destinationChainId
                                        // e.g. length X -> (1 << (X * 8)) - 1
                                        mask := sub(shl(shl(3, chainIdLength), 1), 1)
                            
                                        // increase payload offset by length of destination chain id
                                        srcdataptr := add(srcdataptr, chainIdLength)
                            
                                        // write destinationChainId
                                        mstore(add(chainIds, 32), and(mload(add(_data, srcdataptr)), mask))
                            
                                        // at this moment srcdataptr points to payload
                            
                                        // datasize = message length - payload offset
                                        datasize := sub(mload(_data), srcdataptr)
                                    }
                            
                                    data = new bytes(datasize);
                                    assembly {
                                        // 36 = 4 (selector) + 32 (bytes length header)
                                        srcdataptr := add(srcdataptr, 36)
                            
                                        // calldataload(4) - offset of first bytes argument in the calldata
                                        calldatacopy(add(data, 32), add(calldataload(4), srcdataptr), datasize)
                                    }
                                }
                            }
                            
                            // File: contracts/interfaces/IUpgradeabilityOwnerStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            interface IUpgradeabilityOwnerStorage {
                                function upgradeabilityOwner() external view returns (address);
                            }
                            
                            // File: contracts/upgradeable_contracts/Upgradeable.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract Upgradeable {
                                // Avoid using onlyUpgradeabilityOwner name to prevent issues with implementation from proxy contract
                                modifier onlyIfUpgradeabilityOwner() {
                                    require(msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner());
                                    /* solcov ignore next */
                                    _;
                                }
                            }
                            
                            // File: contracts/upgradeability/EternalStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title EternalStorage
                             * @dev This contract holds all the necessary state variables to carry out the storage of any contract.
                             */
                            contract EternalStorage {
                                mapping(bytes32 => uint256) internal uintStorage;
                                mapping(bytes32 => string) internal stringStorage;
                                mapping(bytes32 => address) internal addressStorage;
                                mapping(bytes32 => bytes) internal bytesStorage;
                                mapping(bytes32 => bool) internal boolStorage;
                                mapping(bytes32 => int256) internal intStorage;
                            
                            }
                            
                            // File: contracts/upgradeable_contracts/Initializable.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract Initializable is EternalStorage {
                                bytes32 internal constant INITIALIZED = 0x0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba; // keccak256(abi.encodePacked("isInitialized"))
                            
                                function setInitialize() internal {
                                    boolStorage[INITIALIZED] = true;
                                }
                            
                                function isInitialized() public view returns (bool) {
                                    return boolStorage[INITIALIZED];
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/InitializableBridge.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract InitializableBridge is Initializable {
                                bytes32 internal constant DEPLOYED_AT_BLOCK = 0xb120ceec05576ad0c710bc6e85f1768535e27554458f05dcbb5c65b8c7a749b0; // keccak256(abi.encodePacked("deployedAtBlock"))
                            
                                function deployedAtBlock() external view returns (uint256) {
                                    return uintStorage[DEPLOYED_AT_BLOCK];
                                }
                            }
                            
                            // File: openzeppelin-solidity/contracts/AddressUtils.sol
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * Utility library of inline functions on addresses
                             */
                            library AddressUtils {
                            
                              /**
                               * Returns whether the target address is a contract
                               * @dev This function will return false if invoked during the constructor of a contract,
                               * as the code is not actually created until after the constructor finishes.
                               * @param _addr address to check
                               * @return whether the target address is a contract
                               */
                              function isContract(address _addr) internal view returns (bool) {
                                uint256 size;
                                // XXX Currently there is no better way to check if there is a contract in an address
                                // than to check the size of the code at that address.
                                // See https://ethereum.stackexchange.com/a/14016/36603
                                // for more details about how this works.
                                // TODO Check this again before the Serenity release, because all addresses will be
                                // contracts then.
                                // solium-disable-next-line security/no-inline-assembly
                                assembly { size := extcodesize(_addr) }
                                return size > 0;
                              }
                            
                            }
                            
                            // File: contracts/upgradeable_contracts/ValidatorStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract ValidatorStorage {
                                bytes32 internal constant VALIDATOR_CONTRACT = 0x5a74bb7e202fb8e4bf311841c7d64ec19df195fee77d7e7ae749b27921b6ddfe; // keccak256(abi.encodePacked("validatorContract"))
                            }
                            
                            // File: contracts/upgradeable_contracts/Validatable.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            contract Validatable is EternalStorage, ValidatorStorage {
                                function validatorContract() public view returns (IBridgeValidators) {
                                    return IBridgeValidators(addressStorage[VALIDATOR_CONTRACT]);
                                }
                            
                                modifier onlyValidator() {
                                    require(validatorContract().isValidator(msg.sender));
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                function requiredSignatures() public view returns (uint256) {
                                    return validatorContract().requiredSignatures();
                                }
                            
                            }
                            
                            // File: contracts/upgradeable_contracts/Ownable.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            /**
                             * @title Ownable
                             * @dev This contract has an owner address providing basic authorization control
                             */
                            contract Ownable is EternalStorage {
                                bytes4 internal constant UPGRADEABILITY_OWNER = 0x6fde8202; // upgradeabilityOwner()
                            
                                /**
                                * @dev Event to show ownership has been transferred
                                * @param previousOwner representing the address of the previous owner
                                * @param newOwner representing the address of the new owner
                                */
                                event OwnershipTransferred(address previousOwner, address newOwner);
                            
                                /**
                                * @dev Throws if called by any account other than the owner.
                                */
                                modifier onlyOwner() {
                                    require(msg.sender == owner());
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                /**
                                * @dev Throws if called by any account other than contract itself or owner.
                                */
                                modifier onlyRelevantSender() {
                                    // proxy owner if used through proxy, address(0) otherwise
                                    require(
                                        !address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy
                                            msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner() || // covers usage through regular proxy calls
                                            msg.sender == address(this) // covers calls through upgradeAndCall proxy method
                                    );
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                bytes32 internal constant OWNER = 0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0; // keccak256(abi.encodePacked("owner"))
                            
                                /**
                                * @dev Tells the address of the owner
                                * @return the address of the owner
                                */
                                function owner() public view returns (address) {
                                    return addressStorage[OWNER];
                                }
                            
                                /**
                                * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                * @param newOwner the address to transfer ownership to.
                                */
                                function transferOwnership(address newOwner) external onlyOwner {
                                    _setOwner(newOwner);
                                }
                            
                                /**
                                * @dev Sets a new owner address
                                */
                                function _setOwner(address newOwner) internal {
                                    require(newOwner != address(0));
                                    emit OwnershipTransferred(owner(), newOwner);
                                    addressStorage[OWNER] = newOwner;
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/Sacrifice.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract Sacrifice {
                                constructor(address _recipient) public payable {
                                    selfdestruct(_recipient);
                                }
                            }
                            
                            // File: contracts/libraries/Address.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title Address
                             * @dev Helper methods for Address type.
                             */
                            library Address {
                                /**
                                * @dev Try to send native tokens to the address. If it fails, it will force the transfer by creating a selfdestruct contract
                                * @param _receiver address that will receive the native tokens
                                * @param _value the amount of native tokens to send
                                */
                                function safeSendValue(address _receiver, uint256 _value) internal {
                                    if (!_receiver.send(_value)) {
                                        (new Sacrifice).value(_value)(_receiver);
                                    }
                                }
                            }
                            
                            // File: openzeppelin-solidity/contracts/math/SafeMath.sol
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * @title SafeMath
                             * @dev Math operations with safety checks that throw on error
                             */
                            library SafeMath {
                            
                              /**
                              * @dev Multiplies two numbers, throws on overflow.
                              */
                              function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
                                // Gas optimization: this is cheaper than asserting '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;
                                }
                            
                                c = _a * _b;
                                assert(c / _a == _b);
                                return c;
                              }
                            
                              /**
                              * @dev Integer division of two numbers, truncating the quotient.
                              */
                              function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
                                // assert(_b > 0); // Solidity automatically throws 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 _a / _b;
                              }
                            
                              /**
                              * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
                              */
                              function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
                                assert(_b <= _a);
                                return _a - _b;
                              }
                            
                              /**
                              * @dev Adds two numbers, throws on overflow.
                              */
                              function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
                                c = _a + _b;
                                assert(c >= _a);
                                return c;
                              }
                            }
                            
                            // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * @title ERC20Basic
                             * @dev Simpler version of ERC20 interface
                             * See https://github.com/ethereum/EIPs/issues/179
                             */
                            contract ERC20Basic {
                              function totalSupply() public view returns (uint256);
                              function balanceOf(address _who) public view returns (uint256);
                              function transfer(address _to, uint256 _value) public returns (bool);
                              event Transfer(address indexed from, address indexed to, uint256 value);
                            }
                            
                            // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
                            
                            pragma solidity ^0.4.24;
                            
                            /**
                             * @title ERC20 interface
                             * @dev see https://github.com/ethereum/EIPs/issues/20
                             */
                            contract ERC20 is ERC20Basic {
                              function allowance(address _owner, address _spender)
                                public view returns (uint256);
                            
                              function transferFrom(address _from, address _to, uint256 _value)
                                public returns (bool);
                            
                              function approve(address _spender, uint256 _value) public returns (bool);
                              event Approval(
                                address indexed owner,
                                address indexed spender,
                                uint256 value
                              );
                            }
                            
                            // File: contracts/interfaces/ERC677.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract ERC677 is ERC20 {
                                event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
                            
                                function transferAndCall(address, uint256, bytes) external returns (bool);
                            
                                function increaseAllowance(address spender, uint256 addedValue) public returns (bool);
                                function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool);
                            }
                            
                            contract LegacyERC20 {
                                function transfer(address _spender, uint256 _value) public; // returns (bool);
                                function transferFrom(address _owner, address _spender, uint256 _value) public; // returns (bool);
                            }
                            
                            // File: contracts/libraries/SafeERC20.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            /**
                             * @title SafeERC20
                             * @dev Helper methods for safe token transfers.
                             * Functions perform additional checks to be sure that token transfer really happened.
                             */
                            library SafeERC20 {
                                using SafeMath for uint256;
                            
                                /**
                                * @dev Same as ERC20.transfer(address,uint256) but with extra consistency checks.
                                * @param _token address of the token contract
                                * @param _to address of the receiver
                                * @param _value amount of tokens to send
                                */
                                function safeTransfer(address _token, address _to, uint256 _value) internal {
                                    LegacyERC20(_token).transfer(_to, _value);
                                    assembly {
                                        if returndatasize {
                                            returndatacopy(0, 0, 32)
                                            if iszero(mload(0)) {
                                                revert(0, 0)
                                            }
                                        }
                                    }
                                }
                            
                                /**
                                * @dev Same as ERC20.transferFrom(address,address,uint256) but with extra consistency checks.
                                * @param _token address of the token contract
                                * @param _from address of the sender
                                * @param _value amount of tokens to send
                                */
                                function safeTransferFrom(address _token, address _from, uint256 _value) internal {
                                    LegacyERC20(_token).transferFrom(_from, address(this), _value);
                                    assembly {
                                        if returndatasize {
                                            returndatacopy(0, 0, 32)
                                            if iszero(mload(0)) {
                                                revert(0, 0)
                                            }
                                        }
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/Claimable.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            /**
                             * @title Claimable
                             * @dev Implementation of the claiming utils that can be useful for withdrawing accidentally sent tokens that are not used in bridge operations.
                             */
                            contract Claimable {
                                using SafeERC20 for address;
                            
                                /**
                                 * Throws if a given address is equal to address(0)
                                 */
                                modifier validAddress(address _to) {
                                    require(_to != address(0));
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                /**
                                 * @dev Withdraws the erc20 tokens or native coins from this contract.
                                 * Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()).
                                 * @param _token address of the claimed token or address(0) for native coins.
                                 * @param _to address of the tokens/coins receiver.
                                 */
                                function claimValues(address _token, address _to) internal validAddress(_to) {
                                    if (_token == address(0)) {
                                        claimNativeCoins(_to);
                                    } else {
                                        claimErc20Tokens(_token, _to);
                                    }
                                }
                            
                                /**
                                 * @dev Internal function for withdrawing all native coins from the contract.
                                 * @param _to address of the coins receiver.
                                 */
                                function claimNativeCoins(address _to) internal {
                                    uint256 value = address(this).balance;
                                    Address.safeSendValue(_to, value);
                                }
                            
                                /**
                                 * @dev Internal function for withdrawing all tokens of ssome particular ERC20 contract from this contract.
                                 * @param _token address of the claimed ERC20 token.
                                 * @param _to address of the tokens receiver.
                                 */
                                function claimErc20Tokens(address _token, address _to) internal {
                                    ERC20Basic token = ERC20Basic(_token);
                                    uint256 balance = token.balanceOf(this);
                                    _token.safeTransfer(_to, balance);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/VersionableBridge.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract VersionableBridge {
                                function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
                                    return (6, 1, 0);
                                }
                            
                                /* solcov ignore next */
                                function getBridgeMode() external pure returns (bytes4);
                            }
                            
                            // File: contracts/upgradeable_contracts/DecimalShiftBridge.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            contract DecimalShiftBridge is EternalStorage {
                                using SafeMath for uint256;
                            
                                bytes32 internal constant DECIMAL_SHIFT = 0x1e8ecaafaddea96ed9ac6d2642dcdfe1bebe58a930b1085842d8fc122b371ee5; // keccak256(abi.encodePacked("decimalShift"))
                            
                                /**
                                * @dev Internal function for setting the decimal shift for bridge operations.
                                * Decimal shift can be positive, negative, or equal to zero.
                                * It has the following meaning: N tokens in the foreign chain are equivalent to N * pow(10, shift) tokens on the home side.
                                * @param _shift new value of decimal shift.
                                */
                                function _setDecimalShift(int256 _shift) internal {
                                    // since 1 wei * 10**77 > 2**255, it does not make any sense to use higher values
                                    require(_shift > -77 && _shift < 77);
                                    uintStorage[DECIMAL_SHIFT] = uint256(_shift);
                                }
                            
                                /**
                                * @dev Returns the value of foreign-to-home decimal shift.
                                * @return decimal shift.
                                */
                                function decimalShift() public view returns (int256) {
                                    return int256(uintStorage[DECIMAL_SHIFT]);
                                }
                            
                                /**
                                * @dev Converts the amount of home tokens into the equivalent amount of foreign tokens.
                                * @param _value amount of home tokens.
                                * @return equivalent amount of foreign tokens.
                                */
                                function _unshiftValue(uint256 _value) internal view returns (uint256) {
                                    return _shiftUint(_value, -decimalShift());
                                }
                            
                                /**
                                * @dev Converts the amount of foreign tokens into the equivalent amount of home tokens.
                                * @param _value amount of foreign tokens.
                                * @return equivalent amount of home tokens.
                                */
                                function _shiftValue(uint256 _value) internal view returns (uint256) {
                                    return _shiftUint(_value, decimalShift());
                                }
                            
                                /**
                                * @dev Calculates _value * pow(10, _shift).
                                * @param _value amount of tokens.
                                * @param _shift decimal shift to apply.
                                * @return shifted value.
                                */
                                function _shiftUint(uint256 _value, int256 _shift) private pure returns (uint256) {
                                    if (_shift == 0) {
                                        return _value;
                                    }
                                    if (_shift > 0) {
                                        return _value.mul(10**uint256(_shift));
                                    }
                                    return _value.div(10**uint256(-_shift));
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/BasicBridge.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            
                            
                            
                            
                            
                            contract BasicBridge is
                                InitializableBridge,
                                Validatable,
                                Ownable,
                                Upgradeable,
                                Claimable,
                                VersionableBridge,
                                DecimalShiftBridge
                            {
                                event GasPriceChanged(uint256 gasPrice);
                                event RequiredBlockConfirmationChanged(uint256 requiredBlockConfirmations);
                            
                                bytes32 internal constant GAS_PRICE = 0x55b3774520b5993024893d303890baa4e84b1244a43c60034d1ced2d3cf2b04b; // keccak256(abi.encodePacked("gasPrice"))
                                bytes32 internal constant REQUIRED_BLOCK_CONFIRMATIONS = 0x916daedf6915000ff68ced2f0b6773fe6f2582237f92c3c95bb4d79407230071; // keccak256(abi.encodePacked("requiredBlockConfirmations"))
                            
                                /**
                                * @dev Public setter for fallback gas price value. Only bridge owner can call this method.
                                * @param _gasPrice new value for the gas price.
                                */
                                function setGasPrice(uint256 _gasPrice) external onlyOwner {
                                    _setGasPrice(_gasPrice);
                                }
                            
                                function gasPrice() external view returns (uint256) {
                                    return uintStorage[GAS_PRICE];
                                }
                            
                                function setRequiredBlockConfirmations(uint256 _blockConfirmations) external onlyOwner {
                                    _setRequiredBlockConfirmations(_blockConfirmations);
                                }
                            
                                function _setRequiredBlockConfirmations(uint256 _blockConfirmations) internal {
                                    require(_blockConfirmations > 0);
                                    uintStorage[REQUIRED_BLOCK_CONFIRMATIONS] = _blockConfirmations;
                                    emit RequiredBlockConfirmationChanged(_blockConfirmations);
                                }
                            
                                function requiredBlockConfirmations() external view returns (uint256) {
                                    return uintStorage[REQUIRED_BLOCK_CONFIRMATIONS];
                                }
                            
                                /**
                                * @dev Internal function for updating fallback gas price value.
                                * @param _gasPrice new value for the gas price, zero gas price is allowed.
                                */
                                function _setGasPrice(uint256 _gasPrice) internal {
                                    uintStorage[GAS_PRICE] = _gasPrice;
                                    emit GasPriceChanged(_gasPrice);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/arbitrary_message/VersionableAMB.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract VersionableAMB is VersionableBridge {
                                // message format version as a single 4-bytes number padded to 32-bytes
                                // value, included into every outgoing relay request
                                //
                                // the message version should be updated every time when
                                // - new field appears
                                // - some field removed
                                // - fields order is changed
                                bytes32 internal constant MESSAGE_PACKING_VERSION = 0x00050000 << 224;
                            
                                /**
                                 * Returns currently used bridge version
                                 * @return (major, minor, patch) version triple
                                 */
                                function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
                                    return (6, 2, 0);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/arbitrary_message/BasicAMB.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            contract BasicAMB is BasicBridge, VersionableAMB {
                                bytes32 internal constant MAX_GAS_PER_TX = 0x2670ecc91ec356e32067fd27b36614132d727b84a1e03e08f412a4f2cf075974; // keccak256(abi.encodePacked("maxGasPerTx"))
                                bytes32 internal constant NONCE = 0x7ab1577440dd7bedf920cb6de2f9fc6bf7ba98c78c85a3fa1f8311aac95e1759; // keccak256(abi.encodePacked("nonce"))
                                bytes32 internal constant SOURCE_CHAIN_ID = 0x67d6f42a1ed69c62022f2d160ddc6f2f0acd37ad1db0c24f4702d7d3343a4add; // keccak256(abi.encodePacked("sourceChainId"))
                                bytes32 internal constant SOURCE_CHAIN_ID_LENGTH = 0xe504ae1fd6471eea80f18b8532a61a9bb91fba4f5b837f80a1cfb6752350af44; // keccak256(abi.encodePacked("sourceChainIdLength"))
                                bytes32 internal constant DESTINATION_CHAIN_ID = 0xbbd454018e72a3f6c02bbd785bacc49e46292744f3f6761276723823aa332320; // keccak256(abi.encodePacked("destinationChainId"))
                                bytes32 internal constant DESTINATION_CHAIN_ID_LENGTH = 0xfb792ae4ad11102b93f26a51b3749c2b3667f8b561566a4806d4989692811594; // keccak256(abi.encodePacked("destinationChainIdLength"))
                                bytes32 internal constant ALLOW_REENTRANT_REQUESTS = 0xffa3a5a0e192028fc343362a39c5688e5a60819a4dc5ab3ee70c25bc25b78dd6; // keccak256(abi.encodePacked("allowReentrantRequests"))
                            
                                /**
                                 * Initializes AMB contract
                                 * @param _sourceChainId chain id of a network where this contract is deployed
                                 * @param _destinationChainId chain id of a network where all outgoing messages are directed
                                 * @param _validatorContract address of the validators contract
                                 * @param _maxGasPerTx maximum amount of gas per one message execution
                                 * @param _gasPrice default gas price used by oracles for sending transactions in this network
                                 * @param _requiredBlockConfirmations number of block confirmations oracle will wait before processing passed messages
                                 * @param _owner address of new bridge owner
                                 */
                                function initialize(
                                    uint256 _sourceChainId,
                                    uint256 _destinationChainId,
                                    address _validatorContract,
                                    uint256 _maxGasPerTx,
                                    uint256 _gasPrice,
                                    uint256 _requiredBlockConfirmations,
                                    address _owner
                                ) external onlyRelevantSender returns (bool) {
                                    require(!isInitialized());
                                    require(AddressUtils.isContract(_validatorContract));
                            
                                    _setChainIds(_sourceChainId, _destinationChainId);
                                    addressStorage[VALIDATOR_CONTRACT] = _validatorContract;
                                    uintStorage[DEPLOYED_AT_BLOCK] = block.number;
                                    uintStorage[MAX_GAS_PER_TX] = _maxGasPerTx;
                                    _setGasPrice(_gasPrice);
                                    _setRequiredBlockConfirmations(_requiredBlockConfirmations);
                                    _setOwner(_owner);
                                    setInitialize();
                            
                                    return isInitialized();
                                }
                            
                                function getBridgeMode() external pure returns (bytes4 _data) {
                                    return 0x2544fbb9; // bytes4(keccak256(abi.encodePacked("arbitrary-message-bridge-core")))
                                }
                            
                                function maxGasPerTx() public view returns (uint256) {
                                    return uintStorage[MAX_GAS_PER_TX];
                                }
                            
                                function setMaxGasPerTx(uint256 _maxGasPerTx) external onlyOwner {
                                    uintStorage[MAX_GAS_PER_TX] = _maxGasPerTx;
                                }
                            
                                /**
                                 * Internal function for retrieving chain id for the source network
                                 * @return chain id for the current network
                                 */
                                function sourceChainId() public view returns (uint256) {
                                    return uintStorage[SOURCE_CHAIN_ID];
                                }
                            
                                /**
                                 * Internal function for retrieving chain id for the destination network
                                 * @return chain id for the destination network
                                 */
                                function destinationChainId() public view returns (uint256) {
                                    return uintStorage[DESTINATION_CHAIN_ID];
                                }
                            
                                /**
                                 * Updates chain ids of used networks
                                 * @param _sourceChainId chain id for current network
                                 * @param _destinationChainId chain id for opposite network
                                 */
                                function setChainIds(uint256 _sourceChainId, uint256 _destinationChainId) external onlyOwner {
                                    _setChainIds(_sourceChainId, _destinationChainId);
                                }
                            
                                /**
                                 * Sets the flag to allow passing new AMB requests in the opposite direction,
                                 * while other AMB message is being processed.
                                 * Only owner can call this method.
                                 * @param _enable true, if reentrant requests are allowed.
                                 */
                                function setAllowReentrantRequests(bool _enable) external onlyOwner {
                                    boolStorage[ALLOW_REENTRANT_REQUESTS] = _enable;
                                }
                            
                                /**
                                 * Tells if passing reentrant requests is allowed.
                                 * @return true, if reentrant requests are allowed.
                                 */
                                function allowReentrantRequests() public view returns (bool) {
                                    return boolStorage[ALLOW_REENTRANT_REQUESTS];
                                }
                            
                                /**
                                 * @dev Withdraws the erc20 tokens or native coins from this contract.
                                 * @param _token address of the claimed token or address(0) for native coins.
                                 * @param _to address of the tokens/coins receiver.
                                 */
                                function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner {
                                    claimValues(_token, _to);
                                }
                            
                                /**
                                 * Internal function for retrieving current nonce value
                                 * @return nonce value
                                 */
                                function _nonce() internal view returns (uint64) {
                                    return uint64(uintStorage[NONCE]);
                                }
                            
                                /**
                                 * Internal function for updating nonce value
                                 * @param _nonce new nonce value
                                 */
                                function _setNonce(uint64 _nonce) internal {
                                    uintStorage[NONCE] = uint256(_nonce);
                                }
                            
                                /**
                                 * Internal function for updating chain ids of used networks
                                 * @param _sourceChainId chain id for current network
                                 * @param _destinationChainId chain id for opposite network
                                 */
                                function _setChainIds(uint256 _sourceChainId, uint256 _destinationChainId) internal {
                                    require(_sourceChainId > 0 && _destinationChainId > 0);
                                    require(_sourceChainId != _destinationChainId);
                            
                                    // Length fields are needed further when encoding the message.
                                    // Chain ids are compressed, so that leading zero bytes are not preserved.
                                    // In order to save some gas during calls to MessageDelivery.c,
                                    // lengths of chain ids are precalculated and being saved in the storage.
                                    uint256 sourceChainIdLength = 0;
                                    uint256 destinationChainIdLength = 0;
                                    uint256 mask = 0xff;
                            
                                    for (uint256 i = 1; sourceChainIdLength == 0 || destinationChainIdLength == 0; i++) {
                                        if (sourceChainIdLength == 0 && _sourceChainId & mask == _sourceChainId) {
                                            sourceChainIdLength = i;
                                        }
                                        if (destinationChainIdLength == 0 && _destinationChainId & mask == _destinationChainId) {
                                            destinationChainIdLength = i;
                                        }
                                        mask = (mask << 8) | 0xff;
                                    }
                            
                                    uintStorage[SOURCE_CHAIN_ID] = _sourceChainId;
                                    uintStorage[SOURCE_CHAIN_ID_LENGTH] = sourceChainIdLength;
                                    uintStorage[DESTINATION_CHAIN_ID] = _destinationChainId;
                                    uintStorage[DESTINATION_CHAIN_ID_LENGTH] = destinationChainIdLength;
                                }
                            
                                /**
                                 * Internal function for retrieving chain id length for the source network
                                 * @return chain id for the current network
                                 */
                                function _sourceChainIdLength() internal view returns (uint256) {
                                    return uintStorage[SOURCE_CHAIN_ID_LENGTH];
                                }
                            
                                /**
                                 * Internal function for retrieving chain id length for the destination network
                                 * @return chain id for the destination network
                                 */
                                function _destinationChainIdLength() internal view returns (uint256) {
                                    return uintStorage[DESTINATION_CHAIN_ID_LENGTH];
                                }
                            
                                /**
                                 * Internal function for validating version of the received message
                                 * @param _messageId id of the received message
                                 */
                                function _isMessageVersionValid(bytes32 _messageId) internal returns (bool) {
                                    return
                                        _messageId & 0xffffffff00000000000000000000000000000000000000000000000000000000 == MESSAGE_PACKING_VERSION;
                                }
                            
                                /**
                                 * Internal function for validating destination chain id of the received message
                                 * @param _chainId destination chain id of the received message
                                 */
                                function _isDestinationChainIdValid(uint256 _chainId) internal returns (bool res) {
                                    return _chainId == sourceChainId();
                                }
                            }
                            
                            // File: contracts/libraries/Bytes.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title Bytes
                             * @dev Helper methods to transform bytes to other solidity types.
                             */
                            library Bytes {
                                /**
                                * @dev Converts bytes array to bytes32.
                                * Truncates bytes array if its size is more than 32 bytes.
                                * NOTE: This function does not perform any checks on the received parameter.
                                * Make sure that the _bytes argument has a correct length, not less than 32 bytes.
                                * A case when _bytes has length less than 32 will lead to the undefined behaviour,
                                * since assembly will read data from memory that is not related to the _bytes argument.
                                * @param _bytes to be converted to bytes32 type
                                * @return bytes32 type of the firsts 32 bytes array in parameter.
                                */
                                function bytesToBytes32(bytes _bytes) internal pure returns (bytes32 result) {
                                    assembly {
                                        result := mload(add(_bytes, 32))
                                    }
                                }
                            
                                /**
                                * @dev Truncate bytes array if its size is more than 20 bytes.
                                * NOTE: Similar to the bytesToBytes32 function, make sure that _bytes is not shorter than 20 bytes.
                                * @param _bytes to be converted to address type
                                * @return address included in the firsts 20 bytes of the bytes array in parameter.
                                */
                                function bytesToAddress(bytes _bytes) internal pure returns (address addr) {
                                    assembly {
                                        addr := mload(add(_bytes, 20))
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/arbitrary_message/MessageProcessor.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            contract MessageProcessor is EternalStorage {
                                /**
                                * @dev Returns a status of the message that came from the other side.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @return true if call executed successfully.
                                */
                                function messageCallStatus(bytes32 _messageId) external view returns (bool) {
                                    return boolStorage[keccak256(abi.encodePacked("messageCallStatus", _messageId))];
                                }
                            
                                /**
                                * @dev Sets a status of the message that came from the other side.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @param _status execution status, true if executed successfully.
                                */
                                function setMessageCallStatus(bytes32 _messageId, bool _status) internal {
                                    boolStorage[keccak256(abi.encodePacked("messageCallStatus", _messageId))] = _status;
                                }
                            
                                /**
                                * @dev Returns a data hash of the failed message that came from the other side.
                                * NOTE: dataHash was used previously to identify outgoing message before AMB message id was introduced.
                                * It is kept for backwards compatibility with old mediators contracts.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @return keccak256 hash of message data.
                                */
                                function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32) {
                                    return bytes32(uintStorage[keccak256(abi.encodePacked("failedMessageDataHash", _messageId))]);
                                }
                            
                                /**
                                * @dev Sets a data hash of the failed message that came from the other side.
                                * NOTE: dataHash was used previously to identify outgoing message before AMB message id was introduced.
                                * It is kept for backwards compatibility with old mediators contracts.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @param data of the processed message.
                                */
                                function setFailedMessageDataHash(bytes32 _messageId, bytes data) internal {
                                    uintStorage[keccak256(abi.encodePacked("failedMessageDataHash", _messageId))] = uint256(keccak256(data));
                                }
                            
                                /**
                                * @dev Returns a receiver address of the failed message that came from the other side.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @return receiver address.
                                */
                                function failedMessageReceiver(bytes32 _messageId) external view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))];
                                }
                            
                                /**
                                * @dev Sets a sender address of the failed message that came from the other side.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @param _receiver address of the receiver.
                                */
                                function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal {
                                    addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver;
                                }
                            
                                /**
                                * @dev Returns a sender address of the failed message that came from the other side.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @return sender address on the other side.
                                */
                                function failedMessageSender(bytes32 _messageId) external view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("failedMessageSender", _messageId))];
                                }
                            
                                /**
                                * @dev Sets a sender address of the failed message that came from the other side.
                                * @param _messageId id of the message from the other side that triggered a call.
                                * @param _sender address of the sender on the other side.
                                */
                                function setFailedMessageSender(bytes32 _messageId, address _sender) internal {
                                    addressStorage[keccak256(abi.encodePacked("failedMessageSender", _messageId))] = _sender;
                                }
                            
                                /**
                                * @dev Returns an address of the sender on the other side for the currently processed message.
                                * Can be used by executors for getting other side caller address.
                                * @return address of the sender on the other side.
                                */
                                function messageSender() external view returns (address sender) {
                                    assembly {
                                        // Even though this is not the same as addressStorage[keccak256(abi.encodePacked("messageSender"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        sender := sload(0x7b58b2a669d8e0992eae9eaef641092c0f686fd31070e7236865557fa1571b5b) // keccak256(abi.encodePacked("messageSender"))
                                    }
                                }
                            
                                /**
                                * @dev Sets an address of the sender on the other side for the currently processed message.
                                * @param _sender address of the sender on the other side.
                                */
                                function setMessageSender(address _sender) internal {
                                    assembly {
                                        // Even though this is not the same as addressStorage[keccak256(abi.encodePacked("messageSender"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        sstore(0x7b58b2a669d8e0992eae9eaef641092c0f686fd31070e7236865557fa1571b5b, _sender) // keccak256(abi.encodePacked("messageSender"))
                                    }
                                }
                            
                                /**
                                * @dev Returns an id of the currently processed message.
                                * @return id of the message that originated on the other side.
                                */
                                function messageId() public view returns (bytes32 id) {
                                    assembly {
                                        // Even though this is not the same as uintStorage[keccak256(abi.encodePacked("messageId"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        id := sload(0xe34bb2103dc34f2c144cc216c132d6ffb55dac57575c22e089161bbe65083304) // keccak256(abi.encodePacked("messageId"))
                                    }
                                }
                            
                                /**
                                * @dev Returns an id of the currently processed message.
                                * NOTE: transactionHash was used previously to identify incoming message before AMB message id was introduced.
                                * It is kept for backwards compatibility with old mediators contracts, although it doesn't return txHash anymore.
                                * @return id of the message that originated on the other side.
                                */
                                function transactionHash() external view returns (bytes32) {
                                    return messageId();
                                }
                            
                                /**
                                * @dev Sets a message id of the currently processed message.
                                * @param _messageId id of the message that originated on the other side.
                                */
                                function setMessageId(bytes32 _messageId) internal {
                                    assembly {
                                        // Even though this is not the same as uintStorage[keccak256(abi.encodePacked("messageId"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        sstore(0xe34bb2103dc34f2c144cc216c132d6ffb55dac57575c22e089161bbe65083304, _messageId) // keccak256(abi.encodePacked("messageId"))
                                    }
                                }
                            
                                /**
                                * @dev Returns an originating chain id of the currently processed message.
                                * @return source chain id of the message that originated on the other side.
                                */
                                function messageSourceChainId() external view returns (uint256 id) {
                                    assembly {
                                        // Even though this is not the same as uintStorage[keccak256(abi.encodePacked("messageSourceChainId"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        id := sload(0x7f0fcd9e49860f055dd0c1682d635d309ecb5e3011654c716d9eb59a7ddec7d2) // keccak256(abi.encodePacked("messageSourceChainId"))
                                    }
                                }
                            
                                /**
                                * @dev Sets an originating chain id of the currently processed message.
                                * @param _sourceChainId source chain id of the message that originated on the other side.
                                */
                                function setMessageSourceChainId(uint256 _sourceChainId) internal {
                                    assembly {
                                        // Even though this is not the same as uintStorage[keccak256(abi.encodePacked("messageSourceChainId"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        sstore(0x7f0fcd9e49860f055dd0c1682d635d309ecb5e3011654c716d9eb59a7ddec7d2, _sourceChainId) // keccak256(abi.encodePacked("messageSourceChainId"))
                                    }
                                }
                            
                                /**
                                * @dev Processes received message. Makes a call to the message executor,
                                * sets dataHash, receive, sender variables for failed messages.
                                * @param _sender sender address on the other side.
                                * @param _executor address of an executor.
                                * @param _messageId id of the processed message.
                                * @param _gasLimit gas limit for a call to executor.
                                * @param _sourceChainId source chain id is of the received message.
                                * @param _data calldata for a call to executor.
                                */
                                function processMessage(
                                    address _sender,
                                    address _executor,
                                    bytes32 _messageId,
                                    uint256 _gasLimit,
                                    uint8, /* dataType */
                                    uint256 _sourceChainId,
                                    bytes memory _data
                                ) internal {
                                    bool status = _passMessage(_sender, _executor, _data, _gasLimit, _messageId, _sourceChainId);
                            
                                    setMessageCallStatus(_messageId, status);
                                    if (!status) {
                                        setFailedMessageDataHash(_messageId, _data);
                                        setFailedMessageReceiver(_messageId, _executor);
                                        setFailedMessageSender(_messageId, _sender);
                                    }
                                    emitEventOnMessageProcessed(_sender, _executor, _messageId, status);
                                }
                            
                                /**
                                * @dev Makes a call to the message executor.
                                * @param _sender sender address on the other side.
                                * @param _contract address of an executor contract.
                                * @param _data calldata for a call to executor.
                                * @param _gas gas limit for a call to executor. 2^32 - 1, if caller will pass all available gas for the execution.
                                * @param _messageId id of the processed message.
                                * @param _sourceChainId source chain id is of the received message.
                                */
                                function _passMessage(
                                    address _sender,
                                    address _contract,
                                    bytes _data,
                                    uint256 _gas,
                                    bytes32 _messageId,
                                    uint256 _sourceChainId
                                ) internal returns (bool) {
                                    setMessageSender(_sender);
                                    setMessageId(_messageId);
                                    setMessageSourceChainId(_sourceChainId);
                            
                                    // After EIP-150, max gas cost allowed to be passed to the internal call is equal to the 63/64 of total gas left.
                                    // In reality, min(gasLimit, 63/64 * gasleft()) will be used as the call gas limit.
                                    // Imagine a situation, when message requires 10000000 gas to be executed successfully.
                                    // Also suppose, that at this point, gasleft() is equal to 10158000, so the callee will receive ~ 10158000 * 63 / 64 = 9999300 gas.
                                    // That amount of gas is not enough, so the call will fail. At the same time,
                                    // even if the callee failed the bridge contract still has ~ 158000 gas to
                                    // finish its execution and it will be enough. The internal call fails but
                                    // only because the oracle provides incorrect gas limit for the transaction
                                    // This check is needed here in order to force contract to pass exactly the requested amount of gas.
                                    // Avoiding it may lead to the unwanted message failure in some extreme cases.
                                    require(_gas == 0xffffffff || (gasleft() * 63) / 64 > _gas);
                            
                                    bool status = _contract.call.gas(_gas)(_data);
                                    _validateExecutionStatus(status);
                                    setMessageSender(address(0));
                                    setMessageId(bytes32(0));
                                    setMessageSourceChainId(0);
                                    return status;
                                }
                            
                                /**
                                * @dev Validates message execution status. In simplest case, does nothing.
                                * @param _status message execution status.
                                */
                                function _validateExecutionStatus(bool _status) internal {
                                    (_status);
                                }
                            
                                /* solcov ignore next */
                                function emitEventOnMessageProcessed(address sender, address executor, bytes32 messageId, bool status) internal;
                            }
                            
                            // File: contracts/upgradeable_contracts/arbitrary_message/MessageDelivery.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            
                            
                            contract MessageDelivery is BasicAMB, MessageProcessor {
                                using SafeMath for uint256;
                            
                                uint256 internal constant SEND_TO_ORACLE_DRIVEN_LANE = 0x00;
                                // after EIP2929, call to warmed contract address costs 100 instead of 2600
                                uint256 internal constant MIN_GAS_PER_CALL = 100;
                            
                                /**
                                * @dev Requests message relay to the opposite network
                                * @param _contract executor address on the other side
                                * @param _data calldata passed to the executor on the other side
                                * @param _gas gas limit used on the other network for executing a message
                                */
                                function requireToPassMessage(address _contract, bytes memory _data, uint256 _gas) public returns (bytes32) {
                                    return _sendMessage(_contract, _data, _gas, SEND_TO_ORACLE_DRIVEN_LANE);
                                }
                            
                                /**
                                * @dev Initiates sending of an AMB message to the opposite network
                                * @param _contract executor address on the other side
                                * @param _data calldata passed to the executor on the other side
                                * @param _gas gas limit used on the other network for executing a message
                                * @param _dataType AMB message dataType to be included as a part of the header
                                */
                                function _sendMessage(address _contract, bytes memory _data, uint256 _gas, uint256 _dataType)
                                    internal
                                    returns (bytes32)
                                {
                                    // it is not allowed to pass messages while other messages are processed
                                    // if other is not explicitly configured
                                    require(messageId() == bytes32(0) || allowReentrantRequests());
                                    require(_gas >= MIN_GAS_PER_CALL && _gas <= maxGasPerTx());
                            
                                    uint256 selector;
                                    assembly {
                                        selector := and(mload(add(_data, 4)), 0xffffffff)
                                    }
                                    // In order to prevent possible unauthorized ERC20 withdrawals, the following function signatures are prohibited:
                                    // * transfer(address,uint256)
                                    // * approve(address,uint256)
                                    // * transferFrom(address,address,uint256)
                                    // * approveAndCall(address,uint256,bytes)
                                    // * transferAndCall(address,uint256,bytes)
                                    // See https://medium.com/immunefi/xdai-stake-arbitrary-call-method-bug-postmortem-f80a90ac56e3 for more details
                                    require(
                                        selector != 0xa9059cbb &&
                                            selector != 0x095ea7b3 &&
                                            selector != 0x23b872dd &&
                                            selector != 0x4000aea0 &&
                                            selector != 0xcae9ca51
                                    );
                            
                                    (bytes32 _messageId, bytes memory header) = _packHeader(_contract, _gas, _dataType);
                            
                                    bytes memory eventData = abi.encodePacked(header, _data);
                            
                                    emitEventOnMessageRequest(_messageId, eventData);
                                    return _messageId;
                                }
                            
                                /**
                                * @dev Packs message header into a single bytes blob
                                * @param _contract executor address on the other side
                                * @param _gas gas limit used on the other network for executing a message
                                * @param _dataType AMB message dataType to be included as a part of the header
                                */
                                function _packHeader(address _contract, uint256 _gas, uint256 _dataType)
                                    internal
                                    view
                                    returns (bytes32 _messageId, bytes memory header)
                                {
                                    uint256 srcChainId = sourceChainId();
                                    uint256 srcChainIdLength = _sourceChainIdLength();
                                    uint256 dstChainId = destinationChainId();
                                    uint256 dstChainIdLength = _destinationChainIdLength();
                            
                                    _messageId = _getNewMessageId(srcChainId);
                            
                                    // 79 = 4 + 20 + 8 + 20 + 20 + 4 + 1 + 1 + 1
                                    header = new bytes(79 + srcChainIdLength + dstChainIdLength);
                            
                                    // In order to save the gas, the header is packed in the reverse order.
                                    // With such approach, it is possible to store right-aligned values without any additional bit shifts.
                                    assembly {
                                        let ptr := add(header, mload(header)) // points to the last word of header
                                        mstore(ptr, dstChainId)
                                        mstore(sub(ptr, dstChainIdLength), srcChainId)
                            
                                        mstore(add(header, 79), _dataType)
                                        mstore(add(header, 78), dstChainIdLength)
                                        mstore(add(header, 77), srcChainIdLength)
                                        mstore(add(header, 76), _gas)
                                        mstore(add(header, 72), _contract)
                                        mstore(add(header, 52), caller)
                                        mstore(add(header, 32), _messageId)
                                    }
                                }
                            
                                /**
                                 * @dev Generates a new messageId for the passed request/message.
                                 * Increments the nonce accordingly.
                                 * @param _srcChainId source chain id of the newly created message. Should be a chain id of the current network.
                                 * @return unique message id to use for the new request/message.
                                 */
                                function _getNewMessageId(uint256 _srcChainId) internal returns (bytes32) {
                                    uint64 nonce = _nonce();
                                    _setNonce(nonce + 1);
                            
                                    // Bridge id is recalculated every time again and again, since it is still cheaper than using SLOAD opcode (800 gas)
                                    bytes32 bridgeId = keccak256(abi.encodePacked(_srcChainId, address(this))) &
                                        0x00000000ffffffffffffffffffffffffffffffffffffffff0000000000000000;
                            
                                    return MESSAGE_PACKING_VERSION | bridgeId | bytes32(nonce);
                                }
                            
                                /* solcov ignore next */
                                function emitEventOnMessageRequest(bytes32 messageId, bytes encodedData) internal;
                            }
                            
                            // File: contracts/upgradeable_contracts/MessageRelay.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract MessageRelay is EternalStorage {
                                function relayedMessages(bytes32 _txHash) public view returns (bool) {
                                    return boolStorage[keccak256(abi.encodePacked("relayedMessages", _txHash))];
                                }
                            
                                function setRelayedMessages(bytes32 _txHash, bool _status) internal {
                                    boolStorage[keccak256(abi.encodePacked("relayedMessages", _txHash))] = _status;
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/arbitrary_message/BasicForeignAMB.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            
                            
                            contract BasicForeignAMB is BasicAMB, MessageRelay, MessageDelivery {
                                /**
                                * @dev Validates provided signatures and relays a given message
                                * @param _data bytes to be relayed
                                * @param _signatures bytes blob with signatures to be validated
                                */
                                function executeSignatures(bytes _data, bytes _signatures) public {
                                    _allowMessageExecution(_data, _signatures);
                            
                                    bytes32 msgId;
                                    address sender;
                                    address executor;
                                    uint32 gasLimit;
                                    uint8 dataType;
                                    uint256[2] memory chainIds;
                                    bytes memory data;
                            
                                    (msgId, sender, executor, gasLimit, dataType, chainIds, data) = ArbitraryMessage.unpackData(_data);
                            
                                    _executeMessage(msgId, sender, executor, gasLimit, dataType, chainIds, data);
                                }
                            
                                /**
                                * @dev Validates provided signatures and relays a given message.
                                * The message is not allowed to fail. The whole tx will be revered if message fails.
                                * @param _data bytes to be relayed
                                * @param _signatures bytes blob with signatures to be validated
                                */
                                function safeExecuteSignatures(bytes _data, bytes _signatures) external {
                                    executeSignatures(_data, _signatures);
                                }
                            
                                /**
                                * @dev Validates provided signatures and relays a given message. Allows to override the gas limit of the passed message.
                                * Usually it makes sense to provide a higher amount of gas for the execution.
                                * The message is not allowed to fail. The whole tx will be revered if message fails.
                                * @param _data bytes to be relayed
                                * @param _signatures bytes blob with signatures to be validated
                                */
                                function safeExecuteSignaturesWithGasLimit(bytes _data, bytes _signatures, uint32 _gas) public {
                                    _allowMessageExecution(_data, _signatures);
                            
                                    bytes32 msgId;
                                    address sender;
                                    address executor;
                                    uint8 dataType;
                                    uint256[2] memory chainIds;
                                    bytes memory data;
                            
                                    (msgId, sender, executor, , dataType, chainIds, data) = ArbitraryMessage.unpackData(_data);
                            
                                    _executeMessage(msgId, sender, executor, _gas, dataType, chainIds, data);
                                }
                            
                                /**
                                * @dev Validates provided signatures and relays a given message. Passes all available gas for the execution.
                                * The message is not allowed to fail. The whole tx will be revered if message fails.
                                * @param _data bytes to be relayed
                                * @param _signatures bytes blob with signatures to be validated
                                */
                                function safeExecuteSignaturesWithAutoGasLimit(bytes _data, bytes _signatures) external {
                                    safeExecuteSignaturesWithGasLimit(_data, _signatures, 0xffffffff);
                                }
                            
                                /**
                                * @dev Internal function for validating pre-execution requirements.
                                * @param _data bytes to be relayed.
                                * @param _signatures bytes blob with signatures to be validated.
                                */
                                function _allowMessageExecution(bytes _data, bytes _signatures) internal {
                                    // this checks prevents execution of other messages, while some other message is being processed
                                    // nested executeSignatures is considered to be unsafe,
                                    // since it allows to change/reset the AMB context variables (messageId, messageSender, messageSourceChainId)
                                    // while processing nested message
                                    require(messageId() == bytes32(0));
                            
                                    Message.hasEnoughValidSignatures(_data, _signatures, validatorContract(), true);
                                }
                            
                                /**
                                * @dev Internal function for executing decoded message. Performs additional validation on the message fields.
                                * @param msgId id of the processed message.
                                * @param sender sender address on the other side.
                                * @param executor address of an executor.
                                * @param gasLimit gas limit for a call to executor.
                                * @param dataType AMB message dataType to be included as a part of the header.
                                * @param chainIds pair of source and destination chain ids.
                                * @param data calldata for a call to executor.
                                */
                                function _executeMessage(
                                    bytes32 msgId,
                                    address sender,
                                    address executor,
                                    uint32 gasLimit,
                                    uint8 dataType,
                                    uint256[2] memory chainIds,
                                    bytes memory data
                                ) internal {
                                    require(_isMessageVersionValid(msgId));
                                    require(_isDestinationChainIdValid(chainIds[1]));
                                    require(!relayedMessages(msgId));
                                    setRelayedMessages(msgId, true);
                                    processMessage(sender, executor, msgId, gasLimit, dataType, chainIds[0], data);
                                }
                            
                                /**
                                * @dev Validates message execution status. Reverts if message is was executed in safe mode and reverted.
                                * @param _status message execution status.
                                */
                                function _validateExecutionStatus(bool _status) internal {
                                    require(_status || msg.sig == this.executeSignatures.selector);
                                }
                            
                                /**
                                * @dev Internal function for updating fallback gas price value.
                                * @param _gasPrice new value for the gas price, zero gas price is not allowed.
                                */
                                function _setGasPrice(uint256 _gasPrice) internal {
                                    require(_gasPrice > 0);
                                    super._setGasPrice(_gasPrice);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/arbitrary_message/ForeignAMB.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract ForeignAMB is BasicForeignAMB {
                                event UserRequestForAffirmation(bytes32 indexed messageId, bytes encodedData);
                                event RelayedMessage(address indexed sender, address indexed executor, bytes32 indexed messageId, bool status);
                            
                                function emitEventOnMessageRequest(bytes32 messageId, bytes encodedData) internal {
                                    emit UserRequestForAffirmation(messageId, encodedData);
                                }
                            
                                function emitEventOnMessageProcessed(address sender, address executor, bytes32 messageId, bool status) internal {
                                    emit RelayedMessage(sender, executor, messageId, status);
                                }
                            }
                            

                            File 5 of 8: EternalStorageProxy
                            // File: contracts/upgradeability/EternalStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title EternalStorage
                             * @dev This contract holds all the necessary state variables to carry out the storage of any contract.
                             */
                            contract EternalStorage {
                                mapping(bytes32 => uint256) internal uintStorage;
                                mapping(bytes32 => string) internal stringStorage;
                                mapping(bytes32 => address) internal addressStorage;
                                mapping(bytes32 => bytes) internal bytesStorage;
                                mapping(bytes32 => bool) internal boolStorage;
                                mapping(bytes32 => int256) internal intStorage;
                            
                            }
                            
                            // File: openzeppelin-solidity/contracts/AddressUtils.sol
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * Utility library of inline functions on addresses
                             */
                            library AddressUtils {
                            
                              /**
                               * Returns whether the target address is a contract
                               * @dev This function will return false if invoked during the constructor of a contract,
                               * as the code is not actually created until after the constructor finishes.
                               * @param _addr address to check
                               * @return whether the target address is a contract
                               */
                              function isContract(address _addr) internal view returns (bool) {
                                uint256 size;
                                // XXX Currently there is no better way to check if there is a contract in an address
                                // than to check the size of the code at that address.
                                // See https://ethereum.stackexchange.com/a/14016/36603
                                // for more details about how this works.
                                // TODO Check this again before the Serenity release, because all addresses will be
                                // contracts then.
                                // solium-disable-next-line security/no-inline-assembly
                                assembly { size := extcodesize(_addr) }
                                return size > 0;
                              }
                            
                            }
                            
                            // File: contracts/upgradeability/Proxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title Proxy
                             * @dev Gives the possibility to delegate any call to a foreign implementation.
                             */
                            contract Proxy {
                                /**
                                * @dev Tells the address of the implementation where every call will be delegated.
                                * @return address of the implementation to which it will be delegated
                                */
                                /* solcov ignore next */
                                function implementation() public view returns (address);
                            
                                /**
                                * @dev Fallback function allowing to perform a delegatecall to the given implementation.
                                * This function will return whatever the implementation call returns
                                */
                                function() public payable {
                                    // solhint-disable-previous-line no-complex-fallback
                                    address _impl = implementation();
                                    require(_impl != address(0));
                                    assembly {
                                        /*
                                            0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40)
                                            loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty
                                            memory. It's needed because we're going to write the return data of delegatecall to the
                                            free memory slot.
                                        */
                                        let ptr := mload(0x40)
                                        /*
                                            `calldatacopy` is copy calldatasize bytes from calldata
                                            First argument is the destination to which data is copied(ptr)
                                            Second argument specifies the start position of the copied data.
                                                Since calldata is sort of its own unique location in memory,
                                                0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata.
                                                That's always going to be the zeroth byte of the function selector.
                                            Third argument, calldatasize, specifies how much data will be copied.
                                                calldata is naturally calldatasize bytes long (same thing as msg.data.length)
                                        */
                                        calldatacopy(ptr, 0, calldatasize)
                                        /*
                                            delegatecall params explained:
                                            gas: the amount of gas to provide for the call. `gas` is an Opcode that gives
                                                us the amount of gas still available to execution
                            
                                            _impl: address of the contract to delegate to
                            
                                            ptr: to pass copied data
                            
                                            calldatasize: loads the size of `bytes memory data`, same as msg.data.length
                            
                                            0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic,
                                                    these are set to 0, 0 so the output data will not be written to memory. The output
                                                    data will be read using `returndatasize` and `returdatacopy` instead.
                            
                                            result: This will be 0 if the call fails and 1 if it succeeds
                                        */
                                        let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
                                        /*
                            
                                        */
                                        /*
                                            ptr current points to the value stored at 0x40,
                                            because we assigned it like ptr := mload(0x40).
                                            Because we use 0x40 as a free memory pointer,
                                            we want to make sure that the next time we want to allocate memory,
                                            we aren't overwriting anything important.
                                            So, by adding ptr and returndatasize,
                                            we get a memory location beyond the end of the data we will be copying to ptr.
                                            We place this in at 0x40, and any reads from 0x40 will now read from free memory
                                        */
                                        mstore(0x40, add(ptr, returndatasize))
                                        /*
                                            `returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the
                                                slot it will copy to, 0 means copy from the beginning of the return data, and size is
                                                the amount of data to copy.
                                            `returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall
                                        */
                                        returndatacopy(ptr, 0, returndatasize)
                            
                                        /*
                                            if `result` is 0, revert.
                                            if `result` is 1, return `size` amount of data from `ptr`. This is the data that was
                                            copied to `ptr` from the delegatecall return data
                                        */
                                        switch result
                                            case 0 {
                                                revert(ptr, returndatasize)
                                            }
                                            default {
                                                return(ptr, returndatasize)
                                            }
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title UpgradeabilityStorage
                             * @dev This contract holds all the necessary state variables to support the upgrade functionality
                             */
                            contract UpgradeabilityStorage {
                                // Version name of the current implementation
                                uint256 internal _version;
                            
                                // Address of the current implementation
                                address internal _implementation;
                            
                                /**
                                * @dev Tells the version name of the current implementation
                                * @return uint256 representing the name of the current version
                                */
                                function version() external view returns (uint256) {
                                    return _version;
                                }
                            
                                /**
                                * @dev Tells the address of the current implementation
                                * @return address of the current implementation
                                */
                                function implementation() public view returns (address) {
                                    return _implementation;
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityProxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            
                            /**
                             * @title UpgradeabilityProxy
                             * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded
                             */
                            contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage {
                                /**
                                * @dev This event will be emitted every time the implementation gets upgraded
                                * @param version representing the version name of the upgraded implementation
                                * @param implementation representing the address of the upgraded implementation
                                */
                                event Upgraded(uint256 version, address indexed implementation);
                            
                                /**
                                * @dev Upgrades the implementation address
                                * @param version representing the version name of the new implementation to be set
                                * @param implementation representing the address of the new implementation to be set
                                */
                                function _upgradeTo(uint256 version, address implementation) internal {
                                    require(_implementation != implementation);
                            
                                    // This additional check verifies that provided implementation is at least a contract
                                    require(AddressUtils.isContract(implementation));
                            
                                    // This additional check guarantees that new version will be at least greater than the privios one,
                                    // so it is impossible to reuse old versions, or use the last version twice
                                    require(version > _version);
                            
                                    _version = version;
                                    _implementation = implementation;
                                    emit Upgraded(version, implementation);
                                }
                            }
                            
                            // File: contracts/upgradeability/UpgradeabilityOwnerStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title UpgradeabilityOwnerStorage
                             * @dev This contract keeps track of the upgradeability owner
                             */
                            contract UpgradeabilityOwnerStorage {
                                // Owner of the contract
                                address internal _upgradeabilityOwner;
                            
                                /**
                                * @dev Tells the address of the owner
                                * @return the address of the owner
                                */
                                function upgradeabilityOwner() public view returns (address) {
                                    return _upgradeabilityOwner;
                                }
                            
                                /**
                                * @dev Sets the address of the owner
                                */
                                function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
                                    _upgradeabilityOwner = newUpgradeabilityOwner;
                                }
                            }
                            
                            // File: contracts/upgradeability/OwnedUpgradeabilityProxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            /**
                             * @title OwnedUpgradeabilityProxy
                             * @dev This contract combines an upgradeability proxy with basic authorization control functionalities
                             */
                            contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityProxy {
                                /**
                                * @dev Event to show ownership has been transferred
                                * @param previousOwner representing the address of the previous owner
                                * @param newOwner representing the address of the new owner
                                */
                                event ProxyOwnershipTransferred(address previousOwner, address newOwner);
                            
                                /**
                                * @dev the constructor sets the original owner of the contract to the sender account.
                                */
                                constructor() public {
                                    setUpgradeabilityOwner(msg.sender);
                                }
                            
                                /**
                                * @dev Throws if called by any account other than the owner.
                                */
                                modifier onlyUpgradeabilityOwner() {
                                    require(msg.sender == upgradeabilityOwner());
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                /**
                                * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                * @param newOwner The address to transfer ownership to.
                                */
                                function transferProxyOwnership(address newOwner) external onlyUpgradeabilityOwner {
                                    require(newOwner != address(0));
                                    emit ProxyOwnershipTransferred(upgradeabilityOwner(), newOwner);
                                    setUpgradeabilityOwner(newOwner);
                                }
                            
                                /**
                                * @dev Allows the upgradeability owner to upgrade the current version of the proxy.
                                * @param version representing the version name of the new implementation to be set.
                                * @param implementation representing the address of the new implementation to be set.
                                */
                                function upgradeTo(uint256 version, address implementation) public onlyUpgradeabilityOwner {
                                    _upgradeTo(version, implementation);
                                }
                            
                                /**
                                * @dev Allows the upgradeability owner to upgrade the current version of the proxy and call the new implementation
                                * to initialize whatever is needed through a low level call.
                                * @param version representing the version name of the new implementation to be set.
                                * @param implementation representing the address of the new implementation to be set.
                                * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
                                * signature of the implementation to be called with the needed payload
                                */
                                function upgradeToAndCall(uint256 version, address implementation, bytes data)
                                    external
                                    payable
                                    onlyUpgradeabilityOwner
                                {
                                    upgradeTo(version, implementation);
                                    // solhint-disable-next-line avoid-call-value
                                    require(address(this).call.value(msg.value)(data));
                                }
                            }
                            
                            // File: contracts/upgradeability/EternalStorageProxy.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            /**
                             * @title EternalStorageProxy
                             * @dev This proxy holds the storage of the token contract and delegates every call to the current implementation set.
                             * Besides, it allows to upgrade the token's behaviour towards further implementations, and provides basic
                             * authorization control functionalities
                             */
                            // solhint-disable-next-line no-empty-blocks
                            contract EternalStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {}

                            File 6 of 8: BridgeValidators
                            // File: contracts/upgradeability/EternalStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            /**
                             * @title EternalStorage
                             * @dev This contract holds all the necessary state variables to carry out the storage of any contract.
                             */
                            contract EternalStorage {
                                mapping(bytes32 => uint256) internal uintStorage;
                                mapping(bytes32 => string) internal stringStorage;
                                mapping(bytes32 => address) internal addressStorage;
                                mapping(bytes32 => bytes) internal bytesStorage;
                                mapping(bytes32 => bool) internal boolStorage;
                                mapping(bytes32 => int256) internal intStorage;
                            
                            }
                            
                            // File: contracts/interfaces/IUpgradeabilityOwnerStorage.sol
                            
                            pragma solidity 0.4.24;
                            
                            interface IUpgradeabilityOwnerStorage {
                                function upgradeabilityOwner() external view returns (address);
                            }
                            
                            // File: contracts/upgradeable_contracts/Ownable.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            /**
                             * @title Ownable
                             * @dev This contract has an owner address providing basic authorization control
                             */
                            contract Ownable is EternalStorage {
                                bytes4 internal constant UPGRADEABILITY_OWNER = 0x6fde8202; // upgradeabilityOwner()
                            
                                /**
                                * @dev Event to show ownership has been transferred
                                * @param previousOwner representing the address of the previous owner
                                * @param newOwner representing the address of the new owner
                                */
                                event OwnershipTransferred(address previousOwner, address newOwner);
                            
                                /**
                                * @dev Throws if called by any account other than the owner.
                                */
                                modifier onlyOwner() {
                                    require(msg.sender == owner());
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                /**
                                * @dev Throws if called by any account other than contract itself or owner.
                                */
                                modifier onlyRelevantSender() {
                                    // proxy owner if used through proxy, address(0) otherwise
                                    require(
                                        !address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy
                                            msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner() || // covers usage through regular proxy calls
                                            msg.sender == address(this) // covers calls through upgradeAndCall proxy method
                                    );
                                    /* solcov ignore next */
                                    _;
                                }
                            
                                bytes32 internal constant OWNER = 0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0; // keccak256(abi.encodePacked("owner"))
                            
                                /**
                                * @dev Tells the address of the owner
                                * @return the address of the owner
                                */
                                function owner() public view returns (address) {
                                    return addressStorage[OWNER];
                                }
                            
                                /**
                                * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                * @param newOwner the address to transfer ownership to.
                                */
                                function transferOwnership(address newOwner) external onlyOwner {
                                    _setOwner(newOwner);
                                }
                            
                                /**
                                * @dev Sets a new owner address
                                */
                                function _setOwner(address newOwner) internal {
                                    require(newOwner != address(0));
                                    emit OwnershipTransferred(owner(), newOwner);
                                    addressStorage[OWNER] = newOwner;
                                }
                            }
                            
                            // File: openzeppelin-solidity/contracts/math/SafeMath.sol
                            
                            pragma solidity ^0.4.24;
                            
                            
                            /**
                             * @title SafeMath
                             * @dev Math operations with safety checks that throw on error
                             */
                            library SafeMath {
                            
                              /**
                              * @dev Multiplies two numbers, throws on overflow.
                              */
                              function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
                                // Gas optimization: this is cheaper than asserting '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;
                                }
                            
                                c = _a * _b;
                                assert(c / _a == _b);
                                return c;
                              }
                            
                              /**
                              * @dev Integer division of two numbers, truncating the quotient.
                              */
                              function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
                                // assert(_b > 0); // Solidity automatically throws 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 _a / _b;
                              }
                            
                              /**
                              * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
                              */
                              function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
                                assert(_b <= _a);
                                return _a - _b;
                              }
                            
                              /**
                              * @dev Adds two numbers, throws on overflow.
                              */
                              function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
                                c = _a + _b;
                                assert(c >= _a);
                                return c;
                              }
                            }
                            
                            // File: contracts/upgradeable_contracts/Initializable.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract Initializable is EternalStorage {
                                bytes32 internal constant INITIALIZED = 0x0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba; // keccak256(abi.encodePacked("isInitialized"))
                            
                                function setInitialize() internal {
                                    boolStorage[INITIALIZED] = true;
                                }
                            
                                function isInitialized() public view returns (bool) {
                                    return boolStorage[INITIALIZED];
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/InitializableBridge.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract InitializableBridge is Initializable {
                                bytes32 internal constant DEPLOYED_AT_BLOCK = 0xb120ceec05576ad0c710bc6e85f1768535e27554458f05dcbb5c65b8c7a749b0; // keccak256(abi.encodePacked("deployedAtBlock"))
                            
                                function deployedAtBlock() external view returns (uint256) {
                                    return uintStorage[DEPLOYED_AT_BLOCK];
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/BaseBridgeValidators.sol
                            
                            pragma solidity 0.4.24;
                            
                            
                            
                            contract BaseBridgeValidators is InitializableBridge, Ownable {
                                using SafeMath for uint256;
                            
                                address public constant F_ADDR = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF;
                                uint256 internal constant MAX_VALIDATORS = 50;
                                bytes32 internal constant REQUIRED_SIGNATURES = 0xd18ea17c351d6834a0e568067fb71804d2a588d5e26d60f792b1c724b1bd53b1; // keccak256(abi.encodePacked("requiredSignatures"))
                                bytes32 internal constant VALIDATOR_COUNT = 0x8656d603d9f985c3483946a92789d52202f49736384ba131cb92f62c4c1aa082; // keccak256(abi.encodePacked("validatorCount"))
                            
                                event ValidatorAdded(address indexed validator);
                                event ValidatorRemoved(address indexed validator);
                                event RequiredSignaturesChanged(uint256 requiredSignatures);
                            
                                function setRequiredSignatures(uint256 _requiredSignatures) external onlyOwner {
                                    require(validatorCount() >= _requiredSignatures);
                                    require(_requiredSignatures != 0);
                                    uintStorage[REQUIRED_SIGNATURES] = _requiredSignatures;
                                    emit RequiredSignaturesChanged(_requiredSignatures);
                                }
                            
                                function getBridgeValidatorsInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
                                    return (2, 3, 0);
                                }
                            
                                function validatorList() external view returns (address[]) {
                                    address[] memory list = new address[](validatorCount());
                                    uint256 counter = 0;
                                    address nextValidator = getNextValidator(F_ADDR);
                                    require(nextValidator != address(0));
                            
                                    while (nextValidator != F_ADDR) {
                                        list[counter] = nextValidator;
                                        nextValidator = getNextValidator(nextValidator);
                                        counter++;
                            
                                        require(nextValidator != address(0));
                                    }
                            
                                    return list;
                                }
                            
                                function _addValidator(address _validator) internal {
                                    require(_validator != address(0) && _validator != F_ADDR);
                                    require(!isValidator(_validator));
                            
                                    address firstValidator = getNextValidator(F_ADDR);
                                    require(firstValidator != address(0));
                                    setNextValidator(_validator, firstValidator);
                                    setNextValidator(F_ADDR, _validator);
                                    setValidatorCount(validatorCount().add(1));
                                }
                            
                                function _removeValidator(address _validator) internal {
                                    require(validatorCount() > requiredSignatures());
                                    require(isValidator(_validator));
                                    address validatorsNext = getNextValidator(_validator);
                                    address index = F_ADDR;
                                    address next = getNextValidator(index);
                                    require(next != address(0));
                            
                                    while (next != _validator) {
                                        index = next;
                                        next = getNextValidator(index);
                            
                                        require(next != F_ADDR && next != address(0));
                                    }
                            
                                    setNextValidator(index, validatorsNext);
                                    deleteItemFromAddressStorage("validatorsList", _validator);
                                    setValidatorCount(validatorCount().sub(1));
                                }
                            
                                function requiredSignatures() public view returns (uint256) {
                                    return uintStorage[REQUIRED_SIGNATURES];
                                }
                            
                                function validatorCount() public view returns (uint256) {
                                    return uintStorage[VALIDATOR_COUNT];
                                }
                            
                                function isValidator(address _validator) public view returns (bool) {
                                    return _validator != F_ADDR && getNextValidator(_validator) != address(0);
                                }
                            
                                function getNextValidator(address _address) public view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("validatorsList", _address))];
                                }
                            
                                function deleteItemFromAddressStorage(string _mapName, address _address) internal {
                                    delete addressStorage[keccak256(abi.encodePacked(_mapName, _address))];
                                }
                            
                                function setValidatorCount(uint256 _validatorCount) internal {
                                    require(_validatorCount <= MAX_VALIDATORS);
                                    uintStorage[VALIDATOR_COUNT] = _validatorCount;
                                }
                            
                                function setNextValidator(address _prevValidator, address _validator) internal {
                                    addressStorage[keccak256(abi.encodePacked("validatorsList", _prevValidator))] = _validator;
                                }
                            
                                function isValidatorDuty(address _validator) external view returns (bool) {
                                    uint256 counter = 0;
                                    address next = getNextValidator(F_ADDR);
                                    require(next != address(0));
                            
                                    while (next != F_ADDR) {
                                        if (next == _validator) {
                                            return (block.number % validatorCount() == counter);
                                        }
                            
                                        next = getNextValidator(next);
                                        counter++;
                            
                                        require(next != address(0));
                                    }
                            
                                    return false;
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/BridgeValidators.sol
                            
                            pragma solidity 0.4.24;
                            
                            contract BridgeValidators is BaseBridgeValidators {
                                function initialize(uint256 _requiredSignatures, address[] _initialValidators, address _owner)
                                    external
                                    onlyRelevantSender
                                    returns (bool)
                                {
                                    require(!isInitialized());
                                    _setOwner(_owner);
                                    require(_requiredSignatures != 0);
                                    require(_initialValidators.length >= _requiredSignatures);
                            
                                    for (uint256 i = 0; i < _initialValidators.length; i++) {
                                        require(_initialValidators[i] != address(0) && _initialValidators[i] != F_ADDR);
                                        require(!isValidator(_initialValidators[i]));
                            
                                        if (i == 0) {
                                            setNextValidator(F_ADDR, _initialValidators[i]);
                                            if (_initialValidators.length == 1) {
                                                setNextValidator(_initialValidators[i], F_ADDR);
                                            }
                                        } else if (i == _initialValidators.length - 1) {
                                            setNextValidator(_initialValidators[i - 1], _initialValidators[i]);
                                            setNextValidator(_initialValidators[i], F_ADDR);
                                        } else {
                                            setNextValidator(_initialValidators[i - 1], _initialValidators[i]);
                                        }
                            
                                        emit ValidatorAdded(_initialValidators[i]);
                                    }
                            
                                    setValidatorCount(_initialValidators.length);
                                    uintStorage[REQUIRED_SIGNATURES] = _requiredSignatures;
                                    uintStorage[DEPLOYED_AT_BLOCK] = block.number;
                                    setInitialize();
                                    emit RequiredSignaturesChanged(_requiredSignatures);
                            
                                    return isInitialized();
                                }
                            
                                function addValidator(address _validator) external onlyOwner {
                                    _addValidator(_validator);
                                    emit ValidatorAdded(_validator);
                                }
                            
                                function removeValidator(address _validator) external onlyOwner {
                                    _removeValidator(_validator);
                                    emit ValidatorRemoved(_validator);
                                }
                            }
                            

                            File 7 of 8: ForeignOmnibridge
                            // File: @openzeppelin/contracts/math/SafeMath.sol
                            
                            
                            pragma solidity ^0.7.0;
                            
                            /**
                             * @dev Wrappers over Solidity's arithmetic operations with added overflow
                             * checks.
                             *
                             * Arithmetic operations in Solidity wrap on overflow. This can easily result
                             * in bugs, because programmers usually assume that an overflow raises an
                             * error, which is the standard behavior in high level programming languages.
                             * `SafeMath` restores this intuition by reverting the transaction when an
                             * operation overflows.
                             *
                             * Using this library instead of the unchecked operations eliminates an entire
                             * class of bugs, so it's recommended to use it always.
                             */
                            library SafeMath {
                                /**
                                 * @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) {
                                    uint256 c = a + b;
                                    require(c >= a, "SafeMath: addition overflow");
                            
                                    return c;
                                }
                            
                                /**
                                 * @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 sub(a, b, "SafeMath: subtraction overflow");
                                }
                            
                                /**
                                 * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
                                 * overflow (when the result is negative).
                                 *
                                 * Counterpart to Solidity's `-` operator.
                                 *
                                 * Requirements:
                                 *
                                 * - Subtraction cannot overflow.
                                 */
                                function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
                                    require(b <= a, errorMessage);
                                    uint256 c = a - b;
                            
                                    return c;
                                }
                            
                                /**
                                 * @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) {
                                    // 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 0;
                                    }
                            
                                    uint256 c = a * b;
                                    require(c / a == b, "SafeMath: multiplication overflow");
                            
                                    return c;
                                }
                            
                                /**
                                 * @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) {
                                    return div(a, b, "SafeMath: division by zero");
                                }
                            
                                /**
                                 * @dev Returns the integer division of two unsigned integers. Reverts 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) {
                                    require(b > 0, errorMessage);
                                    uint256 c = a / b;
                                    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
                            
                                    return c;
                                }
                            
                                /**
                                 * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
                                 * Reverts 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 mod(a, b, "SafeMath: modulo by zero");
                                }
                            
                                /**
                                 * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
                                 * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
                                    require(b != 0, errorMessage);
                                    return a % b;
                                }
                            }
                            
                            // File: contracts/upgradeability/EternalStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title EternalStorage
                             * @dev This contract holds all the necessary state variables to carry out the storage of any contract.
                             */
                            contract EternalStorage {
                                mapping(bytes32 => uint256) internal uintStorage;
                                mapping(bytes32 => string) internal stringStorage;
                                mapping(bytes32 => address) internal addressStorage;
                                mapping(bytes32 => bytes) internal bytesStorage;
                                mapping(bytes32 => bool) internal boolStorage;
                                mapping(bytes32 => int256) internal intStorage;
                            }
                            
                            // File: contracts/upgradeable_contracts/Initializable.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            contract Initializable is EternalStorage {
                                bytes32 internal constant INITIALIZED = 0x0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba; // keccak256(abi.encodePacked("isInitialized"))
                            
                                function setInitialize() internal {
                                    boolStorage[INITIALIZED] = true;
                                }
                            
                                function isInitialized() public view returns (bool) {
                                    return boolStorage[INITIALIZED];
                                }
                            }
                            
                            // File: contracts/interfaces/IUpgradeabilityOwnerStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            interface IUpgradeabilityOwnerStorage {
                                function upgradeabilityOwner() external view returns (address);
                            }
                            
                            // File: contracts/upgradeable_contracts/Upgradeable.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            contract Upgradeable {
                                /**
                                 * @dev Throws if called by any account other than the upgradeability owner.
                                 */
                                modifier onlyIfUpgradeabilityOwner() {
                                    _onlyIfUpgradeabilityOwner();
                                    _;
                                }
                            
                                /**
                                 * @dev Internal function for reducing onlyIfUpgradeabilityOwner modifier bytecode overhead.
                                 */
                                function _onlyIfUpgradeabilityOwner() internal view {
                                    require(msg.sender == IUpgradeabilityOwnerStorage(address(this)).upgradeabilityOwner());
                                }
                            }
                            
                            // File: @openzeppelin/contracts/token/ERC20/IERC20.sol
                            
                            
                            pragma solidity ^0.7.0;
                            
                            /**
                             * @dev Interface of the ERC20 standard as defined in the EIP.
                             */
                            interface IERC20 {
                                /**
                                 * @dev Returns the amount of tokens in existence.
                                 */
                                function totalSupply() external view returns (uint256);
                            
                                /**
                                 * @dev Returns the amount of tokens owned by `account`.
                                 */
                                function balanceOf(address account) external view returns (uint256);
                            
                                /**
                                 * @dev Moves `amount` tokens from the caller's account to `recipient`.
                                 *
                                 * Returns a boolean value indicating whether the operation succeeded.
                                 *
                                 * Emits a {Transfer} event.
                                 */
                                function transfer(address recipient, uint256 amount) external returns (bool);
                            
                                /**
                                 * @dev Returns the remaining number of tokens that `spender` will be
                                 * allowed to spend on behalf of `owner` through {transferFrom}. This is
                                 * zero by default.
                                 *
                                 * This value changes when {approve} or {transferFrom} are called.
                                 */
                                function allowance(address owner, address spender) external view returns (uint256);
                            
                                /**
                                 * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
                                 *
                                 * Returns a boolean value indicating whether the operation succeeded.
                                 *
                                 * IMPORTANT: Beware that changing an allowance with this method brings the risk
                                 * that someone may use both the old and the new allowance by unfortunate
                                 * transaction ordering. One possible solution to mitigate this race
                                 * condition is to first reduce the spender's allowance to 0 and set the
                                 * desired value afterwards:
                                 * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                                 *
                                 * Emits an {Approval} event.
                                 */
                                function approve(address spender, uint256 amount) external returns (bool);
                            
                                /**
                                 * @dev Moves `amount` tokens from `sender` to `recipient` using the
                                 * allowance mechanism. `amount` is then deducted from the caller's
                                 * allowance.
                                 *
                                 * Returns a boolean value indicating whether the operation succeeded.
                                 *
                                 * Emits a {Transfer} event.
                                 */
                                function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
                            
                                /**
                                 * @dev Emitted when `value` tokens are moved from one account (`from`) to
                                 * another (`to`).
                                 *
                                 * Note that `value` may be zero.
                                 */
                                event Transfer(address indexed from, address indexed to, uint256 value);
                            
                                /**
                                 * @dev Emitted when the allowance of a `spender` for an `owner` is set by
                                 * a call to {approve}. `value` is the new allowance.
                                 */
                                event Approval(address indexed owner, address indexed spender, uint256 value);
                            }
                            
                            // File: @openzeppelin/contracts/utils/Address.sol
                            
                            
                            pragma solidity ^0.7.0;
                            
                            /**
                             * @dev Collection of functions related to the address type
                             */
                            library Address {
                                /**
                                 * @dev Returns true if `account` is a contract.
                                 *
                                 * [IMPORTANT]
                                 * ====
                                 * It is unsafe to assume that an address for which this function returns
                                 * false is an externally-owned account (EOA) and not a contract.
                                 *
                                 * Among others, `isContract` will return false for the following
                                 * types of addresses:
                                 *
                                 *  - an externally-owned account
                                 *  - a contract in construction
                                 *  - an address where a contract will be created
                                 *  - an address where a contract lived, but was destroyed
                                 * ====
                                 */
                                function isContract(address account) internal view returns (bool) {
                                    // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
                                    // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
                                    // for accounts without code, i.e. `keccak256('')`
                                    bytes32 codehash;
                                    bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
                                    // solhint-disable-next-line no-inline-assembly
                                    assembly { codehash := extcodehash(account) }
                                    return (codehash != accountHash && codehash != 0x0);
                                }
                            
                                /**
                                 * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                                 * `recipient`, forwarding all available gas and reverting on errors.
                                 *
                                 * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                                 * of certain opcodes, possibly making contracts go over the 2300 gas limit
                                 * imposed by `transfer`, making them unable to receive funds via
                                 * `transfer`. {sendValue} removes this limitation.
                                 *
                                 * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                                 *
                                 * IMPORTANT: because control is transferred to `recipient`, care must be
                                 * taken to not create reentrancy vulnerabilities. Consider using
                                 * {ReentrancyGuard} or the
                                 * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                                 */
                                function sendValue(address payable recipient, uint256 amount) internal {
                                    require(address(this).balance >= amount, "Address: insufficient balance");
                            
                                    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
                                    (bool success, ) = recipient.call{ value: amount }("");
                                    require(success, "Address: unable to send value, recipient may have reverted");
                                }
                            
                                /**
                                 * @dev Performs a Solidity function call using a low level `call`. A
                                 * plain`call` is an unsafe replacement for a function call: use this
                                 * function instead.
                                 *
                                 * If `target` reverts with a revert reason, it is bubbled up by this
                                 * function (like regular Solidity function calls).
                                 *
                                 * Returns the raw returned data. To convert to the expected return value,
                                 * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
                                 *
                                 * Requirements:
                                 *
                                 * - `target` must be a contract.
                                 * - calling `target` with `data` must not revert.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCall(address target, bytes memory data) internal returns (bytes memory) {
                                  return functionCall(target, data, "Address: low-level call failed");
                                }
                            
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
                                 * `errorMessage` as a fallback revert reason when `target` reverts.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
                                    return _functionCallWithValue(target, data, 0, errorMessage);
                                }
                            
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                                 * but also transferring `value` wei to `target`.
                                 *
                                 * Requirements:
                                 *
                                 * - the calling contract must have an ETH balance of at least `value`.
                                 * - the called Solidity function must be `payable`.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
                                    return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
                                }
                            
                                /**
                                 * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
                                 * with `errorMessage` as a fallback revert reason when `target` reverts.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
                                    require(address(this).balance >= value, "Address: insufficient balance for call");
                                    return _functionCallWithValue(target, data, value, errorMessage);
                                }
                            
                                function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
                                    require(isContract(target), "Address: call to non-contract");
                            
                                    // solhint-disable-next-line avoid-low-level-calls
                                    (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
                                    if (success) {
                                        return returndata;
                                    } else {
                                        // Look for revert reason and bubble it up if present
                                        if (returndata.length > 0) {
                                            // The easiest way to bubble the revert reason is using memory via assembly
                            
                                            // solhint-disable-next-line no-inline-assembly
                                            assembly {
                                                let returndata_size := mload(returndata)
                                                revert(add(32, returndata), returndata_size)
                                            }
                                        } else {
                                            revert(errorMessage);
                                        }
                                    }
                                }
                            }
                            
                            // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol
                            
                            
                            pragma solidity ^0.7.0;
                            
                            
                            
                            
                            /**
                             * @title SafeERC20
                             * @dev Wrappers around ERC20 operations that throw on failure (when the token
                             * contract returns false). Tokens that return no value (and instead revert or
                             * throw on failure) are also supported, non-reverting calls are assumed to be
                             * successful.
                             * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
                             * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
                             */
                            library SafeERC20 {
                                using SafeMath for uint256;
                                using Address for address;
                            
                                function safeTransfer(IERC20 token, address to, uint256 value) internal {
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
                                }
                            
                                function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
                                }
                            
                                /**
                                 * @dev Deprecated. This function has issues similar to the ones found in
                                 * {IERC20-approve}, and its usage is discouraged.
                                 *
                                 * Whenever possible, use {safeIncreaseAllowance} and
                                 * {safeDecreaseAllowance} instead.
                                 */
                                function safeApprove(IERC20 token, address spender, uint256 value) internal {
                                    // safeApprove should only be called when setting an initial allowance,
                                    // or when resetting it to zero. To increase and decrease it, use
                                    // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
                                    // solhint-disable-next-line max-line-length
                                    require((value == 0) || (token.allowance(address(this), spender) == 0),
                                        "SafeERC20: approve from non-zero to non-zero allowance"
                                    );
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
                                }
                            
                                function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
                                    uint256 newAllowance = token.allowance(address(this), spender).add(value);
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
                                }
                            
                                function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
                                    uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
                                }
                            
                                /**
                                 * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
                                 * on the return value: the return value is optional (but if data is returned, it must not be false).
                                 * @param token The token targeted by the call.
                                 * @param data The call data (encoded using abi.encode or one of its variants).
                                 */
                                function _callOptionalReturn(IERC20 token, bytes memory data) private {
                                    // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
                                    // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
                                    // the target address contains contract code and also asserts for success in the low-level call.
                            
                                    bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
                                    if (returndata.length > 0) { // Return data is optional
                                        // solhint-disable-next-line max-line-length
                                        require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/Sacrifice.sol
                            
                            pragma solidity 0.7.5;
                            
                            contract Sacrifice {
                                constructor(address payable _recipient) payable {
                                    selfdestruct(_recipient);
                                }
                            }
                            
                            // File: contracts/libraries/AddressHelper.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title AddressHelper
                             * @dev Helper methods for Address type.
                             */
                            library AddressHelper {
                                /**
                                 * @dev Try to send native tokens to the address. If it fails, it will force the transfer by creating a selfdestruct contract
                                 * @param _receiver address that will receive the native tokens
                                 * @param _value the amount of native tokens to send
                                 */
                                function safeSendValue(address payable _receiver, uint256 _value) internal {
                                    if (!(_receiver).send(_value)) {
                                        new Sacrifice{ value: _value }(_receiver);
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/Claimable.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title Claimable
                             * @dev Implementation of the claiming utils that can be useful for withdrawing accidentally sent tokens that are not used in bridge operations.
                             */
                            contract Claimable {
                                using SafeERC20 for IERC20;
                            
                                /**
                                 * Throws if a given address is equal to address(0)
                                 */
                                modifier validAddress(address _to) {
                                    require(_to != address(0));
                                    _;
                                }
                            
                                /**
                                 * @dev Withdraws the erc20 tokens or native coins from this contract.
                                 * Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()).
                                 * @param _token address of the claimed token or address(0) for native coins.
                                 * @param _to address of the tokens/coins receiver.
                                 */
                                function claimValues(address _token, address _to) internal validAddress(_to) {
                                    if (_token == address(0)) {
                                        claimNativeCoins(_to);
                                    } else {
                                        claimErc20Tokens(_token, _to);
                                    }
                                }
                            
                                /**
                                 * @dev Internal function for withdrawing all native coins from the contract.
                                 * @param _to address of the coins receiver.
                                 */
                                function claimNativeCoins(address _to) internal {
                                    uint256 value = address(this).balance;
                                    AddressHelper.safeSendValue(payable(_to), value);
                                }
                            
                                /**
                                 * @dev Internal function for withdrawing all tokens of some particular ERC20 contract from this contract.
                                 * @param _token address of the claimed ERC20 token.
                                 * @param _to address of the tokens receiver.
                                 */
                                function claimErc20Tokens(address _token, address _to) internal {
                                    IERC20 token = IERC20(_token);
                                    uint256 balance = token.balanceOf(address(this));
                                    token.safeTransfer(_to, balance);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/components/bridged/BridgedTokensRegistry.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title BridgedTokensRegistry
                             * @dev Functionality for keeping track of registered bridged token pairs.
                             */
                            contract BridgedTokensRegistry is EternalStorage {
                                event NewTokenRegistered(address indexed nativeToken, address indexed bridgedToken);
                            
                                /**
                                 * @dev Retrieves address of the bridged token contract associated with a specific native token contract on the other side.
                                 * @param _nativeToken address of the native token contract on the other side.
                                 * @return address of the deployed bridged token contract.
                                 */
                                function bridgedTokenAddress(address _nativeToken) public view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("homeTokenAddress", _nativeToken))];
                                }
                            
                                /**
                                 * @dev Retrieves address of the native token contract associated with a specific bridged token contract.
                                 * @param _bridgedToken address of the created bridged token contract on this side.
                                 * @return address of the native token contract on the other side of the bridge.
                                 */
                                function nativeTokenAddress(address _bridgedToken) public view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", _bridgedToken))];
                                }
                            
                                /**
                                 * @dev Internal function for updating a pair of addresses for the bridged token.
                                 * @param _nativeToken address of the native token contract on the other side.
                                 * @param _bridgedToken address of the created bridged token contract on this side.
                                 */
                                function _setTokenAddressPair(address _nativeToken, address _bridgedToken) internal {
                                    addressStorage[keccak256(abi.encodePacked("homeTokenAddress", _nativeToken))] = _bridgedToken;
                                    addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", _bridgedToken))] = _nativeToken;
                            
                                    emit NewTokenRegistered(_nativeToken, _bridgedToken);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/components/native/NativeTokensRegistry.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title NativeTokensRegistry
                             * @dev Functionality for keeping track of registered native tokens.
                             */
                            contract NativeTokensRegistry is EternalStorage {
                                /**
                                 * @dev Checks if for a given native token, the deployment of its bridged alternative was already acknowledged.
                                 * @param _token address of native token contract.
                                 * @return true, if bridged token was already deployed.
                                 */
                                function isBridgedTokenDeployAcknowledged(address _token) public view returns (bool) {
                                    return boolStorage[keccak256(abi.encodePacked("ackDeploy", _token))];
                                }
                            
                                /**
                                 * @dev Acknowledges the deployment of bridged token contract on the other side.
                                 * @param _token address of native token contract.
                                 */
                                function _ackBridgedTokenDeploy(address _token) internal {
                                    if (!boolStorage[keccak256(abi.encodePacked("ackDeploy", _token))]) {
                                        boolStorage[keccak256(abi.encodePacked("ackDeploy", _token))] = true;
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/components/native/MediatorBalanceStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title MediatorBalanceStorage
                             * @dev Functionality for storing expected mediator balance for native tokens.
                             */
                            contract MediatorBalanceStorage is EternalStorage {
                                /**
                                 * @dev Tells the expected token balance of the contract.
                                 * @param _token address of token contract.
                                 * @return the current tracked token balance of the contract.
                                 */
                                function mediatorBalance(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("mediatorBalance", _token))];
                                }
                            
                                /**
                                 * @dev Updates expected token balance of the contract.
                                 * @param _token address of token contract.
                                 * @param _balance the new token balance of the contract.
                                 */
                                function _setMediatorBalance(address _token, uint256 _balance) internal {
                                    uintStorage[keccak256(abi.encodePacked("mediatorBalance", _token))] = _balance;
                                }
                            }
                            
                            // File: contracts/interfaces/IERC677.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            interface IERC677 is IERC20 {
                                event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
                            
                                function transferAndCall(
                                    address to,
                                    uint256 value,
                                    bytes calldata data
                                ) external returns (bool);
                            
                                function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
                            
                                function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
                            }
                            
                            // File: contracts/libraries/Bytes.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title Bytes
                             * @dev Helper methods to transform bytes to other solidity types.
                             */
                            library Bytes {
                                /**
                                 * @dev Truncate bytes array if its size is more than 20 bytes.
                                 * NOTE: This function does not perform any checks on the received parameter.
                                 * Make sure that the _bytes argument has a correct length, not less than 20 bytes.
                                 * A case when _bytes has length less than 20 will lead to the undefined behaviour,
                                 * since assembly will read data from memory that is not related to the _bytes argument.
                                 * @param _bytes to be converted to address type
                                 * @return addr address included in the firsts 20 bytes of the bytes array in parameter.
                                 */
                                function bytesToAddress(bytes memory _bytes) internal pure returns (address addr) {
                                    assembly {
                                        addr := mload(add(_bytes, 20))
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/ReentrancyGuard.sol
                            
                            pragma solidity 0.7.5;
                            
                            contract ReentrancyGuard {
                                function lock() internal view returns (bool res) {
                                    assembly {
                                        // Even though this is not the same as boolStorage[keccak256(abi.encodePacked("lock"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        res := sload(0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92) // keccak256(abi.encodePacked("lock"))
                                    }
                                }
                            
                                function setLock(bool _lock) internal {
                                    assembly {
                                        // Even though this is not the same as boolStorage[keccak256(abi.encodePacked("lock"))],
                                        // since solidity mapping introduces another level of addressing, such slot change is safe
                                        // for temporary variables which are cleared at the end of the call execution.
                                        sstore(0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92, _lock) // keccak256(abi.encodePacked("lock"))
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/Ownable.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title Ownable
                             * @dev This contract has an owner address providing basic authorization control
                             */
                            contract Ownable is EternalStorage {
                                bytes4 internal constant UPGRADEABILITY_OWNER = 0x6fde8202; // upgradeabilityOwner()
                            
                                /**
                                 * @dev Event to show ownership has been transferred
                                 * @param previousOwner representing the address of the previous owner
                                 * @param newOwner representing the address of the new owner
                                 */
                                event OwnershipTransferred(address previousOwner, address newOwner);
                            
                                /**
                                 * @dev Throws if called by any account other than the owner.
                                 */
                                modifier onlyOwner() {
                                    _onlyOwner();
                                    _;
                                }
                            
                                /**
                                 * @dev Internal function for reducing onlyOwner modifier bytecode overhead.
                                 */
                                function _onlyOwner() internal view {
                                    require(msg.sender == owner());
                                }
                            
                                /**
                                 * @dev Throws if called through proxy by any account other than contract itself or an upgradeability owner.
                                 */
                                modifier onlyRelevantSender() {
                                    (bool isProxy, bytes memory returnData) =
                                        address(this).staticcall(abi.encodeWithSelector(UPGRADEABILITY_OWNER));
                                    require(
                                        !isProxy || // covers usage without calling through storage proxy
                                            (returnData.length == 32 && msg.sender == abi.decode(returnData, (address))) || // covers usage through regular proxy calls
                                            msg.sender == address(this) // covers calls through upgradeAndCall proxy method
                                    );
                                    _;
                                }
                            
                                bytes32 internal constant OWNER = 0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0; // keccak256(abi.encodePacked("owner"))
                            
                                /**
                                 * @dev Tells the address of the owner
                                 * @return the address of the owner
                                 */
                                function owner() public view returns (address) {
                                    return addressStorage[OWNER];
                                }
                            
                                /**
                                 * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                 * @param newOwner the address to transfer ownership to.
                                 */
                                function transferOwnership(address newOwner) external onlyOwner {
                                    _setOwner(newOwner);
                                }
                            
                                /**
                                 * @dev Sets a new owner address
                                 */
                                function _setOwner(address newOwner) internal {
                                    require(newOwner != address(0));
                                    emit OwnershipTransferred(owner(), newOwner);
                                    addressStorage[OWNER] = newOwner;
                                }
                            }
                            
                            // File: contracts/interfaces/IAMB.sol
                            
                            pragma solidity 0.7.5;
                            
                            interface IAMB {
                                event UserRequestForAffirmation(bytes32 indexed messageId, bytes encodedData);
                                event UserRequestForSignature(bytes32 indexed messageId, bytes encodedData);
                                event AffirmationCompleted(
                                    address indexed sender,
                                    address indexed executor,
                                    bytes32 indexed messageId,
                                    bool status
                                );
                                event RelayedMessage(address indexed sender, address indexed executor, bytes32 indexed messageId, bool status);
                            
                                function messageSender() external view returns (address);
                            
                                function maxGasPerTx() external view returns (uint256);
                            
                                function transactionHash() external view returns (bytes32);
                            
                                function messageId() external view returns (bytes32);
                            
                                function messageSourceChainId() external view returns (bytes32);
                            
                                function messageCallStatus(bytes32 _messageId) external view returns (bool);
                            
                                function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32);
                            
                                function failedMessageReceiver(bytes32 _messageId) external view returns (address);
                            
                                function failedMessageSender(bytes32 _messageId) external view returns (address);
                            
                                function requireToPassMessage(
                                    address _contract,
                                    bytes calldata _data,
                                    uint256 _gas
                                ) external returns (bytes32);
                            
                                function requireToConfirmMessage(
                                    address _contract,
                                    bytes calldata _data,
                                    uint256 _gas
                                ) external returns (bytes32);
                            
                                function sourceChainId() external view returns (uint256);
                            
                                function destinationChainId() external view returns (uint256);
                            }
                            
                            // File: contracts/upgradeable_contracts/BasicAMBMediator.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            /**
                             * @title BasicAMBMediator
                             * @dev Basic storage and methods needed by mediators to interact with AMB bridge.
                             */
                            abstract contract BasicAMBMediator is Ownable {
                                bytes32 internal constant BRIDGE_CONTRACT = 0x811bbb11e8899da471f0e69a3ed55090fc90215227fc5fb1cb0d6e962ea7b74f; // keccak256(abi.encodePacked("bridgeContract"))
                                bytes32 internal constant MEDIATOR_CONTRACT = 0x98aa806e31e94a687a31c65769cb99670064dd7f5a87526da075c5fb4eab9880; // keccak256(abi.encodePacked("mediatorContract"))
                            
                                /**
                                 * @dev Throws if caller on the other side is not an associated mediator.
                                 */
                                modifier onlyMediator {
                                    _onlyMediator();
                                    _;
                                }
                            
                                /**
                                 * @dev Internal function for reducing onlyMediator modifier bytecode overhead.
                                 */
                                function _onlyMediator() internal view {
                                    IAMB bridge = bridgeContract();
                                    require(msg.sender == address(bridge));
                                    require(bridge.messageSender() == mediatorContractOnOtherSide());
                                }
                            
                                /**
                                 * @dev Sets the AMB bridge contract address. Only the owner can call this method.
                                 * @param _bridgeContract the address of the bridge contract.
                                 */
                                function setBridgeContract(address _bridgeContract) external onlyOwner {
                                    _setBridgeContract(_bridgeContract);
                                }
                            
                                /**
                                 * @dev Sets the mediator contract address from the other network. Only the owner can call this method.
                                 * @param _mediatorContract the address of the mediator contract.
                                 */
                                function setMediatorContractOnOtherSide(address _mediatorContract) external onlyOwner {
                                    _setMediatorContractOnOtherSide(_mediatorContract);
                                }
                            
                                /**
                                 * @dev Get the AMB interface for the bridge contract address
                                 * @return AMB interface for the bridge contract address
                                 */
                                function bridgeContract() public view returns (IAMB) {
                                    return IAMB(addressStorage[BRIDGE_CONTRACT]);
                                }
                            
                                /**
                                 * @dev Tells the mediator contract address from the other network.
                                 * @return the address of the mediator contract.
                                 */
                                function mediatorContractOnOtherSide() public view virtual returns (address) {
                                    return addressStorage[MEDIATOR_CONTRACT];
                                }
                            
                                /**
                                 * @dev Stores a valid AMB bridge contract address.
                                 * @param _bridgeContract the address of the bridge contract.
                                 */
                                function _setBridgeContract(address _bridgeContract) internal {
                                    require(Address.isContract(_bridgeContract));
                                    addressStorage[BRIDGE_CONTRACT] = _bridgeContract;
                                }
                            
                                /**
                                 * @dev Stores the mediator contract address from the other network.
                                 * @param _mediatorContract the address of the mediator contract.
                                 */
                                function _setMediatorContractOnOtherSide(address _mediatorContract) internal {
                                    addressStorage[MEDIATOR_CONTRACT] = _mediatorContract;
                                }
                            
                                /**
                                 * @dev Tells the id of the message originated on the other network.
                                 * @return the id of the message originated on the other network.
                                 */
                                function messageId() internal view returns (bytes32) {
                                    return bridgeContract().messageId();
                                }
                            
                                /**
                                 * @dev Tells the maximum gas limit that a message can use on its execution by the AMB bridge on the other network.
                                 * @return the maximum gas limit value.
                                 */
                                function maxGasPerTx() internal view returns (uint256) {
                                    return bridgeContract().maxGasPerTx();
                                }
                            
                                function _passMessage(bytes memory _data, bool _useOracleLane) internal virtual returns (bytes32);
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/TokensRelayer.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            
                            
                            
                            /**
                             * @title TokensRelayer
                             * @dev Functionality for bridging multiple tokens to the other side of the bridge.
                             */
                            abstract contract TokensRelayer is BasicAMBMediator, ReentrancyGuard {
                                using SafeMath for uint256;
                                using SafeERC20 for IERC677;
                            
                                /**
                                 * @dev ERC677 transfer callback function.
                                 * @param _from address of tokens sender.
                                 * @param _value amount of transferred tokens.
                                 * @param _data additional transfer data, can be used for passing alternative receiver address.
                                 */
                                function onTokenTransfer(
                                    address _from,
                                    uint256 _value,
                                    bytes memory _data
                                ) external returns (bool) {
                                    if (!lock()) {
                                        bytes memory data = new bytes(0);
                                        address receiver = _from;
                                        if (_data.length >= 20) {
                                            receiver = Bytes.bytesToAddress(_data);
                                            if (_data.length > 20) {
                                                assembly {
                                                    let size := sub(mload(_data), 20)
                                                    data := add(_data, 20)
                                                    mstore(data, size)
                                                }
                                            }
                                        }
                                        bridgeSpecificActionsOnTokenTransfer(msg.sender, _from, receiver, _value, data);
                                    }
                                    return true;
                                }
                            
                                /**
                                 * @dev Initiate the bridge operation for some amount of tokens from msg.sender.
                                 * The user should first call Approve method of the ERC677 token.
                                 * @param token bridged token contract address.
                                 * @param _receiver address that will receive the native tokens on the other network.
                                 * @param _value amount of tokens to be transferred to the other network.
                                 */
                                function relayTokens(
                                    IERC677 token,
                                    address _receiver,
                                    uint256 _value
                                ) external {
                                    _relayTokens(token, _receiver, _value, new bytes(0));
                                }
                            
                                /**
                                 * @dev Initiate the bridge operation for some amount of tokens from msg.sender to msg.sender on the other side.
                                 * The user should first call Approve method of the ERC677 token.
                                 * @param token bridged token contract address.
                                 * @param _value amount of tokens to be transferred to the other network.
                                 */
                                function relayTokens(IERC677 token, uint256 _value) external {
                                    _relayTokens(token, msg.sender, _value, new bytes(0));
                                }
                            
                                /**
                                 * @dev Initiate the bridge operation for some amount of tokens from msg.sender.
                                 * The user should first call Approve method of the ERC677 token.
                                 * @param token bridged token contract address.
                                 * @param _receiver address that will receive the native tokens on the other network.
                                 * @param _value amount of tokens to be transferred to the other network.
                                 * @param _data additional transfer data to be used on the other side.
                                 */
                                function relayTokensAndCall(
                                    IERC677 token,
                                    address _receiver,
                                    uint256 _value,
                                    bytes memory _data
                                ) external {
                                    _relayTokens(token, _receiver, _value, _data);
                                }
                            
                                /**
                                 * @dev Validates that the token amount is inside the limits, calls transferFrom to transfer the tokens to the contract
                                 * and invokes the method to burn/lock the tokens and unlock/mint the tokens on the other network.
                                 * The user should first call Approve method of the ERC677 token.
                                 * @param token bridge token contract address.
                                 * @param _receiver address that will receive the native tokens on the other network.
                                 * @param _value amount of tokens to be transferred to the other network.
                                 * @param _data additional transfer data to be used on the other side.
                                 */
                                function _relayTokens(
                                    IERC677 token,
                                    address _receiver,
                                    uint256 _value,
                                    bytes memory _data
                                ) internal {
                                    // This lock is to prevent calling passMessage twice if a ERC677 token is used.
                                    // When transferFrom is called, after the transfer, the ERC677 token will call onTokenTransfer from this contract
                                    // which will call passMessage.
                                    require(!lock());
                            
                                    uint256 balanceBefore = token.balanceOf(address(this));
                                    setLock(true);
                                    token.safeTransferFrom(msg.sender, address(this), _value);
                                    setLock(false);
                                    uint256 balanceDiff = token.balanceOf(address(this)).sub(balanceBefore);
                                    require(balanceDiff <= _value);
                                    bridgeSpecificActionsOnTokenTransfer(address(token), msg.sender, _receiver, balanceDiff, _data);
                                }
                            
                                function bridgeSpecificActionsOnTokenTransfer(
                                    address _token,
                                    address _from,
                                    address _receiver,
                                    uint256 _value,
                                    bytes memory _data
                                ) internal virtual;
                            }
                            
                            // File: contracts/upgradeable_contracts/VersionableBridge.sol
                            
                            pragma solidity 0.7.5;
                            
                            interface VersionableBridge {
                                function getBridgeInterfacesVersion()
                                    external
                                    pure
                                    returns (
                                        uint64 major,
                                        uint64 minor,
                                        uint64 patch
                                    );
                            
                                function getBridgeMode() external pure returns (bytes4);
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/OmnibridgeInfo.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title OmnibridgeInfo
                             * @dev Functionality for versioning Omnibridge mediator.
                             */
                            contract OmnibridgeInfo is VersionableBridge {
                                event TokensBridgingInitiated(
                                    address indexed token,
                                    address indexed sender,
                                    uint256 value,
                                    bytes32 indexed messageId
                                );
                                event TokensBridged(address indexed token, address indexed recipient, uint256 value, bytes32 indexed messageId);
                            
                                /**
                                 * @dev Tells the bridge interface version that this contract supports.
                                 * @return major value of the version
                                 * @return minor value of the version
                                 * @return patch value of the version
                                 */
                                function getBridgeInterfacesVersion()
                                    external
                                    pure
                                    override
                                    returns (
                                        uint64 major,
                                        uint64 minor,
                                        uint64 patch
                                    )
                                {
                                    return (3, 3, 0);
                                }
                            
                                /**
                                 * @dev Tells the bridge mode that this contract supports.
                                 * @return _data 4 bytes representing the bridge mode
                                 */
                                function getBridgeMode() external pure override returns (bytes4 _data) {
                                    return 0xb1516c26; // bytes4(keccak256(abi.encodePacked("multi-erc-to-erc-amb")))
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/TokensBridgeLimits.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            /**
                             * @title TokensBridgeLimits
                             * @dev Functionality for keeping track of bridging limits for multiple tokens.
                             */
                            contract TokensBridgeLimits is EternalStorage, Ownable {
                                using SafeMath for uint256;
                            
                                // token == 0x00..00 represents default limits (assuming decimals == 18) for all newly created tokens
                                event DailyLimitChanged(address indexed token, uint256 newLimit);
                                event ExecutionDailyLimitChanged(address indexed token, uint256 newLimit);
                            
                                /**
                                 * @dev Checks if specified token was already bridged at least once.
                                 * @param _token address of the token contract.
                                 * @return true, if token address is address(0) or token was already bridged.
                                 */
                                function isTokenRegistered(address _token) public view returns (bool) {
                                    return minPerTx(_token) > 0;
                                }
                            
                                /**
                                 * @dev Retrieves the total spent amount for particular token during specific day.
                                 * @param _token address of the token contract.
                                 * @param _day day number for which spent amount if requested.
                                 * @return amount of tokens sent through the bridge to the other side.
                                 */
                                function totalSpentPerDay(address _token, uint256 _day) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _token, _day))];
                                }
                            
                                /**
                                 * @dev Retrieves the total executed amount for particular token during specific day.
                                 * @param _token address of the token contract.
                                 * @param _day day number for which spent amount if requested.
                                 * @return amount of tokens received from the bridge from the other side.
                                 */
                                function totalExecutedPerDay(address _token, uint256 _day) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))];
                                }
                            
                                /**
                                 * @dev Retrieves current daily limit for a particular token contract.
                                 * @param _token address of the token contract.
                                 * @return daily limit on tokens that can be sent through the bridge per day.
                                 */
                                function dailyLimit(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))];
                                }
                            
                                /**
                                 * @dev Retrieves current execution daily limit for a particular token contract.
                                 * @param _token address of the token contract.
                                 * @return daily limit on tokens that can be received from the bridge on the other side per day.
                                 */
                                function executionDailyLimit(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))];
                                }
                            
                                /**
                                 * @dev Retrieves current maximum amount of tokens per one transfer for a particular token contract.
                                 * @param _token address of the token contract.
                                 * @return maximum amount on tokens that can be sent through the bridge in one transfer.
                                 */
                                function maxPerTx(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))];
                                }
                            
                                /**
                                 * @dev Retrieves current maximum execution amount of tokens per one transfer for a particular token contract.
                                 * @param _token address of the token contract.
                                 * @return maximum amount on tokens that can received from the bridge on the other side in one transaction.
                                 */
                                function executionMaxPerTx(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))];
                                }
                            
                                /**
                                 * @dev Retrieves current minimum amount of tokens per one transfer for a particular token contract.
                                 * @param _token address of the token contract.
                                 * @return minimum amount on tokens that can be sent through the bridge in one transfer.
                                 */
                                function minPerTx(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("minPerTx", _token))];
                                }
                            
                                /**
                                 * @dev Checks that bridged amount of tokens conforms to the configured limits.
                                 * @param _token address of the token contract.
                                 * @param _amount amount of bridge tokens.
                                 * @return true, if specified amount can be bridged.
                                 */
                                function withinLimit(address _token, uint256 _amount) public view returns (bool) {
                                    uint256 nextLimit = totalSpentPerDay(_token, getCurrentDay()).add(_amount);
                                    return
                                        dailyLimit(address(0)) > 0 &&
                                        dailyLimit(_token) >= nextLimit &&
                                        _amount <= maxPerTx(_token) &&
                                        _amount >= minPerTx(_token);
                                }
                            
                                /**
                                 * @dev Checks that bridged amount of tokens conforms to the configured execution limits.
                                 * @param _token address of the token contract.
                                 * @param _amount amount of bridge tokens.
                                 * @return true, if specified amount can be processed and executed.
                                 */
                                function withinExecutionLimit(address _token, uint256 _amount) public view returns (bool) {
                                    uint256 nextLimit = totalExecutedPerDay(_token, getCurrentDay()).add(_amount);
                                    return
                                        executionDailyLimit(address(0)) > 0 &&
                                        executionDailyLimit(_token) >= nextLimit &&
                                        _amount <= executionMaxPerTx(_token);
                                }
                            
                                /**
                                 * @dev Returns current day number.
                                 * @return day number.
                                 */
                                function getCurrentDay() public view returns (uint256) {
                                    // solhint-disable-next-line not-rely-on-time
                                    return block.timestamp / 1 days;
                                }
                            
                                /**
                                 * @dev Updates daily limit for the particular token. Only owner can call this method.
                                 * @param _token address of the token contract, or address(0) for configuring the efault limit.
                                 * @param _dailyLimit daily allowed amount of bridged tokens, should be greater than maxPerTx.
                                 * 0 value is also allowed, will stop the bridge operations in outgoing direction.
                                 */
                                function setDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner {
                                    require(isTokenRegistered(_token));
                                    require(_dailyLimit > maxPerTx(_token) || _dailyLimit == 0);
                                    uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))] = _dailyLimit;
                                    emit DailyLimitChanged(_token, _dailyLimit);
                                }
                            
                                /**
                                 * @dev Updates execution daily limit for the particular token. Only owner can call this method.
                                 * @param _token address of the token contract, or address(0) for configuring the default limit.
                                 * @param _dailyLimit daily allowed amount of executed tokens, should be greater than executionMaxPerTx.
                                 * 0 value is also allowed, will stop the bridge operations in incoming direction.
                                 */
                                function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner {
                                    require(isTokenRegistered(_token));
                                    require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0);
                                    uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit;
                                    emit ExecutionDailyLimitChanged(_token, _dailyLimit);
                                }
                            
                                /**
                                 * @dev Updates execution maximum per transaction for the particular token. Only owner can call this method.
                                 * @param _token address of the token contract, or address(0) for configuring the default limit.
                                 * @param _maxPerTx maximum amount of executed tokens per one transaction, should be less than executionDailyLimit.
                                 * 0 value is also allowed, will stop the bridge operations in incoming direction.
                                 */
                                function setExecutionMaxPerTx(address _token, uint256 _maxPerTx) external onlyOwner {
                                    require(isTokenRegistered(_token));
                                    require(_maxPerTx == 0 || (_maxPerTx > 0 && _maxPerTx < executionDailyLimit(_token)));
                                    uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))] = _maxPerTx;
                                }
                            
                                /**
                                 * @dev Updates maximum per transaction for the particular token. Only owner can call this method.
                                 * @param _token address of the token contract, or address(0) for configuring the default limit.
                                 * @param _maxPerTx maximum amount of tokens per one transaction, should be less than dailyLimit, greater than minPerTx.
                                 * 0 value is also allowed, will stop the bridge operations in outgoing direction.
                                 */
                                function setMaxPerTx(address _token, uint256 _maxPerTx) external onlyOwner {
                                    require(isTokenRegistered(_token));
                                    require(_maxPerTx == 0 || (_maxPerTx > minPerTx(_token) && _maxPerTx < dailyLimit(_token)));
                                    uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))] = _maxPerTx;
                                }
                            
                                /**
                                 * @dev Updates minimum per transaction for the particular token. Only owner can call this method.
                                 * @param _token address of the token contract, or address(0) for configuring the default limit.
                                 * @param _minPerTx minimum amount of tokens per one transaction, should be less than maxPerTx and dailyLimit.
                                 */
                                function setMinPerTx(address _token, uint256 _minPerTx) external onlyOwner {
                                    require(isTokenRegistered(_token));
                                    require(_minPerTx > 0 && _minPerTx < dailyLimit(_token) && _minPerTx < maxPerTx(_token));
                                    uintStorage[keccak256(abi.encodePacked("minPerTx", _token))] = _minPerTx;
                                }
                            
                                /**
                                 * @dev Retrieves maximum available bridge amount per one transaction taking into account maxPerTx() and dailyLimit() parameters.
                                 * @param _token address of the token contract, or address(0) for the default limit.
                                 * @return minimum of maxPerTx parameter and remaining daily quota.
                                 */
                                function maxAvailablePerTx(address _token) public view returns (uint256) {
                                    uint256 _maxPerTx = maxPerTx(_token);
                                    uint256 _dailyLimit = dailyLimit(_token);
                                    uint256 _spent = totalSpentPerDay(_token, getCurrentDay());
                                    uint256 _remainingOutOfDaily = _dailyLimit > _spent ? _dailyLimit - _spent : 0;
                                    return _maxPerTx < _remainingOutOfDaily ? _maxPerTx : _remainingOutOfDaily;
                                }
                            
                                /**
                                 * @dev Internal function for adding spent amount for some token.
                                 * @param _token address of the token contract.
                                 * @param _day day number, when tokens are processed.
                                 * @param _value amount of bridge tokens.
                                 */
                                function addTotalSpentPerDay(
                                    address _token,
                                    uint256 _day,
                                    uint256 _value
                                ) internal {
                                    uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _token, _day))] = totalSpentPerDay(_token, _day).add(
                                        _value
                                    );
                                }
                            
                                /**
                                 * @dev Internal function for adding executed amount for some token.
                                 * @param _token address of the token contract.
                                 * @param _day day number, when tokens are processed.
                                 * @param _value amount of bridge tokens.
                                 */
                                function addTotalExecutedPerDay(
                                    address _token,
                                    uint256 _day,
                                    uint256 _value
                                ) internal {
                                    uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))] = totalExecutedPerDay(
                                        _token,
                                        _day
                                    )
                                        .add(_value);
                                }
                            
                                /**
                                 * @dev Internal function for initializing limits for some token.
                                 * @param _token address of the token contract.
                                 * @param _limits [ 0 = dailyLimit, 1 = maxPerTx, 2 = minPerTx ].
                                 */
                                function _setLimits(address _token, uint256[3] memory _limits) internal {
                                    require(
                                        _limits[2] > 0 && // minPerTx > 0
                                            _limits[1] > _limits[2] && // maxPerTx > minPerTx
                                            _limits[0] > _limits[1] // dailyLimit > maxPerTx
                                    );
                            
                                    uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))] = _limits[0];
                                    uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))] = _limits[1];
                                    uintStorage[keccak256(abi.encodePacked("minPerTx", _token))] = _limits[2];
                            
                                    emit DailyLimitChanged(_token, _limits[0]);
                                }
                            
                                /**
                                 * @dev Internal function for initializing execution limits for some token.
                                 * @param _token address of the token contract.
                                 * @param _limits [ 0 = executionDailyLimit, 1 = executionMaxPerTx ].
                                 */
                                function _setExecutionLimits(address _token, uint256[2] memory _limits) internal {
                                    require(_limits[1] < _limits[0]); // foreignMaxPerTx < foreignDailyLimit
                            
                                    uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _limits[0];
                                    uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))] = _limits[1];
                            
                                    emit ExecutionDailyLimitChanged(_token, _limits[0]);
                                }
                            
                                /**
                                 * @dev Internal function for initializing limits for some token relative to its decimals parameter.
                                 * @param _token address of the token contract.
                                 * @param _decimals token decimals parameter.
                                 */
                                function _initializeTokenBridgeLimits(address _token, uint256 _decimals) internal {
                                    uint256 factor;
                                    if (_decimals < 18) {
                                        factor = 10**(18 - _decimals);
                            
                                        uint256 _minPerTx = minPerTx(address(0)).div(factor);
                                        uint256 _maxPerTx = maxPerTx(address(0)).div(factor);
                                        uint256 _dailyLimit = dailyLimit(address(0)).div(factor);
                                        uint256 _executionMaxPerTx = executionMaxPerTx(address(0)).div(factor);
                                        uint256 _executionDailyLimit = executionDailyLimit(address(0)).div(factor);
                            
                                        // such situation can happen when calculated limits relative to the token decimals are too low
                                        // e.g. minPerTx(address(0)) == 10 ** 14, _decimals == 3. _minPerTx happens to be 0, which is not allowed.
                                        // in this case, limits are raised to the default values
                                        if (_minPerTx == 0) {
                                            // Numbers 1, 100, 10000 are chosen in a semi-random way,
                                            // so that any token with small decimals can still be bridged in some amounts.
                                            // It is possible to override limits for the particular token later if needed.
                                            _minPerTx = 1;
                                            if (_maxPerTx <= _minPerTx) {
                                                _maxPerTx = 100;
                                                _executionMaxPerTx = 100;
                                                if (_dailyLimit <= _maxPerTx || _executionDailyLimit <= _executionMaxPerTx) {
                                                    _dailyLimit = 10000;
                                                    _executionDailyLimit = 10000;
                                                }
                                            }
                                        }
                                        _setLimits(_token, [_dailyLimit, _maxPerTx, _minPerTx]);
                                        _setExecutionLimits(_token, [_executionDailyLimit, _executionMaxPerTx]);
                                    } else {
                                        factor = 10**(_decimals - 18);
                                        _setLimits(
                                            _token,
                                            [dailyLimit(address(0)).mul(factor), maxPerTx(address(0)).mul(factor), minPerTx(address(0)).mul(factor)]
                                        );
                                        _setExecutionLimits(
                                            _token,
                                            [executionDailyLimit(address(0)).mul(factor), executionMaxPerTx(address(0)).mul(factor)]
                                        );
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/BridgeOperationsStorage.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title BridgeOperationsStorage
                             * @dev Functionality for storing processed bridged operations.
                             */
                            abstract contract BridgeOperationsStorage is EternalStorage {
                                /**
                                 * @dev Stores the bridged token of a message sent to the AMB bridge.
                                 * @param _messageId of the message sent to the bridge.
                                 * @param _token bridged token address.
                                 */
                                function setMessageToken(bytes32 _messageId, address _token) internal {
                                    addressStorage[keccak256(abi.encodePacked("messageToken", _messageId))] = _token;
                                }
                            
                                /**
                                 * @dev Tells the bridged token address of a message sent to the AMB bridge.
                                 * @return address of a token contract.
                                 */
                                function messageToken(bytes32 _messageId) internal view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("messageToken", _messageId))];
                                }
                            
                                /**
                                 * @dev Stores the value of a message sent to the AMB bridge.
                                 * @param _messageId of the message sent to the bridge.
                                 * @param _value amount of tokens bridged.
                                 */
                                function setMessageValue(bytes32 _messageId, uint256 _value) internal {
                                    uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))] = _value;
                                }
                            
                                /**
                                 * @dev Tells the amount of tokens of a message sent to the AMB bridge.
                                 * @return value representing amount of tokens.
                                 */
                                function messageValue(bytes32 _messageId) internal view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))];
                                }
                            
                                /**
                                 * @dev Stores the receiver of a message sent to the AMB bridge.
                                 * @param _messageId of the message sent to the bridge.
                                 * @param _recipient receiver of the tokens bridged.
                                 */
                                function setMessageRecipient(bytes32 _messageId, address _recipient) internal {
                                    addressStorage[keccak256(abi.encodePacked("messageRecipient", _messageId))] = _recipient;
                                }
                            
                                /**
                                 * @dev Tells the receiver of a message sent to the AMB bridge.
                                 * @return address of the receiver.
                                 */
                                function messageRecipient(bytes32 _messageId) internal view returns (address) {
                                    return addressStorage[keccak256(abi.encodePacked("messageRecipient", _messageId))];
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/FailedMessagesProcessor.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title FailedMessagesProcessor
                             * @dev Functionality for fixing failed bridging operations.
                             */
                            abstract contract FailedMessagesProcessor is BasicAMBMediator, BridgeOperationsStorage {
                                event FailedMessageFixed(bytes32 indexed messageId, address token, address recipient, uint256 value);
                            
                                /**
                                 * @dev Method to be called when a bridged message execution failed. It will generate a new message requesting to
                                 * fix/roll back the transferred assets on the other network.
                                 * @param _messageId id of the message which execution failed.
                                 */
                                function requestFailedMessageFix(bytes32 _messageId) external {
                                    IAMB bridge = bridgeContract();
                                    require(!bridge.messageCallStatus(_messageId));
                                    require(bridge.failedMessageReceiver(_messageId) == address(this));
                                    require(bridge.failedMessageSender(_messageId) == mediatorContractOnOtherSide());
                            
                                    bytes4 methodSelector = this.fixFailedMessage.selector;
                                    bytes memory data = abi.encodeWithSelector(methodSelector, _messageId);
                                    _passMessage(data, true);
                                }
                            
                                /**
                                 * @dev Handles the request to fix transferred assets which bridged message execution failed on the other network.
                                 * It uses the information stored by passMessage method when the assets were initially transferred
                                 * @param _messageId id of the message which execution failed on the other network.
                                 */
                                function fixFailedMessage(bytes32 _messageId) public onlyMediator {
                                    require(!messageFixed(_messageId));
                            
                                    address token = messageToken(_messageId);
                                    address recipient = messageRecipient(_messageId);
                                    uint256 value = messageValue(_messageId);
                                    setMessageFixed(_messageId);
                                    executeActionOnFixedTokens(token, recipient, value);
                                    emit FailedMessageFixed(_messageId, token, recipient, value);
                                }
                            
                                /**
                                 * @dev Tells if a message sent to the AMB bridge has been fixed.
                                 * @return bool indicating the status of the message.
                                 */
                                function messageFixed(bytes32 _messageId) public view returns (bool) {
                                    return boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))];
                                }
                            
                                /**
                                 * @dev Sets that the message sent to the AMB bridge has been fixed.
                                 * @param _messageId of the message sent to the bridge.
                                 */
                                function setMessageFixed(bytes32 _messageId) internal {
                                    boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))] = true;
                                }
                            
                                function executeActionOnFixedTokens(
                                    address _token,
                                    address _recipient,
                                    uint256 _value
                                ) internal virtual;
                            }
                            
                            // File: contracts/upgradeability/Proxy.sol
                            
                            pragma solidity 0.7.5;
                            
                            /**
                             * @title Proxy
                             * @dev Gives the possibility to delegate any call to a foreign implementation.
                             */
                            abstract contract Proxy {
                                /**
                                 * @dev Tells the address of the implementation where every call will be delegated.
                                 * @return address of the implementation to which it will be delegated
                                 */
                                function implementation() public view virtual returns (address);
                            
                                /**
                                 * @dev Fallback function allowing to perform a delegatecall to the given implementation.
                                 * This function will return whatever the implementation call returns
                                 */
                                fallback() external payable {
                                    // solhint-disable-previous-line no-complex-fallback
                                    address _impl = implementation();
                                    require(_impl != address(0));
                                    assembly {
                                        /*
                                            0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40)
                                            loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty
                                            memory. It's needed because we're going to write the return data of delegatecall to the
                                            free memory slot.
                                        */
                                        let ptr := mload(0x40)
                                        /*
                                            `calldatacopy` is copy calldatasize bytes from calldata
                                            First argument is the destination to which data is copied(ptr)
                                            Second argument specifies the start position of the copied data.
                                                Since calldata is sort of its own unique location in memory,
                                                0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata.
                                                That's always going to be the zeroth byte of the function selector.
                                            Third argument, calldatasize, specifies how much data will be copied.
                                                calldata is naturally calldatasize bytes long (same thing as msg.data.length)
                                        */
                                        calldatacopy(ptr, 0, calldatasize())
                                        /*
                                            delegatecall params explained:
                                            gas: the amount of gas to provide for the call. `gas` is an Opcode that gives
                                                us the amount of gas still available to execution
                            
                                            _impl: address of the contract to delegate to
                            
                                            ptr: to pass copied data
                            
                                            calldatasize: loads the size of `bytes memory data`, same as msg.data.length
                            
                                            0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic,
                                                    these are set to 0, 0 so the output data will not be written to memory. The output
                                                    data will be read using `returndatasize` and `returdatacopy` instead.
                            
                                            result: This will be 0 if the call fails and 1 if it succeeds
                                        */
                                        let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
                                        /*
                            
                                        */
                                        /*
                                            ptr current points to the value stored at 0x40,
                                            because we assigned it like ptr := mload(0x40).
                                            Because we use 0x40 as a free memory pointer,
                                            we want to make sure that the next time we want to allocate memory,
                                            we aren't overwriting anything important.
                                            So, by adding ptr and returndatasize,
                                            we get a memory location beyond the end of the data we will be copying to ptr.
                                            We place this in at 0x40, and any reads from 0x40 will now read from free memory
                                        */
                                        mstore(0x40, add(ptr, returndatasize()))
                                        /*
                                            `returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the
                                                slot it will copy to, 0 means copy from the beginning of the return data, and size is
                                                the amount of data to copy.
                                            `returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall
                                        */
                                        returndatacopy(ptr, 0, returndatasize())
                            
                                        /*
                                            if `result` is 0, revert.
                                            if `result` is 1, return `size` amount of data from `ptr`. This is the data that was
                                            copied to `ptr` from the delegatecall return data
                                        */
                                        switch result
                                            case 0 {
                                                revert(ptr, returndatasize())
                                            }
                                            default {
                                                return(ptr, returndatasize())
                                            }
                                    }
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/modules/factory/TokenProxy.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            interface IPermittableTokenVersion {
                                function version() external pure returns (string memory);
                            }
                            
                            /**
                             * @title TokenProxy
                             * @dev Helps to reduces the size of the deployed bytecode for automatically created tokens, by using a proxy contract.
                             */
                            contract TokenProxy is Proxy {
                                // storage layout is copied from PermittableToken.sol
                                string internal name;
                                string internal symbol;
                                uint8 internal decimals;
                                mapping(address => uint256) internal balances;
                                uint256 internal totalSupply;
                                mapping(address => mapping(address => uint256)) internal allowed;
                                address internal owner;
                                bool internal mintingFinished;
                                address internal bridgeContractAddr;
                                // string public constant version = "1";
                                bytes32 internal DOMAIN_SEPARATOR;
                                // bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb;
                                mapping(address => uint256) internal nonces;
                                mapping(address => mapping(address => uint256)) internal expirations;
                            
                                /**
                                 * @dev Creates a non-upgradeable token proxy for PermitableToken.sol, initializes its eternalStorage.
                                 * @param _tokenImage address of the token image used for mirroring all functions.
                                 * @param _name token name.
                                 * @param _symbol token symbol.
                                 * @param _decimals token decimals.
                                 * @param _chainId chain id for current network.
                                 * @param _owner address of the owner for this contract.
                                 */
                                constructor(
                                    address _tokenImage,
                                    string memory _name,
                                    string memory _symbol,
                                    uint8 _decimals,
                                    uint256 _chainId,
                                    address _owner
                                ) {
                                    string memory version = IPermittableTokenVersion(_tokenImage).version();
                            
                                    assembly {
                                        // EIP 1967
                                        // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
                                        sstore(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, _tokenImage)
                                    }
                                    name = _name;
                                    symbol = _symbol;
                                    decimals = _decimals;
                                    owner = _owner; // _owner == HomeOmnibridge/ForeignOmnibridge mediator
                                    bridgeContractAddr = _owner;
                                    DOMAIN_SEPARATOR = keccak256(
                                        abi.encode(
                                            keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                                            keccak256(bytes(_name)),
                                            keccak256(bytes(version)),
                                            _chainId,
                                            address(this)
                                        )
                                    );
                                }
                            
                                /**
                                 * @dev Retrieves the implementation contract address, mirrored token image.
                                 * @return impl token image address.
                                 */
                                function implementation() public view override returns (address impl) {
                                    assembly {
                                        impl := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
                                    }
                                }
                            
                                /**
                                 * @dev Tells the current version of the token proxy interfaces.
                                 */
                                function getTokenProxyInterfacesVersion()
                                    external
                                    pure
                                    returns (
                                        uint64 major,
                                        uint64 minor,
                                        uint64 patch
                                    )
                                {
                                    return (1, 0, 0);
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/modules/OwnableModule.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title OwnableModule
                             * @dev Common functionality for multi-token extension non-upgradeable module.
                             */
                            contract OwnableModule {
                                address public owner;
                            
                                /**
                                 * @dev Initializes this contract.
                                 * @param _owner address of the owner that is allowed to perform additional actions on the particular module.
                                 */
                                constructor(address _owner) {
                                    owner = _owner;
                                }
                            
                                /**
                                 * @dev Throws if sender is not the owner of this contract.
                                 */
                                modifier onlyOwner {
                                    require(msg.sender == owner);
                                    _;
                                }
                            
                                /**
                                 * @dev Changes the owner of this contract.
                                 * @param _newOwner address of the new owner.
                                 */
                                function transferOwnership(address _newOwner) external onlyOwner {
                                    owner = _newOwner;
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/modules/factory/TokenFactory.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            /**
                             * @title TokenFactory
                             * @dev Factory contract for deployment of new TokenProxy contracts.
                             */
                            contract TokenFactory is OwnableModule {
                                address public tokenImage;
                            
                                /**
                                 * @dev Initializes this contract
                                 * @param _owner of this factory contract.
                                 * @param _tokenImage address of the token image contract that should be used for creation of new tokens.
                                 */
                                constructor(address _owner, address _tokenImage) OwnableModule(_owner) {
                                    tokenImage = _tokenImage;
                                }
                            
                                /**
                                 * @dev Tells the module interface version that this contract supports.
                                 * @return major value of the version
                                 * @return minor value of the version
                                 * @return patch value of the version
                                 */
                                function getModuleInterfacesVersion()
                                    external
                                    pure
                                    returns (
                                        uint64 major,
                                        uint64 minor,
                                        uint64 patch
                                    )
                                {
                                    return (1, 0, 0);
                                }
                            
                                /**
                                 * @dev Updates the address of the used token image contract.
                                 * Only owner can call this method.
                                 * @param _tokenImage address of the new token image used for further deployments.
                                 */
                                function setTokenImage(address _tokenImage) external onlyOwner {
                                    require(Address.isContract(_tokenImage));
                                    tokenImage = _tokenImage;
                                }
                            
                                /**
                                 * @dev Deploys a new TokenProxy contract, using saved token image contract as a template.
                                 * @param _name deployed token name.
                                 * @param _symbol deployed token symbol.
                                 * @param _decimals deployed token decimals.
                                 * @param _chainId chain id of the current environment.
                                 * @return address of a newly created contract.
                                 */
                                function deploy(
                                    string calldata _name,
                                    string calldata _symbol,
                                    uint8 _decimals,
                                    uint256 _chainId
                                ) external returns (address) {
                                    return address(new TokenProxy(tokenImage, _name, _symbol, _decimals, _chainId, msg.sender));
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/modules/factory/TokenFactoryConnector.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            /**
                             * @title TokenFactoryConnector
                             * @dev Connectivity functionality for working with TokenFactory contract.
                             */
                            contract TokenFactoryConnector is Ownable {
                                bytes32 internal constant TOKEN_FACTORY_CONTRACT =
                                    0x269c5905f777ee6391c7a361d17039a7d62f52ba9fffeb98c5ade342705731a3; // keccak256(abi.encodePacked("tokenFactoryContract"))
                            
                                /**
                                 * @dev Updates an address of the used TokenFactory contract used for creating new tokens.
                                 * @param _tokenFactory address of TokenFactory contract.
                                 */
                                function setTokenFactory(address _tokenFactory) external onlyOwner {
                                    _setTokenFactory(_tokenFactory);
                                }
                            
                                /**
                                 * @dev Retrieves an address of the token factory contract.
                                 * @return address of the TokenFactory contract.
                                 */
                                function tokenFactory() public view returns (TokenFactory) {
                                    return TokenFactory(addressStorage[TOKEN_FACTORY_CONTRACT]);
                                }
                            
                                /**
                                 * @dev Internal function for updating an address of the token factory contract.
                                 * @param _tokenFactory address of the deployed TokenFactory contract.
                                 */
                                function _setTokenFactory(address _tokenFactory) internal {
                                    require(Address.isContract(_tokenFactory));
                                    addressStorage[TOKEN_FACTORY_CONTRACT] = _tokenFactory;
                                }
                            }
                            
                            // File: contracts/interfaces/IBurnableMintableERC677Token.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            interface IBurnableMintableERC677Token is IERC677 {
                                function mint(address _to, uint256 _amount) external returns (bool);
                            
                                function burn(uint256 _value) external;
                            
                                function claimTokens(address _token, address _to) external;
                            }
                            
                            // File: contracts/interfaces/IERC20Metadata.sol
                            
                            pragma solidity 0.7.5;
                            
                            interface IERC20Metadata {
                                function name() external view returns (string memory);
                            
                                function symbol() external view returns (string memory);
                            
                                function decimals() external view returns (uint8);
                            }
                            
                            // File: contracts/interfaces/IERC20Receiver.sol
                            
                            pragma solidity 0.7.5;
                            
                            interface IERC20Receiver {
                                function onTokenBridged(
                                    address token,
                                    uint256 value,
                                    bytes calldata data
                                ) external;
                            }
                            
                            // File: contracts/libraries/TokenReader.sol
                            
                            pragma solidity 0.7.5;
                            
                            // solhint-disable
                            interface ITokenDetails {
                                function name() external view;
                                function NAME() external view;
                                function symbol() external view;
                                function SYMBOL() external view;
                                function decimals() external view;
                                function DECIMALS() external view;
                            }
                            // solhint-enable
                            
                            /**
                             * @title TokenReader
                             * @dev Helper methods for reading name/symbol/decimals parameters from ERC20 token contracts.
                             */
                            library TokenReader {
                                /**
                                 * @dev Reads the name property of the provided token.
                                 * Either name() or NAME() method is used.
                                 * Both, string and bytes32 types are supported.
                                 * @param _token address of the token contract.
                                 * @return token name as a string or an empty string if none of the methods succeeded.
                                 */
                                function readName(address _token) internal view returns (string memory) {
                                    (bool status, bytes memory data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.name.selector));
                                    if (!status) {
                                        (status, data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.NAME.selector));
                                        if (!status) {
                                            return "";
                                        }
                                    }
                                    return _convertToString(data);
                                }
                            
                                /**
                                 * @dev Reads the symbol property of the provided token.
                                 * Either symbol() or SYMBOL() method is used.
                                 * Both, string and bytes32 types are supported.
                                 * @param _token address of the token contract.
                                 * @return token symbol as a string or an empty string if none of the methods succeeded.
                                 */
                                function readSymbol(address _token) internal view returns (string memory) {
                                    (bool status, bytes memory data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.symbol.selector));
                                    if (!status) {
                                        (status, data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.SYMBOL.selector));
                                        if (!status) {
                                            return "";
                                        }
                                    }
                                    return _convertToString(data);
                                }
                            
                                /**
                                 * @dev Reads the decimals property of the provided token.
                                 * Either decimals() or DECIMALS() method is used.
                                 * @param _token address of the token contract.
                                 * @return token decimals or 0 if none of the methods succeeded.
                                 */
                                function readDecimals(address _token) internal view returns (uint8) {
                                    (bool status, bytes memory data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.decimals.selector));
                                    if (!status) {
                                        (status, data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.DECIMALS.selector));
                                        if (!status) {
                                            return 0;
                                        }
                                    }
                                    return abi.decode(data, (uint8));
                                }
                            
                                /**
                                 * @dev Internal function for converting returned value of name()/symbol() from bytes32/string to string.
                                 * @param returnData data returned by the token contract.
                                 * @return string with value obtained from returnData.
                                 */
                                function _convertToString(bytes memory returnData) private pure returns (string memory) {
                                    if (returnData.length > 32) {
                                        return abi.decode(returnData, (string));
                                    } else if (returnData.length == 32) {
                                        bytes32 data = abi.decode(returnData, (bytes32));
                                        string memory res = new string(32);
                                        assembly {
                                            let len := 0
                                            mstore(add(res, 32), data) // save value in result string
                            
                                            // solhint-disable
                                            for { } gt(data, 0) { len := add(len, 1) } { // until string is empty
                                                data := shl(8, data) // shift left by one symbol
                                            }
                                            // solhint-enable
                                            mstore(res, len) // save result string length
                                        }
                                        return res;
                                    } else {
                                        return "";
                                    }
                                }
                            }
                            
                            // File: contracts/libraries/SafeMint.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title SafeMint
                             * @dev Wrapper around the mint() function in all mintable tokens that verifies the return value.
                             */
                            library SafeMint {
                                /**
                                 * @dev Wrapper around IBurnableMintableERC677Token.mint() that verifies that output value is true.
                                 * @param _token token contract.
                                 * @param _to address of the tokens receiver.
                                 * @param _value amount of tokens to mint.
                                 */
                                function safeMint(
                                    IBurnableMintableERC677Token _token,
                                    address _to,
                                    uint256 _value
                                ) internal {
                                    require(_token.mint(_to, _value));
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/BasicOmnibridge.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            
                            /**
                             * @title BasicOmnibridge
                             * @dev Common functionality for multi-token mediator intended to work on top of AMB bridge.
                             */
                            abstract contract BasicOmnibridge is
                                Initializable,
                                Upgradeable,
                                Claimable,
                                OmnibridgeInfo,
                                TokensRelayer,
                                FailedMessagesProcessor,
                                BridgedTokensRegistry,
                                NativeTokensRegistry,
                                MediatorBalanceStorage,
                                TokenFactoryConnector,
                                TokensBridgeLimits
                            {
                                using SafeERC20 for IERC677;
                                using SafeMint for IBurnableMintableERC677Token;
                                using SafeMath for uint256;
                            
                                // Workaround for storing variable up-to-32 bytes suffix
                                uint256 private immutable SUFFIX_SIZE;
                                bytes32 private immutable SUFFIX;
                            
                                // Since contract is intended to be deployed under EternalStorageProxy, only constant and immutable variables can be set here
                                constructor(string memory _suffix) {
                                    require(bytes(_suffix).length <= 32);
                                    bytes32 suffix;
                                    assembly {
                                        suffix := mload(add(_suffix, 32))
                                    }
                                    SUFFIX = suffix;
                                    SUFFIX_SIZE = bytes(_suffix).length;
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract.
                                 * Checks that the value is inside the execution limits and invokes the Mint or Unlock accordingly.
                                 * @param _token address of the native ERC20/ERC677 token on the other side.
                                 * @param _name name of the native token, name suffix will be appended, if empty, symbol will be used instead.
                                 * @param _symbol symbol of the bridged token, if empty, name will be used instead.
                                 * @param _decimals decimals of the bridge foreign token.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 */
                                function deployAndHandleBridgedTokens(
                                    address _token,
                                    string calldata _name,
                                    string calldata _symbol,
                                    uint8 _decimals,
                                    address _recipient,
                                    uint256 _value
                                ) external onlyMediator {
                                    address bridgedToken = _getBridgedTokenOrDeploy(_token, _name, _symbol, _decimals);
                            
                                    _handleTokens(bridgedToken, false, _recipient, _value);
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract.
                                 * Executes a callback on the receiver.
                                 * Checks that the value is inside the execution limits and invokes the Mint accordingly.
                                 * @param _token address of the native ERC20/ERC677 token on the other side.
                                 * @param _name name of the native token, name suffix will be appended, if empty, symbol will be used instead.
                                 * @param _symbol symbol of the bridged token, if empty, name will be used instead.
                                 * @param _decimals decimals of the bridge foreign token.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 * @param _data additional data passed from the other chain.
                                 */
                                function deployAndHandleBridgedTokensAndCall(
                                    address _token,
                                    string calldata _name,
                                    string calldata _symbol,
                                    uint8 _decimals,
                                    address _recipient,
                                    uint256 _value,
                                    bytes calldata _data
                                ) external onlyMediator {
                                    address bridgedToken = _getBridgedTokenOrDeploy(_token, _name, _symbol, _decimals);
                            
                                    _handleTokens(bridgedToken, false, _recipient, _value);
                            
                                    _receiverCallback(_recipient, bridgedToken, _value, _data);
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens for the already registered token pair.
                                 * Checks that the value is inside the execution limits and invokes the Mint accordingly.
                                 * @param _token address of the native ERC20/ERC677 token on the other side.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 */
                                function handleBridgedTokens(
                                    address _token,
                                    address _recipient,
                                    uint256 _value
                                ) external onlyMediator {
                                    address token = bridgedTokenAddress(_token);
                            
                                    require(isTokenRegistered(token));
                            
                                    _handleTokens(token, false, _recipient, _value);
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens for the already registered token pair.
                                 * Checks that the value is inside the execution limits and invokes the Unlock accordingly.
                                 * Executes a callback on the receiver.
                                 * @param _token address of the native ERC20/ERC677 token on the other side.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 * @param _data additional transfer data passed from the other side.
                                 */
                                function handleBridgedTokensAndCall(
                                    address _token,
                                    address _recipient,
                                    uint256 _value,
                                    bytes memory _data
                                ) external onlyMediator {
                                    address token = bridgedTokenAddress(_token);
                            
                                    require(isTokenRegistered(token));
                            
                                    _handleTokens(token, false, _recipient, _value);
                            
                                    _receiverCallback(_recipient, token, _value, _data);
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens that are native to this chain.
                                 * Checks that the value is inside the execution limits and invokes the Unlock accordingly.
                                 * @param _token native ERC20 token.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 */
                                function handleNativeTokens(
                                    address _token,
                                    address _recipient,
                                    uint256 _value
                                ) external onlyMediator {
                                    _ackBridgedTokenDeploy(_token);
                            
                                    _handleTokens(_token, true, _recipient, _value);
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens that are native to this chain.
                                 * Checks that the value is inside the execution limits and invokes the Unlock accordingly.
                                 * Executes a callback on the receiver.
                                 * @param _token native ERC20 token.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 * @param _data additional transfer data passed from the other side.
                                 */
                                function handleNativeTokensAndCall(
                                    address _token,
                                    address _recipient,
                                    uint256 _value,
                                    bytes memory _data
                                ) external onlyMediator {
                                    _ackBridgedTokenDeploy(_token);
                            
                                    _handleTokens(_token, true, _recipient, _value);
                            
                                    _receiverCallback(_recipient, _token, _value, _data);
                                }
                            
                                /**
                                 * @dev Checks if a given token is a bridged token that is native to this side of the bridge.
                                 * @param _token address of token contract.
                                 * @return message id of the send message.
                                 */
                                function isRegisteredAsNativeToken(address _token) public view returns (bool) {
                                    return isTokenRegistered(_token) && nativeTokenAddress(_token) == address(0);
                                }
                            
                                /**
                                 * @dev Unlock back the amount of tokens that were bridged to the other network but failed.
                                 * @param _token address that bridged token contract.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 */
                                function executeActionOnFixedTokens(
                                    address _token,
                                    address _recipient,
                                    uint256 _value
                                ) internal override {
                                    _releaseTokens(nativeTokenAddress(_token) == address(0), _token, _recipient, _value, _value);
                                }
                            
                                /**
                                 * @dev Allows to pre-set the bridged token contract for not-yet bridged token.
                                 * Only the owner can call this method.
                                 * @param _nativeToken address of the token contract on the other side that was not yet bridged.
                                 * @param _bridgedToken address of the bridged token contract.
                                 */
                                function setCustomTokenAddressPair(address _nativeToken, address _bridgedToken) external onlyOwner {
                                    require(!isTokenRegistered(_bridgedToken));
                                    require(nativeTokenAddress(_bridgedToken) == address(0));
                                    require(bridgedTokenAddress(_nativeToken) == address(0));
                                    // Unfortunately, there is no simple way to verify that the _nativeToken address
                                    // does not belong to the bridged token on the other side,
                                    // since information about bridged tokens addresses is not transferred back.
                                    // Therefore, owner account calling this function SHOULD manually verify on the other side of the bridge that
                                    // nativeTokenAddress(_nativeToken) == address(0) && isTokenRegistered(_nativeToken) == false.
                            
                                    IBurnableMintableERC677Token(_bridgedToken).safeMint(address(this), 1);
                                    IBurnableMintableERC677Token(_bridgedToken).burn(1);
                            
                                    _setTokenAddressPair(_nativeToken, _bridgedToken);
                                }
                            
                                /**
                                 * @dev Allows to send to the other network the amount of locked tokens that can be forced into the contract
                                 * without the invocation of the required methods. (e. g. regular transfer without a call to onTokenTransfer)
                                 * @param _token address of the token contract.
                                 * Before calling this method, it must be carefully investigated how imbalance happened
                                 * in order to avoid an attempt to steal the funds from a token with double addresses
                                 * (e.g. TUSD is accessible at both 0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E and 0x0000000000085d4780B73119b644AE5ecd22b376)
                                 * @param _receiver the address that will receive the tokens on the other network.
                                 */
                                function fixMediatorBalance(address _token, address _receiver)
                                    external
                                    onlyIfUpgradeabilityOwner
                                    validAddress(_receiver)
                                {
                                    require(isRegisteredAsNativeToken(_token));
                            
                                    uint256 diff = _unaccountedBalance(_token);
                                    require(diff > 0);
                                    uint256 available = maxAvailablePerTx(_token);
                                    require(available > 0);
                                    if (diff > available) {
                                        diff = available;
                                    }
                                    addTotalSpentPerDay(_token, getCurrentDay(), diff);
                            
                                    bytes memory data = _prepareMessage(address(0), _token, _receiver, diff, new bytes(0));
                                    bytes32 _messageId = _passMessage(data, true);
                                    _recordBridgeOperation(_messageId, _token, _receiver, diff);
                                }
                            
                                /**
                                 * @dev Claims stuck tokens. Only unsupported tokens can be claimed.
                                 * When dealing with already supported tokens, fixMediatorBalance can be used instead.
                                 * @param _token address of claimed token, address(0) for native
                                 * @param _to address of tokens receiver
                                 */
                                function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner {
                                    // Only unregistered tokens and native coins are allowed to be claimed with the use of this function
                                    require(_token == address(0) || !isTokenRegistered(_token));
                                    claimValues(_token, _to);
                                }
                            
                                /**
                                 * @dev Withdraws erc20 tokens or native coins from the bridged token contract.
                                 * Only the proxy owner is allowed to call this method.
                                 * @param _bridgedToken address of the bridged token contract.
                                 * @param _token address of the claimed token or address(0) for native coins.
                                 * @param _to address of the tokens/coins receiver.
                                 */
                                function claimTokensFromTokenContract(
                                    address _bridgedToken,
                                    address _token,
                                    address _to
                                ) external onlyIfUpgradeabilityOwner {
                                    IBurnableMintableERC677Token(_bridgedToken).claimTokens(_token, _to);
                                }
                            
                                /**
                                 * @dev Internal function for recording bridge operation for further usage.
                                 * Recorded information is used for fixing failed requests on the other side.
                                 * @param _messageId id of the sent message.
                                 * @param _token bridged token address.
                                 * @param _sender address of the tokens sender.
                                 * @param _value bridged value.
                                 */
                                function _recordBridgeOperation(
                                    bytes32 _messageId,
                                    address _token,
                                    address _sender,
                                    uint256 _value
                                ) internal {
                                    setMessageToken(_messageId, _token);
                                    setMessageRecipient(_messageId, _sender);
                                    setMessageValue(_messageId, _value);
                            
                                    emit TokensBridgingInitiated(_token, _sender, _value, _messageId);
                                }
                            
                                /**
                                 * @dev Constructs the message to be sent to the other side. Burns/locks bridged amount of tokens.
                                 * @param _nativeToken address of the native token contract.
                                 * @param _token bridged token address.
                                 * @param _receiver address of the tokens receiver on the other side.
                                 * @param _value bridged value.
                                 * @param _data additional transfer data passed from the other side.
                                 */
                                function _prepareMessage(
                                    address _nativeToken,
                                    address _token,
                                    address _receiver,
                                    uint256 _value,
                                    bytes memory _data
                                ) internal returns (bytes memory) {
                                    bool withData = _data.length > 0 || msg.sig == this.relayTokensAndCall.selector;
                            
                                    // process token is native with respect to this side of the bridge
                                    if (_nativeToken == address(0)) {
                                        _setMediatorBalance(_token, mediatorBalance(_token).add(_value));
                            
                                        // process token which bridged alternative was already ACKed to be deployed
                                        if (isBridgedTokenDeployAcknowledged(_token)) {
                                            return
                                                withData
                                                    ? abi.encodeWithSelector(
                                                        this.handleBridgedTokensAndCall.selector,
                                                        _token,
                                                        _receiver,
                                                        _value,
                                                        _data
                                                    )
                                                    : abi.encodeWithSelector(this.handleBridgedTokens.selector, _token, _receiver, _value);
                                        }
                            
                                        uint8 decimals = TokenReader.readDecimals(_token);
                                        string memory name = TokenReader.readName(_token);
                                        string memory symbol = TokenReader.readSymbol(_token);
                            
                                        require(bytes(name).length > 0 || bytes(symbol).length > 0);
                            
                                        return
                                            withData
                                                ? abi.encodeWithSelector(
                                                    this.deployAndHandleBridgedTokensAndCall.selector,
                                                    _token,
                                                    name,
                                                    symbol,
                                                    decimals,
                                                    _receiver,
                                                    _value,
                                                    _data
                                                )
                                                : abi.encodeWithSelector(
                                                    this.deployAndHandleBridgedTokens.selector,
                                                    _token,
                                                    name,
                                                    symbol,
                                                    decimals,
                                                    _receiver,
                                                    _value
                                                );
                                    }
                            
                                    // process already known token that is bridged from other chain
                                    IBurnableMintableERC677Token(_token).burn(_value);
                                    return
                                        withData
                                            ? abi.encodeWithSelector(
                                                this.handleNativeTokensAndCall.selector,
                                                _nativeToken,
                                                _receiver,
                                                _value,
                                                _data
                                            )
                                            : abi.encodeWithSelector(this.handleNativeTokens.selector, _nativeToken, _receiver, _value);
                                }
                            
                                /**
                                 * @dev Internal function for getting minter proxy address.
                                 * @param _token address of the token to mint.
                                 * @return address of the minter contract that should be used for calling mint(address,uint256)
                                 */
                                function _getMinterFor(address _token) internal pure virtual returns (IBurnableMintableERC677Token) {
                                    return IBurnableMintableERC677Token(_token);
                                }
                            
                                /**
                                 * Internal function for unlocking some amount of tokens.
                                 * @param _isNative true, if token is native w.r.t. to this side of the bridge.
                                 * @param _token address of the token contract.
                                 * @param _recipient address of the tokens receiver.
                                 * @param _value amount of tokens to unlock.
                                 * @param _balanceChange amount of balance to subtract from the mediator balance.
                                 */
                                function _releaseTokens(
                                    bool _isNative,
                                    address _token,
                                    address _recipient,
                                    uint256 _value,
                                    uint256 _balanceChange
                                ) internal virtual {
                                    if (_isNative) {
                                        IERC677(_token).safeTransfer(_recipient, _value);
                                        _setMediatorBalance(_token, mediatorBalance(_token).sub(_balanceChange));
                                    } else {
                                        _getMinterFor(_token).safeMint(_recipient, _value);
                                    }
                                }
                            
                                /**
                                 * Internal function for getting address of the bridged token. Deploys new token if necessary.
                                 * @param _token address of the token contract on the other side of the bridge.
                                 * @param _name name of the native token, name suffix will be appended, if empty, symbol will be used instead.
                                 * @param _symbol symbol of the bridged token, if empty, name will be used instead.
                                 * @param _decimals decimals of the bridge foreign token.
                                 */
                                function _getBridgedTokenOrDeploy(
                                    address _token,
                                    string calldata _name,
                                    string calldata _symbol,
                                    uint8 _decimals
                                ) internal returns (address) {
                                    address bridgedToken = bridgedTokenAddress(_token);
                                    if (bridgedToken == address(0)) {
                                        string memory name = _name;
                                        string memory symbol = _symbol;
                                        require(bytes(name).length > 0 || bytes(symbol).length > 0);
                                        if (bytes(name).length == 0) {
                                            name = symbol;
                                        } else if (bytes(symbol).length == 0) {
                                            symbol = name;
                                        }
                                        name = _transformName(name);
                                        bridgedToken = tokenFactory().deploy(name, symbol, _decimals, bridgeContract().sourceChainId());
                                        _setTokenAddressPair(_token, bridgedToken);
                                        _initializeTokenBridgeLimits(bridgedToken, _decimals);
                                    } else if (!isTokenRegistered(bridgedToken)) {
                                        require(IERC20Metadata(bridgedToken).decimals() == _decimals);
                                        _initializeTokenBridgeLimits(bridgedToken, _decimals);
                                    }
                                    return bridgedToken;
                                }
                            
                                /**
                                 * Notifies receiving contract about the completed bridging operation.
                                 * @param _recipient address of the tokens receiver.
                                 * @param _token address of the bridged token.
                                 * @param _value amount of tokens transferred.
                                 * @param _data additional data passed to the callback.
                                 */
                                function _receiverCallback(
                                    address _recipient,
                                    address _token,
                                    uint256 _value,
                                    bytes memory _data
                                ) internal {
                                    if (Address.isContract(_recipient)) {
                                        _recipient.call(abi.encodeWithSelector(IERC20Receiver.onTokenBridged.selector, _token, _value, _data));
                                    }
                                }
                            
                                /**
                                 * @dev Internal function for transforming the bridged token name. Appends a side-specific suffix.
                                 * @param _name bridged token from the other side.
                                 * @return token name for this side of the bridge.
                                 */
                                function _transformName(string memory _name) internal view returns (string memory) {
                                    string memory result = string(abi.encodePacked(_name, SUFFIX));
                                    uint256 size = SUFFIX_SIZE;
                                    assembly {
                                        mstore(result, add(mload(_name), size))
                                    }
                                    return result;
                                }
                            
                                /**
                                 * @dev Internal function for counting excess balance which is not tracked within the bridge.
                                 * Represents the amount of forced tokens on this contract.
                                 * @param _token address of the token contract.
                                 * @return amount of excess tokens.
                                 */
                                function _unaccountedBalance(address _token) internal view virtual returns (uint256) {
                                    return IERC677(_token).balanceOf(address(this)).sub(mediatorBalance(_token));
                                }
                            
                                function _handleTokens(
                                    address _token,
                                    bool _isNative,
                                    address _recipient,
                                    uint256 _value
                                ) internal virtual;
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/GasLimitManager.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            /**
                             * @title GasLimitManager
                             * @dev Functionality for determining the request gas limit for AMB execution.
                             */
                            abstract contract GasLimitManager is BasicAMBMediator {
                                bytes32 internal constant REQUEST_GAS_LIMIT = 0x2dfd6c9f781bb6bbb5369c114e949b69ebb440ef3d4dd6b2836225eb1dc3a2be; // keccak256(abi.encodePacked("requestGasLimit"))
                            
                                /**
                                 * @dev Sets the default gas limit to be used in the message execution by the AMB bridge on the other network.
                                 * This value can't exceed the parameter maxGasPerTx defined on the AMB bridge.
                                 * Only the owner can call this method.
                                 * @param _gasLimit the gas limit for the message execution.
                                 */
                                function setRequestGasLimit(uint256 _gasLimit) external onlyOwner {
                                    _setRequestGasLimit(_gasLimit);
                                }
                            
                                /**
                                 * @dev Tells the default gas limit to be used in the message execution by the AMB bridge on the other network.
                                 * @return the gas limit for the message execution.
                                 */
                                function requestGasLimit() public view returns (uint256) {
                                    return uintStorage[REQUEST_GAS_LIMIT];
                                }
                            
                                /**
                                 * @dev Stores the gas limit to be used in the message execution by the AMB bridge on the other network.
                                 * @param _gasLimit the gas limit for the message execution.
                                 */
                                function _setRequestGasLimit(uint256 _gasLimit) internal {
                                    require(_gasLimit <= maxGasPerTx());
                                    uintStorage[REQUEST_GAS_LIMIT] = _gasLimit;
                                }
                            }
                            
                            // File: contracts/interfaces/IInterestReceiver.sol
                            
                            pragma solidity 0.7.5;
                            
                            interface IInterestReceiver {
                                function onInterestReceived(address _token) external;
                            }
                            
                            // File: contracts/interfaces/IInterestImplementation.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            interface IInterestImplementation {
                                event InterestEnabled(address indexed token, address xToken);
                                event InterestDustUpdated(address indexed token, uint96 dust);
                                event InterestReceiverUpdated(address indexed token, address receiver);
                                event MinInterestPaidUpdated(address indexed token, uint256 amount);
                                event PaidInterest(address indexed token, address to, uint256 value);
                                event ForceDisable(address indexed token, uint256 tokensAmount, uint256 xTokensAmount, uint256 investedAmount);
                            
                                function isInterestSupported(address _token) external view returns (bool);
                            
                                function invest(address _token, uint256 _amount) external;
                            
                                function withdraw(address _token, uint256 _amount) external;
                            
                                function investedAmount(address _token) external view returns (uint256);
                            }
                            
                            // File: contracts/upgradeable_contracts/components/common/InterestConnector.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            
                            
                            
                            
                            /**
                             * @title InterestConnector
                             * @dev This contract gives an abstract way of receiving interest on locked tokens.
                             */
                            contract InterestConnector is Ownable, MediatorBalanceStorage {
                                using SafeMath for uint256;
                                using SafeERC20 for IERC20;
                            
                                /**
                                 * @dev Tells address of the interest earning implementation for the specific token contract.
                                 * If interest earning is disabled, will return 0x00..00.
                                 * Can be an address of the deployed CompoundInterestERC20 contract.
                                 * @param _token address of the locked token contract.
                                 * @return address of the implementation contract.
                                 */
                                function interestImplementation(address _token) public view returns (IInterestImplementation) {
                                    return IInterestImplementation(addressStorage[keccak256(abi.encodePacked("interestImpl", _token))]);
                                }
                            
                                /**
                                 * @dev Initializes interest receiving functionality for the particular locked token.
                                 * Only owner can call this method.
                                 * @param _token address of the token for interest earning.
                                 * @param _impl address of the interest earning implementation contract.
                                 * @param _minCashThreshold minimum amount of underlying tokens that are not invested.
                                 */
                                function initializeInterest(
                                    address _token,
                                    address _impl,
                                    uint256 _minCashThreshold
                                ) external onlyOwner {
                                    require(address(interestImplementation(_token)) == address(0));
                                    _setInterestImplementation(_token, _impl);
                                    _setMinCashThreshold(_token, _minCashThreshold);
                                }
                            
                                /**
                                 * @dev Sets minimum amount of tokens that cannot be invested.
                                 * Only owner can call this method.
                                 * @param _token address of the token contract.
                                 * @param _minCashThreshold minimum amount of underlying tokens that are not invested.
                                 */
                                function setMinCashThreshold(address _token, uint256 _minCashThreshold) external onlyOwner {
                                    _setMinCashThreshold(_token, _minCashThreshold);
                                }
                            
                                /**
                                 * @dev Tells minimum amount of tokens that are not being invested.
                                 * @param _token address of the invested token contract.
                                 * @return amount of tokens.
                                 */
                                function minCashThreshold(address _token) public view returns (uint256) {
                                    return uintStorage[keccak256(abi.encodePacked("minCashThreshold", _token))];
                                }
                            
                                /**
                                 * @dev Disables interest for locked funds.
                                 * Only owner can call this method.
                                 * Prior to calling this function, consider to call payInterest and claimCompAndPay.
                                 * @param _token of token to disable interest for.
                                 */
                                function disableInterest(address _token) external onlyOwner {
                                    interestImplementation(_token).withdraw(_token, uint256(-1));
                                    _setInterestImplementation(_token, address(0));
                                }
                            
                                /**
                                 * @dev Invests all excess tokens. Leaves only minCashThreshold in underlying tokens.
                                 * Requires interest for the given token to be enabled first.
                                 * @param _token address of the token contract considered.
                                 */
                                function invest(address _token) external {
                                    IInterestImplementation impl = interestImplementation(_token);
                                    // less than _token.balanceOf(this), since it does not take into account mistakenly locked tokens that should be processed via fixMediatorBalance.
                                    uint256 balance = mediatorBalance(_token).sub(impl.investedAmount(_token));
                                    uint256 minCash = minCashThreshold(_token);
                            
                                    require(balance > minCash);
                                    uint256 amount = balance - minCash;
                            
                                    IERC20(_token).safeTransfer(address(impl), amount);
                                    impl.invest(_token, amount);
                                }
                            
                                /**
                                 * @dev Internal function for setting interest earning implementation contract for some token.
                                 * Also acts as an interest enabled flag.
                                 * @param _token address of the token contract.
                                 * @param _impl address of the implementation contract.
                                 */
                                function _setInterestImplementation(address _token, address _impl) internal {
                                    require(_impl == address(0) || IInterestImplementation(_impl).isInterestSupported(_token));
                                    addressStorage[keccak256(abi.encodePacked("interestImpl", _token))] = _impl;
                                }
                            
                                /**
                                 * @dev Internal function for setting minimum amount of tokens that cannot be invested.
                                 * @param _token address of the token contract.
                                 * @param _minCashThreshold minimum amount of underlying tokens that are not invested.
                                 */
                                function _setMinCashThreshold(address _token, uint256 _minCashThreshold) internal {
                                    uintStorage[keccak256(abi.encodePacked("minCashThreshold", _token))] = _minCashThreshold;
                                }
                            }
                            
                            // File: contracts/upgradeable_contracts/ForeignOmnibridge.sol
                            
                            pragma solidity 0.7.5;
                            
                            
                            
                            
                            
                            /**
                             * @title ForeignOmnibridge
                             * @dev Foreign side implementation for multi-token mediator intended to work on top of AMB bridge.
                             * It is designed to be used as an implementation contract of EternalStorageProxy contract.
                             */
                            contract ForeignOmnibridge is BasicOmnibridge, GasLimitManager, InterestConnector {
                                using SafeERC20 for IERC677;
                                using SafeMint for IBurnableMintableERC677Token;
                                using SafeMath for uint256;
                            
                                constructor(string memory _suffix) BasicOmnibridge(_suffix) {}
                            
                                /**
                                 * @dev Stores the initial parameters of the mediator.
                                 * @param _bridgeContract the address of the AMB bridge contract.
                                 * @param _mediatorContract the address of the mediator contract on the other network.
                                 * @param _dailyLimitMaxPerTxMinPerTxArray array with limit values for the assets to be bridged to the other network.
                                 *   [ 0 = dailyLimit, 1 = maxPerTx, 2 = minPerTx ]
                                 * @param _executionDailyLimitExecutionMaxPerTxArray array with limit values for the assets bridged from the other network.
                                 *   [ 0 = executionDailyLimit, 1 = executionMaxPerTx ]
                                 * @param _requestGasLimit the gas limit for the message execution.
                                 * @param _owner address of the owner of the mediator contract.
                                 * @param _tokenFactory address of the TokenFactory contract that will be used for the deployment of new tokens.
                                 */
                                function initialize(
                                    address _bridgeContract,
                                    address _mediatorContract,
                                    uint256[3] calldata _dailyLimitMaxPerTxMinPerTxArray, // [ 0 = _dailyLimit, 1 = _maxPerTx, 2 = _minPerTx ]
                                    uint256[2] calldata _executionDailyLimitExecutionMaxPerTxArray, // [ 0 = _executionDailyLimit, 1 = _executionMaxPerTx ]
                                    uint256 _requestGasLimit,
                                    address _owner,
                                    address _tokenFactory
                                ) external onlyRelevantSender returns (bool) {
                                    require(!isInitialized());
                            
                                    _setBridgeContract(_bridgeContract);
                                    _setMediatorContractOnOtherSide(_mediatorContract);
                                    _setLimits(address(0), _dailyLimitMaxPerTxMinPerTxArray);
                                    _setExecutionLimits(address(0), _executionDailyLimitExecutionMaxPerTxArray);
                                    _setRequestGasLimit(_requestGasLimit);
                                    _setOwner(_owner);
                                    _setTokenFactory(_tokenFactory);
                            
                                    setInitialize();
                            
                                    return isInitialized();
                                }
                            
                                /**
                                 * One-time function to be used together with upgradeToAndCall method.
                                 * Sets the token factory contract.
                                 * @param _tokenFactory address of the deployed TokenFactory contract.
                                 */
                                function upgradeToReverseMode(address _tokenFactory) external {
                                    require(msg.sender == address(this));
                            
                                    _setTokenFactory(_tokenFactory);
                                }
                            
                                /**
                                 * @dev Handles the bridged tokens.
                                 * Checks that the value is inside the execution limits and invokes the Mint or Unlock accordingly.
                                 * @param _token token contract address on this side of the bridge.
                                 * @param _isNative true, if given token is native to this chain and Unlock should be used.
                                 * @param _recipient address that will receive the tokens.
                                 * @param _value amount of tokens to be received.
                                 */
                                function _handleTokens(
                                    address _token,
                                    bool _isNative,
                                    address _recipient,
                                    uint256 _value
                                ) internal override {
                                    // prohibit withdrawal of tokens during other bridge operations (e.g. relayTokens)
                                    // such reentrant withdrawal can lead to an incorrect balanceDiff calculation
                                    require(!lock());
                            
                                    require(withinExecutionLimit(_token, _value));
                                    addTotalExecutedPerDay(_token, getCurrentDay(), _value);
                            
                                    _releaseTokens(_isNative, _token, _recipient, _value, _value);
                            
                                    emit TokensBridged(_token, _recipient, _value, messageId());
                                }
                            
                                /**
                                 * @dev Executes action on deposit of bridged tokens
                                 * @param _token address of the token contract
                                 * @param _from address of tokens sender
                                 * @param _receiver address of tokens receiver on the other side
                                 * @param _value requested amount of bridged tokens
                                 * @param _data additional transfer data to be used on the other side
                                 */
                                function bridgeSpecificActionsOnTokenTransfer(
                                    address _token,
                                    address _from,
                                    address _receiver,
                                    uint256 _value,
                                    bytes memory _data
                                ) internal virtual override {
                                    require(_receiver != address(0) && _receiver != mediatorContractOnOtherSide());
                            
                                    // native unbridged token
                                    if (!isTokenRegistered(_token)) {
                                        uint8 decimals = TokenReader.readDecimals(_token);
                                        _initializeTokenBridgeLimits(_token, decimals);
                                    }
                            
                                    require(withinLimit(_token, _value));
                                    addTotalSpentPerDay(_token, getCurrentDay(), _value);
                            
                                    bytes memory data = _prepareMessage(nativeTokenAddress(_token), _token, _receiver, _value, _data);
                                    bytes32 _messageId = _passMessage(data, true);
                                    _recordBridgeOperation(_messageId, _token, _from, _value);
                                }
                            
                                /**
                                 * Internal function for unlocking some amount of tokens.
                                 * @param _isNative true, if token is native w.r.t. to this side of the bridge.
                                 * @param _token address of the token contract.
                                 * @param _recipient address of the tokens receiver.
                                 * @param _value amount of tokens to unlock.
                                 * @param _balanceChange amount of balance to subtract from the mediator balance.
                                 */
                                function _releaseTokens(
                                    bool _isNative,
                                    address _token,
                                    address _recipient,
                                    uint256 _value,
                                    uint256 _balanceChange
                                ) internal override {
                                    if (_isNative) {
                                        // There are two edge cases related to withdrawals on the foreign side of the bridge.
                                        // 1) Minting of extra STAKE tokens, if supply on the Home side exceeds total bridge amount on the Foreign side.
                                        // 2) Withdrawal of the invested tokens back from the Compound-like protocol, if currently available funds are insufficient.
                                        // Most of the time, these cases do not intersect. However, in case STAKE tokens are also invested (e.g. via EasyStaking),
                                        // the situation can be the following:
                                        // - 20 STAKE are bridged through the OB. 15 STAKE of which are invested into EasyStaking, and 5 STAKE are locked directly on the bridge.
                                        // - 5 STAKE are mistakenly locked on the bridge via regular transfer, they are not accounted in mediatorBalance(STAKE)
                                        // - User requests withdrawal of 30 STAKE from the Home side.
                                        // Correct sequence of actions should be the following:
                                        // - Mint new STAKE tokens (value - mediatorBalance(STAKE) = 30 STAKE - 20 STAKE = 10 STAKE)
                                        // - Set local variable balance to 30 STAKE
                                        // - Withdraw all invested STAKE tokens (value - (balance - investedAmount(STAKE)) = 30 STAKE - (30 STAKE - 15 STAKE) = 15 STAKE)
                            
                                        uint256 balance = mediatorBalance(_token);
                                        if (_token == address(0x0Ae055097C6d159879521C384F1D2123D1f195e6) && balance < _value) {
                                            IBurnableMintableERC677Token(_token).safeMint(address(this), _value - balance);
                                            balance = _value;
                                        }
                            
                                        IInterestImplementation impl = interestImplementation(_token);
                                        // can be used instead of Address.isContract(address(impl)),
                                        // since _setInterestImplementation guarantees that impl is either a contract or zero address
                                        // and interest implementation does not contain any selfdestruct opcode
                                        if (address(impl) != address(0)) {
                                            uint256 availableBalance = balance.sub(impl.investedAmount(_token));
                                            if (_value > availableBalance) {
                                                impl.withdraw(_token, (_value - availableBalance).add(minCashThreshold(_token)));
                                            }
                                        }
                            
                                        _setMediatorBalance(_token, balance.sub(_balanceChange));
                                        IERC677(_token).safeTransfer(_recipient, _value);
                                    } else {
                                        _getMinterFor(_token).safeMint(_recipient, _value);
                                    }
                                }
                            
                                /**
                                 * @dev Internal function for sending an AMB message to the mediator on the other side.
                                 * @param _data data to be sent to the other side of the bridge.
                                 * @param _useOracleLane always true, not used on this side of the bridge.
                                 * @return id of the sent message.
                                 */
                                function _passMessage(bytes memory _data, bool _useOracleLane) internal override returns (bytes32) {
                                    (_useOracleLane);
                            
                                    return bridgeContract().requireToPassMessage(mediatorContractOnOtherSide(), _data, requestGasLimit());
                                }
                            
                                /**
                                 * @dev Internal function for counting excess balance which is not tracked within the bridge.
                                 * Represents the amount of forced tokens on this contract.
                                 * @param _token address of the token contract.
                                 * @return amount of excess tokens.
                                 */
                                function _unaccountedBalance(address _token) internal view override returns (uint256) {
                                    IInterestImplementation impl = interestImplementation(_token);
                                    uint256 invested = Address.isContract(address(impl)) ? impl.investedAmount(_token) : 0;
                                    return IERC677(_token).balanceOf(address(this)).sub(mediatorBalance(_token).sub(invested));
                                }
                            }
                            

                            File 8 of 8: FiatTokenV2_2
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { EIP712Domain } from "./EIP712Domain.sol"; // solhint-disable-line no-unused-import
                            import { Blacklistable } from "../v1/Blacklistable.sol"; // solhint-disable-line no-unused-import
                            import { FiatTokenV1 } from "../v1/FiatTokenV1.sol"; // solhint-disable-line no-unused-import
                            import { FiatTokenV2 } from "./FiatTokenV2.sol"; // solhint-disable-line no-unused-import
                            import { FiatTokenV2_1 } from "./FiatTokenV2_1.sol";
                            import { EIP712 } from "../util/EIP712.sol";
                            // solhint-disable func-name-mixedcase
                            /**
                             * @title FiatToken V2.2
                             * @notice ERC20 Token backed by fiat reserves, version 2.2
                             */
                            contract FiatTokenV2_2 is FiatTokenV2_1 {
                                /**
                                 * @notice Initialize v2.2
                                 * @param accountsToBlacklist   A list of accounts to migrate from the old blacklist
                                 * @param newSymbol             New token symbol
                                 * data structure to the new blacklist data structure.
                                 */
                                function initializeV2_2(
                                    address[] calldata accountsToBlacklist,
                                    string calldata newSymbol
                                ) external {
                                    // solhint-disable-next-line reason-string
                                    require(_initializedVersion == 2);
                                    // Update fiat token symbol
                                    symbol = newSymbol;
                                    // Add previously blacklisted accounts to the new blacklist data structure
                                    // and remove them from the old blacklist data structure.
                                    for (uint256 i = 0; i < accountsToBlacklist.length; i++) {
                                        require(
                                            _deprecatedBlacklisted[accountsToBlacklist[i]],
                                            "FiatTokenV2_2: Blacklisting previously unblacklisted account!"
                                        );
                                        _blacklist(accountsToBlacklist[i]);
                                        delete _deprecatedBlacklisted[accountsToBlacklist[i]];
                                    }
                                    _blacklist(address(this));
                                    delete _deprecatedBlacklisted[address(this)];
                                    _initializedVersion = 3;
                                }
                                /**
                                 * @dev Internal function to get the current chain id.
                                 * @return The current chain id.
                                 */
                                function _chainId() internal virtual view returns (uint256) {
                                    uint256 chainId;
                                    assembly {
                                        chainId := chainid()
                                    }
                                    return chainId;
                                }
                                /**
                                 * @inheritdoc EIP712Domain
                                 */
                                function _domainSeparator() internal override view returns (bytes32) {
                                    return EIP712.makeDomainSeparator(name, "2", _chainId());
                                }
                                /**
                                 * @notice Update allowance with a signed permit
                                 * @dev EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param owner       Token owner's address (Authorizer)
                                 * @param spender     Spender's address
                                 * @param value       Amount of allowance
                                 * @param deadline    The time at which the signature expires (unix time), or max uint256 value to signal no expiration
                                 * @param signature   Signature bytes signed by an EOA wallet or a contract wallet
                                 */
                                function permit(
                                    address owner,
                                    address spender,
                                    uint256 value,
                                    uint256 deadline,
                                    bytes memory signature
                                ) external whenNotPaused {
                                    _permit(owner, spender, value, deadline, signature);
                                }
                                /**
                                 * @notice Execute a transfer with a signed authorization
                                 * @dev EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param signature     Signature bytes signed by an EOA wallet or a contract wallet
                                 */
                                function transferWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    bytes memory signature
                                ) external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
                                    _transferWithAuthorization(
                                        from,
                                        to,
                                        value,
                                        validAfter,
                                        validBefore,
                                        nonce,
                                        signature
                                    );
                                }
                                /**
                                 * @notice Receive a transfer with a signed authorization from the payer
                                 * @dev This has an additional check to ensure that the payee's address
                                 * matches the caller of this function to prevent front-running attacks.
                                 * EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param signature     Signature bytes signed by an EOA wallet or a contract wallet
                                 */
                                function receiveWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    bytes memory signature
                                ) external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
                                    _receiveWithAuthorization(
                                        from,
                                        to,
                                        value,
                                        validAfter,
                                        validBefore,
                                        nonce,
                                        signature
                                    );
                                }
                                /**
                                 * @notice Attempt to cancel an authorization
                                 * @dev Works only if the authorization is not yet used.
                                 * EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 * @param signature     Signature bytes signed by an EOA wallet or a contract wallet
                                 */
                                function cancelAuthorization(
                                    address authorizer,
                                    bytes32 nonce,
                                    bytes memory signature
                                ) external whenNotPaused {
                                    _cancelAuthorization(authorizer, nonce, signature);
                                }
                                /**
                                 * @dev Helper method that sets the blacklist state of an account on balanceAndBlacklistStates.
                                 * If _shouldBlacklist is true, we apply a (1 << 255) bitmask with an OR operation on the
                                 * account's balanceAndBlacklistState. This flips the high bit for the account to 1,
                                 * indicating that the account is blacklisted.
                                 *
                                 * If _shouldBlacklist if false, we reset the account's balanceAndBlacklistStates to their
                                 * balances. This clears the high bit for the account, indicating that the account is unblacklisted.
                                 * @param _account         The address of the account.
                                 * @param _shouldBlacklist True if the account should be blacklisted, false if the account should be unblacklisted.
                                 */
                                function _setBlacklistState(address _account, bool _shouldBlacklist)
                                    internal
                                    override
                                {
                                    balanceAndBlacklistStates[_account] = _shouldBlacklist
                                        ? balanceAndBlacklistStates[_account] | (1 << 255)
                                        : _balanceOf(_account);
                                }
                                /**
                                 * @dev Helper method that sets the balance of an account on balanceAndBlacklistStates.
                                 * Since balances are stored in the last 255 bits of the balanceAndBlacklistStates value,
                                 * we need to ensure that the updated balance does not exceed (2^255 - 1).
                                 * Since blacklisted accounts' balances cannot be updated, the method will also
                                 * revert if the account is blacklisted
                                 * @param _account The address of the account.
                                 * @param _balance The new fiat token balance of the account (max: (2^255 - 1)).
                                 */
                                function _setBalance(address _account, uint256 _balance) internal override {
                                    require(
                                        _balance <= ((1 << 255) - 1),
                                        "FiatTokenV2_2: Balance exceeds (2^255 - 1)"
                                    );
                                    require(
                                        !_isBlacklisted(_account),
                                        "FiatTokenV2_2: Account is blacklisted"
                                    );
                                    balanceAndBlacklistStates[_account] = _balance;
                                }
                                /**
                                 * @inheritdoc Blacklistable
                                 */
                                function _isBlacklisted(address _account)
                                    internal
                                    override
                                    view
                                    returns (bool)
                                {
                                    return balanceAndBlacklistStates[_account] >> 255 == 1;
                                }
                                /**
                                 * @dev Helper method to obtain the balance of an account. Since balances
                                 * are stored in the last 255 bits of the balanceAndBlacklistStates value,
                                 * we apply a ((1 << 255) - 1) bit bitmask with an AND operation on the
                                 * balanceAndBlacklistState to obtain the balance.
                                 * @param _account  The address of the account.
                                 * @return          The fiat token balance of the account.
                                 */
                                function _balanceOf(address _account)
                                    internal
                                    override
                                    view
                                    returns (uint256)
                                {
                                    return balanceAndBlacklistStates[_account] & ((1 << 255) - 1);
                                }
                                /**
                                 * @inheritdoc FiatTokenV1
                                 */
                                function approve(address spender, uint256 value)
                                    external
                                    override
                                    whenNotPaused
                                    returns (bool)
                                {
                                    _approve(msg.sender, spender, value);
                                    return true;
                                }
                                /**
                                 * @inheritdoc FiatTokenV2
                                 */
                                function permit(
                                    address owner,
                                    address spender,
                                    uint256 value,
                                    uint256 deadline,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) external override whenNotPaused {
                                    _permit(owner, spender, value, deadline, v, r, s);
                                }
                                /**
                                 * @inheritdoc FiatTokenV2
                                 */
                                function increaseAllowance(address spender, uint256 increment)
                                    external
                                    override
                                    whenNotPaused
                                    returns (bool)
                                {
                                    _increaseAllowance(msg.sender, spender, increment);
                                    return true;
                                }
                                /**
                                 * @inheritdoc FiatTokenV2
                                 */
                                function decreaseAllowance(address spender, uint256 decrement)
                                    external
                                    override
                                    whenNotPaused
                                    returns (bool)
                                {
                                    _decreaseAllowance(msg.sender, spender, decrement);
                                    return true;
                                }
                            }
                            // SPDX-License-Identifier: MIT
                            pragma solidity >=0.6.2 <0.8.0;
                            /**
                             * @dev Collection of functions related to the address type
                             */
                            library Address {
                                /**
                                 * @dev Returns true if `account` is a contract.
                                 *
                                 * [IMPORTANT]
                                 * ====
                                 * It is unsafe to assume that an address for which this function returns
                                 * false is an externally-owned account (EOA) and not a contract.
                                 *
                                 * Among others, `isContract` will return false for the following
                                 * types of addresses:
                                 *
                                 *  - an externally-owned account
                                 *  - a contract in construction
                                 *  - an address where a contract will be created
                                 *  - an address where a contract lived, but was destroyed
                                 * ====
                                 */
                                function isContract(address account) internal view returns (bool) {
                                    // This method relies on extcodesize, which returns 0 for contracts in
                                    // construction, since the code is only stored at the end of the
                                    // constructor execution.
                                    uint256 size;
                                    // solhint-disable-next-line no-inline-assembly
                                    assembly { size := extcodesize(account) }
                                    return size > 0;
                                }
                                /**
                                 * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
                                 * `recipient`, forwarding all available gas and reverting on errors.
                                 *
                                 * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
                                 * of certain opcodes, possibly making contracts go over the 2300 gas limit
                                 * imposed by `transfer`, making them unable to receive funds via
                                 * `transfer`. {sendValue} removes this limitation.
                                 *
                                 * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
                                 *
                                 * IMPORTANT: because control is transferred to `recipient`, care must be
                                 * taken to not create reentrancy vulnerabilities. Consider using
                                 * {ReentrancyGuard} or the
                                 * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
                                 */
                                function sendValue(address payable recipient, uint256 amount) internal {
                                    require(address(this).balance >= amount, "Address: insufficient balance");
                                    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
                                    (bool success, ) = recipient.call{ value: amount }("");
                                    require(success, "Address: unable to send value, recipient may have reverted");
                                }
                                /**
                                 * @dev Performs a Solidity function call using a low level `call`. A
                                 * plain`call` is an unsafe replacement for a function call: use this
                                 * function instead.
                                 *
                                 * If `target` reverts with a revert reason, it is bubbled up by this
                                 * function (like regular Solidity function calls).
                                 *
                                 * Returns the raw returned data. To convert to the expected return value,
                                 * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
                                 *
                                 * Requirements:
                                 *
                                 * - `target` must be a contract.
                                 * - calling `target` with `data` must not revert.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCall(address target, bytes memory data) internal returns (bytes memory) {
                                  return functionCall(target, data, "Address: low-level call failed");
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
                                 * `errorMessage` as a fallback revert reason when `target` reverts.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
                                    return functionCallWithValue(target, data, 0, errorMessage);
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                                 * but also transferring `value` wei to `target`.
                                 *
                                 * Requirements:
                                 *
                                 * - the calling contract must have an ETH balance of at least `value`.
                                 * - the called Solidity function must be `payable`.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
                                    return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
                                 * with `errorMessage` as a fallback revert reason when `target` reverts.
                                 *
                                 * _Available since v3.1._
                                 */
                                function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
                                    require(address(this).balance >= value, "Address: insufficient balance for call");
                                    require(isContract(target), "Address: call to non-contract");
                                    // solhint-disable-next-line avoid-low-level-calls
                                    (bool success, bytes memory returndata) = target.call{ value: value }(data);
                                    return _verifyCallResult(success, returndata, errorMessage);
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                                 * but performing a static call.
                                 *
                                 * _Available since v3.3._
                                 */
                                function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
                                    return functionStaticCall(target, data, "Address: low-level static call failed");
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
                                 * but performing a static call.
                                 *
                                 * _Available since v3.3._
                                 */
                                function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
                                    require(isContract(target), "Address: static call to non-contract");
                                    // solhint-disable-next-line avoid-low-level-calls
                                    (bool success, bytes memory returndata) = target.staticcall(data);
                                    return _verifyCallResult(success, returndata, errorMessage);
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
                                 * but performing a delegate call.
                                 *
                                 * _Available since v3.4._
                                 */
                                function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
                                    return functionDelegateCall(target, data, "Address: low-level delegate call failed");
                                }
                                /**
                                 * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
                                 * but performing a delegate call.
                                 *
                                 * _Available since v3.4._
                                 */
                                function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
                                    require(isContract(target), "Address: delegate call to non-contract");
                                    // solhint-disable-next-line avoid-low-level-calls
                                    (bool success, bytes memory returndata) = target.delegatecall(data);
                                    return _verifyCallResult(success, returndata, errorMessage);
                                }
                                function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
                                    if (success) {
                                        return returndata;
                                    } else {
                                        // Look for revert reason and bubble it up if present
                                        if (returndata.length > 0) {
                                            // The easiest way to bubble the revert reason is using memory via assembly
                                            // solhint-disable-next-line no-inline-assembly
                                            assembly {
                                                let returndata_size := mload(returndata)
                                                revert(add(32, returndata), returndata_size)
                                            }
                                        } else {
                                            revert(errorMessage);
                                        }
                                    }
                                }
                            }
                            // SPDX-License-Identifier: MIT
                            pragma solidity >=0.6.0 <0.8.0;
                            import "./IERC20.sol";
                            import "../../math/SafeMath.sol";
                            import "../../utils/Address.sol";
                            /**
                             * @title SafeERC20
                             * @dev Wrappers around ERC20 operations that throw on failure (when the token
                             * contract returns false). Tokens that return no value (and instead revert or
                             * throw on failure) are also supported, non-reverting calls are assumed to be
                             * successful.
                             * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
                             * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
                             */
                            library SafeERC20 {
                                using SafeMath for uint256;
                                using Address for address;
                                function safeTransfer(IERC20 token, address to, uint256 value) internal {
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
                                }
                                function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
                                }
                                /**
                                 * @dev Deprecated. This function has issues similar to the ones found in
                                 * {IERC20-approve}, and its usage is discouraged.
                                 *
                                 * Whenever possible, use {safeIncreaseAllowance} and
                                 * {safeDecreaseAllowance} instead.
                                 */
                                function safeApprove(IERC20 token, address spender, uint256 value) internal {
                                    // safeApprove should only be called when setting an initial allowance,
                                    // or when resetting it to zero. To increase and decrease it, use
                                    // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
                                    // solhint-disable-next-line max-line-length
                                    require((value == 0) || (token.allowance(address(this), spender) == 0),
                                        "SafeERC20: approve from non-zero to non-zero allowance"
                                    );
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
                                }
                                function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
                                    uint256 newAllowance = token.allowance(address(this), spender).add(value);
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
                                }
                                function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
                                    uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
                                    _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
                                }
                                /**
                                 * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
                                 * on the return value: the return value is optional (but if data is returned, it must not be false).
                                 * @param token The token targeted by the call.
                                 * @param data The call data (encoded using abi.encode or one of its variants).
                                 */
                                function _callOptionalReturn(IERC20 token, bytes memory data) private {
                                    // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
                                    // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
                                    // the target address contains contract code and also asserts for success in the low-level call.
                                    bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
                                    if (returndata.length > 0) { // Return data is optional
                                        // solhint-disable-next-line max-line-length
                                        require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
                                    }
                                }
                            }
                            // SPDX-License-Identifier: MIT
                            pragma solidity >=0.6.0 <0.8.0;
                            /**
                             * @dev Interface of the ERC20 standard as defined in the EIP.
                             */
                            interface IERC20 {
                                /**
                                 * @dev Returns the amount of tokens in existence.
                                 */
                                function totalSupply() external view returns (uint256);
                                /**
                                 * @dev Returns the amount of tokens owned by `account`.
                                 */
                                function balanceOf(address account) external view returns (uint256);
                                /**
                                 * @dev Moves `amount` tokens from the caller's account to `recipient`.
                                 *
                                 * Returns a boolean value indicating whether the operation succeeded.
                                 *
                                 * Emits a {Transfer} event.
                                 */
                                function transfer(address recipient, uint256 amount) external returns (bool);
                                /**
                                 * @dev Returns the remaining number of tokens that `spender` will be
                                 * allowed to spend on behalf of `owner` through {transferFrom}. This is
                                 * zero by default.
                                 *
                                 * This value changes when {approve} or {transferFrom} are called.
                                 */
                                function allowance(address owner, address spender) external view returns (uint256);
                                /**
                                 * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
                                 *
                                 * Returns a boolean value indicating whether the operation succeeded.
                                 *
                                 * IMPORTANT: Beware that changing an allowance with this method brings the risk
                                 * that someone may use both the old and the new allowance by unfortunate
                                 * transaction ordering. One possible solution to mitigate this race
                                 * condition is to first reduce the spender's allowance to 0 and set the
                                 * desired value afterwards:
                                 * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                                 *
                                 * Emits an {Approval} event.
                                 */
                                function approve(address spender, uint256 amount) external returns (bool);
                                /**
                                 * @dev Moves `amount` tokens from `sender` to `recipient` using the
                                 * allowance mechanism. `amount` is then deducted from the caller's
                                 * allowance.
                                 *
                                 * Returns a boolean value indicating whether the operation succeeded.
                                 *
                                 * Emits a {Transfer} event.
                                 */
                                function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
                                /**
                                 * @dev Emitted when `value` tokens are moved from one account (`from`) to
                                 * another (`to`).
                                 *
                                 * Note that `value` may be zero.
                                 */
                                event Transfer(address indexed from, address indexed to, uint256 value);
                                /**
                                 * @dev Emitted when the allowance of a `spender` for an `owner` is set by
                                 * a call to {approve}. `value` is the new allowance.
                                 */
                                event Approval(address indexed owner, address indexed spender, uint256 value);
                            }
                            // SPDX-License-Identifier: MIT
                            pragma solidity >=0.6.0 <0.8.0;
                            /**
                             * @dev Wrappers over Solidity's arithmetic operations with added overflow
                             * checks.
                             *
                             * Arithmetic operations in Solidity wrap on overflow. This can easily result
                             * in bugs, because programmers usually assume that an overflow raises an
                             * error, which is the standard behavior in high level programming languages.
                             * `SafeMath` restores this intuition by reverting the transaction when an
                             * operation overflows.
                             *
                             * Using this library instead of the unchecked operations eliminates an entire
                             * class of bugs, so it's recommended to use it always.
                             */
                            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) {
                                    uint256 c = a + b;
                                    if (c < a) return (false, 0);
                                    return (true, c);
                                }
                                /**
                                 * @dev Returns the substraction of two unsigned integers, with an overflow flag.
                                 *
                                 * _Available since v3.4._
                                 */
                                function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
                                    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) {
                                    // 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) {
                                    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) {
                                    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) {
                                    uint256 c = a + b;
                                    require(c >= a, "SafeMath: addition overflow");
                                    return c;
                                }
                                /**
                                 * @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) {
                                    require(b <= a, "SafeMath: subtraction overflow");
                                    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) {
                                    if (a == 0) return 0;
                                    uint256 c = a * b;
                                    require(c / a == b, "SafeMath: multiplication overflow");
                                    return c;
                                }
                                /**
                                 * @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. 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) internal pure returns (uint256) {
                                    require(b > 0, "SafeMath: division by zero");
                                    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) {
                                    require(b > 0, "SafeMath: modulo by zero");
                                    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) {
                                    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.
                                 *
                                 * CAUTION: This function is deprecated because it requires allocating memory for the error
                                 * message unnecessarily. For custom revert reasons use {tryDiv}.
                                 *
                                 * 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) {
                                    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) {
                                    require(b > 0, errorMessage);
                                    return a % b;
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { FiatTokenV2 } from "./FiatTokenV2.sol";
                            // solhint-disable func-name-mixedcase
                            /**
                             * @title FiatToken V2.1
                             * @notice ERC20 Token backed by fiat reserves, version 2.1
                             */
                            contract FiatTokenV2_1 is FiatTokenV2 {
                                /**
                                 * @notice Initialize v2.1
                                 * @param lostAndFound  The address to which the locked funds are sent
                                 */
                                function initializeV2_1(address lostAndFound) external {
                                    // solhint-disable-next-line reason-string
                                    require(_initializedVersion == 1);
                                    uint256 lockedAmount = _balanceOf(address(this));
                                    if (lockedAmount > 0) {
                                        _transfer(address(this), lostAndFound, lockedAmount);
                                    }
                                    _blacklist(address(this));
                                    _initializedVersion = 2;
                                }
                                /**
                                 * @notice Version string for the EIP712 domain separator
                                 * @return Version string
                                 */
                                function version() external pure returns (string memory) {
                                    return "2";
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { FiatTokenV1_1 } from "../v1.1/FiatTokenV1_1.sol";
                            import { EIP712 } from "../util/EIP712.sol";
                            import { EIP3009 } from "./EIP3009.sol";
                            import { EIP2612 } from "./EIP2612.sol";
                            /**
                             * @title FiatToken V2
                             * @notice ERC20 Token backed by fiat reserves, version 2
                             */
                            contract FiatTokenV2 is FiatTokenV1_1, EIP3009, EIP2612 {
                                uint8 internal _initializedVersion;
                                /**
                                 * @notice Initialize v2
                                 * @param newName   New token name
                                 */
                                function initializeV2(string calldata newName) external {
                                    // solhint-disable-next-line reason-string
                                    require(initialized && _initializedVersion == 0);
                                    name = newName;
                                    _DEPRECATED_CACHED_DOMAIN_SEPARATOR = EIP712.makeDomainSeparator(
                                        newName,
                                        "2"
                                    );
                                    _initializedVersion = 1;
                                }
                                /**
                                 * @notice Increase the allowance by a given increment
                                 * @param spender   Spender's address
                                 * @param increment Amount of increase in allowance
                                 * @return True if successful
                                 */
                                function increaseAllowance(address spender, uint256 increment)
                                    external
                                    virtual
                                    whenNotPaused
                                    notBlacklisted(msg.sender)
                                    notBlacklisted(spender)
                                    returns (bool)
                                {
                                    _increaseAllowance(msg.sender, spender, increment);
                                    return true;
                                }
                                /**
                                 * @notice Decrease the allowance by a given decrement
                                 * @param spender   Spender's address
                                 * @param decrement Amount of decrease in allowance
                                 * @return True if successful
                                 */
                                function decreaseAllowance(address spender, uint256 decrement)
                                    external
                                    virtual
                                    whenNotPaused
                                    notBlacklisted(msg.sender)
                                    notBlacklisted(spender)
                                    returns (bool)
                                {
                                    _decreaseAllowance(msg.sender, spender, decrement);
                                    return true;
                                }
                                /**
                                 * @notice Execute a transfer with a signed authorization
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param v             v of the signature
                                 * @param r             r of the signature
                                 * @param s             s of the signature
                                 */
                                function transferWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
                                    _transferWithAuthorization(
                                        from,
                                        to,
                                        value,
                                        validAfter,
                                        validBefore,
                                        nonce,
                                        v,
                                        r,
                                        s
                                    );
                                }
                                /**
                                 * @notice Receive a transfer with a signed authorization from the payer
                                 * @dev This has an additional check to ensure that the payee's address
                                 * matches the caller of this function to prevent front-running attacks.
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param v             v of the signature
                                 * @param r             r of the signature
                                 * @param s             s of the signature
                                 */
                                function receiveWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
                                    _receiveWithAuthorization(
                                        from,
                                        to,
                                        value,
                                        validAfter,
                                        validBefore,
                                        nonce,
                                        v,
                                        r,
                                        s
                                    );
                                }
                                /**
                                 * @notice Attempt to cancel an authorization
                                 * @dev Works only if the authorization is not yet used.
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 * @param v             v of the signature
                                 * @param r             r of the signature
                                 * @param s             s of the signature
                                 */
                                function cancelAuthorization(
                                    address authorizer,
                                    bytes32 nonce,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) external whenNotPaused {
                                    _cancelAuthorization(authorizer, nonce, v, r, s);
                                }
                                /**
                                 * @notice Update allowance with a signed permit
                                 * @param owner       Token owner's address (Authorizer)
                                 * @param spender     Spender's address
                                 * @param value       Amount of allowance
                                 * @param deadline    The time at which the signature expires (unix time), or max uint256 value to signal no expiration
                                 * @param v           v of the signature
                                 * @param r           r of the signature
                                 * @param s           s of the signature
                                 */
                                function permit(
                                    address owner,
                                    address spender,
                                    uint256 value,
                                    uint256 deadline,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                )
                                    external
                                    virtual
                                    whenNotPaused
                                    notBlacklisted(owner)
                                    notBlacklisted(spender)
                                {
                                    _permit(owner, spender, value, deadline, v, r, s);
                                }
                                /**
                                 * @dev Internal function to increase the allowance by a given increment
                                 * @param owner     Token owner's address
                                 * @param spender   Spender's address
                                 * @param increment Amount of increase
                                 */
                                function _increaseAllowance(
                                    address owner,
                                    address spender,
                                    uint256 increment
                                ) internal override {
                                    _approve(owner, spender, allowed[owner][spender].add(increment));
                                }
                                /**
                                 * @dev Internal function to decrease the allowance by a given decrement
                                 * @param owner     Token owner's address
                                 * @param spender   Spender's address
                                 * @param decrement Amount of decrease
                                 */
                                function _decreaseAllowance(
                                    address owner,
                                    address spender,
                                    uint256 decrement
                                ) internal override {
                                    _approve(
                                        owner,
                                        spender,
                                        allowed[owner][spender].sub(
                                            decrement,
                                            "ERC20: decreased allowance below zero"
                                        )
                                    );
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            // solhint-disable func-name-mixedcase
                            /**
                             * @title EIP712 Domain
                             */
                            contract EIP712Domain {
                                // was originally DOMAIN_SEPARATOR
                                // but that has been moved to a method so we can override it in V2_2+
                                bytes32 internal _DEPRECATED_CACHED_DOMAIN_SEPARATOR;
                                /**
                                 * @notice Get the EIP712 Domain Separator.
                                 * @return The bytes32 EIP712 domain separator.
                                 */
                                function DOMAIN_SEPARATOR() external view returns (bytes32) {
                                    return _domainSeparator();
                                }
                                /**
                                 * @dev Internal method to get the EIP712 Domain Separator.
                                 * @return The bytes32 EIP712 domain separator.
                                 */
                                function _domainSeparator() internal virtual view returns (bytes32) {
                                    return _DEPRECATED_CACHED_DOMAIN_SEPARATOR;
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { AbstractFiatTokenV2 } from "./AbstractFiatTokenV2.sol";
                            import { EIP712Domain } from "./EIP712Domain.sol";
                            import { SignatureChecker } from "../util/SignatureChecker.sol";
                            import { MessageHashUtils } from "../util/MessageHashUtils.sol";
                            /**
                             * @title EIP-3009
                             * @notice Provide internal implementation for gas-abstracted transfers
                             * @dev Contracts that inherit from this must wrap these with publicly
                             * accessible functions, optionally adding modifiers where necessary
                             */
                            abstract contract EIP3009 is AbstractFiatTokenV2, EIP712Domain {
                                // keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
                                bytes32
                                    public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
                                // keccak256("ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")
                                bytes32
                                    public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH = 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;
                                // keccak256("CancelAuthorization(address authorizer,bytes32 nonce)")
                                bytes32
                                    public constant CANCEL_AUTHORIZATION_TYPEHASH = 0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;
                                /**
                                 * @dev authorizer address => nonce => bool (true if nonce is used)
                                 */
                                mapping(address => mapping(bytes32 => bool)) private _authorizationStates;
                                event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);
                                event AuthorizationCanceled(
                                    address indexed authorizer,
                                    bytes32 indexed nonce
                                );
                                /**
                                 * @notice Returns the state of an authorization
                                 * @dev Nonces are randomly generated 32-byte data unique to the
                                 * authorizer's address
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 * @return True if the nonce is used
                                 */
                                function authorizationState(address authorizer, bytes32 nonce)
                                    external
                                    view
                                    returns (bool)
                                {
                                    return _authorizationStates[authorizer][nonce];
                                }
                                /**
                                 * @notice Execute a transfer with a signed authorization
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param v             v of the signature
                                 * @param r             r of the signature
                                 * @param s             s of the signature
                                 */
                                function _transferWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) internal {
                                    _transferWithAuthorization(
                                        from,
                                        to,
                                        value,
                                        validAfter,
                                        validBefore,
                                        nonce,
                                        abi.encodePacked(r, s, v)
                                    );
                                }
                                /**
                                 * @notice Execute a transfer with a signed authorization
                                 * @dev EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param signature     Signature byte array produced by an EOA wallet or a contract wallet
                                 */
                                function _transferWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    bytes memory signature
                                ) internal {
                                    _requireValidAuthorization(from, nonce, validAfter, validBefore);
                                    _requireValidSignature(
                                        from,
                                        keccak256(
                                            abi.encode(
                                                TRANSFER_WITH_AUTHORIZATION_TYPEHASH,
                                                from,
                                                to,
                                                value,
                                                validAfter,
                                                validBefore,
                                                nonce
                                            )
                                        ),
                                        signature
                                    );
                                    _markAuthorizationAsUsed(from, nonce);
                                    _transfer(from, to, value);
                                }
                                /**
                                 * @notice Receive a transfer with a signed authorization from the payer
                                 * @dev This has an additional check to ensure that the payee's address
                                 * matches the caller of this function to prevent front-running attacks.
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param v             v of the signature
                                 * @param r             r of the signature
                                 * @param s             s of the signature
                                 */
                                function _receiveWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) internal {
                                    _receiveWithAuthorization(
                                        from,
                                        to,
                                        value,
                                        validAfter,
                                        validBefore,
                                        nonce,
                                        abi.encodePacked(r, s, v)
                                    );
                                }
                                /**
                                 * @notice Receive a transfer with a signed authorization from the payer
                                 * @dev This has an additional check to ensure that the payee's address
                                 * matches the caller of this function to prevent front-running attacks.
                                 * EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param from          Payer's address (Authorizer)
                                 * @param to            Payee's address
                                 * @param value         Amount to be transferred
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 * @param nonce         Unique nonce
                                 * @param signature     Signature byte array produced by an EOA wallet or a contract wallet
                                 */
                                function _receiveWithAuthorization(
                                    address from,
                                    address to,
                                    uint256 value,
                                    uint256 validAfter,
                                    uint256 validBefore,
                                    bytes32 nonce,
                                    bytes memory signature
                                ) internal {
                                    require(to == msg.sender, "FiatTokenV2: caller must be the payee");
                                    _requireValidAuthorization(from, nonce, validAfter, validBefore);
                                    _requireValidSignature(
                                        from,
                                        keccak256(
                                            abi.encode(
                                                RECEIVE_WITH_AUTHORIZATION_TYPEHASH,
                                                from,
                                                to,
                                                value,
                                                validAfter,
                                                validBefore,
                                                nonce
                                            )
                                        ),
                                        signature
                                    );
                                    _markAuthorizationAsUsed(from, nonce);
                                    _transfer(from, to, value);
                                }
                                /**
                                 * @notice Attempt to cancel an authorization
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 * @param v             v of the signature
                                 * @param r             r of the signature
                                 * @param s             s of the signature
                                 */
                                function _cancelAuthorization(
                                    address authorizer,
                                    bytes32 nonce,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) internal {
                                    _cancelAuthorization(authorizer, nonce, abi.encodePacked(r, s, v));
                                }
                                /**
                                 * @notice Attempt to cancel an authorization
                                 * @dev EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 * @param signature     Signature byte array produced by an EOA wallet or a contract wallet
                                 */
                                function _cancelAuthorization(
                                    address authorizer,
                                    bytes32 nonce,
                                    bytes memory signature
                                ) internal {
                                    _requireUnusedAuthorization(authorizer, nonce);
                                    _requireValidSignature(
                                        authorizer,
                                        keccak256(
                                            abi.encode(CANCEL_AUTHORIZATION_TYPEHASH, authorizer, nonce)
                                        ),
                                        signature
                                    );
                                    _authorizationStates[authorizer][nonce] = true;
                                    emit AuthorizationCanceled(authorizer, nonce);
                                }
                                /**
                                 * @notice Validates that signature against input data struct
                                 * @param signer        Signer's address
                                 * @param dataHash      Hash of encoded data struct
                                 * @param signature     Signature byte array produced by an EOA wallet or a contract wallet
                                 */
                                function _requireValidSignature(
                                    address signer,
                                    bytes32 dataHash,
                                    bytes memory signature
                                ) private view {
                                    require(
                                        SignatureChecker.isValidSignatureNow(
                                            signer,
                                            MessageHashUtils.toTypedDataHash(_domainSeparator(), dataHash),
                                            signature
                                        ),
                                        "FiatTokenV2: invalid signature"
                                    );
                                }
                                /**
                                 * @notice Check that an authorization is unused
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 */
                                function _requireUnusedAuthorization(address authorizer, bytes32 nonce)
                                    private
                                    view
                                {
                                    require(
                                        !_authorizationStates[authorizer][nonce],
                                        "FiatTokenV2: authorization is used or canceled"
                                    );
                                }
                                /**
                                 * @notice Check that authorization is valid
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 * @param validAfter    The time after which this is valid (unix time)
                                 * @param validBefore   The time before which this is valid (unix time)
                                 */
                                function _requireValidAuthorization(
                                    address authorizer,
                                    bytes32 nonce,
                                    uint256 validAfter,
                                    uint256 validBefore
                                ) private view {
                                    require(
                                        now > validAfter,
                                        "FiatTokenV2: authorization is not yet valid"
                                    );
                                    require(now < validBefore, "FiatTokenV2: authorization is expired");
                                    _requireUnusedAuthorization(authorizer, nonce);
                                }
                                /**
                                 * @notice Mark an authorization as used
                                 * @param authorizer    Authorizer's address
                                 * @param nonce         Nonce of the authorization
                                 */
                                function _markAuthorizationAsUsed(address authorizer, bytes32 nonce)
                                    private
                                {
                                    _authorizationStates[authorizer][nonce] = true;
                                    emit AuthorizationUsed(authorizer, nonce);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { AbstractFiatTokenV2 } from "./AbstractFiatTokenV2.sol";
                            import { EIP712Domain } from "./EIP712Domain.sol";
                            import { MessageHashUtils } from "../util/MessageHashUtils.sol";
                            import { SignatureChecker } from "../util/SignatureChecker.sol";
                            /**
                             * @title EIP-2612
                             * @notice Provide internal implementation for gas-abstracted approvals
                             */
                            abstract contract EIP2612 is AbstractFiatTokenV2, EIP712Domain {
                                // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")
                                bytes32
                                    public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
                                mapping(address => uint256) private _permitNonces;
                                /**
                                 * @notice Nonces for permit
                                 * @param owner Token owner's address (Authorizer)
                                 * @return Next nonce
                                 */
                                function nonces(address owner) external view returns (uint256) {
                                    return _permitNonces[owner];
                                }
                                /**
                                 * @notice Verify a signed approval permit and execute if valid
                                 * @param owner     Token owner's address (Authorizer)
                                 * @param spender   Spender's address
                                 * @param value     Amount of allowance
                                 * @param deadline  The time at which the signature expires (unix time), or max uint256 value to signal no expiration
                                 * @param v         v of the signature
                                 * @param r         r of the signature
                                 * @param s         s of the signature
                                 */
                                function _permit(
                                    address owner,
                                    address spender,
                                    uint256 value,
                                    uint256 deadline,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) internal {
                                    _permit(owner, spender, value, deadline, abi.encodePacked(r, s, v));
                                }
                                /**
                                 * @notice Verify a signed approval permit and execute if valid
                                 * @dev EOA wallet signatures should be packed in the order of r, s, v.
                                 * @param owner      Token owner's address (Authorizer)
                                 * @param spender    Spender's address
                                 * @param value      Amount of allowance
                                 * @param deadline   The time at which the signature expires (unix time), or max uint256 value to signal no expiration
                                 * @param signature  Signature byte array signed by an EOA wallet or a contract wallet
                                 */
                                function _permit(
                                    address owner,
                                    address spender,
                                    uint256 value,
                                    uint256 deadline,
                                    bytes memory signature
                                ) internal {
                                    require(
                                        deadline == type(uint256).max || deadline >= now,
                                        "FiatTokenV2: permit is expired"
                                    );
                                    bytes32 typedDataHash = MessageHashUtils.toTypedDataHash(
                                        _domainSeparator(),
                                        keccak256(
                                            abi.encode(
                                                PERMIT_TYPEHASH,
                                                owner,
                                                spender,
                                                value,
                                                _permitNonces[owner]++,
                                                deadline
                                            )
                                        )
                                    );
                                    require(
                                        SignatureChecker.isValidSignatureNow(
                                            owner,
                                            typedDataHash,
                                            signature
                                        ),
                                        "EIP2612: invalid signature"
                                    );
                                    _approve(owner, spender, value);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { AbstractFiatTokenV1 } from "../v1/AbstractFiatTokenV1.sol";
                            abstract contract AbstractFiatTokenV2 is AbstractFiatTokenV1 {
                                function _increaseAllowance(
                                    address owner,
                                    address spender,
                                    uint256 increment
                                ) internal virtual;
                                function _decreaseAllowance(
                                    address owner,
                                    address spender,
                                    uint256 decrement
                                ) internal virtual;
                            }
                            /**
                             * SPDX-License-Identifier: MIT
                             *
                             * Copyright (c) 2016 Smart Contract Solutions, Inc.
                             * Copyright (c) 2018-2020 CENTRE SECZ
                             *
                             * Permission is hereby granted, free of charge, to any person obtaining a copy
                             * of this software and associated documentation files (the "Software"), to deal
                             * in the Software without restriction, including without limitation the rights
                             * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                             * copies of the Software, and to permit persons to whom the Software is
                             * furnished to do so, subject to the following conditions:
                             *
                             * The above copyright notice and this permission notice shall be included in
                             * copies or substantial portions of the Software.
                             *
                             * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
                             * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                             * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                             * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                             * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                             * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
                             * SOFTWARE.
                             */
                            pragma solidity 0.6.12;
                            import { Ownable } from "./Ownable.sol";
                            /**
                             * @notice Base contract which allows children to implement an emergency stop
                             * mechanism
                             * @dev Forked from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/feb665136c0dae9912e08397c1a21c4af3651ef3/contracts/lifecycle/Pausable.sol
                             * Modifications:
                             * 1. Added pauser role, switched pause/unpause to be onlyPauser (6/14/2018)
                             * 2. Removed whenNotPause/whenPaused from pause/unpause (6/14/2018)
                             * 3. Removed whenPaused (6/14/2018)
                             * 4. Switches ownable library to use ZeppelinOS (7/12/18)
                             * 5. Remove constructor (7/13/18)
                             * 6. Reformat, conform to Solidity 0.6 syntax and add error messages (5/13/20)
                             * 7. Make public functions external (5/27/20)
                             */
                            contract Pausable is Ownable {
                                event Pause();
                                event Unpause();
                                event PauserChanged(address indexed newAddress);
                                address public pauser;
                                bool public paused = false;
                                /**
                                 * @dev Modifier to make a function callable only when the contract is not paused.
                                 */
                                modifier whenNotPaused() {
                                    require(!paused, "Pausable: paused");
                                    _;
                                }
                                /**
                                 * @dev throws if called by any account other than the pauser
                                 */
                                modifier onlyPauser() {
                                    require(msg.sender == pauser, "Pausable: caller is not the pauser");
                                    _;
                                }
                                /**
                                 * @dev called by the owner to pause, triggers stopped state
                                 */
                                function pause() external onlyPauser {
                                    paused = true;
                                    emit Pause();
                                }
                                /**
                                 * @dev called by the owner to unpause, returns to normal state
                                 */
                                function unpause() external onlyPauser {
                                    paused = false;
                                    emit Unpause();
                                }
                                /**
                                 * @notice Updates the pauser address.
                                 * @param _newPauser The address of the new pauser.
                                 */
                                function updatePauser(address _newPauser) external onlyOwner {
                                    require(
                                        _newPauser != address(0),
                                        "Pausable: new pauser is the zero address"
                                    );
                                    pauser = _newPauser;
                                    emit PauserChanged(pauser);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: MIT
                             *
                             * Copyright (c) 2018 zOS Global Limited.
                             * Copyright (c) 2018-2020 CENTRE SECZ
                             *
                             * Permission is hereby granted, free of charge, to any person obtaining a copy
                             * of this software and associated documentation files (the "Software"), to deal
                             * in the Software without restriction, including without limitation the rights
                             * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                             * copies of the Software, and to permit persons to whom the Software is
                             * furnished to do so, subject to the following conditions:
                             *
                             * The above copyright notice and this permission notice shall be included in
                             * copies or substantial portions of the Software.
                             *
                             * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
                             * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                             * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                             * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                             * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                             * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
                             * SOFTWARE.
                             */
                            pragma solidity 0.6.12;
                            /**
                             * @notice The Ownable contract has an owner address, and provides basic
                             * authorization control functions
                             * @dev Forked from https://github.com/OpenZeppelin/openzeppelin-labs/blob/3887ab77b8adafba4a26ace002f3a684c1a3388b/upgradeability_ownership/contracts/ownership/Ownable.sol
                             * Modifications:
                             * 1. Consolidate OwnableStorage into this contract (7/13/18)
                             * 2. Reformat, conform to Solidity 0.6 syntax, and add error messages (5/13/20)
                             * 3. Make public functions external (5/27/20)
                             */
                            contract Ownable {
                                // Owner of the contract
                                address private _owner;
                                /**
                                 * @dev Event to show ownership has been transferred
                                 * @param previousOwner representing the address of the previous owner
                                 * @param newOwner representing the address of the new owner
                                 */
                                event OwnershipTransferred(address previousOwner, address newOwner);
                                /**
                                 * @dev The constructor sets the original owner of the contract to the sender account.
                                 */
                                constructor() public {
                                    setOwner(msg.sender);
                                }
                                /**
                                 * @dev Tells the address of the owner
                                 * @return the address of the owner
                                 */
                                function owner() external view returns (address) {
                                    return _owner;
                                }
                                /**
                                 * @dev Sets a new owner address
                                 */
                                function setOwner(address newOwner) internal {
                                    _owner = newOwner;
                                }
                                /**
                                 * @dev Throws if called by any account other than the owner.
                                 */
                                modifier onlyOwner() {
                                    require(msg.sender == _owner, "Ownable: caller is not the owner");
                                    _;
                                }
                                /**
                                 * @dev Allows the current owner to transfer control of the contract to a newOwner.
                                 * @param newOwner The address to transfer ownership to.
                                 */
                                function transferOwnership(address newOwner) external onlyOwner {
                                    require(
                                        newOwner != address(0),
                                        "Ownable: new owner is the zero address"
                                    );
                                    emit OwnershipTransferred(_owner, newOwner);
                                    setOwner(newOwner);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
                            import { AbstractFiatTokenV1 } from "./AbstractFiatTokenV1.sol";
                            import { Ownable } from "./Ownable.sol";
                            import { Pausable } from "./Pausable.sol";
                            import { Blacklistable } from "./Blacklistable.sol";
                            /**
                             * @title FiatToken
                             * @dev ERC20 Token backed by fiat reserves
                             */
                            contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable {
                                using SafeMath for uint256;
                                string public name;
                                string public symbol;
                                uint8 public decimals;
                                string public currency;
                                address public masterMinter;
                                bool internal initialized;
                                /// @dev A mapping that stores the balance and blacklist states for a given address.
                                /// The first bit defines whether the address is blacklisted (1 if blacklisted, 0 otherwise).
                                /// The last 255 bits define the balance for the address.
                                mapping(address => uint256) internal balanceAndBlacklistStates;
                                mapping(address => mapping(address => uint256)) internal allowed;
                                uint256 internal totalSupply_ = 0;
                                mapping(address => bool) internal minters;
                                mapping(address => uint256) internal minterAllowed;
                                event Mint(address indexed minter, address indexed to, uint256 amount);
                                event Burn(address indexed burner, uint256 amount);
                                event MinterConfigured(address indexed minter, uint256 minterAllowedAmount);
                                event MinterRemoved(address indexed oldMinter);
                                event MasterMinterChanged(address indexed newMasterMinter);
                                /**
                                 * @notice Initializes the fiat token contract.
                                 * @param tokenName       The name of the fiat token.
                                 * @param tokenSymbol     The symbol of the fiat token.
                                 * @param tokenCurrency   The fiat currency that the token represents.
                                 * @param tokenDecimals   The number of decimals that the token uses.
                                 * @param newMasterMinter The masterMinter address for the fiat token.
                                 * @param newPauser       The pauser address for the fiat token.
                                 * @param newBlacklister  The blacklister address for the fiat token.
                                 * @param newOwner        The owner of the fiat token.
                                 */
                                function initialize(
                                    string memory tokenName,
                                    string memory tokenSymbol,
                                    string memory tokenCurrency,
                                    uint8 tokenDecimals,
                                    address newMasterMinter,
                                    address newPauser,
                                    address newBlacklister,
                                    address newOwner
                                ) public {
                                    require(!initialized, "FiatToken: contract is already initialized");
                                    require(
                                        newMasterMinter != address(0),
                                        "FiatToken: new masterMinter is the zero address"
                                    );
                                    require(
                                        newPauser != address(0),
                                        "FiatToken: new pauser is the zero address"
                                    );
                                    require(
                                        newBlacklister != address(0),
                                        "FiatToken: new blacklister is the zero address"
                                    );
                                    require(
                                        newOwner != address(0),
                                        "FiatToken: new owner is the zero address"
                                    );
                                    name = tokenName;
                                    symbol = tokenSymbol;
                                    currency = tokenCurrency;
                                    decimals = tokenDecimals;
                                    masterMinter = newMasterMinter;
                                    pauser = newPauser;
                                    blacklister = newBlacklister;
                                    setOwner(newOwner);
                                    initialized = true;
                                }
                                /**
                                 * @dev Throws if called by any account other than a minter.
                                 */
                                modifier onlyMinters() {
                                    require(minters[msg.sender], "FiatToken: caller is not a minter");
                                    _;
                                }
                                /**
                                 * @notice Mints fiat tokens to an address.
                                 * @param _to The address that will receive the minted tokens.
                                 * @param _amount The amount of tokens to mint. Must be less than or equal
                                 * to the minterAllowance of the caller.
                                 * @return True if the operation was successful.
                                 */
                                function mint(address _to, uint256 _amount)
                                    external
                                    whenNotPaused
                                    onlyMinters
                                    notBlacklisted(msg.sender)
                                    notBlacklisted(_to)
                                    returns (bool)
                                {
                                    require(_to != address(0), "FiatToken: mint to the zero address");
                                    require(_amount > 0, "FiatToken: mint amount not greater than 0");
                                    uint256 mintingAllowedAmount = minterAllowed[msg.sender];
                                    require(
                                        _amount <= mintingAllowedAmount,
                                        "FiatToken: mint amount exceeds minterAllowance"
                                    );
                                    totalSupply_ = totalSupply_.add(_amount);
                                    _setBalance(_to, _balanceOf(_to).add(_amount));
                                    minterAllowed[msg.sender] = mintingAllowedAmount.sub(_amount);
                                    emit Mint(msg.sender, _to, _amount);
                                    emit Transfer(address(0), _to, _amount);
                                    return true;
                                }
                                /**
                                 * @dev Throws if called by any account other than the masterMinter
                                 */
                                modifier onlyMasterMinter() {
                                    require(
                                        msg.sender == masterMinter,
                                        "FiatToken: caller is not the masterMinter"
                                    );
                                    _;
                                }
                                /**
                                 * @notice Gets the minter allowance for an account.
                                 * @param minter The address to check.
                                 * @return The remaining minter allowance for the account.
                                 */
                                function minterAllowance(address minter) external view returns (uint256) {
                                    return minterAllowed[minter];
                                }
                                /**
                                 * @notice Checks if an account is a minter.
                                 * @param account The address to check.
                                 * @return True if the account is a minter, false if the account is not a minter.
                                 */
                                function isMinter(address account) external view returns (bool) {
                                    return minters[account];
                                }
                                /**
                                 * @notice Gets the remaining amount of fiat tokens a spender is allowed to transfer on
                                 * behalf of the token owner.
                                 * @param owner   The token owner's address.
                                 * @param spender The spender's address.
                                 * @return The remaining allowance.
                                 */
                                function allowance(address owner, address spender)
                                    external
                                    override
                                    view
                                    returns (uint256)
                                {
                                    return allowed[owner][spender];
                                }
                                /**
                                 * @notice Gets the totalSupply of the fiat token.
                                 * @return The totalSupply of the fiat token.
                                 */
                                function totalSupply() external override view returns (uint256) {
                                    return totalSupply_;
                                }
                                /**
                                 * @notice Gets the fiat token balance of an account.
                                 * @param account  The address to check.
                                 * @return balance The fiat token balance of the account.
                                 */
                                function balanceOf(address account)
                                    external
                                    override
                                    view
                                    returns (uint256)
                                {
                                    return _balanceOf(account);
                                }
                                /**
                                 * @notice Sets a fiat token allowance for a spender to spend on behalf of the caller.
                                 * @param spender The spender's address.
                                 * @param value   The allowance amount.
                                 * @return True if the operation was successful.
                                 */
                                function approve(address spender, uint256 value)
                                    external
                                    virtual
                                    override
                                    whenNotPaused
                                    notBlacklisted(msg.sender)
                                    notBlacklisted(spender)
                                    returns (bool)
                                {
                                    _approve(msg.sender, spender, value);
                                    return true;
                                }
                                /**
                                 * @dev Internal function to set allowance.
                                 * @param owner     Token owner's address.
                                 * @param spender   Spender's address.
                                 * @param value     Allowance amount.
                                 */
                                function _approve(
                                    address owner,
                                    address spender,
                                    uint256 value
                                ) internal override {
                                    require(owner != address(0), "ERC20: approve from the zero address");
                                    require(spender != address(0), "ERC20: approve to the zero address");
                                    allowed[owner][spender] = value;
                                    emit Approval(owner, spender, value);
                                }
                                /**
                                 * @notice Transfers tokens from an address to another by spending the caller's allowance.
                                 * @dev The caller must have some fiat token allowance on the payer's tokens.
                                 * @param from  Payer's address.
                                 * @param to    Payee's address.
                                 * @param value Transfer amount.
                                 * @return True if the operation was successful.
                                 */
                                function transferFrom(
                                    address from,
                                    address to,
                                    uint256 value
                                )
                                    external
                                    override
                                    whenNotPaused
                                    notBlacklisted(msg.sender)
                                    notBlacklisted(from)
                                    notBlacklisted(to)
                                    returns (bool)
                                {
                                    require(
                                        value <= allowed[from][msg.sender],
                                        "ERC20: transfer amount exceeds allowance"
                                    );
                                    _transfer(from, to, value);
                                    allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
                                    return true;
                                }
                                /**
                                 * @notice Transfers tokens from the caller.
                                 * @param to    Payee's address.
                                 * @param value Transfer amount.
                                 * @return True if the operation was successful.
                                 */
                                function transfer(address to, uint256 value)
                                    external
                                    override
                                    whenNotPaused
                                    notBlacklisted(msg.sender)
                                    notBlacklisted(to)
                                    returns (bool)
                                {
                                    _transfer(msg.sender, to, value);
                                    return true;
                                }
                                /**
                                 * @dev Internal function to process transfers.
                                 * @param from  Payer's address.
                                 * @param to    Payee's address.
                                 * @param value Transfer amount.
                                 */
                                function _transfer(
                                    address from,
                                    address to,
                                    uint256 value
                                ) internal override {
                                    require(from != address(0), "ERC20: transfer from the zero address");
                                    require(to != address(0), "ERC20: transfer to the zero address");
                                    require(
                                        value <= _balanceOf(from),
                                        "ERC20: transfer amount exceeds balance"
                                    );
                                    _setBalance(from, _balanceOf(from).sub(value));
                                    _setBalance(to, _balanceOf(to).add(value));
                                    emit Transfer(from, to, value);
                                }
                                /**
                                 * @notice Adds or updates a new minter with a mint allowance.
                                 * @param minter The address of the minter.
                                 * @param minterAllowedAmount The minting amount allowed for the minter.
                                 * @return True if the operation was successful.
                                 */
                                function configureMinter(address minter, uint256 minterAllowedAmount)
                                    external
                                    whenNotPaused
                                    onlyMasterMinter
                                    returns (bool)
                                {
                                    minters[minter] = true;
                                    minterAllowed[minter] = minterAllowedAmount;
                                    emit MinterConfigured(minter, minterAllowedAmount);
                                    return true;
                                }
                                /**
                                 * @notice Removes a minter.
                                 * @param minter The address of the minter to remove.
                                 * @return True if the operation was successful.
                                 */
                                function removeMinter(address minter)
                                    external
                                    onlyMasterMinter
                                    returns (bool)
                                {
                                    minters[minter] = false;
                                    minterAllowed[minter] = 0;
                                    emit MinterRemoved(minter);
                                    return true;
                                }
                                /**
                                 * @notice Allows a minter to burn some of its own tokens.
                                 * @dev The caller must be a minter, must not be blacklisted, and the amount to burn
                                 * should be less than or equal to the account's balance.
                                 * @param _amount the amount of tokens to be burned.
                                 */
                                function burn(uint256 _amount)
                                    external
                                    whenNotPaused
                                    onlyMinters
                                    notBlacklisted(msg.sender)
                                {
                                    uint256 balance = _balanceOf(msg.sender);
                                    require(_amount > 0, "FiatToken: burn amount not greater than 0");
                                    require(balance >= _amount, "FiatToken: burn amount exceeds balance");
                                    totalSupply_ = totalSupply_.sub(_amount);
                                    _setBalance(msg.sender, balance.sub(_amount));
                                    emit Burn(msg.sender, _amount);
                                    emit Transfer(msg.sender, address(0), _amount);
                                }
                                /**
                                 * @notice Updates the master minter address.
                                 * @param _newMasterMinter The address of the new master minter.
                                 */
                                function updateMasterMinter(address _newMasterMinter) external onlyOwner {
                                    require(
                                        _newMasterMinter != address(0),
                                        "FiatToken: new masterMinter is the zero address"
                                    );
                                    masterMinter = _newMasterMinter;
                                    emit MasterMinterChanged(masterMinter);
                                }
                                /**
                                 * @inheritdoc Blacklistable
                                 */
                                function _blacklist(address _account) internal override {
                                    _setBlacklistState(_account, true);
                                }
                                /**
                                 * @inheritdoc Blacklistable
                                 */
                                function _unBlacklist(address _account) internal override {
                                    _setBlacklistState(_account, false);
                                }
                                /**
                                 * @dev Helper method that sets the blacklist state of an account.
                                 * @param _account         The address of the account.
                                 * @param _shouldBlacklist True if the account should be blacklisted, false if the account should be unblacklisted.
                                 */
                                function _setBlacklistState(address _account, bool _shouldBlacklist)
                                    internal
                                    virtual
                                {
                                    _deprecatedBlacklisted[_account] = _shouldBlacklist;
                                }
                                /**
                                 * @dev Helper method that sets the balance of an account.
                                 * @param _account The address of the account.
                                 * @param _balance The new fiat token balance of the account.
                                 */
                                function _setBalance(address _account, uint256 _balance) internal virtual {
                                    balanceAndBlacklistStates[_account] = _balance;
                                }
                                /**
                                 * @inheritdoc Blacklistable
                                 */
                                function _isBlacklisted(address _account)
                                    internal
                                    virtual
                                    override
                                    view
                                    returns (bool)
                                {
                                    return _deprecatedBlacklisted[_account];
                                }
                                /**
                                 * @dev Helper method to obtain the balance of an account.
                                 * @param _account  The address of the account.
                                 * @return          The fiat token balance of the account.
                                 */
                                function _balanceOf(address _account)
                                    internal
                                    virtual
                                    view
                                    returns (uint256)
                                {
                                    return balanceAndBlacklistStates[_account];
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { Ownable } from "./Ownable.sol";
                            /**
                             * @title Blacklistable Token
                             * @dev Allows accounts to be blacklisted by a "blacklister" role
                             */
                            abstract contract Blacklistable is Ownable {
                                address public blacklister;
                                mapping(address => bool) internal _deprecatedBlacklisted;
                                event Blacklisted(address indexed _account);
                                event UnBlacklisted(address indexed _account);
                                event BlacklisterChanged(address indexed newBlacklister);
                                /**
                                 * @dev Throws if called by any account other than the blacklister.
                                 */
                                modifier onlyBlacklister() {
                                    require(
                                        msg.sender == blacklister,
                                        "Blacklistable: caller is not the blacklister"
                                    );
                                    _;
                                }
                                /**
                                 * @dev Throws if argument account is blacklisted.
                                 * @param _account The address to check.
                                 */
                                modifier notBlacklisted(address _account) {
                                    require(
                                        !_isBlacklisted(_account),
                                        "Blacklistable: account is blacklisted"
                                    );
                                    _;
                                }
                                /**
                                 * @notice Checks if account is blacklisted.
                                 * @param _account The address to check.
                                 * @return True if the account is blacklisted, false if the account is not blacklisted.
                                 */
                                function isBlacklisted(address _account) external view returns (bool) {
                                    return _isBlacklisted(_account);
                                }
                                /**
                                 * @notice Adds account to blacklist.
                                 * @param _account The address to blacklist.
                                 */
                                function blacklist(address _account) external onlyBlacklister {
                                    _blacklist(_account);
                                    emit Blacklisted(_account);
                                }
                                /**
                                 * @notice Removes account from blacklist.
                                 * @param _account The address to remove from the blacklist.
                                 */
                                function unBlacklist(address _account) external onlyBlacklister {
                                    _unBlacklist(_account);
                                    emit UnBlacklisted(_account);
                                }
                                /**
                                 * @notice Updates the blacklister address.
                                 * @param _newBlacklister The address of the new blacklister.
                                 */
                                function updateBlacklister(address _newBlacklister) external onlyOwner {
                                    require(
                                        _newBlacklister != address(0),
                                        "Blacklistable: new blacklister is the zero address"
                                    );
                                    blacklister = _newBlacklister;
                                    emit BlacklisterChanged(blacklister);
                                }
                                /**
                                 * @dev Checks if account is blacklisted.
                                 * @param _account The address to check.
                                 * @return true if the account is blacklisted, false otherwise.
                                 */
                                function _isBlacklisted(address _account)
                                    internal
                                    virtual
                                    view
                                    returns (bool);
                                /**
                                 * @dev Helper method that blacklists an account.
                                 * @param _account The address to blacklist.
                                 */
                                function _blacklist(address _account) internal virtual;
                                /**
                                 * @dev Helper method that unblacklists an account.
                                 * @param _account The address to unblacklist.
                                 */
                                function _unBlacklist(address _account) internal virtual;
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                            abstract contract AbstractFiatTokenV1 is IERC20 {
                                function _approve(
                                    address owner,
                                    address spender,
                                    uint256 value
                                ) internal virtual;
                                function _transfer(
                                    address from,
                                    address to,
                                    uint256 value
                                ) internal virtual;
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { Ownable } from "../v1/Ownable.sol";
                            import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
                            import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
                            contract Rescuable is Ownable {
                                using SafeERC20 for IERC20;
                                address private _rescuer;
                                event RescuerChanged(address indexed newRescuer);
                                /**
                                 * @notice Returns current rescuer
                                 * @return Rescuer's address
                                 */
                                function rescuer() external view returns (address) {
                                    return _rescuer;
                                }
                                /**
                                 * @notice Revert if called by any account other than the rescuer.
                                 */
                                modifier onlyRescuer() {
                                    require(msg.sender == _rescuer, "Rescuable: caller is not the rescuer");
                                    _;
                                }
                                /**
                                 * @notice Rescue ERC20 tokens locked up in this contract.
                                 * @param tokenContract ERC20 token contract address
                                 * @param to        Recipient address
                                 * @param amount    Amount to withdraw
                                 */
                                function rescueERC20(
                                    IERC20 tokenContract,
                                    address to,
                                    uint256 amount
                                ) external onlyRescuer {
                                    tokenContract.safeTransfer(to, amount);
                                }
                                /**
                                 * @notice Updates the rescuer address.
                                 * @param newRescuer The address of the new rescuer.
                                 */
                                function updateRescuer(address newRescuer) external onlyOwner {
                                    require(
                                        newRescuer != address(0),
                                        "Rescuable: new rescuer is the zero address"
                                    );
                                    _rescuer = newRescuer;
                                    emit RescuerChanged(newRescuer);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { FiatTokenV1 } from "../v1/FiatTokenV1.sol";
                            import { Rescuable } from "./Rescuable.sol";
                            /**
                             * @title FiatTokenV1_1
                             * @dev ERC20 Token backed by fiat reserves
                             */
                            contract FiatTokenV1_1 is FiatTokenV1, Rescuable {
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            import { ECRecover } from "./ECRecover.sol";
                            import { IERC1271 } from "../interface/IERC1271.sol";
                            /**
                             * @dev Signature verification helper that can be used instead of `ECRecover.recover` to seamlessly support both ECDSA
                             * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets.
                             *
                             * Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/21bb89ef5bfc789b9333eb05e3ba2b7b284ac77c/contracts/utils/cryptography/SignatureChecker.sol
                             */
                            library SignatureChecker {
                                /**
                                 * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
                                 * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECRecover.recover`.
                                 * @param signer        Address of the claimed signer
                                 * @param digest        Keccak-256 hash digest of the signed message
                                 * @param signature     Signature byte array associated with hash
                                 */
                                function isValidSignatureNow(
                                    address signer,
                                    bytes32 digest,
                                    bytes memory signature
                                ) external view returns (bool) {
                                    if (!isContract(signer)) {
                                        return ECRecover.recover(digest, signature) == signer;
                                    }
                                    return isValidERC1271SignatureNow(signer, digest, signature);
                                }
                                /**
                                 * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
                                 * against the signer smart contract using ERC1271.
                                 * @param signer        Address of the claimed signer
                                 * @param digest        Keccak-256 hash digest of the signed message
                                 * @param signature     Signature byte array associated with hash
                                 *
                                 * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
                                 * change through time. It could return true at block N and false at block N+1 (or the opposite).
                                 */
                                function isValidERC1271SignatureNow(
                                    address signer,
                                    bytes32 digest,
                                    bytes memory signature
                                ) internal view returns (bool) {
                                    (bool success, bytes memory result) = signer.staticcall(
                                        abi.encodeWithSelector(
                                            IERC1271.isValidSignature.selector,
                                            digest,
                                            signature
                                        )
                                    );
                                    return (success &&
                                        result.length >= 32 &&
                                        abi.decode(result, (bytes32)) ==
                                        bytes32(IERC1271.isValidSignature.selector));
                                }
                                /**
                                 * @dev Checks if the input address is a smart contract.
                                 */
                                function isContract(address addr) internal view returns (bool) {
                                    uint256 size;
                                    assembly {
                                        size := extcodesize(addr)
                                    }
                                    return size > 0;
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            /**
                             * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
                             *
                             * The library provides methods for generating a hash of a message that conforms to the
                             * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
                             * specifications.
                             */
                            library MessageHashUtils {
                                /**
                                 * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
                                 * Adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/21bb89ef5bfc789b9333eb05e3ba2b7b284ac77c/contracts/utils/cryptography/MessageHashUtils.sol
                                 *
                                 * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
                                 * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the
                                 * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
                                 *
                                 * @param domainSeparator    Domain separator
                                 * @param structHash         Hashed EIP-712 data struct
                                 * @return digest            The keccak256 digest of an EIP-712 typed data
                                 */
                                function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash)
                                    internal
                                    pure
                                    returns (bytes32 digest)
                                {
                                    assembly {
                                        let ptr := mload(0x40)
                                        mstore(ptr, "\\x19\\x01")
                                        mstore(add(ptr, 0x02), domainSeparator)
                                        mstore(add(ptr, 0x22), structHash)
                                        digest := keccak256(ptr, 0x42)
                                    }
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            /**
                             * @title EIP712
                             * @notice A library that provides EIP712 helper functions
                             */
                            library EIP712 {
                                /**
                                 * @notice Make EIP712 domain separator
                                 * @param name      Contract name
                                 * @param version   Contract version
                                 * @param chainId   Blockchain ID
                                 * @return Domain separator
                                 */
                                function makeDomainSeparator(
                                    string memory name,
                                    string memory version,
                                    uint256 chainId
                                ) internal view returns (bytes32) {
                                    return
                                        keccak256(
                                            abi.encode(
                                                // keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
                                                0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
                                                keccak256(bytes(name)),
                                                keccak256(bytes(version)),
                                                chainId,
                                                address(this)
                                            )
                                        );
                                }
                                /**
                                 * @notice Make EIP712 domain separator
                                 * @param name      Contract name
                                 * @param version   Contract version
                                 * @return Domain separator
                                 */
                                function makeDomainSeparator(string memory name, string memory version)
                                    internal
                                    view
                                    returns (bytes32)
                                {
                                    uint256 chainId;
                                    assembly {
                                        chainId := chainid()
                                    }
                                    return makeDomainSeparator(name, version, chainId);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            /**
                             * @title ECRecover
                             * @notice A library that provides a safe ECDSA recovery function
                             */
                            library ECRecover {
                                /**
                                 * @notice Recover signer's address from a signed message
                                 * @dev Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/65e4ffde586ec89af3b7e9140bdc9235d1254853/contracts/cryptography/ECDSA.sol
                                 * Modifications: Accept v, r, and s as separate arguments
                                 * @param digest    Keccak-256 hash digest of the signed message
                                 * @param v         v of the signature
                                 * @param r         r of the signature
                                 * @param s         s of the signature
                                 * @return Signer address
                                 */
                                function recover(
                                    bytes32 digest,
                                    uint8 v,
                                    bytes32 r,
                                    bytes32 s
                                ) internal pure returns (address) {
                                    // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
                                    // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
                                    // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
                                    // signatures from current libraries generate a unique signature with an s-value in the lower half order.
                                    //
                                    // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
                                    // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
                                    // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
                                    // these malleable signatures as well.
                                    if (
                                        uint256(s) >
                                        0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0
                                    ) {
                                        revert("ECRecover: invalid signature 's' value");
                                    }
                                    if (v != 27 && v != 28) {
                                        revert("ECRecover: invalid signature 'v' value");
                                    }
                                    // If the signature is valid (and not malleable), return the signer address
                                    address signer = ecrecover(digest, v, r, s);
                                    require(signer != address(0), "ECRecover: invalid signature");
                                    return signer;
                                }
                                /**
                                 * @notice Recover signer's address from a signed message
                                 * @dev Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/0053ee040a7ff1dbc39691c9e67a69f564930a88/contracts/utils/cryptography/ECDSA.sol
                                 * @param digest    Keccak-256 hash digest of the signed message
                                 * @param signature Signature byte array associated with hash
                                 * @return Signer address
                                 */
                                function recover(bytes32 digest, bytes memory signature)
                                    internal
                                    pure
                                    returns (address)
                                {
                                    require(signature.length == 65, "ECRecover: invalid signature length");
                                    bytes32 r;
                                    bytes32 s;
                                    uint8 v;
                                    // ecrecover takes the signature parameters, and the only way to get them
                                    // currently is to use assembly.
                                    /// @solidity memory-safe-assembly
                                    assembly {
                                        r := mload(add(signature, 0x20))
                                        s := mload(add(signature, 0x40))
                                        v := byte(0, mload(add(signature, 0x60)))
                                    }
                                    return recover(digest, v, r, s);
                                }
                            }
                            /**
                             * SPDX-License-Identifier: Apache-2.0
                             *
                             * Copyright (c) 2023, Circle Internet Financial, LLC.
                             *
                             * 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.
                             */
                            pragma solidity 0.6.12;
                            /**
                             * @dev Interface of the ERC1271 standard signature validation method for
                             * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
                             */
                            interface IERC1271 {
                                /**
                                 * @dev Should return whether the signature provided is valid for the provided data
                                 * @param hash          Hash of the data to be signed
                                 * @param signature     Signature byte array associated with the provided data hash
                                 * @return magicValue   bytes4 magic value 0x1626ba7e when function passes
                                 */
                                function isValidSignature(bytes32 hash, bytes memory signature)
                                    external
                                    view
                                    returns (bytes4 magicValue);
                            }