xDAI Price: $0.999732 (-0.02%)

Contract

0x3b05B902Fe763AD87Aa755Fab70F86c76Bf331F4

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Transfer Tokens ...438535362025-12-27 4:16:4519 days ago1766809005IN
0x3b05B902...76Bf331F4
0.10435141 XDAI0.000000020.0001
Transfer Tokens ...429236132025-11-01 12:15:3075 days ago1761999330IN
0x3b05B902...76Bf331F4
0.10136414 XDAI0.000000630.00281974
Transfer Tokens ...425633942025-10-11 4:21:4596 days ago1760156505IN
0x3b05B902...76Bf331F4
0.10197757 XDAI0.000000710.00315046
Transfer Tokens ...425627212025-10-11 3:24:2096 days ago1760153060IN
0x3b05B902...76Bf331F4
0.10557785 XDAI0.000000710.0031866
Transfer Tokens ...417979312025-08-26 8:51:55142 days ago1756198315IN
0x3b05B902...76Bf331F4
0.10829908 XDAI0.000044220.2
Transfer Tokens ...415201722025-08-09 16:52:45159 days ago1754758365IN
0x3b05B902...76Bf331F4
0.12915679 XDAI0.000022590.1
Transfer Tokens ...410801372025-07-14 8:49:00185 days ago1752482940IN
0x3b05B902...76Bf331F4
0.11458214 XDAI0.000067770.3
Transfer Tokens ...410655982025-07-13 11:28:25186 days ago1752406105IN
0x3b05B902...76Bf331F4
0.1050957 XDAI0.000067780.3
Transfer Tokens ...410655492025-07-13 11:24:10186 days ago1752405850IN
0x3b05B902...76Bf331F4
0.10480474 XDAI0.000000020.0001
Transfer Tokens ...410651732025-07-13 10:51:55186 days ago1752403915IN
0x3b05B902...76Bf331F4
0.10443098 XDAI0.000000020.0001
Transfer Tokens ...410650852025-07-13 10:44:20186 days ago1752403460IN
0x3b05B902...76Bf331F4
0.1044659 XDAI0.000067780.3
Transfer Tokens ...410646622025-07-13 10:07:55186 days ago1752401275IN
0x3b05B902...76Bf331F4
0.10449013 XDAI0.000000020.0001
Transfer Tokens ...410645312025-07-13 9:56:10186 days ago1752400570IN
0x3b05B902...76Bf331F4
0.10465498 XDAI0.000067770.3
Transfer Tokens ...410640882025-07-13 9:18:10186 days ago1752398290IN
0x3b05B902...76Bf331F4
0.10437544 XDAI0.000067770.3
Transfer Tokens ...410639562025-07-13 9:06:55186 days ago1752397615IN
0x3b05B902...76Bf331F4
0.10437544 XDAI0.000000020.0001
Transfer Tokens ...410511152025-07-12 14:18:40187 days ago1752329920IN
0x3b05B902...76Bf331F4
0.11720455 XDAI0.000067770.3
Transfer Tokens ...410510052025-07-12 14:09:10187 days ago1752329350IN
0x3b05B902...76Bf331F4
0.11345042 XDAI0.000474442.1
Transfer Tokens ...410508862025-07-12 13:58:45187 days ago1752328725IN
0x3b05B902...76Bf331F4
0.11385724 XDAI0.000067770.3
Transfer Tokens ...410507852025-07-12 13:49:35187 days ago1752328175IN
0x3b05B902...76Bf331F4
0.11672299 XDAI0.000066330.3
Transfer Tokens ...410506942025-07-12 13:41:25187 days ago1752327685IN
0x3b05B902...76Bf331F4
0.11584757 XDAI0.000066330.3
Transfer Tokens ...410505042025-07-12 13:24:15187 days ago1752326655IN
0x3b05B902...76Bf331F4
0.1114586 XDAI0.000066330.3
Transfer Tokens ...410502982025-07-12 13:06:15187 days ago1752325575IN
0x3b05B902...76Bf331F4
0.11971301 XDAI0.000066330.3
Transfer Tokens ...410279462025-07-11 4:28:55188 days ago1752208135IN
0x3b05B902...76Bf331F4
0.10570217 XDAI0.000002210.01
Transfer Tokens ...408197102025-06-28 19:25:40200 days ago1751138740IN
0x3b05B902...76Bf331F4
0.10439475 XDAI00.00000009
Transfer Tokens ...404634562025-06-07 15:16:00222 days ago1749309360IN
0x3b05B902...76Bf331F4
0.1066807 XDAI00.00000008
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
438535362025-12-27 4:16:4519 days ago1766809005
0x3b05B902...76Bf331F4
0.10331823 XDAI
438535362025-12-27 4:16:4519 days ago1766809005
0x3b05B902...76Bf331F4
0.00103318 XDAI
429236132025-11-01 12:15:3075 days ago1761999330
0x3b05B902...76Bf331F4
0.10036053 XDAI
429236132025-11-01 12:15:3075 days ago1761999330
0x3b05B902...76Bf331F4
0.0010036 XDAI
425633942025-10-11 4:21:4596 days ago1760156505
0x3b05B902...76Bf331F4
0.10106776 XDAI
425633942025-10-11 4:21:4596 days ago1760156505
0x3b05B902...76Bf331F4
0.0009098 XDAI
425627212025-10-11 3:24:2096 days ago1760153060
0x3b05B902...76Bf331F4
0.10453252 XDAI
425627212025-10-11 3:24:2096 days ago1760153060
0x3b05B902...76Bf331F4
0.00104532 XDAI
417979312025-08-26 8:51:55142 days ago1756198315
0x3b05B902...76Bf331F4
0.10722681 XDAI
417979312025-08-26 8:51:55142 days ago1756198315
0x3b05B902...76Bf331F4
0.00107226 XDAI
415201722025-08-09 16:52:45159 days ago1754758365
0x3b05B902...76Bf331F4
0.12787801 XDAI
415201722025-08-09 16:52:45159 days ago1754758365
0x3b05B902...76Bf331F4
0.00127878 XDAI
410801372025-07-14 8:49:00185 days ago1752482940
0x3b05B902...76Bf331F4
0.11344766 XDAI
410801372025-07-14 8:49:00185 days ago1752482940
0x3b05B902...76Bf331F4
0.00113447 XDAI
410655982025-07-13 11:28:25186 days ago1752406105
0x3b05B902...76Bf331F4
0.10405515 XDAI
410655982025-07-13 11:28:25186 days ago1752406105
0x3b05B902...76Bf331F4
0.00104055 XDAI
410655492025-07-13 11:24:10186 days ago1752405850
0x3b05B902...76Bf331F4
0.10376707 XDAI
410655492025-07-13 11:24:10186 days ago1752405850
0x3b05B902...76Bf331F4
0.00103767 XDAI
410651732025-07-13 10:51:55186 days ago1752403915
0x3b05B902...76Bf331F4
0.10339701 XDAI
410651732025-07-13 10:51:55186 days ago1752403915
0x3b05B902...76Bf331F4
0.00103397 XDAI
410650852025-07-13 10:44:20186 days ago1752403460
0x3b05B902...76Bf331F4
0.10343159 XDAI
410650852025-07-13 10:44:20186 days ago1752403460
0x3b05B902...76Bf331F4
0.00103431 XDAI
410646622025-07-13 10:07:55186 days ago1752401275
0x3b05B902...76Bf331F4
0.10345558 XDAI
410646622025-07-13 10:07:55186 days ago1752401275
0x3b05B902...76Bf331F4
0.00103455 XDAI
410645312025-07-13 9:56:10186 days ago1752400570
0x3b05B902...76Bf331F4
0.10361879 XDAI
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SynthereumCCIPBridge

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.9;

import {IERC20} from '../../@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {IMintableBurnableERC20} from '../tokens/interfaces/IMintableBurnableERC20.sol';
import {ISynthereumFinder} from '../core/interfaces/IFinder.sol';
import {ISynthereumCCIPBridge} from './interfaces/ICCIPBridge.sol';
import {SynthereumInterfaces} from '../core/Constants.sol';
import {Address} from '../../@openzeppelin/contracts/utils/Address.sol';
import {SafeERC20} from '../../@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import {SafeCast} from '../../@openzeppelin/contracts/utils/math/SafeCast.sol';
import {Context} from '../../@openzeppelin/contracts/utils/Context.sol';
import {ERC2771Context} from '../common/ERC2771Context.sol';
import {ReentrancyGuard} from '../../@openzeppelin/contracts/security/ReentrancyGuard.sol';
import {Client} from '../../@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol';
import {CCIPReceiver} from './CCIPReceiver.sol';
import {AccessControlEnumerable} from '../../@openzeppelin/contracts/access/AccessControlEnumerable.sol';
import {StandardAccessControlEnumerable} from '../common/roles/StandardAccessControlEnumerable.sol';

/**
 * @title Synthereum CCIP bridge for moving synthetic assets cross-chain
 */
contract SynthereumCCIPBridge is
  ISynthereumCCIPBridge,
  ERC2771Context,
  ReentrancyGuard,
  StandardAccessControlEnumerable,
  CCIPReceiver
{
  using Address for address payable;
  using SafeERC20 for IERC20;
  using SafeERC20 for IMintableBurnableERC20;
  using SafeCast for uint256;

  struct MessageEndpoints {
    address contractSender;
    address contractReceiver;
  }

  struct TransferTokensCache {
    address messageReceiver;
    int256 actualBridgedAmount;
    int256 amount;
    address msgSender;
  }

  //----------------------------------------
  // Storage
  //----------------------------------------
  ISynthereumFinder public immutable synthereumFinder;

  mapping(uint64 => MessageEndpoints) internal endpoints;

  mapping(uint64 => Client.EVMExtraArgsV1) internal extraArgs;

  mapping(IMintableBurnableERC20 => mapping(uint64 => IMintableBurnableERC20))
    internal tokensMap;

  mapping(uint64 => bool) freeFee;

  mapping(IMintableBurnableERC20 => mapping(uint64 => int256)) chainBridgedAmount;

  mapping(IMintableBurnableERC20 => int256) totalBridgedAmount;

  mapping(IMintableBurnableERC20 => mapping(uint64 => uint256)) chainMaxAmount;

  //----------------------------------------
  // Events
  //----------------------------------------
  event EndpointsSet(
    uint64 indexed chainSelector,
    address messageSender,
    address messageReceiver
  );

  event EndpointsRemoved(uint64 indexed chainSelector);

  event ExtraArgsSet(
    uint64 indexed chainSelector,
    uint256 gasLimit,
    bool strict
  );

  event ExtraArgsRemoved(uint64 indexed chainSelector);

  event TokenMapped(
    IMintableBurnableERC20 indexed sourceToken,
    uint64 indexed chainSelector,
    IMintableBurnableERC20 indexed destinationToken
  );

  event TokenUnmapped(
    IMintableBurnableERC20 indexed sourceToken,
    uint64 indexed chainSelector
  );

  event MaxChainAmountSet(
    IMintableBurnableERC20 indexed sourceToken,
    uint64 indexed chainSelector,
    uint256 maxAmount
  );

  event MaxChainAmountRemoved(
    IMintableBurnableERC20 indexed sourceToken,
    uint64 indexed chainSelector
  );

  event FreeFeeSet(uint64 indexed chainSelector, bool indexed isFree);

  // Event emitted when the tokens are burned on the source chain and the message sent to ccipi
  event TransferInitiated(
    bytes32 indexed messageId,
    uint64 indexed destinationChainSelector,
    address destinationEndpoint,
    IMintableBurnableERC20 sourceToken,
    IMintableBurnableERC20 destinationToken,
    uint256 amount,
    address sender,
    address receiver,
    address feeToken,
    uint256 fees
  );

  // Event emitted when message is received from ccip and the tokens are minted on the destination chain
  event TransferCompleted(
    bytes32 indexed messageId,
    uint64 indexed sourceChainSelector,
    address sourceEndpoint,
    IMintableBurnableERC20 sourceToken,
    IMintableBurnableERC20 destinationToken,
    uint256 amount,
    address receiver
  );

  //----------------------------------------
  // Constructor
  //----------------------------------------
  /**
   * @notice Constructs the SynthereumCCIPBridge contract
   * @param _synthereumFinder Synthereum finder contract
   * @param _router Chainlink CCIP router
   * @param _roles Admin and Mainteiner roles
   */
  constructor(
    ISynthereumFinder _synthereumFinder,
    address _router,
    Roles memory _roles
  ) CCIPReceiver(_router) {
    synthereumFinder = _synthereumFinder;
    _setAdmin(_roles.admin);
    _setMaintainer(_roles.maintainer);
  }

  receive() external payable {}

  //----------------------------------------
  // External functions
  //----------------------------------------

  /**
   * @notice Set new router
   * @notice Only maintainer can call this function
   * @param _router Address of the new router
   */
  function setRouter(address _router) external onlyMaintainer {
    _setRouter(_router);
  }

  /**
   * @notice Set sender and receiver endpoint for a chain
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector of the destination chain
   * @param _msgSenderEndpoint Sender endpoint for the destination chain in input
   * @param _msgReceiverEndpoint Receiver endpoint for the destination chain in input
   */
  function setEndpoints(
    uint64 _chainSelector,
    address _msgSenderEndpoint,
    address _msgReceiverEndpoint
  ) external onlyMaintainer {
    require(i_router.isChainSupported(_chainSelector), 'Chain not supported');
    require(
      _msgSenderEndpoint != address(0) && _msgReceiverEndpoint != address(0),
      'Null input endpoint'
    );
    endpoints[_chainSelector] = MessageEndpoints(
      _msgSenderEndpoint,
      _msgReceiverEndpoint
    );
    emit EndpointsSet(_chainSelector, _msgSenderEndpoint, _msgReceiverEndpoint);
  }

  /**
   * @notice Remove sender and receiver endpoint for a chain
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector of the destination chain
   */
  function removeEndpoints(uint64 _chainSelector) external onlyMaintainer {
    require(
      endpoints[_chainSelector].contractSender != address(0) &&
        endpoints[_chainSelector].contractReceiver != address(0),
      'Endpoints not supported'
    );
    delete endpoints[_chainSelector];
    emit EndpointsRemoved(_chainSelector);
  }

  /**
   * @notice Set extra args for a chain
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector
   * @param _gasLimit CCIP gas limit for executing transaction by CCIP protocol on on the destination chain in input
   * @param _strict CCIP flag for stop the execution of the queue on the input chain in case of error
   */
  function setExtraArgs(
    uint64 _chainSelector,
    uint256 _gasLimit,
    bool _strict
  ) external onlyMaintainer {
    require(i_router.isChainSupported(_chainSelector), 'Chain not supported');
    require(_gasLimit != 0, 'Null gas input');
    extraArgs[_chainSelector] = Client.EVMExtraArgsV1(_gasLimit, _strict);
    emit ExtraArgsSet(_chainSelector, _gasLimit, _strict);
  }

  /**
   * @notice Remove extra args for a chain
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector of the destination chain
   */
  function removeExtraArgs(uint64 _chainSelector) external onlyMaintainer {
    require(extraArgs[_chainSelector].gasLimit != 0, 'Args not supported');
    delete extraArgs[_chainSelector];
    emit ExtraArgsRemoved(_chainSelector);
  }

  /**
   * @notice Map tokens between this chain and a destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @param _srcTokens List of tokens on this chain
   * @param _destTokens List of tokens on the destination chain in input
   */
  function setMappedTokens(
    uint64 _chainSelector,
    IMintableBurnableERC20[] calldata _srcTokens,
    IMintableBurnableERC20[] calldata _destTokens
  ) external onlyMaintainer {
    require(i_router.isChainSupported(_chainSelector), 'Chain not supported');
    uint256 tokensNumber = _srcTokens.length;
    require(tokensNumber > 0, 'No tokens passed');
    require(
      tokensNumber == _destTokens.length,
      'Src and dest tokens do not match'
    );
    for (uint256 j = 0; j < tokensNumber; ) {
      require(
        address(_srcTokens[j]) != address(0) &&
          address(_destTokens[j]) != address(0),
        'Null token'
      );
      tokensMap[_srcTokens[j]][_chainSelector] = _destTokens[j];
      emit TokenMapped(_srcTokens[j], _chainSelector, _destTokens[j]);
      unchecked {
        j++;
      }
    }
  }

  /**
   * @notice Remove mapped tokens between this chain and a destination chain
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector of the destination chain
   * @param _srcTokens List of tokens on this chain to be removed
   */
  function removeMappedTokens(
    uint64 _chainSelector,
    IMintableBurnableERC20[] calldata _srcTokens
  ) external onlyMaintainer {
    uint256 tokensNumber = _srcTokens.length;
    require(tokensNumber > 0, 'No tokens passed');
    for (uint256 j = 0; j < tokensNumber; ) {
      require(
        address(tokensMap[_srcTokens[j]][_chainSelector]) != address(0),
        'Token not supported'
      );
      delete tokensMap[_srcTokens[j]][_chainSelector];
      emit TokenUnmapped(_srcTokens[j], _chainSelector);
      unchecked {
        j++;
      }
    }
  }

  /**
   * @notice Set max amount of a token that can be bridged on a destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @param _srcTokens List of tokens on this chain
   * @param _amounts List of the max amounts
   */
  function setMaxChainAmount(
    uint64 _chainSelector,
    IMintableBurnableERC20[] calldata _srcTokens,
    uint256[] calldata _amounts
  ) external onlyMaintainer {
    require(i_router.isChainSupported(_chainSelector), 'Chain not supported');
    uint256 tokensNumber = _srcTokens.length;
    require(tokensNumber > 0, 'No tokens passed');
    require(
      tokensNumber == _amounts.length,
      'Src tokens and amounts do not match'
    );
    for (uint256 j = 0; j < tokensNumber; ) {
      require(address(_srcTokens[j]) != address(0), 'Null token');
      require(_amounts[j] > 0, 'Null amount');
      chainMaxAmount[_srcTokens[j]][_chainSelector] = _amounts[j];
      emit MaxChainAmountSet(_srcTokens[j], _chainSelector, _amounts[j]);
      unchecked {
        j++;
      }
    }
  }

  /**
   * @notice Remove  max amount of a token that can be bridged on a destination chain
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector of the destination chain
   * @param _srcTokens List of tokens on this chain whose max amount are removed
   */
  function removeMaxChainAmount(
    uint64 _chainSelector,
    IMintableBurnableERC20[] calldata _srcTokens
  ) external onlyMaintainer {
    uint256 tokensNumber = _srcTokens.length;
    require(tokensNumber > 0, 'No tokens passed');
    for (uint256 j = 0; j < tokensNumber; ) {
      require(
        chainMaxAmount[_srcTokens[j]][_chainSelector] != 0,
        'Max amount not set'
      );
      delete chainMaxAmount[_srcTokens[j]][_chainSelector];
      emit MaxChainAmountRemoved(_srcTokens[j], _chainSelector);
      unchecked {
        j++;
      }
    }
  }

  /**
   * @notice Set fee to free or not
   * @notice Only maintainer can call this function
   * @param _chainSelector CCIP chain selector of the destination chain
   * @param _isFree True if free, otherwise false
   */
  function setFreeFee(uint64 _chainSelector, bool _isFree)
    external
    onlyMaintainer
  {
    require(freeFee[_chainSelector] != _isFree, 'Free fee already set');
    freeFee[_chainSelector] = _isFree;
    emit FreeFeeSet(_chainSelector, _isFree);
  }

  /**
   * @notice Burn tokens on this chain and trigger CCIP bridge for receiving on the destination chain
   * @param _destinationChainSelector CCIP chain selector of the destination chain
   * @param _token Address of the synth token to bridge
   * @param _amount Amount to bridge
   * @param _recipient Address to which receive synth tokens on the destination chain
   * @param _feeToken Address of the token used to pay fees for bridging
   * @return messageId CCIP output message id
   * @return fees Amount of fees to be paid
   */
  function transferTokensToDestinationChain(
    uint64 _destinationChainSelector,
    address _token,
    uint256 _amount,
    address _recipient,
    address _feeToken
  ) external payable nonReentrant returns (bytes32 messageId, uint256 fees) {
    TransferTokensCache memory cache;
    cache.messageReceiver = getDestEndpoint(_destinationChainSelector);
    IMintableBurnableERC20 destToken = IMintableBurnableERC20(
      getMappedToken(_token, _destinationChainSelector)
    );

    cache.actualBridgedAmount = chainBridgedAmount[
      IMintableBurnableERC20(_token)
    ][_destinationChainSelector];
    cache.amount = _amount.toInt256();
    require(
      cache.amount - cache.actualBridgedAmount <=
        chainMaxAmount[IMintableBurnableERC20(_token)][
          _destinationChainSelector
        ].toInt256(),
      'Max bridged amount reached'
    );

    cache.msgSender = _msgSender();
    (messageId, fees) = _burnAndSendCCIPMessage(
      _destinationChainSelector,
      cache.messageReceiver,
      IMintableBurnableERC20(_token),
      destToken,
      _amount,
      cache.msgSender,
      _recipient,
      _feeToken
    );

    chainBridgedAmount[IMintableBurnableERC20(_token)][
      _destinationChainSelector
    ] = cache.actualBridgedAmount - cache.amount;
    totalBridgedAmount[IMintableBurnableERC20(_token)] -= cache.amount;

    // Emit an event with message details
    emit TransferInitiated(
      messageId,
      _destinationChainSelector,
      cache.messageReceiver,
      IMintableBurnableERC20(_token),
      destToken,
      _amount,
      cache.msgSender,
      _recipient,
      _feeToken,
      fees
    );
  }

  /**
   * @notice Withdraw deposited native tokens
   * @notice Only maintainer can call this function
   * @param _beneficiary Address used for receiving native tokens
   */
  function withdraw(address payable _beneficiary)
    external
    onlyMaintainer
    nonReentrant
  {
    // Retrieve the balance of this contract
    uint256 amount = address(this).balance;

    // Revert if there is nothing to withdraw
    require(amount > 0, 'Nothing to withdraw');

    // Attempt to send the funds, capturing the success status and discarding any return data
    _beneficiary.sendValue(amount);
  }

  /**
   * @notice Withdraw deposited ERC20 tokens
   * @notice Only maintainer can call this function
   * @param _token Address of the token to withdraw
   * @param _beneficiary Address used for receiving ERC20 tokens
   */
  function withdrawToken(address _token, address _beneficiary)
    external
    onlyMaintainer
    nonReentrant
  {
    // Retrieve the balance of this contract
    uint256 amount = IERC20(_token).balanceOf(address(this));

    // Revert if there is nothing to withdraw
    require(amount > 0, 'Nothing to withdraw');

    IERC20(_token).safeTransfer(_beneficiary, amount);
  }

  /**
   * @notice Check if a token is whitelisted for a destination chain
   * @param _token Address of the token on this chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if token is whitelisted, otherwise false
   */
  function isTokenWhitelisted(address _token, uint64 _chainSelector)
    external
    view
    returns (bool)
  {
    return
      address(tokensMap[IMintableBurnableERC20(_token)][_chainSelector]) !=
      address(0);
  }

  /**
   * @notice Check if endpoints are supported for a destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if endpoints are supported, otherwise false
   */
  function isEndpointSupported(uint64 _chainSelector)
    external
    view
    returns (bool)
  {
    return
      endpoints[_chainSelector].contractSender != address(0) &&
      endpoints[_chainSelector].contractReceiver != address(0);
  }

  /**
   * @notice Check if extra args are supported for a destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if extra args are supported, otherwise false
   */
  function isExtraArgsSupported(uint64 _chainSelector)
    external
    view
    returns (bool)
  {
    return extraArgs[_chainSelector].gasLimit != 0;
  }

  /**
   * @notice Check if the fee is free on the input destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if fee is flat, otherwise false
   */
  function isFeeFree(uint64 _chainSelector) external view returns (bool) {
    return freeFee[_chainSelector];
  }

  /**
   * @notice Amount of bridged token (negative outbound bridge, positive inbound bridge) for every chain
   * @param _token Address of the token
   * @return Total bridged amount
   */
  function getTotalBridgedAmount(address _token)
    external
    view
    returns (int256)
  {
    return totalBridgedAmount[IMintableBurnableERC20(_token)];
  }

  /**
   * @notice Amount of bridged token (negative outbound bridge, positive inbound bridge) for the input chain
   * @param _token Address of the token
   * @param _destChainSelector CCIP chain selector of the destination chain
   * @return Bridged amount for the input chain
   */
  function getChainBridgedAmount(address _token, uint64 _destChainSelector)
    external
    view
    returns (int256)
  {
    return
      chainBridgedAmount[IMintableBurnableERC20(_token)][_destChainSelector];
  }

  /**
   * @notice Max amount of token to be bridged on input destination chain
   * @param _token Address of the token
   * @param _destChainSelector CCIP chain selector of the destination chain
   * @return Max amount to be bridged
   */
  function getMaxChainAmount(address _token, uint64 _destChainSelector)
    external
    view
    returns (uint256)
  {
    return chainMaxAmount[IMintableBurnableERC20(_token)][_destChainSelector];
  }

  /**
   * @notice Get the source endpoint for the input chain
   * @param _chainSelector CCIP chain selector of the source chain
   * @return srcEndpoint Source endpoint
   */
  function getSrcEndpoint(uint64 _chainSelector)
    public
    view
    returns (address srcEndpoint)
  {
    srcEndpoint = endpoints[_chainSelector].contractSender;
    require(srcEndpoint != address(0), 'Src endpoint not supported');
  }

  /**
   * @notice Get the destination endpoint for the input chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return destEndpoint Destination endpoint
   */
  function getDestEndpoint(uint64 _chainSelector)
    public
    view
    returns (address destEndpoint)
  {
    destEndpoint = endpoints[_chainSelector].contractReceiver;
    require(destEndpoint != address(0), 'Dest endpoint not supported');
  }

  /**
   * @notice Get the extra-args for the input destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return args GasLimit and strict
   */
  function getExtraArgs(uint64 _chainSelector)
    public
    view
    returns (Client.EVMExtraArgsV1 memory args)
  {
    args = extraArgs[_chainSelector];
    require(args.gasLimit != 0, 'Args not supported');
  }

  /**
   * @notice Get the address of the mapped token with the input token on the input destination chain
   * @param _srcToken Address of the token
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return destToken Address of mapped token on the destination chain
   */
  function getMappedToken(address _srcToken, uint64 _chainSelector)
    public
    view
    returns (address destToken)
  {
    destToken = address(
      tokensMap[IMintableBurnableERC20(_srcToken)][_chainSelector]
    );
    require(address(destToken) != address(0), 'Token not supported');
  }

  function isTrustedForwarder(address forwarder)
    public
    view
    override
    returns (bool)
  {
    try
      synthereumFinder.getImplementationAddress(
        SynthereumInterfaces.TrustedForwarder
      )
    returns (address trustedForwarder) {
      if (forwarder == trustedForwarder) {
        return true;
      } else {
        return false;
      }
    } catch {
      return false;
    }
  }

  /// @notice IERC165 supports an interfaceId
  /// @param interfaceId The interfaceId to check
  /// @return true if the interfaceId is supported
  function supportsInterface(bytes4 interfaceId)
    public
    pure
    override(CCIPReceiver, AccessControlEnumerable)
    returns (bool)
  {
    return CCIPReceiver.supportsInterface(interfaceId);
  }

  // called by the router for mint tokens on the destination chain
  function _ccipReceive(Client.Any2EVMMessage memory message)
    internal
    override
    nonReentrant
  {
    // decode cross chain message
    (
      IMintableBurnableERC20 srcToken,
      IMintableBurnableERC20 destToken,
      uint256 amount,
      address recipient
    ) = abi.decode(
      message.data,
      (IMintableBurnableERC20, IMintableBurnableERC20, uint256, address)
    );

    address srcEndpoint = getSrcEndpoint(message.sourceChainSelector);

    require(
      abi.decode(message.sender, (address)) == srcEndpoint,
      'Wrong src endpoint'
    );
    require(
      address(srcToken) ==
        address(
          getMappedToken(address(destToken), message.sourceChainSelector)
        ),
      'Wrong src token'
    );

    // mint token to recipient
    IMintableBurnableERC20(destToken).mint(recipient, amount);

    chainBridgedAmount[destToken][message.sourceChainSelector] += amount
      .toInt256();
    totalBridgedAmount[destToken] += amount.toInt256();

    emit TransferCompleted(
      message.messageId,
      message.sourceChainSelector,
      srcEndpoint,
      srcToken,
      destToken,
      amount,
      recipient
    );
  }

  // burn tokens and trigger bridge message on CCIP
  function _burnAndSendCCIPMessage(
    uint64 _destinationChainSelector,
    address _messageReceiver,
    IMintableBurnableERC20 _srcToken,
    IMintableBurnableERC20 _destToken,
    uint256 _amount,
    address _tokenSender,
    address _tokenRecipient,
    address _feeToken
  ) internal returns (bytes32 messageId, uint256 fees) {
    // burn jAsset
    _srcToken.safeTransferFrom(_tokenSender, address(this), _amount);
    _srcToken.burn(_amount);

    // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message
    Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage(
      _destinationChainSelector,
      _messageReceiver,
      _srcToken,
      _destToken,
      _amount,
      _tokenRecipient,
      _feeToken
    );

    // Get the fee required to send the message
    fees = i_router.getFee(_destinationChainSelector, evm2AnyMessage);

    if (_feeToken != address(0)) {
      require(msg.value == 0, 'Native token sent');
      if (!freeFee[_destinationChainSelector]) {
        IERC20(_feeToken).safeTransferFrom(_tokenSender, address(this), fees);
      } else {
        require(
          IERC20(_feeToken).balanceOf(address(this)) >= fees,
          'Not enough balance'
        );
      }

      // approve the Router to transfer LINK tokens on contract's behalf. It will spend the fees in LINK
      IERC20(_feeToken).safeApprove(address(i_router), fees);

      // Send the message through the router and store the returned message ID
      messageId = i_router.ccipSend(_destinationChainSelector, evm2AnyMessage);
    } else {
      // NATIVE TOKEN FEE
      if (!freeFee[_destinationChainSelector]) {
        require(msg.value >= fees, 'Not enough native fees sent');
        uint256 refundAmount = msg.value - fees;
        if (refundAmount > 0) {
          payable(_tokenSender).sendValue(refundAmount);
        }
      } else {
        require(address(this).balance >= fees, 'Not enough balance');
      }

      // Send the message through the router and store the returned message ID
      messageId = i_router.ccipSend{value: fees}(
        _destinationChainSelector,
        evm2AnyMessage
      );
    }
  }

  // build CCIP message to send to the destination chain
  function _buildCCIPMessage(
    uint64 _destinationChainSelector,
    address _messageReceiver,
    IMintableBurnableERC20 _srcToken,
    IMintableBurnableERC20 _destToken,
    uint256 _amount,
    address _tokenRecipient,
    address _feeToken
  ) internal view returns (Client.EVM2AnyMessage memory) {
    // Create an EVM2AnyMessage struct in memory with necessary information for sending a cross-chain message
    Client.EVM2AnyMessage memory evm2AnyMessage = Client.EVM2AnyMessage({
      receiver: abi.encode(_messageReceiver),
      data: abi.encode(_srcToken, _destToken, _amount, _tokenRecipient),
      tokenAmounts: new Client.EVMTokenAmount[](0), // Empty array as no tokens are transferred
      extraArgs: Client._argsToBytes(
        // Additional arguments, setting gas limit and non-strict sequencing mode
        getExtraArgs(_destinationChainSelector)
      ),
      feeToken: _feeToken
    });
    return evm2AnyMessage;
  }

  function _msgSender()
    internal
    view
    override(ERC2771Context, Context)
    returns (address sender)
  {
    return ERC2771Context._msgSender();
  }

  function _msgData()
    internal
    view
    override(ERC2771Context, Context)
    returns (bytes calldata)
  {
    return ERC2771Context._msgData();
  }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Client} from "../libraries/Client.sol";

/// @notice Application contracts that intend to receive messages from
/// the router should implement this interface.
interface IAny2EVMMessageReceiver {
  /// @notice Called by the Router to deliver a message.
  /// If this reverts, any token transfers also revert. The message
  /// will move to a FAILED state and become available for manual execution.
  /// @param message CCIP Message
  /// @dev Note ensure you check the msg.sender is the OffRampRouter
  function ccipReceive(Client.Any2EVMMessage calldata message) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// End consumer library.
library Client {
  struct EVMTokenAmount {
    address token; // token address on the local chain.
    uint256 amount; // Amount of tokens.
  }

  struct Any2EVMMessage {
    bytes32 messageId; // MessageId corresponding to ccipSend on source.
    uint64 sourceChainSelector; // Source chain selector.
    bytes sender; // abi.decode(sender) if coming from an EVM chain.
    bytes data; // payload sent in original message.
    EVMTokenAmount[] destTokenAmounts; // Tokens and their amounts in their destination chain representation.
  }

  // If extraArgs is empty bytes, the default is 200k gas limit and strict = false.
  struct EVM2AnyMessage {
    bytes receiver; // abi.encode(receiver address) for dest EVM chains
    bytes data; // Data payload
    EVMTokenAmount[] tokenAmounts; // Token transfers
    address feeToken; // Address of feeToken. address(0) means you will send msg.value.
    bytes extraArgs; // Populate this with _argsToBytes(EVMExtraArgsV1)
  }

  // extraArgs will evolve to support new features
  // bytes4(keccak256("CCIP EVMExtraArgsV1"));
  bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9;
  struct EVMExtraArgsV1 {
    uint256 gasLimit; // ATTENTION!!! MAX GAS LIMIT 4M FOR BETA TESTING
    bool strict; // See strict sequencing details below.
  }

  function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) {
    return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs);
  }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.9;

import {IAny2EVMMessageReceiver} from '../../@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IAny2EVMMessageReceiver.sol';
import {Client} from '../../@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol';
import {IERC165} from '../../@openzeppelin/contracts/utils/introspection/IERC165.sol';
import {IRouterClient} from '../../@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol';

/// @title CCIPReceiver - Base contract for CCIP applications that can receive messages.
abstract contract CCIPReceiver is IAny2EVMMessageReceiver, IERC165 {
  IRouterClient internal i_router;

  constructor(address router) {
    _setRouter(router);
  }

  /// @dev only calls from the set router are accepted.
  modifier onlyRouter() {
    require(msg.sender == address(i_router), 'Invalid router');
    _;
  }

  /// @inheritdoc IAny2EVMMessageReceiver
  function ccipReceive(Client.Any2EVMMessage calldata message)
    external
    virtual
    onlyRouter
  {
    _ccipReceive(message);
  }

  /// @notice Set the router
  /// @param router New router
  function _setRouter(address router) internal virtual {
    require(router != address(0), 'Invalid router');
    i_router = IRouterClient(router);
  }

  /// @notice Override this function in your implementation.
  /// @param message Any2EVMMessage
  function _ccipReceive(Client.Any2EVMMessage memory message) internal virtual;

  /// @notice Return the current router
  /// @return i_router address
  function getRouter() public view returns (address) {
    return address(i_router);
  }

  /// @notice IERC165 supports an interfaceId
  /// @param interfaceId The interfaceId to check
  /// @return true if the interfaceId is supported
  function supportsInterface(bytes4 interfaceId)
    public
    pure
    virtual
    returns (bool)
  {
    return
      interfaceId == type(IAny2EVMMessageReceiver).interfaceId ||
      interfaceId == type(IERC165).interfaceId;
  }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Client} from "../libraries/Client.sol";

interface IRouterClient {
  error UnsupportedDestinationChain(uint64 destChainSelector);
  error InsufficientFeeTokenAmount();
  error InvalidMsgValue();

  /// @notice Checks if the given chain ID is supported for sending/receiving.
  /// @param chainSelector The chain to check.
  /// @return supported is true if it is supported, false if not.
  function isChainSupported(uint64 chainSelector) external view returns (bool supported);

  /// @notice Gets a list of all supported tokens which can be sent or received
  /// to/from a given chain id.
  /// @param chainSelector The chainSelector.
  /// @return tokens The addresses of all tokens that are supported.
  function getSupportedTokens(uint64 chainSelector) external view returns (address[] memory tokens);

  /// @param destinationChainSelector The destination chainSelector
  /// @param message The cross-chain CCIP message including data and/or tokens
  /// @return fee returns guaranteed execution fee for the specified message
  /// delivery to destination chain
  /// @dev returns 0 fee on invalid message.
  function getFee(
    uint64 destinationChainSelector,
    Client.EVM2AnyMessage memory message
  ) external view returns (uint256 fee);

  /// @notice Request a message to be sent to the destination chain
  /// @param destinationChainSelector The destination chain ID
  /// @param message The cross-chain CCIP message including data and/or tokens
  /// @return messageId The message ID
  /// @dev Note if msg.value is larger than the required fee (from getFee) we accept
  /// the overpayment with no refund.
  function ccipSend(
    uint64 destinationChainSelector,
    Client.EVM2AnyMessage calldata message
  ) external payable returns (bytes32);
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import {IMintableBurnableERC20} from '../../tokens/interfaces/IMintableBurnableERC20.sol';
import {Client} from '../../../@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol';

/**
 * @title Synthereum CCIP bridge interface containing the open functions
 */
interface ISynthereumCCIPBridge {
  /**
   * @notice Burn tokens on this chain and trigger CCIP bridge for receiving on the destination chain
   * @param _destinationChainSelector CCIP chain selector of the destination chain
   * @param _token Address of the synth token to bridge
   * @param _amount Amount to bridge
   * @param _recipient Address to which receive synth tokens on the destination chain
   * @param _feeToken Address of the token used to pay fees for bridging
   * @return messageId CCIP output message id
   * @return fees Amount of fees to be paid
   */
  function transferTokensToDestinationChain(
    uint64 _destinationChainSelector,
    address _token,
    uint256 _amount,
    address _recipient,
    address _feeToken
  ) external payable returns (bytes32 messageId, uint256 fees);

  /**
   * @notice Check if a token is whitelisted for a destination chain
   * @param _token Address of the token on this chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if token is whitelisted, otherwise false
   */
  function isTokenWhitelisted(address _token, uint64 _chainSelector)
    external
    view
    returns (bool);

  /**
   * @notice Check if endpoints are supported for a destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if endpoints are supported, otherwise false
   */
  function isEndpointSupported(uint64 _chainSelector)
    external
    view
    returns (bool);

  /**
   * @notice Check if extra args are supported for a destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if extra args are supported, otherwise false
   */
  function isExtraArgsSupported(uint64 _chainSelector)
    external
    view
    returns (bool);

  /**
   * @notice Check if the fee is free on the input destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return True if fee is flat, otherwise false
   */
  function isFeeFree(uint64 _chainSelector) external view returns (bool);

  /**
   * @notice Amount of bridged token (negative outbound bridge, positive inbound bridge) for every chain
   * @param _token Address of the token
   */
  function getTotalBridgedAmount(address _token) external view returns (int256);

  /**
   * @notice Amount of bridged token (negative outbound bridge, positive inbound bridge) for the input chain
   * @param _token Address of the token
   * @param _destChainSelector CCIP chain selector of the destination chain
   */
  function getChainBridgedAmount(address _token, uint64 _destChainSelector)
    external
    view
    returns (int256);

  /**
   * @notice Max amount of token to be bridged on input destination chain
   * @param _token Address of the token
   * @param _destChainSelector CCIP chain selector of the destination chain
   * @return Max amount to be bridged
   */
  function getMaxChainAmount(address _token, uint64 _destChainSelector)
    external
    view
    returns (uint256);

  /**
   * @notice Get the source endpoint for the input chain
   * @param _chainSelector CCIP chain selector of the source chain
   * @return srcEndpoint Source endpoint
   */
  function getSrcEndpoint(uint64 _chainSelector)
    external
    view
    returns (address srcEndpoint);

  /**
   * @notice Get the destination endpoint for the input chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return destEndpoint Destination endpoint
   */
  function getDestEndpoint(uint64 _chainSelector)
    external
    view
    returns (address destEndpoint);

  /**
   * @notice Get the extra-args for the input destination chain
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return args GasLimit and strict
   */
  function getExtraArgs(uint64 _chainSelector)
    external
    view
    returns (Client.EVMExtraArgsV1 memory args);

  /**
   * @notice Get the address of the mapped token with the input token on the input destination chain
   * @param _srcToken Address of the token
   * @param _chainSelector CCIP chain selector of the destination chain
   * @return destToken Address of mapped token on the destination chain
   */
  function getMappedToken(address _srcToken, uint64 _chainSelector)
    external
    view
    returns (address destToken);
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {IERC20} from '../../../@openzeppelin/contracts/token/ERC20/IERC20.sol';

/**
 * @title ERC20 interface that includes burn mint and roles methods.
 */
interface IMintableBurnableERC20 is IERC20 {
  /**
   * @notice Burns a specific amount of the caller's tokens.
   * @dev This method should be permissioned to only allow designated parties to burn tokens.
   */
  function burn(uint256 value) external;

  /**
   * @notice Mints tokens and adds them to the balance of the `to` address.
   * @dev This method should be permissioned to only allow designated parties to mint tokens.
   */
  function mint(address to, uint256 value) external returns (bool);

  /**
   * @notice Returns the number of decimals used to get its user representation.
   */
  function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT

pragma solidity ^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: AGPL-3.0-only
pragma solidity >=0.8.0;

/**
 * @title Provides addresses of the contracts implementing certain interfaces.
 */
interface ISynthereumFinder {
  /**
   * @notice Updates the address of the contract that implements `interfaceName`.
   * @param interfaceName bytes32 encoding of the interface name that is either changed or registered.
   * @param implementationAddress address of the deployed contract that implements the interface.
   */
  function changeImplementationAddress(
    bytes32 interfaceName,
    address implementationAddress
  ) external;

  /**
   * @notice Gets the address of the contract that implements the given `interfaceName`.
   * @param interfaceName queried interface.
   * @return implementationAddress Address of the deployed contract that implements the interface.
   */
  function getImplementationAddress(bytes32 interfaceName)
    external
    view
    returns (address);
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.9;

/**
 * @title Stores common interface names used throughout Synthereum.
 */
library SynthereumInterfaces {
  bytes32 public constant Deployer = 'Deployer';
  bytes32 public constant PoolRegistry = 'PoolRegistry';
  bytes32 public constant SelfMintingRegistry = 'SelfMintingRegistry';
  bytes32 public constant FixedRateRegistry = 'FixedRateRegistry';
  bytes32 public constant VaultRegistry = 'VaultRegistry';
  bytes32 public constant StakingLPVaultRegistry = 'StakingLPVaultRegistry';
  bytes32 public constant FactoryVersioning = 'FactoryVersioning';
  bytes32 public constant Manager = 'Manager';
  bytes32 public constant TokenFactory = 'TokenFactory';
  bytes32 public constant CreditLineController = 'CreditLineController';
  bytes32 public constant CollateralWhitelist = 'CollateralWhitelist';
  bytes32 public constant IdentifierWhitelist = 'IdentifierWhitelist';
  bytes32 public constant LendingManager = 'LendingManager';
  bytes32 public constant LendingStorageManager = 'LendingStorageManager';
  bytes32 public constant CommissionReceiver = 'CommissionReceiver';
  bytes32 public constant BuybackProgramReceiver = 'BuybackProgramReceiver';
  bytes32 public constant LendingRewardsReceiver = 'LendingRewardsReceiver';
  bytes32 public constant StakingRewardsReceiver = 'StakingRewardsReceiver';
  bytes32 public constant JarvisToken = 'JarvisToken';
  bytes32 public constant DebtTokenFactory = 'DebtTokenFactory';
  bytes32 public constant VaultFactory = 'VaultFactory';
  bytes32 public constant StakingLPVaultFactory = 'StakingLPVaultFactory';
  bytes32 public constant PriceFeed = 'PriceFeed';
  bytes32 public constant StakedJarvisToken = 'StakedJarvisToken';
  bytes32 public constant StakingLPVaultData = 'StakingLPVaultData';
  bytes32 public constant JarvisBrrrrr = 'JarvisBrrrrr';
  bytes32 public constant MoneyMarketManager = 'MoneyMarketManager';
  bytes32 public constant CrossChainBridge = 'CrossChainBridge';
  bytes32 public constant TrustedForwarder = 'TrustedForwarder';
}

library FactoryInterfaces {
  bytes32 public constant PoolFactory = 'PoolFactory';
  bytes32 public constant SelfMintingFactory = 'SelfMintingFactory';
  bytes32 public constant FixedRateFactory = 'FixedRateFactory';
}

// SPDX-License-Identifier: MIT

pragma solidity ^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;
        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");

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

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

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

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.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 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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such 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.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import {Context} from '../../@openzeppelin/contracts/utils/Context.sol';

/**
 * @dev Context variant with ERC2771 support.
 */
abstract contract ERC2771Context is Context {
  function isTrustedForwarder(address forwarder)
    public
    view
    virtual
    returns (bool);

  function _msgSender()
    internal
    view
    virtual
    override
    returns (address sender)
  {
    if (isTrustedForwarder(msg.sender)) {
      // The assembly code is more direct than the Solidity version using `abi.decode`.
      assembly {
        sender := shr(96, calldataload(sub(calldatasize(), 20)))
      }
    } else {
      return super._msgSender();
    }
  }

  function _msgData() internal view virtual override returns (bytes calldata) {
    if (isTrustedForwarder(msg.sender)) {
      return msg.data[0:msg.data.length - 20];
    } else {
      return super._msgData();
    }
  }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {grantRole} to track enumerable memberships
     */
    function grantRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
        super.grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {revokeRole} to track enumerable memberships
     */
    function revokeRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
        super.revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev Overload {renounceRole} to track enumerable memberships
     */
    function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) {
        super.renounceRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev Overload {_setupRole} to track enumerable memberships
     */
    function _setupRole(bytes32 role, address account) internal virtual override {
        super._setupRole(role, account);
        _roleMembers[role].add(account);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import {AccessControlEnumerable} from '../../../@openzeppelin/contracts/access/AccessControlEnumerable.sol';

/**
 * @dev Extension of {AccessControlEnumerable} that offer support for maintainer role.
 */
contract StandardAccessControlEnumerable is AccessControlEnumerable {
  struct Roles {
    address admin;
    address maintainer;
  }

  bytes32 public constant MAINTAINER_ROLE = keccak256('Maintainer');

  modifier onlyMaintainer() {
    require(
      hasRole(MAINTAINER_ROLE, msg.sender),
      'Sender must be the maintainer'
    );
    _;
  }

  function _setAdmin(address _account) internal {
    _setRoleAdmin(DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_ROLE);
    _setupRole(DEFAULT_ADMIN_ROLE, _account);
  }

  function _setMaintainer(address _account) internal {
    _setRoleAdmin(MAINTAINER_ROLE, DEFAULT_ADMIN_ROLE);
    _setupRole(MAINTAINER_ROLE, _account);
  }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.9;

import {ISynthereumFinder} from './interfaces/IFinder.sol';
import {AccessControlEnumerable} from '../../@openzeppelin/contracts/access/AccessControlEnumerable.sol';

/**
 * @title Provides addresses of contracts implementing certain interfaces.
 */
contract SynthereumFinder is ISynthereumFinder, AccessControlEnumerable {
  bytes32 public constant MAINTAINER_ROLE = keccak256('Maintainer');

  //Describe role structure
  struct Roles {
    address admin;
    address maintainer;
  }

  //----------------------------------------
  // Storage
  //----------------------------------------

  mapping(bytes32 => address) public interfacesImplemented;

  //----------------------------------------
  // Events
  //----------------------------------------

  event InterfaceImplementationChanged(
    bytes32 indexed interfaceName,
    address indexed newImplementationAddress
  );

  //----------------------------------------
  // Modifiers
  //----------------------------------------

  modifier onlyMaintainer() {
    require(
      hasRole(MAINTAINER_ROLE, msg.sender),
      'Sender must be the maintainer'
    );
    _;
  }

  //----------------------------------------
  // Constructors
  //----------------------------------------

  constructor(Roles memory roles) {
    _setRoleAdmin(DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_ROLE);
    _setRoleAdmin(MAINTAINER_ROLE, DEFAULT_ADMIN_ROLE);
    _setupRole(DEFAULT_ADMIN_ROLE, roles.admin);
    _setupRole(MAINTAINER_ROLE, roles.maintainer);
  }

  //----------------------------------------
  // External view
  //----------------------------------------

  /**
   * @notice Updates the address of the contract that implements `interfaceName`.
   * @param interfaceName bytes32 of the interface name that is either changed or registered.
   * @param implementationAddress address of the implementation contract.
   */
  function changeImplementationAddress(
    bytes32 interfaceName,
    address implementationAddress
  ) external override onlyMaintainer {
    interfacesImplemented[interfaceName] = implementationAddress;

    emit InterfaceImplementationChanged(interfaceName, implementationAddress);
  }

  /**
   * @notice Gets the address of the contract that implements the given `interfaceName`.
   * @param interfaceName queried interface.
   * @return implementationAddress Address of the defined interface.
   */
  function getImplementationAddress(bytes32 interfaceName)
    external
    view
    override
    returns (address)
  {
    address implementationAddress = interfacesImplemented[interfaceName];
    require(implementationAddress != address(0x0), 'Implementation not found');
    return implementationAddress;
  }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract ISynthereumFinder","name":"_synthereumFinder","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"components":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"maintainer","type":"address"}],"internalType":"struct StandardAccessControlEnumerable.Roles","name":"_roles","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"}],"name":"EndpointsRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"messageSender","type":"address"},{"indexed":false,"internalType":"address","name":"messageReceiver","type":"address"}],"name":"EndpointsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"}],"name":"ExtraArgsRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bool","name":"strict","type":"bool"}],"name":"ExtraArgsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"},{"indexed":true,"internalType":"bool","name":"isFree","type":"bool"}],"name":"FreeFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IMintableBurnableERC20","name":"sourceToken","type":"address"},{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"}],"name":"MaxChainAmountRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IMintableBurnableERC20","name":"sourceToken","type":"address"},{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"maxAmount","type":"uint256"}],"name":"MaxChainAmountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IMintableBurnableERC20","name":"sourceToken","type":"address"},{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"},{"indexed":true,"internalType":"contract IMintableBurnableERC20","name":"destinationToken","type":"address"}],"name":"TokenMapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IMintableBurnableERC20","name":"sourceToken","type":"address"},{"indexed":true,"internalType":"uint64","name":"chainSelector","type":"uint64"}],"name":"TokenUnmapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"sourceEndpoint","type":"address"},{"indexed":false,"internalType":"contract IMintableBurnableERC20","name":"sourceToken","type":"address"},{"indexed":false,"internalType":"contract IMintableBurnableERC20","name":"destinationToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"TransferCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"messageId","type":"bytes32"},{"indexed":true,"internalType":"uint64","name":"destinationChainSelector","type":"uint64"},{"indexed":false,"internalType":"address","name":"destinationEndpoint","type":"address"},{"indexed":false,"internalType":"contract IMintableBurnableERC20","name":"sourceToken","type":"address"},{"indexed":false,"internalType":"contract IMintableBurnableERC20","name":"destinationToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"feeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"TransferInitiated","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAINTAINER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint64","name":"sourceChainSelector","type":"uint64"},{"internalType":"bytes","name":"sender","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Client.EVMTokenAmount[]","name":"destTokenAmounts","type":"tuple[]"}],"internalType":"struct Client.Any2EVMMessage","name":"message","type":"tuple"}],"name":"ccipReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint64","name":"_destChainSelector","type":"uint64"}],"name":"getChainBridgedAmount","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"getDestEndpoint","outputs":[{"internalType":"address","name":"destEndpoint","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"getExtraArgs","outputs":[{"components":[{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bool","name":"strict","type":"bool"}],"internalType":"struct Client.EVMExtraArgsV1","name":"args","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_srcToken","type":"address"},{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"getMappedToken","outputs":[{"internalType":"address","name":"destToken","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint64","name":"_destChainSelector","type":"uint64"}],"name":"getMaxChainAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"getSrcEndpoint","outputs":[{"internalType":"address","name":"srcEndpoint","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getTotalBridgedAmount","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"isEndpointSupported","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"isExtraArgsSupported","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"isFeeFree","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"isTokenWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"removeEndpoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"}],"name":"removeExtraArgs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"contract IMintableBurnableERC20[]","name":"_srcTokens","type":"address[]"}],"name":"removeMappedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"contract IMintableBurnableERC20[]","name":"_srcTokens","type":"address[]"}],"name":"removeMaxChainAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"address","name":"_msgSenderEndpoint","type":"address"},{"internalType":"address","name":"_msgReceiverEndpoint","type":"address"}],"name":"setEndpoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"uint256","name":"_gasLimit","type":"uint256"},{"internalType":"bool","name":"_strict","type":"bool"}],"name":"setExtraArgs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"bool","name":"_isFree","type":"bool"}],"name":"setFreeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"contract IMintableBurnableERC20[]","name":"_srcTokens","type":"address[]"},{"internalType":"contract IMintableBurnableERC20[]","name":"_destTokens","type":"address[]"}],"name":"setMappedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_chainSelector","type":"uint64"},{"internalType":"contract IMintableBurnableERC20[]","name":"_srcTokens","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"setMaxChainAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"synthereumFinder","outputs":[{"internalType":"contract ISynthereumFinder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_destinationChainSelector","type":"uint64"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_feeToken","type":"address"}],"name":"transferTokensToDestinationChain","outputs":[{"internalType":"bytes32","name":"messageId","type":"bytes32"},{"internalType":"uint256","name":"fees","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_beneficiary","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b506040516200462d3803806200462d833981016040819052620000349162000424565b600160005581620000458162000079565b506001600160a01b03831660805280516200006090620000e7565b6020810151620000709062000104565b505050620004ff565b6001600160a01b038116620000c55760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103937baba32b960911b604482015260640160405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b620000f46000806200013b565b6200010160008262000188565b50565b620001206000805160206200460d83398151915260006200013b565b620001016000805160206200460d8339815191528262000188565b6000828152600160208190526040808320909101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6200019f8282620001cb60201b620021701760201c565b6000828152600260209081526040909120620001c69183906200217e620001db821b17901c565b505050565b620001d78282620001fb565b5050565b6000620001f2836001600160a01b038416620002a2565b90505b92915050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16620001d75760008281526001602081815260408084206001600160a01b0386168552909152909120805460ff191690911790556200025e620002f4565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054620002eb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001f5565b506000620001f5565b60006200030b6200031060201b620021931760201c565b905090565b60006200031d3362000345565b1562000330575060131936013560601c90565b6200030b6200040a60201b620021ba1760201c565b6080516040516302abf57960e61b81526f2a393ab9ba32b22337b93bb0b93232b960811b60048201526000916001600160a01b03169063aafd5e409060240160206040518083038186803b1580156200039d57600080fd5b505afa925050508015620003d0575060408051601f3d908101601f19168201909252620003cd91810190620004d8565b60015b620003dd57506000919050565b806001600160a01b0316836001600160a01b03161415620004015750600192915050565b50600092915050565b3390565b6001600160a01b03811681146200010157600080fd5b600080600083850360808112156200043b57600080fd5b845162000448816200040e565b60208601519094506200045b816200040e565b92506040603f19820112156200047057600080fd5b50604080519081016001600160401b0381118282101715620004a257634e487b7160e01b600052604160045260246000fd5b6040908152850151620004b5816200040e565b81526060850151620004c7816200040e565b602082015292959194509192509050565b600060208284031215620004eb57600080fd5b8151620004f8816200040e565b9392505050565b6080516140eb62000522600039600081816107df015261117d01526140eb6000f3fe6080604052600436106102285760003560e01c80639010d07c11610123578063cec12571116100ab578063efb45c2e1161006f578063efb45c2e14610774578063f5731442146107ad578063f6bf3ef6146107cd578063f874225414610801578063fe23bbdd1461082357600080fd5b8063cec12571146106be578063d547741f146106de578063e01d958a146106fe578063e34813681461071e578063ead5fea51461075457600080fd5b8063a217fddf116100f2578063a217fddf1461062b578063b0f479a114610640578063c0d786551461065e578063c75299341461067e578063ca15c8731461069e57600080fd5b80639010d07c1461059357806391b48f6e146105b357806391d14854146105d35780639f3d6bc8146105f357600080fd5b806336568abe116101b15780636cfc9e5e116101755780636cfc9e5e146104ad57806378d0e582146104cd578063808988671461051b57806385572ffb1461055357806388aa39ec1461057357600080fd5b806336568abe146103df57806337b7a3e4146103ff5780633aeac4e11461044d57806351cff8d91461046d578063572b6c051461048d57600080fd5b8063225d196a116101f8578063225d196a146102f0578063248a9ca3146103105780632d1662bb1461034f5780632f2ff15d1461039f578063319dc24a146103bf57600080fd5b8062faa205146102345780630135f8371461027657806301ffc9a71461029e5780631d4420b6146102ce57600080fd5b3661022f57005b600080fd5b34801561024057600080fd5b5061025461024f36600461361b565b610843565b6040805182518152602092830151151592810192909252015b60405180910390f35b61028961028436600461364b565b6108d6565b6040805192835260208301919091520161026d565b3480156102aa57600080fd5b506102be6102b93660046136b1565b610b53565b604051901515815260200161026d565b3480156102da57600080fd5b506102ee6102e93660046136e9565b610b64565b005b3480156102fc57600080fd5b506102ee61030b366004613774565b610cfd565b34801561031c57600080fd5b5061034161032b3660046137c6565b6000908152600160208190526040909120015490565b60405190815260200161026d565b34801561035b57600080fd5b506102be61036a3660046137df565b6001600160a01b0391821660009081526006602090815260408083206001600160401b03949094168352929052205416151590565b3480156103ab57600080fd5b506102ee6103ba366004613814565b610ebd565b3480156103cb57600080fd5b506102be6103da36600461361b565b610ee4565b3480156103eb57600080fd5b506102ee6103fa366004613814565b610f39565b34801561040b57600080fd5b5061034161041a3660046137df565b6001600160a01b0382166000908152600a602090815260408083206001600160401b038516845290915290205492915050565b34801561045957600080fd5b506102ee610468366004613844565b610f5b565b34801561047957600080fd5b506102ee610488366004613872565b611096565b34801561049957600080fd5b506102be6104a8366004613872565b611152565b3480156104b957600080fd5b506102ee6104c836600461388f565b61122f565b3480156104d957600080fd5b506103416104e83660046137df565b6001600160a01b03821660009081526008602090815260408083206001600160401b038516845290915290205492915050565b34801561052757600080fd5b5061053b6105363660046137df565b611552565b6040516001600160a01b03909116815260200161026d565b34801561055f57600080fd5b506102ee61056e36600461390f565b6115c4565b34801561057f57600080fd5b5061053b61058e36600461361b565b611623565b34801561059f57600080fd5b5061053b6105ae366004613949565b611695565b3480156105bf57600080fd5b506102ee6105ce36600461396b565b6116b4565b3480156105df57600080fd5b506102be6105ee366004613814565b611886565b3480156105ff57600080fd5b506102be61060e36600461361b565b6001600160401b0316600090815260056020526040902054151590565b34801561063757600080fd5b50610341600081565b34801561064c57600080fd5b506003546001600160a01b031661053b565b34801561066a57600080fd5b506102ee610679366004613872565b6118b1565b34801561068a57600080fd5b506102ee61069936600461388f565b6118ee565b3480156106aa57600080fd5b506103416106b93660046137c6565b611c1a565b3480156106ca57600080fd5b506102ee6106d93660046139a9565b611c31565b3480156106ea57600080fd5b506102ee6106f9366004613814565b611d1f565b34801561070a57600080fd5b506102ee61071936600461361b565b611d29565b34801561072a57600080fd5b50610341610739366004613872565b6001600160a01b031660009081526009602052604090205490565b34801561076057600080fd5b5061053b61076f36600461361b565b611e59565b34801561078057600080fd5b506102be61078f36600461361b565b6001600160401b031660009081526007602052604090205460ff1690565b3480156107b957600080fd5b506102ee6107c836600461361b565b611ec8565b3480156107d957600080fd5b5061053b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561080d57600080fd5b5061034160008051602061409683398151915281565b34801561082f57600080fd5b506102ee61083e366004613774565b611fa5565b604080518082018252600080825260209182018190526001600160401b0384168152600582528290208251808401909352805480845260019091015460ff161515918301919091526108d15760405162461bcd60e51b8152602060048201526012602482015271105c99dcc81b9bdd081cdd5c1c1bdc9d195960721b60448201526064015b60405180910390fd5b919050565b600080600260005414156108fc5760405162461bcd60e51b81526004016108c8906139d5565b600260009081556040805160808101825282815260208101839052908101829052606081019190915261092e88611623565b6001600160a01b031681526000610945888a611552565b6001600160a01b03891660009081526008602090815260408083206001600160401b038e168452825290912054908401529050610981876121be565b6040808401919091526001600160a01b0389166000908152600a60209081528282206001600160401b038d168352905220546109bc906121be565b826020015183604001516109d09190613a22565b1315610a1e5760405162461bcd60e51b815260206004820152601a60248201527f4d6178206272696467656420616d6f756e74207265616368656400000000000060448201526064016108c8565b610a2661222c565b6001600160a01b0316606083018190528251610a4c918b91908b9085908c908c8c612236565b60408401516020850151929650909450610a6591613a22565b6001600160a01b03891660008181526008602090815260408083206001600160401b038f1684528252808320949094558584015192825260099052918220805491929091610ab4908490613a22565b90915550508151606080840151604080516001600160a01b0394851681528c85166020820152858516818301529283018b9052908316608083015288831660a083015291871660c082015260e0810185905290516001600160401b038b169186917f4f7fc7a3b4f8ffd103e5d9288b191f668ca7caa10e0b07c1de8b9026fe383119918190036101000190a35050600160005590969095509350505050565b6000610b5e826126a3565b92915050565b610b7c60008051602061409683398151915233611886565b610b985760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03851660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b158015610be457600080fd5b505afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190613a98565b610c385760405162461bcd60e51b81526004016108c890613ab5565b81610c765760405162461bcd60e51b815260206004820152600e60248201526d139d5b1b0819d85cc81a5b9c1d5d60921b60448201526064016108c8565b60408051808201825283815282151560208083018281526001600160401b0388166000818152600584528690209451855590516001909401805460ff19169415159490941790935583518681529081019190915290917fe27d5b3c14a114d5705330d1fa5b7d1fb978ff22de1d55c3a5faba3c12ef0ab491015b60405180910390a2505050565b610d1560008051602061409683398151915233611886565b610d315760405162461bcd60e51b81526004016108c890613a61565b8080610d4f5760405162461bcd60e51b81526004016108c890613ae2565b60005b81811015610eb657600a6000858584818110610d7057610d70613b0c565b9050602002016020810190610d859190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b0389168252909252902054610df65760405162461bcd60e51b815260206004820152601260248201527113585e08185b5bdd5b9d081b9bdd081cd95d60721b60448201526064016108c8565b600a6000858584818110610e0c57610e0c613b0c565b9050602002016020810190610e219190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b038916808352935290812055848483818110610e6457610e64613b0c565b9050602002016020810190610e799190613872565b6001600160a01b03167fc4c3c978a9d0d9d1518cb39062ce9ba7c01872deb12c425d2d09152710f1973460405160405180910390a3600101610d52565b5050505050565b610ec782826126d9565b6000828152600260205260409020610edf908261217e565b505050565b6001600160401b0381166000908152600460205260408120546001600160a01b031615801590610b5e5750506001600160401b03166000908152600460205260409020600101546001600160a01b0316151590565b610f438282612707565b6000828152600260205260409020610edf9082612791565b610f7360008051602061409683398151915233611886565b610f8f5760405162461bcd60e51b81526004016108c890613a61565b60026000541415610fb25760405162461bcd60e51b81526004016108c8906139d5565b600260009081556040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b158015610ff857600080fd5b505afa15801561100c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110309190613b22565b9050600081116110785760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016108c8565b61108c6001600160a01b03841683836127a6565b5050600160005550565b6110ae60008051602061409683398151915233611886565b6110ca5760405162461bcd60e51b81526004016108c890613a61565b600260005414156110ed5760405162461bcd60e51b81526004016108c8906139d5565b600260005547806111365760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016108c8565b6111496001600160a01b03831682612809565b50506001600055565b6040516302abf57960e61b81526f2a393ab9ba32b22337b93bb0b93232b960811b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063aafd5e409060240160206040518083038186803b1580156111c757600080fd5b505afa9250505080156111f7575060408051601f3d908101601f191682019092526111f491810190613b3b565b60015b61120357506000919050565b806001600160a01b0316836001600160a01b031614156112265750600192915050565b50600092915050565b61124760008051602061409683398151915233611886565b6112635760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03871660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b1580156112af57600080fd5b505afa1580156112c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e79190613a98565b6113035760405162461bcd60e51b81526004016108c890613ab5565b82806113215760405162461bcd60e51b81526004016108c890613ae2565b80821461137c5760405162461bcd60e51b815260206004820152602360248201527f53726320746f6b656e7320616e6420616d6f756e747320646f206e6f74206d616044820152620e8c6d60eb1b60648201526084016108c8565b60005b8181101561154957600086868381811061139b5761139b613b0c565b90506020020160208101906113b09190613872565b6001600160a01b031614156113f45760405162461bcd60e51b815260206004820152600a602482015269273ab636103a37b5b2b760b11b60448201526064016108c8565b600084848381811061140857611408613b0c565b905060200201351161144a5760405162461bcd60e51b815260206004820152600b60248201526a139d5b1b08185b5bdd5b9d60aa1b60448201526064016108c8565b83838281811061145c5761145c613b0c565b90506020020135600a600088888581811061147957611479613b0c565b905060200201602081019061148e9190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b038c16808352935220919091558686838181106114d2576114d2613b0c565b90506020020160208101906114e79190613872565b6001600160a01b03167f01f315778069cc280c5dbe64950935865432d313b2f695378e43839888e27e1e86868581811061152357611523613b0c565b9050602002013560405161153991815260200190565b60405180910390a360010161137f565b50505050505050565b6001600160a01b0380831660009081526006602090815260408083206001600160401b03861684529091529020541680610b5e5760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b60448201526064016108c8565b6003546001600160a01b0316331461160f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103937baba32b960911b60448201526064016108c8565b61162061161b82613d03565b612922565b50565b6001600160401b0381166000908152600460205260409020600101546001600160a01b0316806108d15760405162461bcd60e51b815260206004820152601b60248201527f4465737420656e64706f696e74206e6f7420737570706f72746564000000000060448201526064016108c8565b60008281526002602052604081206116ad9083612bd7565b9392505050565b6116cc60008051602061409683398151915233611886565b6116e85760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03851660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b15801561173457600080fd5b505afa158015611748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176c9190613a98565b6117885760405162461bcd60e51b81526004016108c890613ab5565b6001600160a01b038216158015906117a857506001600160a01b03811615155b6117ea5760405162461bcd60e51b8152602060048201526013602482015272139d5b1b081a5b9c1d5d08195b991c1bda5b9d606a1b60448201526064016108c8565b6040805180820182526001600160a01b0384811680835284821660208085018281526001600160401b038a16600081815260048452889020965187549087166001600160a01b031991821617885591516001909701805497909616969091169590951790935584519182529181019190915290917fa0331b1111659dc3fe92c2b1dd894823609fc474f49e8cfceb36e5238f644dad9101610cf0565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6118c960008051602061409683398151915233611886565b6118e55760405162461bcd60e51b81526004016108c890613a61565b61162081612be3565b61190660008051602061409683398151915233611886565b6119225760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03871660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b15801561196e57600080fd5b505afa158015611982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a69190613a98565b6119c25760405162461bcd60e51b81526004016108c890613ab5565b82806119e05760405162461bcd60e51b81526004016108c890613ae2565b808214611a2f5760405162461bcd60e51b815260206004820181905260248201527f53726320616e64206465737420746f6b656e7320646f206e6f74206d6174636860448201526064016108c8565b60005b81811015611549576000868683818110611a4e57611a4e613b0c565b9050602002016020810190611a639190613872565b6001600160a01b031614158015611aaa57506000848483818110611a8957611a89613b0c565b9050602002016020810190611a9e9190613872565b6001600160a01b031614155b611ae35760405162461bcd60e51b815260206004820152600a602482015269273ab636103a37b5b2b760b11b60448201526064016108c8565b838382818110611af557611af5613b0c565b9050602002016020810190611b0a9190613872565b60066000888885818110611b2057611b20613b0c565b9050602002016020810190611b359190613872565b6001600160a01b039081168252602080830193909352604091820160009081206001600160401b038d168252909352912080546001600160a01b03191692909116919091179055838382818110611b8e57611b8e613b0c565b9050602002016020810190611ba39190613872565b6001600160a01b0316876001600160401b0316878784818110611bc857611bc8613b0c565b9050602002016020810190611bdd9190613872565b6001600160a01b03167f34e235f0098f19f6ed66b57986c8981f41faa1267f62394202be246617e5477a60405160405180910390a4600101611a32565b6000818152600260205260408120610b5e90612c4c565b611c4960008051602061409683398151915233611886565b611c655760405162461bcd60e51b81526004016108c890613a61565b6001600160401b03821660009081526007602052604090205460ff1615158115151415611ccb5760405162461bcd60e51b8152602060048201526014602482015273119c99594819995948185b1c9958591e481cd95d60621b60448201526064016108c8565b6001600160401b038216600081815260076020526040808220805460ff191685151590811790915590519092917f5c6b78a0b505fd49df5a1603d81f867a3038e3970f8a1ce1daf36698ad5d45cc91a35050565b610f438282612c56565b611d4160008051602061409683398151915233611886565b611d5d5760405162461bcd60e51b81526004016108c890613a61565b6001600160401b0381166000908152600460205260409020546001600160a01b031615801590611db057506001600160401b0381166000908152600460205260409020600101546001600160a01b031615155b611dfc5760405162461bcd60e51b815260206004820152601760248201527f456e64706f696e7473206e6f7420737570706f7274656400000000000000000060448201526064016108c8565b6001600160401b03811660008181526004602052604080822080546001600160a01b03199081168255600190910180549091169055517f796efd4f9d43cdefbe8613966913d2243449a436e3355806d10fa881e40b48919190a250565b6001600160401b0381166000908152600460205260409020546001600160a01b0316806108d15760405162461bcd60e51b815260206004820152601a60248201527f53726320656e64706f696e74206e6f7420737570706f7274656400000000000060448201526064016108c8565b611ee060008051602061409683398151915233611886565b611efc5760405162461bcd60e51b81526004016108c890613a61565b6001600160401b038116600090815260056020526040902054611f565760405162461bcd60e51b8152602060048201526012602482015271105c99dcc81b9bdd081cdd5c1c1bdc9d195960721b60448201526064016108c8565b6001600160401b038116600081815260056020526040808220828155600101805460ff19169055517f432332e411c36e2e4e47855806cf50cebf906329598989d90b576ade028983619190a250565b611fbd60008051602061409683398151915233611886565b611fd95760405162461bcd60e51b81526004016108c890613a61565b8080611ff75760405162461bcd60e51b81526004016108c890613ae2565b60005b81811015610eb657600060068186868581811061201957612019613b0c565b905060200201602081019061202e9190613872565b6001600160a01b039081168252602080830193909352604091820160009081206001600160401b038b1682529093529120541614156120a55760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b60448201526064016108c8565b600660008585848181106120bb576120bb613b0c565b90506020020160208101906120d09190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b03891680835293522080546001600160a01b031916905584848381811061211e5761211e613b0c565b90506020020160208101906121339190613872565b6001600160a01b03167f35fc26c7e1a23ee3d8b11885b514c5faa1268248880b5676e4863b87d47c5cb160405160405180910390a3600101611ffa565b61217a8282612c7f565b5050565b60006116ad836001600160a01b038416612d07565b600061219e33611152565b156121b0575060131936013560601c90565b503390565b905090565b3390565b60006001600160ff1b038211156122285760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b60648201526084016108c8565b5090565b60006121b5612193565b60008061224e6001600160a01b038916863089612d56565b604051630852cd8d60e31b8152600481018790526001600160a01b038916906342966c6890602401600060405180830381600087803b15801561229057600080fd5b505af11580156122a4573d6000803e3d6000fd5b5050505060006122b98b8b8b8b8b8a8a612d94565b6003546040516320487ded60e01b81529192506001600160a01b0316906320487ded906122ec908e908590600401613e07565b60206040518083038186803b15801561230457600080fd5b505afa158015612318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233c9190613b22565b91506001600160a01b0384161561252a57341561238f5760405162461bcd60e51b815260206004820152601160248201527013985d1a5d99481d1bdad95b881cd95b9d607a1b60448201526064016108c8565b6001600160401b038b1660009081526007602052604090205460ff166123c9576123c46001600160a01b038516873085612d56565b612485565b6040516370a0823160e01b815230600482015282906001600160a01b038616906370a082319060240160206040518083038186803b15801561240a57600080fd5b505afa15801561241e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124429190613b22565b10156124855760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b60448201526064016108c8565b60035461249f906001600160a01b03868116911684612ef5565b6003546040516396f4e9f960e01b81526001600160a01b03909116906396f4e9f9906124d1908e908590600401613e07565b602060405180830381600087803b1580156124eb57600080fd5b505af11580156124ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125239190613b22565b9250612695565b6001600160401b038b1660009081526007602052604090205460ff166125c7578134101561259a5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f756768206e617469766520666565732073656e74000000000060448201526064016108c8565b60006125a68334613ee0565b905080156125c1576125c16001600160a01b03881682612809565b5061260c565b8147101561260c5760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b60448201526064016108c8565b6003546040516396f4e9f960e01b81526001600160a01b03909116906396f4e9f9908490612640908f908690600401613e07565b6020604051808303818588803b15801561265957600080fd5b505af115801561266d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906126929190613b22565b92505b509850989650505050505050565b60006001600160e01b031982166385572ffb60e01b1480610b5e57506001600160e01b031982166301ffc9a760e01b1492915050565b600082815260016020819052604090912001546126fd816126f861222c565b613019565b610edf8383612c7f565b61270f61222c565b6001600160a01b0316816001600160a01b0316146127875760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108c8565b61217a828261307d565b60006116ad836001600160a01b038416613102565b6040516001600160a01b038316602482015260448101829052610edf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526131f5565b804710156128595760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108c8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146128a6576040519150601f19603f3d011682016040523d82523d6000602084013e6128ab565b606091505b5050905080610edf5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108c8565b600260005414156129455760405162461bcd60e51b81526004016108c8906139d5565b6002600081905550600080600080846060015180602001905181019061296b9190613ef7565b935093509350935060006129828660200151611e59565b9050806001600160a01b031686604001518060200190518101906129a69190613b3b565b6001600160a01b0316146129f15760405162461bcd60e51b815260206004820152601260248201527115dc9bdb99c81cdc98c8195b991c1bda5b9d60721b60448201526064016108c8565b6129ff848760200151611552565b6001600160a01b0316856001600160a01b031614612a515760405162461bcd60e51b815260206004820152600f60248201526e2bb937b7339039b931903a37b5b2b760891b60448201526064016108c8565b6040516340c10f1960e01b81526001600160a01b038381166004830152602482018590528516906340c10f1990604401602060405180830381600087803b158015612a9b57600080fd5b505af1158015612aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ad39190613a98565b50612add836121be565b6001600160a01b03851660009081526008602090815260408083208a8301516001600160401b0316845290915281208054909190612b1c908490613f4c565b90915550612b2b9050836121be565b6001600160a01b03851660009081526009602052604081208054909190612b53908490613f4c565b90915550506020868101518751604080516001600160a01b0386811682528a81169582019590955288851681830152606081018890529386166080850152516001600160401b039092169290917f6704923e6b6fc12c14e3538970c6b29585cf2dbd97605c1944f51374a5a9d7809181900360a00190a35050600160005550505050565b60006116ad83836132c7565b6001600160a01b038116612c2a5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103937baba32b960911b60448201526064016108c8565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b5e825490565b60008281526001602081905260409091200154612c75816126f861222c565b610edf838361307d565b612c898282611886565b61217a5760008281526001602081815260408084206001600160a01b0386168552909152909120805460ff19169091179055612cc361222c565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054612d4e57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b5e565b506000610b5e565b6040516001600160a01b0380851660248301528316604482015260648101829052612d8e9085906323b872dd60e01b906084016127d2565b50505050565b612dcf6040518060a0016040528060608152602001606081526020016060815260200160006001600160a01b03168152602001606081525090565b6040805160a080820183526001600160a01b038a811660c0808501919091528451808503909101815260e084018552835283518a82166020808301919091528a831682870152606082018a9052918816608080830191909152855180830390910181529201845280830191909152825160008082529181018452909282019083612e7b565b6040805180820190915260008082526020820152815260200190600190039081612e545790505b508152602001846001600160a01b03168152602001612ee6612e9c8c610843565b6040805182516024820152602092830151151560448083019190915282518083039091018152606490910190915290810180516001600160e01b03166397a657c960e01b17905290565b90529998505050505050505050565b801580612f7e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015612f4457600080fd5b505afa158015612f58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f7c9190613b22565b155b612fe95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016108c8565b6040516001600160a01b038316602482015260448101829052610edf90849063095ea7b360e01b906064016127d2565b6130238282611886565b61217a5761303b816001600160a01b031660146132f1565b6130468360206132f1565b604051602001613057929190613f8d565b60408051601f198184030181529082905262461bcd60e51b82526108c891600401614002565b6130878282611886565b1561217a5760008281526001602090815260408083206001600160a01b03851684529091529020805460ff191690556130be61222c565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600081815260018301602052604081205480156131eb576000613126600183613ee0565b855490915060009061313a90600190613ee0565b905081811461319f57600086600001828154811061315a5761315a613b0c565b906000526020600020015490508087600001848154811061317d5761317d613b0c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806131b0576131b0614015565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b5e565b6000915050610b5e565b600061324a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661348c9092919063ffffffff16565b805190915015610edf57808060200190518101906132689190613a98565b610edf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108c8565b60008260000182815481106132de576132de613b0c565b9060005260206000200154905092915050565b6060600061330083600261402b565b61330b90600261404a565b6001600160401b0381111561332257613322613b58565b6040519080825280601f01601f19166020018201604052801561334c576020820181803683370190505b509050600360fc1b8160008151811061336757613367613b0c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061339657613396613b0c565b60200101906001600160f81b031916908160001a90535060006133ba84600261402b565b6133c590600161404a565b90505b600181111561343d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106133f9576133f9613b0c565b1a60f81b82828151811061340f5761340f613b0c565b60200101906001600160f81b031916908160001a90535060049490941c9361343681614062565b90506133c8565b5083156116ad5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108c8565b606061349b84846000856134a3565b949350505050565b6060824710156135045760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108c8565b843b6135525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108c8565b600080866001600160a01b0316858760405161356e9190614079565b60006040518083038185875af1925050503d80600081146135ab576040519150601f19603f3d011682016040523d82523d6000602084013e6135b0565b606091505b50915091506135c08282866135cb565b979650505050505050565b606083156135da5750816116ad565b8251156135ea5782518084602001fd5b8160405162461bcd60e51b81526004016108c89190614002565b80356001600160401b03811681146108d157600080fd5b60006020828403121561362d57600080fd5b6116ad82613604565b6001600160a01b038116811461162057600080fd5b600080600080600060a0868803121561366357600080fd5b61366c86613604565b9450602086013561367c81613636565b935060408601359250606086013561369381613636565b915060808601356136a381613636565b809150509295509295909350565b6000602082840312156136c357600080fd5b81356001600160e01b0319811681146116ad57600080fd5b801515811461162057600080fd5b6000806000606084860312156136fe57600080fd5b61370784613604565b925060208401359150604084013561371e816136db565b809150509250925092565b60008083601f84011261373b57600080fd5b5081356001600160401b0381111561375257600080fd5b6020830191508360208260051b850101111561376d57600080fd5b9250929050565b60008060006040848603121561378957600080fd5b61379284613604565b925060208401356001600160401b038111156137ad57600080fd5b6137b986828701613729565b9497909650939450505050565b6000602082840312156137d857600080fd5b5035919050565b600080604083850312156137f257600080fd5b82356137fd81613636565b915061380b60208401613604565b90509250929050565b6000806040838503121561382757600080fd5b82359150602083013561383981613636565b809150509250929050565b6000806040838503121561385757600080fd5b823561386281613636565b9150602083013561383981613636565b60006020828403121561388457600080fd5b81356116ad81613636565b6000806000806000606086880312156138a757600080fd5b6138b086613604565b945060208601356001600160401b03808211156138cc57600080fd5b6138d889838a01613729565b909650945060408801359150808211156138f157600080fd5b506138fe88828901613729565b969995985093965092949392505050565b60006020828403121561392157600080fd5b81356001600160401b0381111561393757600080fd5b820160a081850312156116ad57600080fd5b6000806040838503121561395c57600080fd5b50508035926020909101359150565b60008060006060848603121561398057600080fd5b61398984613604565b9250602084013561399981613636565b9150604084013561371e81613636565b600080604083850312156139bc57600080fd5b6139c583613604565b91506020830135613839816136db565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008083128015600160ff1b850184121615613a4057613a40613a0c565b6001600160ff1b0384018313811615613a5b57613a5b613a0c565b50500390565b6020808252601d908201527f53656e646572206d75737420626520746865206d61696e7461696e6572000000604082015260600190565b600060208284031215613aaa57600080fd5b81516116ad816136db565b60208082526013908201527210da185a5b881b9bdd081cdd5c1c1bdc9d1959606a1b604082015260600190565b60208082526010908201526f139bc81d1bdad95b9cc81c185cdcd95960821b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613b3457600080fd5b5051919050565b600060208284031215613b4d57600080fd5b81516116ad81613636565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613b9057613b90613b58565b60405290565b60405160a081016001600160401b0381118282101715613b9057613b90613b58565b604051601f8201601f191681016001600160401b0381118282101715613be057613be0613b58565b604052919050565b600082601f830112613bf957600080fd5b81356001600160401b03811115613c1257613c12613b58565b613c25601f8201601f1916602001613bb8565b818152846020838601011115613c3a57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613c6857600080fd5b813560206001600160401b03821115613c8357613c83613b58565b613c91818360051b01613bb8565b82815260069290921b84018101918181019086841115613cb057600080fd5b8286015b84811015613cf85760408189031215613ccd5760008081fd5b613cd5613b6e565b8135613ce081613636565b81528185013585820152835291830191604001613cb4565b509695505050505050565b600060a08236031215613d1557600080fd5b613d1d613b96565b82358152613d2d60208401613604565b602082015260408301356001600160401b0380821115613d4c57600080fd5b613d5836838701613be8565b60408401526060850135915080821115613d7157600080fd5b613d7d36838701613be8565b60608401526080850135915080821115613d9657600080fd5b50613da336828601613c57565b60808301525092915050565b60005b83811015613dca578181015183820152602001613db2565b83811115612d8e5750506000910152565b60008151808452613df3816020860160208601613daf565b601f01601f19169290920160200192915050565b600060406001600160401b038516835260208181850152845160a083860152613e3360e0860182613ddb565b905081860151603f1980878403016060880152613e508383613ddb565b88860151888203830160808a01528051808352908601945060009350908501905b80841015613ea357845180516001600160a01b0316835286015186830152938501936001939093019290860190613e71565b5060608901516001600160a01b031660a08901526080890151888203830160c08a01529550613ed28187613ddb565b9a9950505050505050505050565b600082821015613ef257613ef2613a0c565b500390565b60008060008060808587031215613f0d57600080fd5b8451613f1881613636565b6020860151909450613f2981613636565b604086015160608701519194509250613f4181613636565b939692955090935050565b600080821280156001600160ff1b0384900385131615613f6e57613f6e613a0c565b600160ff1b8390038412811615613f8757613f87613a0c565b50500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613fc5816017850160208801613daf565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613ff6816028840160208801613daf565b01602801949350505050565b6020815260006116ad6020830184613ddb565b634e487b7160e01b600052603160045260246000fd5b600081600019048311821515161561404557614045613a0c565b500290565b6000821982111561405d5761405d613a0c565b500190565b60008161407157614071613a0c565b506000190190565b6000825161408b818460208701613daf565b919091019291505056fe126303c860ea810f85e857ad8768056e2eebc24b7796655ff3107e4af18e3f1ea2646970667358221220128012db5373a9bc9e55b68a0d62d4891e08c53841ceb4a1f82edb2efc51402664736f6c63430008090033126303c860ea810f85e857ad8768056e2eebc24b7796655ff3107e4af18e3f1e00000000000000000000000080d629cf2d775cb9b97c4a95fe2269e0e8459d3a0000000000000000000000004aad6071085df840abd9baf1697d5d5992bdadce000000000000000000000000b5c54f57d7f3ec6367db4fb5a08a1174797e221c000000000000000000000000d874e1b9ace88bfaf2d5b9859164ac1001b40303

Deployed Bytecode

0x6080604052600436106102285760003560e01c80639010d07c11610123578063cec12571116100ab578063efb45c2e1161006f578063efb45c2e14610774578063f5731442146107ad578063f6bf3ef6146107cd578063f874225414610801578063fe23bbdd1461082357600080fd5b8063cec12571146106be578063d547741f146106de578063e01d958a146106fe578063e34813681461071e578063ead5fea51461075457600080fd5b8063a217fddf116100f2578063a217fddf1461062b578063b0f479a114610640578063c0d786551461065e578063c75299341461067e578063ca15c8731461069e57600080fd5b80639010d07c1461059357806391b48f6e146105b357806391d14854146105d35780639f3d6bc8146105f357600080fd5b806336568abe116101b15780636cfc9e5e116101755780636cfc9e5e146104ad57806378d0e582146104cd578063808988671461051b57806385572ffb1461055357806388aa39ec1461057357600080fd5b806336568abe146103df57806337b7a3e4146103ff5780633aeac4e11461044d57806351cff8d91461046d578063572b6c051461048d57600080fd5b8063225d196a116101f8578063225d196a146102f0578063248a9ca3146103105780632d1662bb1461034f5780632f2ff15d1461039f578063319dc24a146103bf57600080fd5b8062faa205146102345780630135f8371461027657806301ffc9a71461029e5780631d4420b6146102ce57600080fd5b3661022f57005b600080fd5b34801561024057600080fd5b5061025461024f36600461361b565b610843565b6040805182518152602092830151151592810192909252015b60405180910390f35b61028961028436600461364b565b6108d6565b6040805192835260208301919091520161026d565b3480156102aa57600080fd5b506102be6102b93660046136b1565b610b53565b604051901515815260200161026d565b3480156102da57600080fd5b506102ee6102e93660046136e9565b610b64565b005b3480156102fc57600080fd5b506102ee61030b366004613774565b610cfd565b34801561031c57600080fd5b5061034161032b3660046137c6565b6000908152600160208190526040909120015490565b60405190815260200161026d565b34801561035b57600080fd5b506102be61036a3660046137df565b6001600160a01b0391821660009081526006602090815260408083206001600160401b03949094168352929052205416151590565b3480156103ab57600080fd5b506102ee6103ba366004613814565b610ebd565b3480156103cb57600080fd5b506102be6103da36600461361b565b610ee4565b3480156103eb57600080fd5b506102ee6103fa366004613814565b610f39565b34801561040b57600080fd5b5061034161041a3660046137df565b6001600160a01b0382166000908152600a602090815260408083206001600160401b038516845290915290205492915050565b34801561045957600080fd5b506102ee610468366004613844565b610f5b565b34801561047957600080fd5b506102ee610488366004613872565b611096565b34801561049957600080fd5b506102be6104a8366004613872565b611152565b3480156104b957600080fd5b506102ee6104c836600461388f565b61122f565b3480156104d957600080fd5b506103416104e83660046137df565b6001600160a01b03821660009081526008602090815260408083206001600160401b038516845290915290205492915050565b34801561052757600080fd5b5061053b6105363660046137df565b611552565b6040516001600160a01b03909116815260200161026d565b34801561055f57600080fd5b506102ee61056e36600461390f565b6115c4565b34801561057f57600080fd5b5061053b61058e36600461361b565b611623565b34801561059f57600080fd5b5061053b6105ae366004613949565b611695565b3480156105bf57600080fd5b506102ee6105ce36600461396b565b6116b4565b3480156105df57600080fd5b506102be6105ee366004613814565b611886565b3480156105ff57600080fd5b506102be61060e36600461361b565b6001600160401b0316600090815260056020526040902054151590565b34801561063757600080fd5b50610341600081565b34801561064c57600080fd5b506003546001600160a01b031661053b565b34801561066a57600080fd5b506102ee610679366004613872565b6118b1565b34801561068a57600080fd5b506102ee61069936600461388f565b6118ee565b3480156106aa57600080fd5b506103416106b93660046137c6565b611c1a565b3480156106ca57600080fd5b506102ee6106d93660046139a9565b611c31565b3480156106ea57600080fd5b506102ee6106f9366004613814565b611d1f565b34801561070a57600080fd5b506102ee61071936600461361b565b611d29565b34801561072a57600080fd5b50610341610739366004613872565b6001600160a01b031660009081526009602052604090205490565b34801561076057600080fd5b5061053b61076f36600461361b565b611e59565b34801561078057600080fd5b506102be61078f36600461361b565b6001600160401b031660009081526007602052604090205460ff1690565b3480156107b957600080fd5b506102ee6107c836600461361b565b611ec8565b3480156107d957600080fd5b5061053b7f00000000000000000000000080d629cf2d775cb9b97c4a95fe2269e0e8459d3a81565b34801561080d57600080fd5b5061034160008051602061409683398151915281565b34801561082f57600080fd5b506102ee61083e366004613774565b611fa5565b604080518082018252600080825260209182018190526001600160401b0384168152600582528290208251808401909352805480845260019091015460ff161515918301919091526108d15760405162461bcd60e51b8152602060048201526012602482015271105c99dcc81b9bdd081cdd5c1c1bdc9d195960721b60448201526064015b60405180910390fd5b919050565b600080600260005414156108fc5760405162461bcd60e51b81526004016108c8906139d5565b600260009081556040805160808101825282815260208101839052908101829052606081019190915261092e88611623565b6001600160a01b031681526000610945888a611552565b6001600160a01b03891660009081526008602090815260408083206001600160401b038e168452825290912054908401529050610981876121be565b6040808401919091526001600160a01b0389166000908152600a60209081528282206001600160401b038d168352905220546109bc906121be565b826020015183604001516109d09190613a22565b1315610a1e5760405162461bcd60e51b815260206004820152601a60248201527f4d6178206272696467656420616d6f756e74207265616368656400000000000060448201526064016108c8565b610a2661222c565b6001600160a01b0316606083018190528251610a4c918b91908b9085908c908c8c612236565b60408401516020850151929650909450610a6591613a22565b6001600160a01b03891660008181526008602090815260408083206001600160401b038f1684528252808320949094558584015192825260099052918220805491929091610ab4908490613a22565b90915550508151606080840151604080516001600160a01b0394851681528c85166020820152858516818301529283018b9052908316608083015288831660a083015291871660c082015260e0810185905290516001600160401b038b169186917f4f7fc7a3b4f8ffd103e5d9288b191f668ca7caa10e0b07c1de8b9026fe383119918190036101000190a35050600160005590969095509350505050565b6000610b5e826126a3565b92915050565b610b7c60008051602061409683398151915233611886565b610b985760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03851660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b158015610be457600080fd5b505afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190613a98565b610c385760405162461bcd60e51b81526004016108c890613ab5565b81610c765760405162461bcd60e51b815260206004820152600e60248201526d139d5b1b0819d85cc81a5b9c1d5d60921b60448201526064016108c8565b60408051808201825283815282151560208083018281526001600160401b0388166000818152600584528690209451855590516001909401805460ff19169415159490941790935583518681529081019190915290917fe27d5b3c14a114d5705330d1fa5b7d1fb978ff22de1d55c3a5faba3c12ef0ab491015b60405180910390a2505050565b610d1560008051602061409683398151915233611886565b610d315760405162461bcd60e51b81526004016108c890613a61565b8080610d4f5760405162461bcd60e51b81526004016108c890613ae2565b60005b81811015610eb657600a6000858584818110610d7057610d70613b0c565b9050602002016020810190610d859190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b0389168252909252902054610df65760405162461bcd60e51b815260206004820152601260248201527113585e08185b5bdd5b9d081b9bdd081cd95d60721b60448201526064016108c8565b600a6000858584818110610e0c57610e0c613b0c565b9050602002016020810190610e219190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b038916808352935290812055848483818110610e6457610e64613b0c565b9050602002016020810190610e799190613872565b6001600160a01b03167fc4c3c978a9d0d9d1518cb39062ce9ba7c01872deb12c425d2d09152710f1973460405160405180910390a3600101610d52565b5050505050565b610ec782826126d9565b6000828152600260205260409020610edf908261217e565b505050565b6001600160401b0381166000908152600460205260408120546001600160a01b031615801590610b5e5750506001600160401b03166000908152600460205260409020600101546001600160a01b0316151590565b610f438282612707565b6000828152600260205260409020610edf9082612791565b610f7360008051602061409683398151915233611886565b610f8f5760405162461bcd60e51b81526004016108c890613a61565b60026000541415610fb25760405162461bcd60e51b81526004016108c8906139d5565b600260009081556040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b158015610ff857600080fd5b505afa15801561100c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110309190613b22565b9050600081116110785760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016108c8565b61108c6001600160a01b03841683836127a6565b5050600160005550565b6110ae60008051602061409683398151915233611886565b6110ca5760405162461bcd60e51b81526004016108c890613a61565b600260005414156110ed5760405162461bcd60e51b81526004016108c8906139d5565b600260005547806111365760405162461bcd60e51b81526020600482015260136024820152724e6f7468696e6720746f20776974686472617760681b60448201526064016108c8565b6111496001600160a01b03831682612809565b50506001600055565b6040516302abf57960e61b81526f2a393ab9ba32b22337b93bb0b93232b960811b60048201526000907f00000000000000000000000080d629cf2d775cb9b97c4a95fe2269e0e8459d3a6001600160a01b03169063aafd5e409060240160206040518083038186803b1580156111c757600080fd5b505afa9250505080156111f7575060408051601f3d908101601f191682019092526111f491810190613b3b565b60015b61120357506000919050565b806001600160a01b0316836001600160a01b031614156112265750600192915050565b50600092915050565b61124760008051602061409683398151915233611886565b6112635760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03871660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b1580156112af57600080fd5b505afa1580156112c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e79190613a98565b6113035760405162461bcd60e51b81526004016108c890613ab5565b82806113215760405162461bcd60e51b81526004016108c890613ae2565b80821461137c5760405162461bcd60e51b815260206004820152602360248201527f53726320746f6b656e7320616e6420616d6f756e747320646f206e6f74206d616044820152620e8c6d60eb1b60648201526084016108c8565b60005b8181101561154957600086868381811061139b5761139b613b0c565b90506020020160208101906113b09190613872565b6001600160a01b031614156113f45760405162461bcd60e51b815260206004820152600a602482015269273ab636103a37b5b2b760b11b60448201526064016108c8565b600084848381811061140857611408613b0c565b905060200201351161144a5760405162461bcd60e51b815260206004820152600b60248201526a139d5b1b08185b5bdd5b9d60aa1b60448201526064016108c8565b83838281811061145c5761145c613b0c565b90506020020135600a600088888581811061147957611479613b0c565b905060200201602081019061148e9190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b038c16808352935220919091558686838181106114d2576114d2613b0c565b90506020020160208101906114e79190613872565b6001600160a01b03167f01f315778069cc280c5dbe64950935865432d313b2f695378e43839888e27e1e86868581811061152357611523613b0c565b9050602002013560405161153991815260200190565b60405180910390a360010161137f565b50505050505050565b6001600160a01b0380831660009081526006602090815260408083206001600160401b03861684529091529020541680610b5e5760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b60448201526064016108c8565b6003546001600160a01b0316331461160f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103937baba32b960911b60448201526064016108c8565b61162061161b82613d03565b612922565b50565b6001600160401b0381166000908152600460205260409020600101546001600160a01b0316806108d15760405162461bcd60e51b815260206004820152601b60248201527f4465737420656e64706f696e74206e6f7420737570706f72746564000000000060448201526064016108c8565b60008281526002602052604081206116ad9083612bd7565b9392505050565b6116cc60008051602061409683398151915233611886565b6116e85760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03851660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b15801561173457600080fd5b505afa158015611748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176c9190613a98565b6117885760405162461bcd60e51b81526004016108c890613ab5565b6001600160a01b038216158015906117a857506001600160a01b03811615155b6117ea5760405162461bcd60e51b8152602060048201526013602482015272139d5b1b081a5b9c1d5d08195b991c1bda5b9d606a1b60448201526064016108c8565b6040805180820182526001600160a01b0384811680835284821660208085018281526001600160401b038a16600081815260048452889020965187549087166001600160a01b031991821617885591516001909701805497909616969091169590951790935584519182529181019190915290917fa0331b1111659dc3fe92c2b1dd894823609fc474f49e8cfceb36e5238f644dad9101610cf0565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6118c960008051602061409683398151915233611886565b6118e55760405162461bcd60e51b81526004016108c890613a61565b61162081612be3565b61190660008051602061409683398151915233611886565b6119225760405162461bcd60e51b81526004016108c890613a61565b600354604051631491520b60e31b81526001600160401b03871660048201526001600160a01b039091169063a48a90589060240160206040518083038186803b15801561196e57600080fd5b505afa158015611982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a69190613a98565b6119c25760405162461bcd60e51b81526004016108c890613ab5565b82806119e05760405162461bcd60e51b81526004016108c890613ae2565b808214611a2f5760405162461bcd60e51b815260206004820181905260248201527f53726320616e64206465737420746f6b656e7320646f206e6f74206d6174636860448201526064016108c8565b60005b81811015611549576000868683818110611a4e57611a4e613b0c565b9050602002016020810190611a639190613872565b6001600160a01b031614158015611aaa57506000848483818110611a8957611a89613b0c565b9050602002016020810190611a9e9190613872565b6001600160a01b031614155b611ae35760405162461bcd60e51b815260206004820152600a602482015269273ab636103a37b5b2b760b11b60448201526064016108c8565b838382818110611af557611af5613b0c565b9050602002016020810190611b0a9190613872565b60066000888885818110611b2057611b20613b0c565b9050602002016020810190611b359190613872565b6001600160a01b039081168252602080830193909352604091820160009081206001600160401b038d168252909352912080546001600160a01b03191692909116919091179055838382818110611b8e57611b8e613b0c565b9050602002016020810190611ba39190613872565b6001600160a01b0316876001600160401b0316878784818110611bc857611bc8613b0c565b9050602002016020810190611bdd9190613872565b6001600160a01b03167f34e235f0098f19f6ed66b57986c8981f41faa1267f62394202be246617e5477a60405160405180910390a4600101611a32565b6000818152600260205260408120610b5e90612c4c565b611c4960008051602061409683398151915233611886565b611c655760405162461bcd60e51b81526004016108c890613a61565b6001600160401b03821660009081526007602052604090205460ff1615158115151415611ccb5760405162461bcd60e51b8152602060048201526014602482015273119c99594819995948185b1c9958591e481cd95d60621b60448201526064016108c8565b6001600160401b038216600081815260076020526040808220805460ff191685151590811790915590519092917f5c6b78a0b505fd49df5a1603d81f867a3038e3970f8a1ce1daf36698ad5d45cc91a35050565b610f438282612c56565b611d4160008051602061409683398151915233611886565b611d5d5760405162461bcd60e51b81526004016108c890613a61565b6001600160401b0381166000908152600460205260409020546001600160a01b031615801590611db057506001600160401b0381166000908152600460205260409020600101546001600160a01b031615155b611dfc5760405162461bcd60e51b815260206004820152601760248201527f456e64706f696e7473206e6f7420737570706f7274656400000000000000000060448201526064016108c8565b6001600160401b03811660008181526004602052604080822080546001600160a01b03199081168255600190910180549091169055517f796efd4f9d43cdefbe8613966913d2243449a436e3355806d10fa881e40b48919190a250565b6001600160401b0381166000908152600460205260409020546001600160a01b0316806108d15760405162461bcd60e51b815260206004820152601a60248201527f53726320656e64706f696e74206e6f7420737570706f7274656400000000000060448201526064016108c8565b611ee060008051602061409683398151915233611886565b611efc5760405162461bcd60e51b81526004016108c890613a61565b6001600160401b038116600090815260056020526040902054611f565760405162461bcd60e51b8152602060048201526012602482015271105c99dcc81b9bdd081cdd5c1c1bdc9d195960721b60448201526064016108c8565b6001600160401b038116600081815260056020526040808220828155600101805460ff19169055517f432332e411c36e2e4e47855806cf50cebf906329598989d90b576ade028983619190a250565b611fbd60008051602061409683398151915233611886565b611fd95760405162461bcd60e51b81526004016108c890613a61565b8080611ff75760405162461bcd60e51b81526004016108c890613ae2565b60005b81811015610eb657600060068186868581811061201957612019613b0c565b905060200201602081019061202e9190613872565b6001600160a01b039081168252602080830193909352604091820160009081206001600160401b038b1682529093529120541614156120a55760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b60448201526064016108c8565b600660008585848181106120bb576120bb613b0c565b90506020020160208101906120d09190613872565b6001600160a01b03168152602080820192909252604090810160009081206001600160401b03891680835293522080546001600160a01b031916905584848381811061211e5761211e613b0c565b90506020020160208101906121339190613872565b6001600160a01b03167f35fc26c7e1a23ee3d8b11885b514c5faa1268248880b5676e4863b87d47c5cb160405160405180910390a3600101611ffa565b61217a8282612c7f565b5050565b60006116ad836001600160a01b038416612d07565b600061219e33611152565b156121b0575060131936013560601c90565b503390565b905090565b3390565b60006001600160ff1b038211156122285760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b60648201526084016108c8565b5090565b60006121b5612193565b60008061224e6001600160a01b038916863089612d56565b604051630852cd8d60e31b8152600481018790526001600160a01b038916906342966c6890602401600060405180830381600087803b15801561229057600080fd5b505af11580156122a4573d6000803e3d6000fd5b5050505060006122b98b8b8b8b8b8a8a612d94565b6003546040516320487ded60e01b81529192506001600160a01b0316906320487ded906122ec908e908590600401613e07565b60206040518083038186803b15801561230457600080fd5b505afa158015612318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233c9190613b22565b91506001600160a01b0384161561252a57341561238f5760405162461bcd60e51b815260206004820152601160248201527013985d1a5d99481d1bdad95b881cd95b9d607a1b60448201526064016108c8565b6001600160401b038b1660009081526007602052604090205460ff166123c9576123c46001600160a01b038516873085612d56565b612485565b6040516370a0823160e01b815230600482015282906001600160a01b038616906370a082319060240160206040518083038186803b15801561240a57600080fd5b505afa15801561241e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124429190613b22565b10156124855760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b60448201526064016108c8565b60035461249f906001600160a01b03868116911684612ef5565b6003546040516396f4e9f960e01b81526001600160a01b03909116906396f4e9f9906124d1908e908590600401613e07565b602060405180830381600087803b1580156124eb57600080fd5b505af11580156124ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125239190613b22565b9250612695565b6001600160401b038b1660009081526007602052604090205460ff166125c7578134101561259a5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f756768206e617469766520666565732073656e74000000000060448201526064016108c8565b60006125a68334613ee0565b905080156125c1576125c16001600160a01b03881682612809565b5061260c565b8147101561260c5760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b60448201526064016108c8565b6003546040516396f4e9f960e01b81526001600160a01b03909116906396f4e9f9908490612640908f908690600401613e07565b6020604051808303818588803b15801561265957600080fd5b505af115801561266d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906126929190613b22565b92505b509850989650505050505050565b60006001600160e01b031982166385572ffb60e01b1480610b5e57506001600160e01b031982166301ffc9a760e01b1492915050565b600082815260016020819052604090912001546126fd816126f861222c565b613019565b610edf8383612c7f565b61270f61222c565b6001600160a01b0316816001600160a01b0316146127875760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108c8565b61217a828261307d565b60006116ad836001600160a01b038416613102565b6040516001600160a01b038316602482015260448101829052610edf90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526131f5565b804710156128595760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108c8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146128a6576040519150601f19603f3d011682016040523d82523d6000602084013e6128ab565b606091505b5050905080610edf5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108c8565b600260005414156129455760405162461bcd60e51b81526004016108c8906139d5565b6002600081905550600080600080846060015180602001905181019061296b9190613ef7565b935093509350935060006129828660200151611e59565b9050806001600160a01b031686604001518060200190518101906129a69190613b3b565b6001600160a01b0316146129f15760405162461bcd60e51b815260206004820152601260248201527115dc9bdb99c81cdc98c8195b991c1bda5b9d60721b60448201526064016108c8565b6129ff848760200151611552565b6001600160a01b0316856001600160a01b031614612a515760405162461bcd60e51b815260206004820152600f60248201526e2bb937b7339039b931903a37b5b2b760891b60448201526064016108c8565b6040516340c10f1960e01b81526001600160a01b038381166004830152602482018590528516906340c10f1990604401602060405180830381600087803b158015612a9b57600080fd5b505af1158015612aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ad39190613a98565b50612add836121be565b6001600160a01b03851660009081526008602090815260408083208a8301516001600160401b0316845290915281208054909190612b1c908490613f4c565b90915550612b2b9050836121be565b6001600160a01b03851660009081526009602052604081208054909190612b53908490613f4c565b90915550506020868101518751604080516001600160a01b0386811682528a81169582019590955288851681830152606081018890529386166080850152516001600160401b039092169290917f6704923e6b6fc12c14e3538970c6b29585cf2dbd97605c1944f51374a5a9d7809181900360a00190a35050600160005550505050565b60006116ad83836132c7565b6001600160a01b038116612c2a5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103937baba32b960911b60448201526064016108c8565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b5e825490565b60008281526001602081905260409091200154612c75816126f861222c565b610edf838361307d565b612c898282611886565b61217a5760008281526001602081815260408084206001600160a01b0386168552909152909120805460ff19169091179055612cc361222c565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054612d4e57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b5e565b506000610b5e565b6040516001600160a01b0380851660248301528316604482015260648101829052612d8e9085906323b872dd60e01b906084016127d2565b50505050565b612dcf6040518060a0016040528060608152602001606081526020016060815260200160006001600160a01b03168152602001606081525090565b6040805160a080820183526001600160a01b038a811660c0808501919091528451808503909101815260e084018552835283518a82166020808301919091528a831682870152606082018a9052918816608080830191909152855180830390910181529201845280830191909152825160008082529181018452909282019083612e7b565b6040805180820190915260008082526020820152815260200190600190039081612e545790505b508152602001846001600160a01b03168152602001612ee6612e9c8c610843565b6040805182516024820152602092830151151560448083019190915282518083039091018152606490910190915290810180516001600160e01b03166397a657c960e01b17905290565b90529998505050505050505050565b801580612f7e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015612f4457600080fd5b505afa158015612f58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f7c9190613b22565b155b612fe95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016108c8565b6040516001600160a01b038316602482015260448101829052610edf90849063095ea7b360e01b906064016127d2565b6130238282611886565b61217a5761303b816001600160a01b031660146132f1565b6130468360206132f1565b604051602001613057929190613f8d565b60408051601f198184030181529082905262461bcd60e51b82526108c891600401614002565b6130878282611886565b1561217a5760008281526001602090815260408083206001600160a01b03851684529091529020805460ff191690556130be61222c565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600081815260018301602052604081205480156131eb576000613126600183613ee0565b855490915060009061313a90600190613ee0565b905081811461319f57600086600001828154811061315a5761315a613b0c565b906000526020600020015490508087600001848154811061317d5761317d613b0c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806131b0576131b0614015565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b5e565b6000915050610b5e565b600061324a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661348c9092919063ffffffff16565b805190915015610edf57808060200190518101906132689190613a98565b610edf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108c8565b60008260000182815481106132de576132de613b0c565b9060005260206000200154905092915050565b6060600061330083600261402b565b61330b90600261404a565b6001600160401b0381111561332257613322613b58565b6040519080825280601f01601f19166020018201604052801561334c576020820181803683370190505b509050600360fc1b8160008151811061336757613367613b0c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061339657613396613b0c565b60200101906001600160f81b031916908160001a90535060006133ba84600261402b565b6133c590600161404a565b90505b600181111561343d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106133f9576133f9613b0c565b1a60f81b82828151811061340f5761340f613b0c565b60200101906001600160f81b031916908160001a90535060049490941c9361343681614062565b90506133c8565b5083156116ad5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108c8565b606061349b84846000856134a3565b949350505050565b6060824710156135045760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108c8565b843b6135525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108c8565b600080866001600160a01b0316858760405161356e9190614079565b60006040518083038185875af1925050503d80600081146135ab576040519150601f19603f3d011682016040523d82523d6000602084013e6135b0565b606091505b50915091506135c08282866135cb565b979650505050505050565b606083156135da5750816116ad565b8251156135ea5782518084602001fd5b8160405162461bcd60e51b81526004016108c89190614002565b80356001600160401b03811681146108d157600080fd5b60006020828403121561362d57600080fd5b6116ad82613604565b6001600160a01b038116811461162057600080fd5b600080600080600060a0868803121561366357600080fd5b61366c86613604565b9450602086013561367c81613636565b935060408601359250606086013561369381613636565b915060808601356136a381613636565b809150509295509295909350565b6000602082840312156136c357600080fd5b81356001600160e01b0319811681146116ad57600080fd5b801515811461162057600080fd5b6000806000606084860312156136fe57600080fd5b61370784613604565b925060208401359150604084013561371e816136db565b809150509250925092565b60008083601f84011261373b57600080fd5b5081356001600160401b0381111561375257600080fd5b6020830191508360208260051b850101111561376d57600080fd5b9250929050565b60008060006040848603121561378957600080fd5b61379284613604565b925060208401356001600160401b038111156137ad57600080fd5b6137b986828701613729565b9497909650939450505050565b6000602082840312156137d857600080fd5b5035919050565b600080604083850312156137f257600080fd5b82356137fd81613636565b915061380b60208401613604565b90509250929050565b6000806040838503121561382757600080fd5b82359150602083013561383981613636565b809150509250929050565b6000806040838503121561385757600080fd5b823561386281613636565b9150602083013561383981613636565b60006020828403121561388457600080fd5b81356116ad81613636565b6000806000806000606086880312156138a757600080fd5b6138b086613604565b945060208601356001600160401b03808211156138cc57600080fd5b6138d889838a01613729565b909650945060408801359150808211156138f157600080fd5b506138fe88828901613729565b969995985093965092949392505050565b60006020828403121561392157600080fd5b81356001600160401b0381111561393757600080fd5b820160a081850312156116ad57600080fd5b6000806040838503121561395c57600080fd5b50508035926020909101359150565b60008060006060848603121561398057600080fd5b61398984613604565b9250602084013561399981613636565b9150604084013561371e81613636565b600080604083850312156139bc57600080fd5b6139c583613604565b91506020830135613839816136db565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008083128015600160ff1b850184121615613a4057613a40613a0c565b6001600160ff1b0384018313811615613a5b57613a5b613a0c565b50500390565b6020808252601d908201527f53656e646572206d75737420626520746865206d61696e7461696e6572000000604082015260600190565b600060208284031215613aaa57600080fd5b81516116ad816136db565b60208082526013908201527210da185a5b881b9bdd081cdd5c1c1bdc9d1959606a1b604082015260600190565b60208082526010908201526f139bc81d1bdad95b9cc81c185cdcd95960821b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613b3457600080fd5b5051919050565b600060208284031215613b4d57600080fd5b81516116ad81613636565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613b9057613b90613b58565b60405290565b60405160a081016001600160401b0381118282101715613b9057613b90613b58565b604051601f8201601f191681016001600160401b0381118282101715613be057613be0613b58565b604052919050565b600082601f830112613bf957600080fd5b81356001600160401b03811115613c1257613c12613b58565b613c25601f8201601f1916602001613bb8565b818152846020838601011115613c3a57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613c6857600080fd5b813560206001600160401b03821115613c8357613c83613b58565b613c91818360051b01613bb8565b82815260069290921b84018101918181019086841115613cb057600080fd5b8286015b84811015613cf85760408189031215613ccd5760008081fd5b613cd5613b6e565b8135613ce081613636565b81528185013585820152835291830191604001613cb4565b509695505050505050565b600060a08236031215613d1557600080fd5b613d1d613b96565b82358152613d2d60208401613604565b602082015260408301356001600160401b0380821115613d4c57600080fd5b613d5836838701613be8565b60408401526060850135915080821115613d7157600080fd5b613d7d36838701613be8565b60608401526080850135915080821115613d9657600080fd5b50613da336828601613c57565b60808301525092915050565b60005b83811015613dca578181015183820152602001613db2565b83811115612d8e5750506000910152565b60008151808452613df3816020860160208601613daf565b601f01601f19169290920160200192915050565b600060406001600160401b038516835260208181850152845160a083860152613e3360e0860182613ddb565b905081860151603f1980878403016060880152613e508383613ddb565b88860151888203830160808a01528051808352908601945060009350908501905b80841015613ea357845180516001600160a01b0316835286015186830152938501936001939093019290860190613e71565b5060608901516001600160a01b031660a08901526080890151888203830160c08a01529550613ed28187613ddb565b9a9950505050505050505050565b600082821015613ef257613ef2613a0c565b500390565b60008060008060808587031215613f0d57600080fd5b8451613f1881613636565b6020860151909450613f2981613636565b604086015160608701519194509250613f4181613636565b939692955090935050565b600080821280156001600160ff1b0384900385131615613f6e57613f6e613a0c565b600160ff1b8390038412811615613f8757613f87613a0c565b50500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613fc5816017850160208801613daf565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613ff6816028840160208801613daf565b01602801949350505050565b6020815260006116ad6020830184613ddb565b634e487b7160e01b600052603160045260246000fd5b600081600019048311821515161561404557614045613a0c565b500290565b6000821982111561405d5761405d613a0c565b500190565b60008161407157614071613a0c565b506000190190565b6000825161408b818460208701613daf565b919091019291505056fe126303c860ea810f85e857ad8768056e2eebc24b7796655ff3107e4af18e3f1ea2646970667358221220128012db5373a9bc9e55b68a0d62d4891e08c53841ceb4a1f82edb2efc51402664736f6c63430008090033

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

00000000000000000000000080d629cf2d775cb9b97c4a95fe2269e0e8459d3a0000000000000000000000004aad6071085df840abd9baf1697d5d5992bdadce000000000000000000000000b5c54f57d7f3ec6367db4fb5a08a1174797e221c000000000000000000000000d874e1b9ace88bfaf2d5b9859164ac1001b40303

-----Decoded View---------------
Arg [0] : _synthereumFinder (address): 0x80d629cf2D775cB9b97c4A95Fe2269e0E8459d3A
Arg [1] : _router (address): 0x4aAD6071085df840abD9Baf1697d5D5992bDadce
Arg [2] : _roles (tuple):
Arg [1] : admin (address): 0xb5c54f57D7F3eC6367Db4fb5A08a1174797E221c
Arg [2] : maintainer (address): 0xd874E1B9aCe88BFaf2D5B9859164ac1001b40303


-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000080d629cf2d775cb9b97c4a95fe2269e0e8459d3a
Arg [1] : 0000000000000000000000004aad6071085df840abd9baf1697d5d5992bdadce
Arg [2] : 000000000000000000000000b5c54f57d7f3ec6367db4fb5a08a1174797e221c
Arg [3] : 000000000000000000000000d874e1b9ace88bfaf2d5b9859164ac1001b40303


Block Transaction Gas Used Reward
view all blocks validated

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

Validator Index Block Amount
View All Withdrawals

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

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