ETH Price: $2,956.80 (+1.00%)

Contract

0xC1062b7C5Dc8E4b1Df9F200fe360cDc0eD6e7741

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Transaction Hash
Block
From
To
Fulfill Order385015842026-01-24 10:19:033 hrs ago1769249943IN
0xC1062b7C...0eD6e7741
0 ETH0.000000730.0015
Redeem384999092026-01-24 9:51:083 hrs ago1769248268IN
0xC1062b7C...0eD6e7741
0 ETH0.000000380.0015
Fulfill Order384474612026-01-23 19:17:0018 hrs ago1769195820IN
0xC1062b7C...0eD6e7741
0 ETH0.000000680.0015
Redeem384433842026-01-23 18:09:0319 hrs ago1769191743IN
0xC1062b7C...0eD6e7741
0 ETH0.000000330.0015
Redeem384428172026-01-23 17:59:3619 hrs ago1769191176IN
0xC1062b7C...0eD6e7741
0 ETH0.000000340.0015
Redeem384298172026-01-23 14:22:5623 hrs ago1769178176IN
0xC1062b7C...0eD6e7741
0 ETH0.000000380.0015
Fulfill Order384214062026-01-23 12:02:4525 hrs ago1769169765IN
0xC1062b7C...0eD6e7741
0 ETH0.000000590.0015
Redeem384054342026-01-23 7:36:3329 hrs ago1769153793IN
0xC1062b7C...0eD6e7741
0 ETH0.000000360.0015
Redeem383936592026-01-23 4:20:1833 hrs ago1769142018IN
0xC1062b7C...0eD6e7741
0 ETH0.000000360.0015
Redeem383665642026-01-22 20:48:4340 hrs ago1769114923IN
0xC1062b7C...0eD6e7741
0 ETH0.000000380.0015
Fulfill Order383490022026-01-22 15:56:0145 hrs ago1769097361IN
0xC1062b7C...0eD6e7741
0 ETH0.000000720.0015
Fulfill Order383466342026-01-22 15:16:3346 hrs ago1769094993IN
0xC1062b7C...0eD6e7741
0 ETH0.000000910.00150099
Fulfill Order383466262026-01-22 15:16:2546 hrs ago1769094985IN
0xC1062b7C...0eD6e7741
0 ETH0.000001040.0015
Fulfill Order383450342026-01-22 14:49:5346 hrs ago1769093393IN
0xC1062b7C...0eD6e7741
0 ETH0.000000770.00150131
Fulfill Order383449582026-01-22 14:48:3746 hrs ago1769093317IN
0xC1062b7C...0eD6e7741
0 ETH0.000000770.00150244
Fulfill Order383449502026-01-22 14:48:2946 hrs ago1769093309IN
0xC1062b7C...0eD6e7741
0 ETH0.000000840.00151057
Fulfill Order382836252026-01-21 21:46:242 days ago1769031984IN
0xC1062b7C...0eD6e7741
0 ETH0.000000890.0015
Redeem382734182026-01-21 18:56:172 days ago1769021777IN
0xC1062b7C...0eD6e7741
0 ETH0.000000330.0015
Fulfill Order382707642026-01-21 18:12:032 days ago1769019123IN
0xC1062b7C...0eD6e7741
0 ETH0.000001990.0015
Fulfill Order382664362026-01-21 16:59:552 days ago1769014795IN
0xC1062b7C...0eD6e7741
0 ETH0.000000720.0015
Fulfill Order382664282026-01-21 16:59:472 days ago1769014787IN
0xC1062b7C...0eD6e7741
0 ETH0.000000920.0015
Fulfill Order382664202026-01-21 16:59:392 days ago1769014779IN
0xC1062b7C...0eD6e7741
0 ETH0.000000820.0015
Redeem382210112026-01-21 4:22:503 days ago1768969370IN
0xC1062b7C...0eD6e7741
0 ETH0.000000360.0015
Redeem381687192026-01-20 13:51:183 days ago1768917078IN
0xC1062b7C...0eD6e7741
0 ETH0.000000220.00100025
Redeem381554782026-01-20 10:10:374 days ago1768903837IN
0xC1062b7C...0eD6e7741
0 ETH0.000000250.00100025
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
385015842026-01-24 10:19:033 hrs ago1769249943
0xC1062b7C...0eD6e7741
0.00001847 ETH
385015842026-01-24 10:19:033 hrs ago1769249943
0xC1062b7C...0eD6e7741
0.00001847 ETH
384474612026-01-23 19:17:0018 hrs ago1769195820
0xC1062b7C...0eD6e7741
0.00030057 ETH
384474612026-01-23 19:17:0018 hrs ago1769195820
0xC1062b7C...0eD6e7741
0.00030057 ETH
384214062026-01-23 12:02:4525 hrs ago1769169765
0xC1062b7C...0eD6e7741
0.00067971 ETH
384214062026-01-23 12:02:4525 hrs ago1769169765
0xC1062b7C...0eD6e7741
0.00067971 ETH
383490022026-01-22 15:56:0145 hrs ago1769097361
0xC1062b7C...0eD6e7741
0.00007317 ETH
383490022026-01-22 15:56:0145 hrs ago1769097361
0xC1062b7C...0eD6e7741
0.00007317 ETH
383449582026-01-22 14:48:3746 hrs ago1769093317
0xC1062b7C...0eD6e7741
0.00033852 ETH
383449582026-01-22 14:48:3746 hrs ago1769093317
0xC1062b7C...0eD6e7741
0.00033852 ETH
383449502026-01-22 14:48:2946 hrs ago1769093309
0xC1062b7C...0eD6e7741
0.00033853 ETH
381320342026-01-20 3:39:534 days ago1768880393
0xC1062b7C...0eD6e7741
0.00009888 ETH
381320342026-01-20 3:39:534 days ago1768880393
0xC1062b7C...0eD6e7741
0.00009888 ETH
381016122026-01-19 19:12:514 days ago1768849971
0xC1062b7C...0eD6e7741
0.0312557 ETH
381016122026-01-19 19:12:514 days ago1768849971
0xC1062b7C...0eD6e7741
0.0312557 ETH
380847672026-01-19 14:32:064 days ago1768833126
0xC1062b7C...0eD6e7741
0.00006814 ETH
380847672026-01-19 14:32:064 days ago1768833126
0xC1062b7C...0eD6e7741
0.00006814 ETH
380293602026-01-18 23:08:395 days ago1768777719
0xC1062b7C...0eD6e7741
0.00047511 ETH
380293602026-01-18 23:08:395 days ago1768777719
0xC1062b7C...0eD6e7741
0.00047511 ETH
377240822026-01-15 10:20:419 days ago1768472441
0xC1062b7C...0eD6e7741
0.00000354 ETH
377240822026-01-15 10:20:419 days ago1768472441
0xC1062b7C...0eD6e7741
0.00000354 ETH
377234112026-01-15 10:09:309 days ago1768471770
0xC1062b7C...0eD6e7741
0.00029568 ETH
377234112026-01-15 10:09:309 days ago1768471770
0xC1062b7C...0eD6e7741
0.00029568 ETH
377234032026-01-15 10:09:229 days ago1768471762
0xC1062b7C...0eD6e7741
0.00029576 ETH
376994312026-01-15 3:29:509 days ago1768447790
0xC1062b7C...0eD6e7741
0.00030183 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FastMCTP

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 1000 runs

Other Settings:
cancun EvmVersion
File 1 of 15 : FastMCTP.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "ExcessivelySafeCall/ExcessivelySafeCall.sol";
import "./libs/BytesLib.sol";
import "./interfaces/CCTP/v2/ITokenMessengerV2.sol";

contract FastMCTP is ReentrancyGuard {
	using SafeERC20 for IERC20;
	using BytesLib for bytes;
	using ExcessivelySafeCall for address;

	ITokenMessengerV2 public immutable cctpTokenMessengerV2;
	address public feeManager;

	mapping(bytes32 => bytes32) public keyToMintRecipient;
	mapping(uint32 => bytes32) public domainToCaller;

	mapping(address => bool) public whitelistedSwapProtocols;
	mapping(address => bool) public whitelistedMsgSenders;

	address public guardian;
	address public nextGuardian;
	bool public paused;

	uint8 internal constant ETH_DECIMALS = 18;

	uint256 internal constant CCTPV2_SOURCE_DOMAIN_INDEX = 4;
	uint256 internal constant CCTPV2_DESTINATION_DOMAIN_INDEX = 8;
	uint256 internal constant CCTPV2_NONCE_INDEX = 12;
	uint256 internal constant CCTPV2_DETINATION_CALLER_INDEX = 108;
	uint256 internal constant CCTPV2_MESSAGE_BODY_INDEX = 148;
	uint256 internal constant CCTPV2_SOURCE_TOKEN_INDEX = CCTPV2_MESSAGE_BODY_INDEX + 4;
	uint256 internal constant CCTPV2_MINT_RECIPIENT_INDEX = CCTPV2_MESSAGE_BODY_INDEX + 36;
	uint256 internal constant HOOK_DATA_INDEX = CCTPV2_MESSAGE_BODY_INDEX + 228;

	uint256 internal constant GAS_LIMIT_FEE_MANAGER = 1000000;

	event OrderFulfilled(uint32 sourceDomain, bytes32 sourceNonce, uint256 amount);
	event OrderRefunded(uint32 sourceDomain, bytes32 sourceNonce, uint256 amount);

	error Paused();
	error Unauthorized();
	error CctpReceiveFailed();
	error InvalidGasDrop();
	error InvalidMintRecipient();
	error InvalidRedeemFee();
	error InvalidPayload();
	error DeadlineViolation();
	error InvalidAddress();
	error InvalidPayloadType();
	error EthTransferFailed();
	error InvalidAmountOut();
	error MintRecipientNotSet();
	error CallerNotSet();
	error InvalidRefundFee();
	error AlreadySet();
	error UnauthorizedSwapProtocol();
	error UnauthorizedMsgSender();

	struct BridgePayload {
		uint8 payloadType;
		bytes32 destAddr;
		uint64 gasDrop;
		uint64 redeemFee;
		bytes32 referrerAddr;
		uint8 referrerBps;
		bytes32 customPayload;
	}

	struct OrderPayload {
		uint8 payloadType;
		bytes32 destAddr;
		bytes32 tokenOut;
		uint64 amountOutMin;
		uint64 gasDrop;
		uint64 redeemFee;
		uint64 refundFee;
		uint64 deadline;
		bytes32 referrerAddr;
		uint8 referrerBps;
	}

	modifier checkRecipient(bytes memory cctpMsg) {
		if (truncateAddress(cctpMsg.toBytes32(CCTPV2_MINT_RECIPIENT_INDEX)) != address(this)) {
			revert InvalidMintRecipient();
		}
		_;
	}

	modifier whenNotPaused() {
		if (paused) {
			revert Paused();
		}
		_;
	}

	constructor(
		address _cctpTokenMessengerV2,
		address _feeManager
	) {
		cctpTokenMessengerV2 = ITokenMessengerV2(_cctpTokenMessengerV2);
		feeManager = _feeManager;
		guardian = msg.sender;
	}

	function bridge(
		address tokenIn,
		uint256 amountIn,
		uint64 redeemFee,
		uint256 circleMaxFee,
		uint64 gasDrop,
		bytes32 destAddr,
		uint32 destDomain,
		bytes32 referrerAddress,
		uint8 referrerBps,
		uint8 payloadType,
		uint32 minFinalityThreshold,
		bytes memory customPayload
	) external nonReentrant whenNotPaused {
		if (redeemFee + circleMaxFee >= amountIn) {
			revert InvalidRedeemFee();
		}

		if (payloadType != 1 && payloadType != 2) {
			revert InvalidPayloadType();
		}

		IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), amountIn);
		approveIfNeeded(tokenIn, address(cctpTokenMessengerV2), amountIn, true);

		require(referrerBps <= 100, "ReferrerBps should be less than 100");

		bytes32 customPayloadHash;
		if (payloadType == 2) {
			customPayloadHash = keccak256(customPayload);
		}

		BridgePayload memory bridgePayload = BridgePayload({
			payloadType: payloadType,
			destAddr: destAddr,
			gasDrop: gasDrop,
			redeemFee: redeemFee,
			referrerAddr: referrerAddress,
			referrerBps: referrerBps,
			customPayload: customPayloadHash
		});

		sendCctp(tokenIn, amountIn, destDomain, circleMaxFee, minFinalityThreshold, encodeBridgePayload(bridgePayload));
	}

	function createOrder(
		address tokenIn,
		uint256 amountIn,
		uint256 circleMaxFee,
		uint32 destDomain,
		uint32 minFinalityThreshold,
		OrderPayload memory orderPayload
	) external nonReentrant whenNotPaused {
		if (orderPayload.redeemFee + circleMaxFee >= amountIn) {
			revert InvalidRedeemFee();
		}

		if (orderPayload.refundFee + circleMaxFee >= amountIn) {
			revert InvalidRefundFee();
		}

		if (orderPayload.payloadType != 3) {
			revert InvalidPayloadType();
		}

		require(orderPayload.referrerBps <= 100, "ReferrerBps should be less than 100");

		if (orderPayload.tokenOut == bytes32(0) && orderPayload.gasDrop > 0) {
			revert InvalidGasDrop();
		}

		IERC20(tokenIn).safeTransferFrom(msg.sender, address(this), amountIn);
		approveIfNeeded(tokenIn, address(cctpTokenMessengerV2), amountIn, true);

		sendCctp(tokenIn, amountIn, destDomain, circleMaxFee, minFinalityThreshold, encodeOrderPayload(orderPayload));
	}

	function redeem(
		bytes memory cctpMsg,
		bytes memory cctpSigs
	) external nonReentrant payable checkRecipient(cctpMsg) {

		BridgePayload memory bridgePayload = recreateBridgePayload(cctpMsg);

		if (bridgePayload.payloadType != 1 && bridgePayload.payloadType != 2) {
			revert InvalidPayloadType();
		}

		address recipient = truncateAddress(bridgePayload.destAddr);
		if (bridgePayload.payloadType == 2 && msg.sender != recipient) {
			revert Unauthorized();
		}

		(address localToken, uint256 amount) = receiveCctp(cctpMsg, cctpSigs);

		if (bridgePayload.redeemFee > amount) {
			revert InvalidRedeemFee();
		}

		amount = amount - uint256(bridgePayload.redeemFee);

		uint8 referrerBps = bridgePayload.referrerBps > 100 ? 100 : bridgePayload.referrerBps;
		uint8 protocolBps = safeCalcFastMCTPProtocolBps(
			bridgePayload.payloadType,
			localToken,
			amount,
			localToken,
			truncateAddress(bridgePayload.referrerAddr),
			referrerBps
		);
		protocolBps = protocolBps > 100 ? 100 : protocolBps;
		uint256 protocolAmount = amount * protocolBps / 10000;
		uint256 referrerAmount = amount * referrerBps / 10000;

		depositRelayerFee(msg.sender, localToken, uint256(bridgePayload.redeemFee));
		IERC20(localToken).safeTransfer(recipient, amount - protocolAmount - referrerAmount);

		if (referrerAmount > 0) {
			try IERC20(localToken).transfer(truncateAddress(bridgePayload.referrerAddr), referrerAmount) {} catch {}
		}
		if (protocolAmount > 0) {
			try IERC20(localToken).transfer(safeGetFeeCollector(), protocolAmount) {} catch {}
		}

		if (bridgePayload.gasDrop > 0) {
			uint256 denormalizedGasDrop = deNormalizeAmount(bridgePayload.gasDrop, ETH_DECIMALS);
			if (msg.value != denormalizedGasDrop) {
				revert InvalidGasDrop();
			}
			payEth(recipient, denormalizedGasDrop, false);
		}
	}

	function fulfillOrder(
		bytes memory cctpMsg,
		bytes memory cctpSigs,
		address swapProtocol,
		bytes memory swapData
	) external nonReentrant payable checkRecipient(cctpMsg) {
		OrderPayload memory orderPayload = recreateOrderPayload(cctpMsg);
		if (orderPayload.payloadType != 3) {
			revert InvalidPayloadType();
		}

		if (orderPayload.deadline < block.timestamp) {
			revert DeadlineViolation();
		}

		if (!whitelistedSwapProtocols[swapProtocol]) {
			revert UnauthorizedSwapProtocol();
		}

		if (swapProtocol == address(cctpTokenMessengerV2) || swapProtocol == address(cctpTokenMessengerV2.localMessageTransmitter())) {
			revert UnauthorizedSwapProtocol();
		}

		if (!whitelistedMsgSenders[msg.sender]) {
			revert UnauthorizedMsgSender();
		}

		(address localToken, uint256 cctpAmount) = receiveCctp(cctpMsg, cctpSigs);

		if (orderPayload.redeemFee > 0) {
			IERC20(localToken).safeTransfer(msg.sender, orderPayload.redeemFee);
		}

		cctpAmount = cctpAmount - uint256(orderPayload.redeemFee);

		(uint256 referrerAmount, uint256 protocolAmount) = getFeeAmounts(orderPayload, cctpAmount, localToken);

		if (referrerAmount > 0) {
			try IERC20(localToken).transfer(truncateAddress(orderPayload.referrerAddr), referrerAmount) {} catch {}
		}

		if (protocolAmount > 0) {
			try IERC20(localToken).transfer(safeGetFeeCollector(), protocolAmount) {} catch {}
		}

		address tokenOut = truncateAddress(orderPayload.tokenOut);
		require(tokenOut != localToken, "tokenOut cannot be localToken");
		approveIfNeeded(localToken, swapProtocol, cctpAmount - protocolAmount - referrerAmount, false);

		uint256 amountOut;
		if (tokenOut == address(0)) {
			amountOut = address(this).balance;
		} else {
			amountOut = IERC20(tokenOut).balanceOf(address(this));
		}

		(bool swapSuccess, bytes memory swapReturn) = swapProtocol.call{value: 0}(swapData);
		require(swapSuccess, string(swapReturn));

		if (tokenOut == address(0)) {
			amountOut = address(this).balance - amountOut;
		} else {
			amountOut = IERC20(tokenOut).balanceOf(address(this)) - amountOut;
		}

		uint8 decimals;
		if (tokenOut == address(0)) {
			decimals = ETH_DECIMALS;
		} else {
			decimals = decimalsOf(tokenOut);
		}

		makePayments(
			orderPayload,
			tokenOut,
			amountOut
		);

		if (amountOut < deNormalizeAmount(orderPayload.amountOutMin, decimals)) {
			revert InvalidAmountOut();
		}

		logFulfilled(cctpMsg, amountOut);
	}

	function refund(
		bytes memory cctpMsg,
		bytes memory cctpSigs
	) external nonReentrant payable checkRecipient(cctpMsg) {
		(address localToken, uint256 amount) = receiveCctp(cctpMsg, cctpSigs);

		OrderPayload memory orderPayload = recreateOrderPayload(cctpMsg);
		if (orderPayload.payloadType != 3) {
			revert InvalidPayloadType();
		}

		if (orderPayload.deadline >= block.timestamp && localToken != truncateAddress(orderPayload.tokenOut)) {
			revert DeadlineViolation();
		}

		uint256 gasDrop = deNormalizeAmount(orderPayload.gasDrop, ETH_DECIMALS);
		if (msg.value != gasDrop) {
			revert InvalidGasDrop();
		}

		address destAddr = truncateAddress(orderPayload.destAddr);
		if (gasDrop > 0) {
			payEth(destAddr, gasDrop, false);
		}

		IERC20(localToken).safeTransfer(msg.sender, orderPayload.refundFee);
		IERC20(localToken).safeTransfer(destAddr, amount - orderPayload.refundFee);

		emit OrderRefunded(cctpMsg.toUint32(CCTPV2_SOURCE_DOMAIN_INDEX), cctpMsg.toBytes32(CCTPV2_NONCE_INDEX), amount);
	}

	function receiveCctp(bytes memory cctpMsg, bytes memory cctpSigs) internal returns (address, uint256) {
		uint32 cctpSourceDomain = cctpMsg.toUint32(CCTPV2_SOURCE_DOMAIN_INDEX);
		bytes32 cctpSourceToken = cctpMsg.toBytes32(CCTPV2_SOURCE_TOKEN_INDEX);
		address localToken = cctpTokenMessengerV2.localMinter().getLocalToken(cctpSourceDomain, cctpSourceToken);

		uint256 amount = IERC20(localToken).balanceOf(address(this));
		bool success = cctpTokenMessengerV2.localMessageTransmitter().receiveMessage(cctpMsg, cctpSigs);
		if (!success) {
			revert CctpReceiveFailed();
		}
		amount = IERC20(localToken).balanceOf(address(this)) - amount;
		return (localToken, amount);
	}

	function sendCctp(
		address tokenIn,
		uint256 amountIn,
		uint32 destDomain,
		uint256 maxFee,
		uint32 minFinalityThreshold,
		bytes memory hookData
	) internal {
		cctpTokenMessengerV2.depositForBurnWithHook(
			amountIn,
			destDomain,
			getMintRecipient(destDomain, tokenIn),
			tokenIn,
			getCaller(destDomain),
			maxFee,
			minFinalityThreshold,
			hookData
		);
	}

	function makePayments(
		OrderPayload memory orderPayload,
		address tokenOut,
		uint256 amount
	) internal {
		address destAddr = truncateAddress(orderPayload.destAddr);
		if (tokenOut == address(0)) {
			payEth(destAddr, amount, true);
		} else {
			if (orderPayload.gasDrop > 0) {
				uint256 gasDrop = deNormalizeAmount(orderPayload.gasDrop, ETH_DECIMALS);
				if (msg.value != gasDrop) {
					revert InvalidGasDrop();
				}
				payEth(destAddr, gasDrop, false);
			}
			IERC20(tokenOut).safeTransfer(destAddr, amount);
		}
	}

	function logFulfilled(bytes memory cctpMsg, uint256 amount) internal {
		emit OrderFulfilled(cctpMsg.toUint32(CCTPV2_SOURCE_DOMAIN_INDEX), cctpMsg.toBytes32(CCTPV2_NONCE_INDEX), amount);
	}

	function recreateBridgePayload(
		bytes memory cctpMsg
	) internal pure returns (BridgePayload memory) {
		return BridgePayload({
			payloadType: cctpMsg.toUint8(HOOK_DATA_INDEX),
			destAddr: cctpMsg.toBytes32(HOOK_DATA_INDEX + 1),
			gasDrop: cctpMsg.toUint64(HOOK_DATA_INDEX + 33),
			redeemFee: cctpMsg.toUint64(HOOK_DATA_INDEX + 41),
			referrerAddr: cctpMsg.toBytes32(HOOK_DATA_INDEX + 49),
			referrerBps: cctpMsg.toUint8(HOOK_DATA_INDEX + 81),
			customPayload: cctpMsg.toBytes32(HOOK_DATA_INDEX + 82)
		});
	}

	function encodeBridgePayload(BridgePayload memory bridgePayload) internal pure returns (bytes memory) {
		return abi.encodePacked(
			bridgePayload.payloadType,
			bridgePayload.destAddr,
			bridgePayload.gasDrop,
			bridgePayload.redeemFee,
			bridgePayload.referrerAddr,
			bridgePayload.referrerBps,
			bridgePayload.customPayload
		);
	}

	function recreateOrderPayload(
		bytes memory cctpMsg
	) internal pure returns (OrderPayload memory) {
		return OrderPayload({
			payloadType: cctpMsg.toUint8(HOOK_DATA_INDEX),
			destAddr: cctpMsg.toBytes32(HOOK_DATA_INDEX + 1),
			tokenOut: cctpMsg.toBytes32(HOOK_DATA_INDEX + 33),
			amountOutMin: cctpMsg.toUint64(HOOK_DATA_INDEX + 65),
			gasDrop: cctpMsg.toUint64(HOOK_DATA_INDEX + 73),
			redeemFee: cctpMsg.toUint64(HOOK_DATA_INDEX + 81),
			refundFee: cctpMsg.toUint64(HOOK_DATA_INDEX + 89),
			deadline: cctpMsg.toUint64(HOOK_DATA_INDEX + 97),
			referrerAddr: cctpMsg.toBytes32(HOOK_DATA_INDEX + 105),
			referrerBps: cctpMsg.toUint8(HOOK_DATA_INDEX + 137)
		});
	}

	function encodeOrderPayload(OrderPayload memory orderPayload) internal pure returns (bytes memory) {
		return abi.encodePacked(
			orderPayload.payloadType,
			orderPayload.destAddr,
			orderPayload.tokenOut,
			orderPayload.amountOutMin,
			orderPayload.gasDrop,
			orderPayload.redeemFee,
			orderPayload.refundFee,
			orderPayload.deadline,
			orderPayload.referrerAddr,
			orderPayload.referrerBps
		);
	}

	function approveIfNeeded(address tokenAddr, address spender, uint256 amount, bool max) internal {
		IERC20 token = IERC20(tokenAddr);
		uint256 currentAllowance = token.allowance(address(this), spender);

		if (currentAllowance < amount) {
			if (currentAllowance > 0) {
				token.safeApprove(spender, 0);
			}
			token.safeApprove(spender, max ? type(uint256).max : amount);
		}
	}

	function payEth(address to, uint256 amount, bool revertOnFailure) internal {
		(bool success, ) = payable(to).call{value: amount}('');
		if (revertOnFailure) {
			if (success != true) {
				revert EthTransferFailed();
			}
		}
	}

	function getFeeAmounts(OrderPayload memory orderPayload, uint256 cctpAmount, address localToken) internal returns (uint256 referrerAmount, uint256 protocolAmount) {
		uint8 referrerBps = orderPayload.referrerBps > 100 ? 100 : orderPayload.referrerBps;
		referrerAmount = cctpAmount * referrerBps / 10000;
		uint8 protocolBps = safeCalcFastMCTPProtocolBps(
			orderPayload.payloadType,
			localToken,
			cctpAmount,
			truncateAddress(orderPayload.tokenOut),
			truncateAddress(orderPayload.referrerAddr),
			referrerBps
		);
		protocolBps = protocolBps > 100 ? 100 : protocolBps;
		protocolAmount = cctpAmount * protocolBps / 10000;

		return (referrerAmount, protocolAmount);
	}

    function safeCalcFastMCTPProtocolBps(
        uint8 payloadType,
        address localToken,
        uint256 cctpAmount,
        address tokenOut,
        address referrerAddr,
        uint8 referrerBps
    ) internal returns (uint8) {
		(, bytes memory returnData) = address(feeManager)
            .excessivelySafeCall(
                GAS_LIMIT_FEE_MANAGER, // _gas
                0, // _value
                32, // _maxCopy
                abi.encodeWithSignature(
                    "calcFastMCTPProtocolBps(uint8,address,uint256,address,address,uint8)",
                    payloadType,
                    localToken,
                    cctpAmount,
                    tokenOut,
                    referrerAddr,
                    referrerBps
                )
            );
		
		uint256 protocolBps;
		if (returnData.length < 32) {
			protocolBps = 0;
		} else {
			protocolBps = abi.decode(returnData, (uint256));
		}
		return uint8(protocolBps);
    }

    function safeGetFeeCollector() internal returns (address) {
        (, bytes memory returnData) = address(feeManager)
			.excessivelySafeCall(
				GAS_LIMIT_FEE_MANAGER, // _gas
				0, // _value
				32, // _maxCopy
				abi.encodeWithSignature("feeCollector()")
			);

		uint256 feeCollector;
		if (returnData.length < 32) {
			feeCollector = 0;
		} else {
			feeCollector = abi.decode(returnData, (uint256));
		}
		return address(uint160(feeCollector));
    }

	function depositRelayerFee(address relayer, address token, uint256 amount) internal {
		try IERC20(token).transfer(address(feeManager), amount) {} catch {}

		address(feeManager)
			.excessivelySafeCall(
				GAS_LIMIT_FEE_MANAGER, // _gas
				0, // _value
				32, // _maxCopy
				abi.encodeWithSignature("depositFee(address,address,uint256)", relayer, token, amount)
			);
	}

	function getMintRecipient(uint32 destDomain, address tokenIn) internal view returns (bytes32) {
		bytes32 mintRecepient = keyToMintRecipient[keccak256(abi.encodePacked(destDomain, tokenIn))];
		if (mintRecepient == bytes32(0)) {
			revert MintRecipientNotSet();
		}
		return mintRecepient;
	}

	function setMintRecipient(uint32 destDomain, address tokenIn, bytes32 mintRecipient) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		bytes32 key = keccak256(abi.encodePacked(destDomain, tokenIn));
		if (keyToMintRecipient[key] != bytes32(0)) {
			revert AlreadySet();
		}
		keyToMintRecipient[key] = mintRecipient;
	}

	function getCaller(uint32 destDomain) internal view returns (bytes32 caller) {
		caller = domainToCaller[destDomain];
		if (caller == bytes32(0)) {
			revert CallerNotSet();
		}
		return caller;
	}

	function setDomainCallers(uint32 domain, bytes32 caller) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		if (domainToCaller[domain] != bytes32(0)) {
			revert AlreadySet();
		}
		domainToCaller[domain] = caller;
	}

	function setWhitelistedSwapProtocols(address protocol, bool isWhitelisted) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		whitelistedSwapProtocols[protocol] = isWhitelisted;
	}

	function setWhitelistedMsgSenders(address sender, bool isWhitelisted) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		whitelistedMsgSenders[sender] = isWhitelisted;
	}

	function decimalsOf(address token) internal view returns(uint8) {
		(,bytes memory queriedDecimals) = token.staticcall(abi.encodeWithSignature('decimals()'));
		return abi.decode(queriedDecimals, (uint8));
	}

	function deNormalizeAmount(uint256 amount, uint8 decimals) internal pure returns(uint256) {
		if (decimals > 8) {
			amount *= 10 ** (decimals - 8);
		}
		return amount;
	}

	function truncateAddress(bytes32 b) internal pure returns (address) {
		return address(uint160(uint256(b)));
	}

	function setFeeManager(address _feeManager) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		feeManager = _feeManager;
	}	

	function rescueToken(address token, uint256 amount, address to) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		IERC20(token).safeTransfer(to, amount);
	}

	function rescueEth(uint256 amount, address payable to) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		payEth(to, amount, true);
	}

	function rescueRedeem(bytes memory cctpMsg, bytes memory cctpSigs) public {
		if (truncateAddress(cctpMsg.toBytes32(CCTPV2_MINT_RECIPIENT_INDEX)) == address(this)) {
			revert Unauthorized();
		}

		bool success = cctpTokenMessengerV2.localMessageTransmitter().receiveMessage(cctpMsg, cctpSigs);
		if (!success) {
			revert CctpReceiveFailed();
		}
	}

	function setPause(bool _pause) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		paused = _pause;
	}

	function changeGuardian(address newGuardian) public {
		if (msg.sender != guardian) {
			revert Unauthorized();
		}
		nextGuardian = newGuardian;
	}

	function claimGuardian() public {
		if (msg.sender != nextGuardian) {
			revert Unauthorized();
		}
		guardian = nextGuardian;
	}

	receive() external payable {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

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 making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.7.6;

library ExcessivelySafeCall {
    uint256 constant LOW_28_MASK =
        0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

    /// @notice Use when you _really_ really _really_ don't trust the called
    /// contract. This prevents the called contract from causing reversion of
    /// the caller in as many ways as we can.
    /// @dev The main difference between this and a solidity low-level call is
    /// that we limit the number of bytes that the callee can cause to be
    /// copied to caller memory. This prevents stupid things like malicious
    /// contracts returning 10,000,000 bytes causing a local OOG when copying
    /// to memory.
    /// @param _target The address to call
    /// @param _gas The amount of gas to forward to the remote contract
    /// @param _value The value in wei to send to the remote contract
    /// @param _maxCopy The maximum number of bytes of returndata to copy
    /// to memory.
    /// @param _calldata The data to send to the remote contract
    /// @return success and returndata, as `.call()`. Returndata is capped to
    /// `_maxCopy` bytes.
    function excessivelySafeCall(
        address _target,
        uint256 _gas,
        uint256 _value,
        uint16 _maxCopy,
        bytes memory _calldata
    ) internal returns (bool, bytes memory) {
        // set up for assembly call
        uint256 _toCopy;
        bool _success;
        bytes memory _returnData = new bytes(_maxCopy);
        // dispatch message to recipient
        // by assembly calling "handle" function
        // we call via assembly to avoid memcopying a very large returndata
        // returned by a malicious contract
        assembly {
            _success := call(
                _gas, // gas
                _target, // recipient
                _value, // ether value
                add(_calldata, 0x20), // inloc
                mload(_calldata), // inlen
                0, // outloc
                0 // outlen
            )
            // limit our copy to 256 bytes
            _toCopy := returndatasize()
            if gt(_toCopy, _maxCopy) {
                _toCopy := _maxCopy
            }
            // Store the length of the copied bytes
            mstore(_returnData, _toCopy)
            // copy the bytes from returndata[0:_toCopy]
            returndatacopy(add(_returnData, 0x20), 0, _toCopy)
        }
        return (_success, _returnData);
    }

    /// @notice Use when you _really_ really _really_ don't trust the called
    /// contract. This prevents the called contract from causing reversion of
    /// the caller in as many ways as we can.
    /// @dev The main difference between this and a solidity low-level call is
    /// that we limit the number of bytes that the callee can cause to be
    /// copied to caller memory. This prevents stupid things like malicious
    /// contracts returning 10,000,000 bytes causing a local OOG when copying
    /// to memory.
    /// @param _target The address to call
    /// @param _gas The amount of gas to forward to the remote contract
    /// @param _maxCopy The maximum number of bytes of returndata to copy
    /// to memory.
    /// @param _calldata The data to send to the remote contract
    /// @return success and returndata, as `.call()`. Returndata is capped to
    /// `_maxCopy` bytes.
    function excessivelySafeStaticCall(
        address _target,
        uint256 _gas,
        uint16 _maxCopy,
        bytes memory _calldata
    ) internal view returns (bool, bytes memory) {
        // set up for assembly call
        uint256 _toCopy;
        bool _success;
        bytes memory _returnData = new bytes(_maxCopy);
        // dispatch message to recipient
        // by assembly calling "handle" function
        // we call via assembly to avoid memcopying a very large returndata
        // returned by a malicious contract
        assembly {
            _success := staticcall(
                _gas, // gas
                _target, // recipient
                add(_calldata, 0x20), // inloc
                mload(_calldata), // inlen
                0, // outloc
                0 // outlen
            )
            // limit our copy to 256 bytes
            _toCopy := returndatasize()
            if gt(_toCopy, _maxCopy) {
                _toCopy := _maxCopy
            }
            // Store the length of the copied bytes
            mstore(_returnData, _toCopy)
            // copy the bytes from returndata[0:_toCopy]
            returndatacopy(add(_returnData, 0x20), 0, _toCopy)
        }
        return (_success, _returnData);
    }

    /**
     * @notice Swaps function selectors in encoded contract calls
     * @dev Allows reuse of encoded calldata for functions with identical
     * argument types but different names. It simply swaps out the first 4 bytes
     * for the new selector. This function modifies memory in place, and should
     * only be used with caution.
     * @param _newSelector The new 4-byte selector
     * @param _buf The encoded contract args
     */
    function swapSelector(bytes4 _newSelector, bytes memory _buf)
        internal
        pure
    {
        require(_buf.length >= 4);
        uint256 _mask = LOW_28_MASK;
        assembly {
            // load the first word of
            let _word := mload(add(_buf, 0x20))
            // mask out the top 4 bytes
            // /x
            _word := and(_word, _mask)
            _word := or(_newSelector, _word)
            mstore(add(_buf, 0x20), _word)
        }
    }
}

// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


library BytesLib {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
        internal
        pure
        returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
            tempBytes := mload(0x40)

            // Store the length of the first bytes array at the beginning of
            // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

            // Maintain a memory counter for the current write location in the
            // temp bytes array by adding the 32 bytes for the array length to
            // the starting location.
            let mc := add(tempBytes, 0x20)
            // Stop copying when the memory counter reaches the length of the
            // first bytes array.
            let end := add(mc, length)

            for {
                // Initialize a copy counter to the start of the _preBytes data,
                // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
                // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                // Write the _preBytes data into the tempBytes memory 32 bytes
                // at a time.
                mstore(mc, mload(cc))
            }

            // Add the length of _postBytes to the current length of tempBytes
            // and store it as the new length in the first 32 bytes of the
            // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

            // Move the memory counter back from a multiple of 0x20 to the
            // actual end of the _preBytes data.
            mc := end
            // Stop copying when the memory counter reaches the new combined
            // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

            // Update the free-memory pointer by padding our last write location
            // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
            // next 32 byte block, then round down to the nearest multiple of
            // 32. If the sum of the length of the two arrays is zero then add
            // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
              add(add(end, iszero(add(length, mload(_preBytes)))), 31),
              not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
            // Read the first 32 bytes of _preBytes storage, which is the length
            // of the array. (We don't need to use the offset into the slot
            // because arrays use the entire slot.)
            let fslot := sload(_preBytes.slot)
            // Arrays of 31 bytes or less have an even value in their slot,
            // while longer arrays have an odd value. The actual length is
            // the slot divided by two for odd values, and the lowest order
            // byte divided by two for even values.
            // If the slot is even, bitwise and the slot with 255 and divide by
            // two to get the length. If the slot is odd, bitwise and the slot
            // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
                // Since the new array still fits in the slot, we just need to
                // update the contents of the slot.
                // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                    _preBytes.slot,
                    // all the modifications to the slot are inside this
                    // next block
                    add(
                        // we can just add to the slot contents because the
                        // bytes we want to change are the LSBs
                        fslot,
                        add(
                            mul(
                                div(
                                    // load the bytes from memory
                                    mload(add(_postBytes, 0x20)),
                                    // zero all bytes to the right
                                    exp(0x100, sub(32, mlength))
                                ),
                                // and now shift left the number of bytes to
                                // leave space for the length in the slot
                                exp(0x100, sub(32, newlength))
                            ),
                            // increase length by the double of the memory
                            // bytes length
                            mul(mlength, 2)
                        )
                    )
                )
            }
            case 1 {
                // The stored value fits in the slot, but the combined value
                // will exceed it.
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // The contents of the _postBytes array start 32 bytes into
                // the structure. Our first read should obtain the `submod`
                // bytes that can fit into the unused space in the last word
                // of the stored array. To get this, we read 32 bytes starting
                // from `submod`, so the data we read overlaps with the array
                // contents by `submod` bytes. Masking the lowest-order
                // `submod` bytes allows us to add that value directly to the
                // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                    sc,
                    add(
                        and(
                            fslot,
                            0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                        ),
                        and(mload(mc), mask)
                    )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // Copy over the first `submod` bytes of the new data as in
                // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    )
        internal
        pure
        returns (bytes memory)
    {
        require(_length + 31 >= _length, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
                //zero out the 32 bytes slice we are about to return
                //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
        require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
        require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
        require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
        require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
        require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
        require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
        require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
        internal
        view
        returns (bool)
    {
        bool success = true;

        assembly {
            // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
            // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

            // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
                // slength can contain both the length and contents of the array
                // if length < 32 bytes so let's prepare for that
                // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                        // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                            // unsuccess:
                            success := 0
                        }
                    }
                    default {
                        // cb is a circuit breaker in the for loop since there's
                        //  no said feature for inline assembly loops
                        // cb = 1 - don't breaker
                        // cb = 0 - break
                        let cb := 1

                        // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                        // the next line is the loop condition:
                        // while(uint256(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                                // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IMessageTransmitterV2.sol";
import "./ITokenMinterV2.sol";

interface ITokenMessengerV2 {
	function localMessageTransmitter() external view returns (IMessageTransmitterV2);
	function localMinter() external view returns (ITokenMinterV2);

	function depositForBurn(
        uint256 amount,
        uint32 destinationDomain,
        bytes32 mintRecipient,
        address burnToken,
        bytes32 destinationCaller,
        uint256 maxFee,
        uint32 minFinalityThreshold
    ) external;

    function depositForBurnWithHook(
        uint256 amount,
        uint32 destinationDomain,
        bytes32 mintRecipient,
        address burnToken,
        bytes32 destinationCaller,
        uint256 maxFee,
        uint32 minFinalityThreshold,
        bytes calldata hookData
    ) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 15 : IMessageTransmitterV2.sol
/*
 * Copyright 2024 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
pragma solidity ^0.8.0;

import {IReceiverV2} from "./IReceiverV2.sol";
import {IRelayerV2} from "./IRelayerV2.sol";

/**
 * @title IMessageTransmitterV2
 * @notice Interface for V2 message transmitters, which both relay and receive messages.
 */
interface IMessageTransmitterV2 is IRelayerV2, IReceiverV2 {

}

/*
 * Copyright 2024 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
pragma solidity ^0.8.0;

import {ITokenMinter} from "../ITokenMinter.sol";

/**
 * @title ITokenMinterV2
 * @notice Interface for a minter of tokens that are mintable, burnable, and interchangeable
 * across domains.
 */
interface ITokenMinterV2 is ITokenMinter {
    /**
     * @notice Mints to multiple recipients amounts of tokens corresponding to the
     * given (`sourceDomain`, `burnToken`) pair.
     * @param sourceDomain Source domain where `burnToken` was burned.
     * @param burnToken Burned token address as bytes32.
     * @param recipientOne Address to receive `amountOne` of minted tokens
     * @param recipientTwo Address to receive `amountTwo` of minted tokens
     * @param amountOne Amount of tokens to mint to `recipientOne`
     * @param amountTwo Amount of tokens to mint to `recipientTwo`
     * @return mintToken Address of the token that was minted, corresponding to the (`sourceDomain`, `burnToken`) pair
     */
    function mint(
        uint32 sourceDomain,
        bytes32 burnToken,
        address recipientOne,
        address recipientTwo,
        uint256 amountOne,
        uint256 amountTwo
    ) external returns (address);
}

File 12 of 15 : IReceiverV2.sol
/*
 * Copyright 2024 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
pragma solidity ^0.8.0;

import {IReceiver} from "../IReceiver.sol";

/**
 * @title IReceiverV2
 * @notice Receives messages on the destination chain and forwards them to contracts implementing
 * IMessageHandlerV2.
 */
interface IReceiverV2 is IReceiver {

}

File 13 of 15 : IRelayerV2.sol
/*
 * Copyright 2024 Circle Internet Group, Inc. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
pragma solidity ^0.8.0;

/**
 * @title IRelayerV2
 * @notice Sends messages from the source domain to the destination domain
 */
interface IRelayerV2 {
    /**
     * @notice Sends an outgoing message from the source domain.
     * @dev Emits a `MessageSent` event with message information.
     * WARNING: if the `destinationCaller` does not represent a valid address as bytes32, then it will not be possible
     * to broadcast the message on the destination domain. If set to bytes32(0), anyone will be able to broadcast it.
     * This is an advanced feature, and using bytes32(0) should be preferred for use cases where a specific destination caller is not required.
     * @param destinationDomain Domain of destination chain
     * @param recipient Address of message recipient on destination domain as bytes32
     * @param destinationCaller Allowed caller on destination domain (see above WARNING).
     * @param minFinalityThreshold Minimum finality threshold at which the message must be attested to.
     * @param messageBody Content of the message, as raw bytes
     */
    function sendMessage(
        uint32 destinationDomain,
        bytes32 recipient,
        bytes32 destinationCaller,
        uint32 minFinalityThreshold,
        bytes calldata messageBody
    ) external;
}

/*
 * Copyright (c) 2022, Circle Internet Financial Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
pragma solidity ^0.8.0;

/**
 * @title ITokenMinter
 * @notice interface for minter of tokens that are mintable, burnable, and interchangeable
 * across domains.
 */
interface ITokenMinter {
	/**
	 * @notice Mints `amount` of local tokens corresponding to the
	 * given (`sourceDomain`, `burnToken`) pair, to `to` address.
	 * @dev reverts if the (`sourceDomain`, `burnToken`) pair does not
	 * map to a nonzero local token address. This mapping can be queried using
	 * getLocalToken().
	 * @param sourceDomain Source domain where `burnToken` was burned.
	 * @param burnToken Burned token address as bytes32.
	 * @param to Address to receive minted tokens, corresponding to `burnToken`,
	 * on this domain.
	 * @param amount Amount of tokens to mint. Must be less than or equal
	 * to the minterAllowance of this TokenMinter for given `_mintToken`.
	 * @return mintToken token minted.
	 */
	function mint(
		uint32 sourceDomain,
		bytes32 burnToken,
		address to,
		uint256 amount
	) external returns (address mintToken);

	/**
	 * @notice Burn tokens owned by this ITokenMinter.
	 * @param burnToken burnable token.
	 * @param amount amount of tokens to burn. Must be less than or equal to this ITokenMinter's
	 * account balance of the given `_burnToken`.
	 */
	function burn(address burnToken, uint256 amount) external;

	/**
	 * @notice Get the local token associated with the given remote domain and token.
	 * @param remoteDomain Remote domain
	 * @param remoteToken Remote token
	 * @return local token address
	 */
	function getLocalToken(uint32 remoteDomain, bytes32 remoteToken)
		external
		view
		returns (address);

	/**
	 * @notice Set the token controller of this ITokenMinter. Token controller
	 * is responsible for mapping local tokens to remote tokens, and managing
	 * token-specific limits
	 * @param newTokenController new token controller address
	 */
	function setTokenController(address newTokenController) external;
}

/*
 * Copyright (c) 2022, Circle Internet Financial Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
pragma solidity ^0.8.0;

/**
 * @title IReceiver
 * @notice Receives messages on destination chain and forwards them to IMessageDestinationHandler
 */
interface IReceiver {
	/**
	 * @notice Receives an incoming message, validating the header and passing
	 * the body to application-specific handler.
	 * @param message The message raw bytes
	 * @param signature The message signature
	 * @return success bool, true if successful
	 */
	function receiveMessage(bytes calldata message, bytes calldata signature)
		external
		returns (bool success);
}

Settings
{
  "remappings": [
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "ExcessivelySafeCall/=lib/ExcessivelySafeCall/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_cctpTokenMessengerV2","type":"address"},{"internalType":"address","name":"_feeManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadySet","type":"error"},{"inputs":[],"name":"CallerNotSet","type":"error"},{"inputs":[],"name":"CctpReceiveFailed","type":"error"},{"inputs":[],"name":"DeadlineViolation","type":"error"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidAmountOut","type":"error"},{"inputs":[],"name":"InvalidGasDrop","type":"error"},{"inputs":[],"name":"InvalidMintRecipient","type":"error"},{"inputs":[],"name":"InvalidPayload","type":"error"},{"inputs":[],"name":"InvalidPayloadType","type":"error"},{"inputs":[],"name":"InvalidRedeemFee","type":"error"},{"inputs":[],"name":"InvalidRefundFee","type":"error"},{"inputs":[],"name":"MintRecipientNotSet","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnauthorizedMsgSender","type":"error"},{"inputs":[],"name":"UnauthorizedSwapProtocol","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"sourceDomain","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"sourceNonce","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OrderFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"sourceDomain","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"sourceNonce","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OrderRefunded","type":"event"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint64","name":"redeemFee","type":"uint64"},{"internalType":"uint256","name":"circleMaxFee","type":"uint256"},{"internalType":"uint64","name":"gasDrop","type":"uint64"},{"internalType":"bytes32","name":"destAddr","type":"bytes32"},{"internalType":"uint32","name":"destDomain","type":"uint32"},{"internalType":"bytes32","name":"referrerAddress","type":"bytes32"},{"internalType":"uint8","name":"referrerBps","type":"uint8"},{"internalType":"uint8","name":"payloadType","type":"uint8"},{"internalType":"uint32","name":"minFinalityThreshold","type":"uint32"},{"internalType":"bytes","name":"customPayload","type":"bytes"}],"name":"bridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cctpTokenMessengerV2","outputs":[{"internalType":"contract ITokenMessengerV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newGuardian","type":"address"}],"name":"changeGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"circleMaxFee","type":"uint256"},{"internalType":"uint32","name":"destDomain","type":"uint32"},{"internalType":"uint32","name":"minFinalityThreshold","type":"uint32"},{"components":[{"internalType":"uint8","name":"payloadType","type":"uint8"},{"internalType":"bytes32","name":"destAddr","type":"bytes32"},{"internalType":"bytes32","name":"tokenOut","type":"bytes32"},{"internalType":"uint64","name":"amountOutMin","type":"uint64"},{"internalType":"uint64","name":"gasDrop","type":"uint64"},{"internalType":"uint64","name":"redeemFee","type":"uint64"},{"internalType":"uint64","name":"refundFee","type":"uint64"},{"internalType":"uint64","name":"deadline","type":"uint64"},{"internalType":"bytes32","name":"referrerAddr","type":"bytes32"},{"internalType":"uint8","name":"referrerBps","type":"uint8"}],"internalType":"struct FastMCTP.OrderPayload","name":"orderPayload","type":"tuple"}],"name":"createOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"domainToCaller","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"cctpMsg","type":"bytes"},{"internalType":"bytes","name":"cctpSigs","type":"bytes"},{"internalType":"address","name":"swapProtocol","type":"address"},{"internalType":"bytes","name":"swapData","type":"bytes"}],"name":"fulfillOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"guardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"keyToMintRecipient","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"cctpMsg","type":"bytes"},{"internalType":"bytes","name":"cctpSigs","type":"bytes"}],"name":"redeem","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"cctpMsg","type":"bytes"},{"internalType":"bytes","name":"cctpSigs","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"to","type":"address"}],"name":"rescueEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"cctpMsg","type":"bytes"},{"internalType":"bytes","name":"cctpSigs","type":"bytes"}],"name":"rescueRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"rescueToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"domain","type":"uint32"},{"internalType":"bytes32","name":"caller","type":"bytes32"}],"name":"setDomainCallers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeManager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"destDomain","type":"uint32"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bytes32","name":"mintRecipient","type":"bytes32"}],"name":"setMintRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_pause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"setWhitelistedMsgSenders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"setWhitelistedSwapProtocols","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedMsgSenders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedSwapProtocols","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a060405234801561000f575f5ffd5b506040516139f93803806139f983398101604081905261002e91610083565b60015f8190556001600160a01b039283166080528054919092166001600160a01b03199182161790915560068054909116331790556100b4565b80516001600160a01b038116811461007e575f5ffd5b919050565b5f5f60408385031215610094575f5ffd5b61009d83610068565b91506100ab60208401610068565b90509250929050565b6080516138f56101045f395f81816101eb015281816106a30152818161090d01528181610bf301528181610c2e0152818161186601528181611bb401528181611f4901526120c501526138f55ff3fe608060405260043610610191575f3560e01c80634fd416d1116100dc578063d0fb020311610087578063e21e2d8811610062578063e21e2d881461048c578063e5c1bf6e146104ab578063f58b6de8146104be578063f8a67a62146104dd575f5ffd5b8063d0fb020314610447578063dccedc7414610466578063dcee57ff14610479575f5ffd5b8063b25ea8fb116100b7578063b25ea8fb146103ea578063bedb86fb14610409578063cfa1167d14610428575f5ffd5b80634fd416d11461038c5780635c975abb146103ab57806375f50997146103cb575f5ffd5b8063375ef75e1161013c578063472d35b911610117578063472d35b91461032057806347a539e71461033f5780634818e84d1461036d575f5ffd5b8063375ef75e146102ce578063452a9320146102ed578063459656ee1461030c575f5ffd5b80632fcb4f041161016c5780632fcb4f0414610246578063309cdceb1461026557806335b5d81414610290575f5ffd5b80630431c3581461019c578063127cc441146101da5780632337e23614610225575f5ffd5b3661019857005b5f5ffd5b3480156101a7575f5ffd5b506101c76101b6366004612fa1565b60036020525f908152604090205481565b6040519081526020015b60405180910390f35b3480156101e5575f5ffd5b5061020d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101d1565b348015610230575f5ffd5b5061024461023f36600461304a565b6104fc565b005b348015610251575f5ffd5b5061024461026036600461315c565b6106f1565b348015610270575f5ffd5b506101c761027f366004613177565b60026020525f908152604090205481565b34801561029b575f5ffd5b506102be6102aa36600461315c565b60046020525f908152604090205460ff1681565b60405190151581526020016101d1565b3480156102d9575f5ffd5b506102446102e836600461318e565b61074a565b3480156102f8575f5ffd5b5060065461020d906001600160a01b031681565b348015610317575f5ffd5b506102446107bf565b34801561032b575f5ffd5b5061024461033a36600461315c565b61081a565b34801561034a575f5ffd5b506102be61035936600461315c565b60056020525f908152604090205460ff1681565b348015610378575f5ffd5b5060075461020d906001600160a01b031681565b348015610397575f5ffd5b506102446103a63660046131c3565b610873565b3480156103b6575f5ffd5b506007546102be90600160a01b900460ff1681565b3480156103d6575f5ffd5b506102446103e5366004613285565b6108c7565b3480156103f5575f5ffd5b506102446104043660046132ea565b610a1d565b348015610414575f5ffd5b5061024461042336600461330d565b610a57565b348015610433575f5ffd5b506102446104423660046131c3565b610aba565b348015610452575f5ffd5b5060015461020d906001600160a01b031681565b610244610474366004613328565b610b0e565b610244610487366004613285565b61117f565b348015610497575f5ffd5b506102446104a63660046133c9565b611371565b6102446104b9366004613285565b611427565b3480156104c9575f5ffd5b506102446104d8366004613405565b6117af565b3480156104e8575f5ffd5b506102446104f73660046134db565b61197c565b6105046119ba565b600754600160a01b900460ff161561052f576040516313d0ff5960e31b815260040160405180910390fd5b84848260a0015167ffffffffffffffff1661054a919061352e565b10610568576040516308fefc0560e21b815260040160405180910390fd5b84848260c0015167ffffffffffffffff16610583919061352e565b106105ba576040517f2873a4b200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805f015160ff166003146105e15760405163d4380c7360e01b815260040160405180910390fd5b606481610120015160ff16111561064b5760405162461bcd60e51b815260206004820152602360248201527f52656665727265724270732073686f756c64206265206c657373207468616e2060448201526203130360ec1b60648201526084015b60405180910390fd5b604081015115801561066a57505f816080015167ffffffffffffffff16115b1561068857604051636e51edcd60e11b815260040160405180910390fd5b61069d6001600160a01b038716333088611a11565b6106ca867f0000000000000000000000000000000000000000000000000000000000000000876001611a95565b6106e086868587866106db87611b4e565b611bb2565b6106e960015f55565b505050505050565b6006546001600160a01b0316331461071b576040516282b42960e81b815260040160405180910390fd5b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6006546001600160a01b03163314610774576040516282b42960e81b815260040160405180910390fd5b63ffffffff82165f90815260036020526040902054156107a75760405163a741a04560e01b815260040160405180910390fd5b63ffffffff9091165f90815260036020526040902055565b6007546001600160a01b031633146107e9576040516282b42960e81b815260040160405180910390fd5b6007546006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b6006546001600160a01b03163314610844576040516282b42960e81b815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6006546001600160a01b0316331461089d576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091165f908152600560205260409020805460ff1916911515919091179055565b306108e46108e16108da6094602461352e565b8590611c52565b90565b6001600160a01b03160361090a576040516282b42960e81b815260040160405180910390fd5b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632c1219216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610967573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061098b9190613541565b6001600160a01b03166357ecfd2884846040518363ffffffff1660e01b81526004016109b892919061358a565b6020604051808303815f875af11580156109d4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109f891906135b7565b905080610a185760405163605c687360e01b815260040160405180910390fd5b505050565b6006546001600160a01b03163314610a47576040516282b42960e81b815260040160405180910390fd5b610a5381836001611cbd565b5050565b6006546001600160a01b03163314610a81576040516282b42960e81b815260040160405180910390fd5b60078054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6006546001600160a01b03163314610ae4576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091165f908152600460205260409020805460ff1916911515919091179055565b610b166119ba565b8330610b316108e1610b2a6094602461352e565b8490611c52565b6001600160a01b031614610b575760405162bc52d160e21b815260040160405180910390fd5b5f610b6186611d51565b9050805f015160ff16600314610b8a5760405163d4380c7360e01b815260040160405180910390fd5b428160e0015167ffffffffffffffff161015610bb9576040516354a36da760e11b815260040160405180910390fd5b6001600160a01b0384165f9081526004602052604090205460ff16610bf15760405163242d9b3760e21b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b03161480610cc157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632c1219216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c88573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cac9190613541565b6001600160a01b0316846001600160a01b0316145b15610cdf5760405163242d9b3760e21b815260040160405180910390fd5b335f9081526005602052604090205460ff16610d27576040517fb4ee3af100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f610d338888611f1d565b60a0850151919350915067ffffffffffffffff1615610d715760a0830151610d71906001600160a01b03841690339067ffffffffffffffff16612252565b60a0830151610d8a9067ffffffffffffffff16826135d2565b90505f5f610d99858486612282565b90925090508115610e2e57836001600160a01b031663a9059cbb610dbf87610100015190565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303815f875af1925050508015610e27575060408051601f3d908101601f19168201909252610e24918101906135b7565b60015b15610e2e57505b8015610eba57836001600160a01b031663a9059cbb610e4b612320565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af1925050508015610eb3575060408051601f3d908101601f19168201909252610eb0918101906135b7565b60015b15610eba57505b5f610ec6866040015190565b9050846001600160a01b0316816001600160a01b031603610f295760405162461bcd60e51b815260206004820152601d60248201527f746f6b656e4f75742063616e6e6f74206265206c6f63616c546f6b656e0000006044820152606401610642565b610f49858a85610f3986896135d2565b610f4391906135d2565b5f611a95565b5f6001600160a01b038216610f5f575047610fc8565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015610fa1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fc591906135e5565b90505b5f5f8b6001600160a01b03165f8c604051610fe391906135fc565b5f6040518083038185875af1925050503d805f811461101d576040519150601f19603f3d011682016040523d82523d5f602084013e611022565b606091505b50915091508181906110475760405162461bcd60e51b81526004016106429190613612565b506001600160a01b0384166110675761106083476135d2565b92506110dc565b6040516370a0823160e01b815230600482015283906001600160a01b038616906370a0823190602401602060405180830381865afa1580156110ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110cf91906135e5565b6110d991906135d2565b92505b5f6001600160a01b0385166110f3575060126110ff565b6110fc856123b4565b90505b61110a8a8686612464565b6111228a6060015167ffffffffffffffff1682612502565b84101561115b576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111658f85612539565b505050505050505050505061117960015f55565b50505050565b6111876119ba565b813061119b6108e1610b2a6094602461352e565b6001600160a01b0316146111c15760405162bc52d160e21b815260040160405180910390fd5b5f5f6111cd8585611f1d565b915091505f6111db86611d51565b9050805f015160ff166003146112045760405163d4380c7360e01b815260040160405180910390fd5b428160e0015167ffffffffffffffff1610158015611238575060408101516001600160a01b0316836001600160a01b031614155b15611256576040516354a36da760e11b815260040160405180910390fd5b5f611270826080015167ffffffffffffffff166012612502565b905080341461129257604051636e51edcd60e11b815260040160405180910390fd5b5f61129e836020015190565b905081156112b1576112b181835f611cbd565b60c08301516112d6906001600160a01b03871690339067ffffffffffffffff16612252565b611305818460c0015167ffffffffffffffff16866112f491906135d2565b6001600160a01b0388169190612252565b7fb4d4578bf8a1f3c5aa81fae0b333ea7abc62f085e359d86631f63809319bd02561133189600461259a565b61133c8a600c611c52565b6040805163ffffffff90931683526020830191909152810186905260600160405180910390a1505050505050610a5360015f55565b6006546001600160a01b0316331461139b576040516282b42960e81b815260040160405180910390fd5b6040516001600160e01b031960e085901b1660208201526bffffffffffffffffffffffff19606084901b1660248201525f9060380160408051601f1981840301815291815281516020928301205f8181526002909352912054909150156114155760405163a741a04560e01b815260040160405180910390fd5b5f908152600260205260409020555050565b61142f6119ba565b81306114436108e1610b2a6094602461352e565b6001600160a01b0316146114695760405162bc52d160e21b815260040160405180910390fd5b5f611473846125ff565b9050805f015160ff166001141580156114935750805f015160ff16600214155b156114b15760405163d4380c7360e01b815260040160405180910390fd5b5f6114bd826020015190565b9050815f015160ff1660021480156114de5750336001600160a01b03821614155b156114fb576040516282b42960e81b815260040160405180910390fd5b5f5f6115078787611f1d565b9150915080846060015167ffffffffffffffff16111561153a576040516308fefc0560e21b815260040160405180910390fd5b60608401516115539067ffffffffffffffff16826135d2565b90505f60648560a0015160ff161161156f578460a00151611572565b60645b90505f611590865f015185858761158a8b6080015190565b8761271f565b905060648160ff16116115a357806115a6565b60645b90505f6127106115b960ff841686613624565b6115c3919061363b565b90505f6127106115d660ff861687613624565b6115e0919061363b565b90506115fb33878a6060015167ffffffffffffffff166127fe565b611625878261160a85896135d2565b61161491906135d2565b6001600160a01b0389169190612252565b80156116b457856001600160a01b031663a9059cbb6116458a6080015190565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af19250505080156116ad575060408051601f3d908101601f191682019092526116aa918101906135b7565b60015b156116b457505b811561174057856001600160a01b031663a9059cbb6116d1612320565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303815f875af1925050508015611739575060408051601f3d908101601f19168201909252611736918101906135b7565b60015b1561174057505b604088015167ffffffffffffffff161561179d575f61176e896040015167ffffffffffffffff166012612502565b905080341461179057604051636e51edcd60e11b815260040160405180910390fd5b61179b88825f611cbd565b505b505050505050505050610a5360015f55565b6117b76119ba565b600754600160a01b900460ff16156117e2576040516313d0ff5960e31b815260040160405180910390fd5b8a6117f78a67ffffffffffffffff8d1661352e565b10611815576040516308fefc0560e21b815260040160405180910390fd5b8260ff1660011415801561182d57508260ff16600214155b1561184b5760405163d4380c7360e01b815260040160405180910390fd5b6118606001600160a01b038d1633308e611a11565b61188d8c7f00000000000000000000000000000000000000000000000000000000000000008d6001611a95565b60648460ff1611156118ed5760405162461bcd60e51b815260206004820152602360248201527f52656665727265724270732073686f756c64206265206c657373207468616e2060448201526203130360ec1b6064820152608401610642565b5f8360ff166002036119025750805160208201205b5f6040518060e001604052808660ff1681526020018a81526020018b67ffffffffffffffff1681526020018d67ffffffffffffffff1681526020018881526020018760ff1681526020018381525090506119638e8e8a8e886106db87612904565b505061196e60015f55565b505050505050505050505050565b6006546001600160a01b031633146119a6576040516282b42960e81b815260040160405180910390fd5b610a186001600160a01b0384168284612252565b60025f5403611a0b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610642565b60025f55565b6040516001600160a01b03808516602483015283166044820152606481018290526111799085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526129a1565b604051636eb1769f60e11b81523060048201526001600160a01b03848116602483015285915f9183169063dd62ed3e90604401602060405180830381865afa158015611ae3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b0791906135e5565b9050838110156106e9578015611b2b57611b2b6001600160a01b038316865f612a87565b6106e98584611b3a5785611b3d565b5f195b6001600160a01b0385169190612a87565b6060815f015182602001518360400151846060015185608001518660a001518760c001518860e001518961010001518a6101200151604051602001611b9c9a9998979695949392919061365a565b6040516020818303038152906040529050919050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663779b432d8686611bed888b612bba565b8a611bf78a612c4c565b8989896040518963ffffffff1660e01b8152600401611c1d989796959493929190613741565b5f604051808303815f87803b158015611c34575f5ffd5b505af1158015611c46573d5f5f3e3d5ffd5b50505050505050505050565b5f611c5e82602061352e565b83511015611cae5760405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152606401610642565b50818101602001515b92915050565b5f836001600160a01b0316836040515f6040518083038185875af1925050503d805f8114611d06576040519150601f19603f3d011682016040523d82523d5f602084013e611d0b565b606091505b50509050811561117957600181151514611179576040517f6d963f8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805161014080820183525f80835260208301819052828401819052606083018190526080830181905260a0830181905260c0830181905260e08301819052610100830181905261012083015282519081019092529080611dbf611db8609460e461352e565b8590612c9d565b60ff168152602001611de1611dd6609460e461352e565b6108da90600161352e565b8152602001611e00611df5609460e461352e565b6108da90602161352e565b8152602001611e26611e14609460e461352e565b611e1f90604161352e565b8590612d02565b67ffffffffffffffff168152602001611e4f611e44609460e461352e565b611e1f90604961352e565b67ffffffffffffffff168152602001611e78611e6d609460e461352e565b611e1f90605161352e565b67ffffffffffffffff168152602001611ea1611e96609460e461352e565b611e1f90605961352e565b67ffffffffffffffff168152602001611eca611ebf609460e461352e565b611e1f90606161352e565b67ffffffffffffffff168152602001611ef3611ee8609460e461352e565b6108da90606961352e565b8152602001611f12611f07609460e461352e565b611db890608961352e565b60ff16905292915050565b5f8080611f2b85600461259a565b90505f611f44611f3d6094600461352e565b8790611c52565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cb75c11c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fa3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc79190613541565b6040517f78a0565e00000000000000000000000000000000000000000000000000000000815263ffffffff85166004820152602481018490526001600160a01b0391909116906378a0565e90604401602060405180830381865afa158015612031573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120559190613541565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038316906370a0823190602401602060405180830381865afa15801561209c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120c091906135e5565b90505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632c1219216040518163ffffffff1660e01b8152600401602060405180830381865afa15801561211f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121439190613541565b6001600160a01b03166357ecfd288a8a6040518363ffffffff1660e01b815260040161217092919061358a565b6020604051808303815f875af115801561218c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121b091906135b7565b9050806121d05760405163605c687360e01b815260040160405180910390fd5b6040516370a0823160e01b815230600482015282906001600160a01b038516906370a0823190602401602060405180830381865afa158015612214573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061223891906135e5565b61224291906135d2565b9299929850919650505050505050565b6040516001600160a01b038316602482015260448101829052610a1890849063a9059cbb60e01b90606401611a5e565b5f5f5f606486610120015160ff16116122a0578561012001516122a3565b60645b90506127106122b560ff831687613624565b6122bf919061363b565b92505f6122e1875f015186886122d68b6040015190565b6101008c015161158a565b905060648160ff16116122f457806122f7565b60645b905061271061230960ff831688613624565b612313919061363b565b925050505b935093915050565b604080516004815260248101909152602081810180516001600160e01b03167fc415b95c000000000000000000000000000000000000000000000000000000001790526001545f928392612384926001600160a01b031691620f4240918591612d67565b9150505f60208251101561239957505f611cb7565b818060200190518101906123ad91906135e5565b9392505050565b60408051600481526024810182526020810180516001600160e01b03167f313ce5670000000000000000000000000000000000000000000000000000000017905290515f9182916001600160a01b0385169161240f916135fc565b5f60405180830381855afa9150503d805f8114612447576040519150601f19603f3d011682016040523d82523d5f602084013e61244c565b606091505b50915050808060200190518101906123ad91906137a2565b5f612470846020015190565b90506001600160a01b0383166124915761248c81836001611cbd565b611179565b608084015167ffffffffffffffff16156124ee575f6124bf856080015167ffffffffffffffff166012612502565b90508034146124e157604051636e51edcd60e11b815260040160405180910390fd5b6124ec82825f611cbd565b505b6111796001600160a01b0384168284612252565b5f60088260ff1611156125325761251a6008836137bd565b61252590600a6138b1565b61252f9084613624565b92505b5090919050565b7f99e766e06bd9dc43c056e2b2fc007c5b9e73c190b2daeb448fa24530d97c18e661256583600461259a565b61257084600c611c52565b6040805163ffffffff90931683526020830191909152810183905260600160405180910390a15050565b5f6125a682600461352e565b835110156125f65760405162461bcd60e51b815260206004820152601460248201527f746f55696e7433325f6f75744f66426f756e64730000000000000000000000006044820152606401610642565b50016004015190565b6040805160e080820183525f80835260208301819052828401819052606083018190526080830181905260a0830181905260c08301528251908101909252908061264e611db8609460e461352e565b60ff168152602001612665611dd6609460e461352e565b8152602001612684612679609460e461352e565b611e1f90602161352e565b67ffffffffffffffff1681526020016126ad6126a2609460e461352e565b611e1f90602961352e565b67ffffffffffffffff1681526020016126d66126cb609460e461352e565b6108da90603161352e565b81526020016126f56126ea609460e461352e565b611db890605161352e565b60ff16815260200161271761270c609460e461352e565b6108da90605261352e565b905292915050565b60405160ff80881660248301526001600160a01b038088166044840152606483018790528086166084840152841660a4830152821660c48201525f9081906127c690620f424090839060209060e40160408051601f198184030181529190526020810180516001600160e01b03167f1e47aaa0000000000000000000000000000000000000000000000000000000001790526001546001600160a01b031693929190612d67565b9150505f6020825110156127db57505f6127f2565b818060200190518101906127ef91906135e5565b90505b98975050505050505050565b60015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb906044016020604051808303815f875af192505050801561286c575060408051601f3d908101601f19168201909252612869918101906135b7565b60015b1561287357505b6040516001600160a01b03808516602483015283166044820152606481018290526128fd90620f4240905f9060209060840160408051601f198184030181529190526020810180516001600160e01b03167f1c432455000000000000000000000000000000000000000000000000000000001790526001546001600160a01b031693929190612d67565b5050505050565b8051602080830151604080850151606086810151608088015160a089015160c0808b0151965160f89a8b1b7fff000000000000000000000000000000000000000000000000000000000000009081169a82019a909a52602181019890985294851b6001600160c01b031990811660418901529290941b90911660498601526051850152941b90921660718201526072810191909152609201611b9c565b5f6129f5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ded9092919063ffffffff16565b905080515f1480612a15575080806020019051810190612a1591906135b7565b610a185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610642565b801580612aff5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612ad9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612afd91906135e5565b155b612b715760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610642565b6040516001600160a01b038316602482015260448101829052610a189084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611a5e565b6040805160e084901b6001600160e01b031916602080830191909152606084901b6bffffffffffffffffffffffff1916602483015282516018818403018152603890920183528151918101919091205f908152600290915290812054806123ad576040517e6130e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b63ffffffff81165f9081526003602052604090205480612c98576040517f4ceffc8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b5f612ca982600161352e565b83511015612cf95760405162461bcd60e51b815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152606401610642565b50016001015190565b5f612d0e82600861352e565b83511015612d5e5760405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152606401610642565b50016008015190565b5f60605f5f5f8661ffff1667ffffffffffffffff811115612d8a57612d8a612fdc565b6040519080825280601f01601f191660200182016040528015612db4576020820181803683370190505b5090505f5f8751602089018b8e8ef191503d925086831115612dd4578692505b828152825f602083013e90999098509650505050505050565b6060612dfb84845f85612e03565b949350505050565b606082471015612e7b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610642565b5f5f866001600160a01b03168587604051612e9691906135fc565b5f6040518083038185875af1925050503d805f8114612ed0576040519150601f19603f3d011682016040523d82523d5f602084013e612ed5565b606091505b5091509150612ee687838387612ef1565b979650505050505050565b60608315612f5f5782515f03612f58576001600160a01b0385163b612f585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610642565b5081612dfb565b612dfb8383815115612f745781518083602001fd5b8060405162461bcd60e51b81526004016106429190613612565b803563ffffffff81168114612c98575f5ffd5b5f60208284031215612fb1575f5ffd5b6123ad82612f8e565b6001600160a01b0381168114612fce575f5ffd5b50565b8035612c9881612fba565b634e487b7160e01b5f52604160045260245ffd5b604051610140810167ffffffffffffffff8111828210171561301457613014612fdc565b60405290565b60ff81168114612fce575f5ffd5b8035612c988161301a565b803567ffffffffffffffff81168114612c98575f5ffd5b5f5f5f5f5f5f8688036101e0811215613061575f5ffd5b873561306c81612fba565b9650602088013595506040880135945061308860608901612f8e565b935061309660808901612f8e565b9250610140609f19820112156130aa575f5ffd5b506130b3612ff0565b6130bf60a08901613028565b815260c0880135602082015260e088013560408201526130e26101008901613033565b60608201526130f46101208901613033565b60808201526131066101408901613033565b60a08201526131186101608901613033565b60c082015261312a6101808901613033565b60e08201526101a08801356101008201526131486101c08901613028565b610120820152809150509295509295509295565b5f6020828403121561316c575f5ffd5b81356123ad81612fba565b5f60208284031215613187575f5ffd5b5035919050565b5f5f6040838503121561319f575f5ffd5b6131a883612f8e565b946020939093013593505050565b8015158114612fce575f5ffd5b5f5f604083850312156131d4575f5ffd5b82356131df81612fba565b915060208301356131ef816131b6565b809150509250929050565b5f82601f830112613209575f5ffd5b813567ffffffffffffffff81111561322357613223612fdc565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561325257613252612fdc565b604052818152838201602001851015613269575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215613296575f5ffd5b823567ffffffffffffffff8111156132ac575f5ffd5b6132b8858286016131fa565b925050602083013567ffffffffffffffff8111156132d4575f5ffd5b6132e0858286016131fa565b9150509250929050565b5f5f604083850312156132fb575f5ffd5b8235915060208301356131ef81612fba565b5f6020828403121561331d575f5ffd5b81356123ad816131b6565b5f5f5f5f6080858703121561333b575f5ffd5b843567ffffffffffffffff811115613351575f5ffd5b61335d878288016131fa565b945050602085013567ffffffffffffffff811115613379575f5ffd5b613385878288016131fa565b935050604085013561339681612fba565b9150606085013567ffffffffffffffff8111156133b1575f5ffd5b6133bd878288016131fa565b91505092959194509250565b5f5f5f606084860312156133db575f5ffd5b6133e484612f8e565b925060208401356133f481612fba565b929592945050506040919091013590565b5f5f5f5f5f5f5f5f5f5f5f5f6101808d8f031215613421575f5ffd5b61342a8d612fd1565b9b5060208d01359a5061343f60408e01613033565b995060608d0135985061345460808e01613033565b975060a08d0135965061346960c08e01612f8e565b955060e08d0135945061347f6101008e01613028565b935061348e6101208e01613028565b925061349d6101408e01612f8e565b915067ffffffffffffffff6101608e013511156134b8575f5ffd5b6134c98e6101608f01358f016131fa565b90509295989b509295989b509295989b565b5f5f5f606084860312156134ed575f5ffd5b83356134f881612fba565b925060208401359150604084013561350f81612fba565b809150509250925092565b634e487b7160e01b5f52601160045260245ffd5b80820180821115611cb757611cb761351a565b5f60208284031215613551575f5ffd5b81516123ad81612fba565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b604081525f61359c604083018561355c565b82810360208401526135ae818561355c565b95945050505050565b5f602082840312156135c7575f5ffd5b81516123ad816131b6565b81810381811115611cb757611cb761351a565b5f602082840312156135f5575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b602081525f6123ad602083018461355c565b8082028115828204841417611cb757611cb761351a565b5f8261365557634e487b7160e01b5f52601260045260245ffd5b500490565b7fff000000000000000000000000000000000000000000000000000000000000008b60f81b1681528960018201528860218201526001600160c01b03198860c01b1660418201526001600160c01b03198760c01b1660498201526001600160c01b03198660c01b1660518201526136e0605982018660c01b6001600160c01b0319169052565b6136f9606182018560c01b6001600160c01b0319169052565b826069820152613730608982018360f81b7fff00000000000000000000000000000000000000000000000000000000000000169052565b608a019a9950505050505050505050565b88815263ffffffff881660208201528660408201526001600160a01b03861660608201528460808201528360a082015263ffffffff831660c082015261010060e08201525f61379461010083018461355c565b9a9950505050505050505050565b5f602082840312156137b2575f5ffd5b81516123ad8161301a565b60ff8281168282160390811115611cb757611cb761351a565b6001815b6001841115612318578085048111156137f5576137f561351a565b600184161561380357908102905b60019390931c9280026137da565b5f8261381f57506001611cb7565b8161382b57505f611cb7565b8160018114613841576002811461384b57613867565b6001915050611cb7565b60ff84111561385c5761385c61351a565b50506001821b611cb7565b5060208310610133831016604e8410600b841016171561388a575081810a611cb7565b6138965f1984846137d6565b805f19048211156138a9576138a961351a565b029392505050565b5f6123ad60ff84168361381156fea26469706673582212203da4dccb65e3bea444aeb48e97bfb77305a3fa1ea57afd170c3391d455bb18c564736f6c634300081c003300000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d000000000000000000000000598400ba0d8ba9c3b57ad424a68183f1d17c7e56

Deployed Bytecode

0x608060405260043610610191575f3560e01c80634fd416d1116100dc578063d0fb020311610087578063e21e2d8811610062578063e21e2d881461048c578063e5c1bf6e146104ab578063f58b6de8146104be578063f8a67a62146104dd575f5ffd5b8063d0fb020314610447578063dccedc7414610466578063dcee57ff14610479575f5ffd5b8063b25ea8fb116100b7578063b25ea8fb146103ea578063bedb86fb14610409578063cfa1167d14610428575f5ffd5b80634fd416d11461038c5780635c975abb146103ab57806375f50997146103cb575f5ffd5b8063375ef75e1161013c578063472d35b911610117578063472d35b91461032057806347a539e71461033f5780634818e84d1461036d575f5ffd5b8063375ef75e146102ce578063452a9320146102ed578063459656ee1461030c575f5ffd5b80632fcb4f041161016c5780632fcb4f0414610246578063309cdceb1461026557806335b5d81414610290575f5ffd5b80630431c3581461019c578063127cc441146101da5780632337e23614610225575f5ffd5b3661019857005b5f5ffd5b3480156101a7575f5ffd5b506101c76101b6366004612fa1565b60036020525f908152604090205481565b6040519081526020015b60405180910390f35b3480156101e5575f5ffd5b5061020d7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d81565b6040516001600160a01b0390911681526020016101d1565b348015610230575f5ffd5b5061024461023f36600461304a565b6104fc565b005b348015610251575f5ffd5b5061024461026036600461315c565b6106f1565b348015610270575f5ffd5b506101c761027f366004613177565b60026020525f908152604090205481565b34801561029b575f5ffd5b506102be6102aa36600461315c565b60046020525f908152604090205460ff1681565b60405190151581526020016101d1565b3480156102d9575f5ffd5b506102446102e836600461318e565b61074a565b3480156102f8575f5ffd5b5060065461020d906001600160a01b031681565b348015610317575f5ffd5b506102446107bf565b34801561032b575f5ffd5b5061024461033a36600461315c565b61081a565b34801561034a575f5ffd5b506102be61035936600461315c565b60056020525f908152604090205460ff1681565b348015610378575f5ffd5b5060075461020d906001600160a01b031681565b348015610397575f5ffd5b506102446103a63660046131c3565b610873565b3480156103b6575f5ffd5b506007546102be90600160a01b900460ff1681565b3480156103d6575f5ffd5b506102446103e5366004613285565b6108c7565b3480156103f5575f5ffd5b506102446104043660046132ea565b610a1d565b348015610414575f5ffd5b5061024461042336600461330d565b610a57565b348015610433575f5ffd5b506102446104423660046131c3565b610aba565b348015610452575f5ffd5b5060015461020d906001600160a01b031681565b610244610474366004613328565b610b0e565b610244610487366004613285565b61117f565b348015610497575f5ffd5b506102446104a63660046133c9565b611371565b6102446104b9366004613285565b611427565b3480156104c9575f5ffd5b506102446104d8366004613405565b6117af565b3480156104e8575f5ffd5b506102446104f73660046134db565b61197c565b6105046119ba565b600754600160a01b900460ff161561052f576040516313d0ff5960e31b815260040160405180910390fd5b84848260a0015167ffffffffffffffff1661054a919061352e565b10610568576040516308fefc0560e21b815260040160405180910390fd5b84848260c0015167ffffffffffffffff16610583919061352e565b106105ba576040517f2873a4b200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805f015160ff166003146105e15760405163d4380c7360e01b815260040160405180910390fd5b606481610120015160ff16111561064b5760405162461bcd60e51b815260206004820152602360248201527f52656665727265724270732073686f756c64206265206c657373207468616e2060448201526203130360ec1b60648201526084015b60405180910390fd5b604081015115801561066a57505f816080015167ffffffffffffffff16115b1561068857604051636e51edcd60e11b815260040160405180910390fd5b61069d6001600160a01b038716333088611a11565b6106ca867f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d876001611a95565b6106e086868587866106db87611b4e565b611bb2565b6106e960015f55565b505050505050565b6006546001600160a01b0316331461071b576040516282b42960e81b815260040160405180910390fd5b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6006546001600160a01b03163314610774576040516282b42960e81b815260040160405180910390fd5b63ffffffff82165f90815260036020526040902054156107a75760405163a741a04560e01b815260040160405180910390fd5b63ffffffff9091165f90815260036020526040902055565b6007546001600160a01b031633146107e9576040516282b42960e81b815260040160405180910390fd5b6007546006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909216919091179055565b6006546001600160a01b03163314610844576040516282b42960e81b815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6006546001600160a01b0316331461089d576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091165f908152600560205260409020805460ff1916911515919091179055565b306108e46108e16108da6094602461352e565b8590611c52565b90565b6001600160a01b03160361090a576040516282b42960e81b815260040160405180910390fd5b5f7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d6001600160a01b0316632c1219216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610967573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061098b9190613541565b6001600160a01b03166357ecfd2884846040518363ffffffff1660e01b81526004016109b892919061358a565b6020604051808303815f875af11580156109d4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109f891906135b7565b905080610a185760405163605c687360e01b815260040160405180910390fd5b505050565b6006546001600160a01b03163314610a47576040516282b42960e81b815260040160405180910390fd5b610a5381836001611cbd565b5050565b6006546001600160a01b03163314610a81576040516282b42960e81b815260040160405180910390fd5b60078054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6006546001600160a01b03163314610ae4576040516282b42960e81b815260040160405180910390fd5b6001600160a01b03919091165f908152600460205260409020805460ff1916911515919091179055565b610b166119ba565b8330610b316108e1610b2a6094602461352e565b8490611c52565b6001600160a01b031614610b575760405162bc52d160e21b815260040160405180910390fd5b5f610b6186611d51565b9050805f015160ff16600314610b8a5760405163d4380c7360e01b815260040160405180910390fd5b428160e0015167ffffffffffffffff161015610bb9576040516354a36da760e11b815260040160405180910390fd5b6001600160a01b0384165f9081526004602052604090205460ff16610bf15760405163242d9b3760e21b815260040160405180910390fd5b7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d6001600160a01b0316846001600160a01b03161480610cc157507f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d6001600160a01b0316632c1219216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c88573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cac9190613541565b6001600160a01b0316846001600160a01b0316145b15610cdf5760405163242d9b3760e21b815260040160405180910390fd5b335f9081526005602052604090205460ff16610d27576040517fb4ee3af100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f610d338888611f1d565b60a0850151919350915067ffffffffffffffff1615610d715760a0830151610d71906001600160a01b03841690339067ffffffffffffffff16612252565b60a0830151610d8a9067ffffffffffffffff16826135d2565b90505f5f610d99858486612282565b90925090508115610e2e57836001600160a01b031663a9059cbb610dbf87610100015190565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303815f875af1925050508015610e27575060408051601f3d908101601f19168201909252610e24918101906135b7565b60015b15610e2e57505b8015610eba57836001600160a01b031663a9059cbb610e4b612320565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af1925050508015610eb3575060408051601f3d908101601f19168201909252610eb0918101906135b7565b60015b15610eba57505b5f610ec6866040015190565b9050846001600160a01b0316816001600160a01b031603610f295760405162461bcd60e51b815260206004820152601d60248201527f746f6b656e4f75742063616e6e6f74206265206c6f63616c546f6b656e0000006044820152606401610642565b610f49858a85610f3986896135d2565b610f4391906135d2565b5f611a95565b5f6001600160a01b038216610f5f575047610fc8565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015610fa1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fc591906135e5565b90505b5f5f8b6001600160a01b03165f8c604051610fe391906135fc565b5f6040518083038185875af1925050503d805f811461101d576040519150601f19603f3d011682016040523d82523d5f602084013e611022565b606091505b50915091508181906110475760405162461bcd60e51b81526004016106429190613612565b506001600160a01b0384166110675761106083476135d2565b92506110dc565b6040516370a0823160e01b815230600482015283906001600160a01b038616906370a0823190602401602060405180830381865afa1580156110ab573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110cf91906135e5565b6110d991906135d2565b92505b5f6001600160a01b0385166110f3575060126110ff565b6110fc856123b4565b90505b61110a8a8686612464565b6111228a6060015167ffffffffffffffff1682612502565b84101561115b576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111658f85612539565b505050505050505050505061117960015f55565b50505050565b6111876119ba565b813061119b6108e1610b2a6094602461352e565b6001600160a01b0316146111c15760405162bc52d160e21b815260040160405180910390fd5b5f5f6111cd8585611f1d565b915091505f6111db86611d51565b9050805f015160ff166003146112045760405163d4380c7360e01b815260040160405180910390fd5b428160e0015167ffffffffffffffff1610158015611238575060408101516001600160a01b0316836001600160a01b031614155b15611256576040516354a36da760e11b815260040160405180910390fd5b5f611270826080015167ffffffffffffffff166012612502565b905080341461129257604051636e51edcd60e11b815260040160405180910390fd5b5f61129e836020015190565b905081156112b1576112b181835f611cbd565b60c08301516112d6906001600160a01b03871690339067ffffffffffffffff16612252565b611305818460c0015167ffffffffffffffff16866112f491906135d2565b6001600160a01b0388169190612252565b7fb4d4578bf8a1f3c5aa81fae0b333ea7abc62f085e359d86631f63809319bd02561133189600461259a565b61133c8a600c611c52565b6040805163ffffffff90931683526020830191909152810186905260600160405180910390a1505050505050610a5360015f55565b6006546001600160a01b0316331461139b576040516282b42960e81b815260040160405180910390fd5b6040516001600160e01b031960e085901b1660208201526bffffffffffffffffffffffff19606084901b1660248201525f9060380160408051601f1981840301815291815281516020928301205f8181526002909352912054909150156114155760405163a741a04560e01b815260040160405180910390fd5b5f908152600260205260409020555050565b61142f6119ba565b81306114436108e1610b2a6094602461352e565b6001600160a01b0316146114695760405162bc52d160e21b815260040160405180910390fd5b5f611473846125ff565b9050805f015160ff166001141580156114935750805f015160ff16600214155b156114b15760405163d4380c7360e01b815260040160405180910390fd5b5f6114bd826020015190565b9050815f015160ff1660021480156114de5750336001600160a01b03821614155b156114fb576040516282b42960e81b815260040160405180910390fd5b5f5f6115078787611f1d565b9150915080846060015167ffffffffffffffff16111561153a576040516308fefc0560e21b815260040160405180910390fd5b60608401516115539067ffffffffffffffff16826135d2565b90505f60648560a0015160ff161161156f578460a00151611572565b60645b90505f611590865f015185858761158a8b6080015190565b8761271f565b905060648160ff16116115a357806115a6565b60645b90505f6127106115b960ff841686613624565b6115c3919061363b565b90505f6127106115d660ff861687613624565b6115e0919061363b565b90506115fb33878a6060015167ffffffffffffffff166127fe565b611625878261160a85896135d2565b61161491906135d2565b6001600160a01b0389169190612252565b80156116b457856001600160a01b031663a9059cbb6116458a6080015190565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af19250505080156116ad575060408051601f3d908101601f191682019092526116aa918101906135b7565b60015b156116b457505b811561174057856001600160a01b031663a9059cbb6116d1612320565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303815f875af1925050508015611739575060408051601f3d908101601f19168201909252611736918101906135b7565b60015b1561174057505b604088015167ffffffffffffffff161561179d575f61176e896040015167ffffffffffffffff166012612502565b905080341461179057604051636e51edcd60e11b815260040160405180910390fd5b61179b88825f611cbd565b505b505050505050505050610a5360015f55565b6117b76119ba565b600754600160a01b900460ff16156117e2576040516313d0ff5960e31b815260040160405180910390fd5b8a6117f78a67ffffffffffffffff8d1661352e565b10611815576040516308fefc0560e21b815260040160405180910390fd5b8260ff1660011415801561182d57508260ff16600214155b1561184b5760405163d4380c7360e01b815260040160405180910390fd5b6118606001600160a01b038d1633308e611a11565b61188d8c7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d8d6001611a95565b60648460ff1611156118ed5760405162461bcd60e51b815260206004820152602360248201527f52656665727265724270732073686f756c64206265206c657373207468616e2060448201526203130360ec1b6064820152608401610642565b5f8360ff166002036119025750805160208201205b5f6040518060e001604052808660ff1681526020018a81526020018b67ffffffffffffffff1681526020018d67ffffffffffffffff1681526020018881526020018760ff1681526020018381525090506119638e8e8a8e886106db87612904565b505061196e60015f55565b505050505050505050505050565b6006546001600160a01b031633146119a6576040516282b42960e81b815260040160405180910390fd5b610a186001600160a01b0384168284612252565b60025f5403611a0b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610642565b60025f55565b6040516001600160a01b03808516602483015283166044820152606481018290526111799085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526129a1565b604051636eb1769f60e11b81523060048201526001600160a01b03848116602483015285915f9183169063dd62ed3e90604401602060405180830381865afa158015611ae3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b0791906135e5565b9050838110156106e9578015611b2b57611b2b6001600160a01b038316865f612a87565b6106e98584611b3a5785611b3d565b5f195b6001600160a01b0385169190612a87565b6060815f015182602001518360400151846060015185608001518660a001518760c001518860e001518961010001518a6101200151604051602001611b9c9a9998979695949392919061365a565b6040516020818303038152906040529050919050565b7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d6001600160a01b031663779b432d8686611bed888b612bba565b8a611bf78a612c4c565b8989896040518963ffffffff1660e01b8152600401611c1d989796959493929190613741565b5f604051808303815f87803b158015611c34575f5ffd5b505af1158015611c46573d5f5f3e3d5ffd5b50505050505050505050565b5f611c5e82602061352e565b83511015611cae5760405162461bcd60e51b815260206004820152601560248201527f746f427974657333325f6f75744f66426f756e647300000000000000000000006044820152606401610642565b50818101602001515b92915050565b5f836001600160a01b0316836040515f6040518083038185875af1925050503d805f8114611d06576040519150601f19603f3d011682016040523d82523d5f602084013e611d0b565b606091505b50509050811561117957600181151514611179576040517f6d963f8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805161014080820183525f80835260208301819052828401819052606083018190526080830181905260a0830181905260c0830181905260e08301819052610100830181905261012083015282519081019092529080611dbf611db8609460e461352e565b8590612c9d565b60ff168152602001611de1611dd6609460e461352e565b6108da90600161352e565b8152602001611e00611df5609460e461352e565b6108da90602161352e565b8152602001611e26611e14609460e461352e565b611e1f90604161352e565b8590612d02565b67ffffffffffffffff168152602001611e4f611e44609460e461352e565b611e1f90604961352e565b67ffffffffffffffff168152602001611e78611e6d609460e461352e565b611e1f90605161352e565b67ffffffffffffffff168152602001611ea1611e96609460e461352e565b611e1f90605961352e565b67ffffffffffffffff168152602001611eca611ebf609460e461352e565b611e1f90606161352e565b67ffffffffffffffff168152602001611ef3611ee8609460e461352e565b6108da90606961352e565b8152602001611f12611f07609460e461352e565b611db890608961352e565b60ff16905292915050565b5f8080611f2b85600461259a565b90505f611f44611f3d6094600461352e565b8790611c52565b90505f7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d6001600160a01b031663cb75c11c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fa3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc79190613541565b6040517f78a0565e00000000000000000000000000000000000000000000000000000000815263ffffffff85166004820152602481018490526001600160a01b0391909116906378a0565e90604401602060405180830381865afa158015612031573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120559190613541565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038316906370a0823190602401602060405180830381865afa15801561209c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120c091906135e5565b90505f7f00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d6001600160a01b0316632c1219216040518163ffffffff1660e01b8152600401602060405180830381865afa15801561211f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121439190613541565b6001600160a01b03166357ecfd288a8a6040518363ffffffff1660e01b815260040161217092919061358a565b6020604051808303815f875af115801561218c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121b091906135b7565b9050806121d05760405163605c687360e01b815260040160405180910390fd5b6040516370a0823160e01b815230600482015282906001600160a01b038516906370a0823190602401602060405180830381865afa158015612214573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061223891906135e5565b61224291906135d2565b9299929850919650505050505050565b6040516001600160a01b038316602482015260448101829052610a1890849063a9059cbb60e01b90606401611a5e565b5f5f5f606486610120015160ff16116122a0578561012001516122a3565b60645b90506127106122b560ff831687613624565b6122bf919061363b565b92505f6122e1875f015186886122d68b6040015190565b6101008c015161158a565b905060648160ff16116122f457806122f7565b60645b905061271061230960ff831688613624565b612313919061363b565b925050505b935093915050565b604080516004815260248101909152602081810180516001600160e01b03167fc415b95c000000000000000000000000000000000000000000000000000000001790526001545f928392612384926001600160a01b031691620f4240918591612d67565b9150505f60208251101561239957505f611cb7565b818060200190518101906123ad91906135e5565b9392505050565b60408051600481526024810182526020810180516001600160e01b03167f313ce5670000000000000000000000000000000000000000000000000000000017905290515f9182916001600160a01b0385169161240f916135fc565b5f60405180830381855afa9150503d805f8114612447576040519150601f19603f3d011682016040523d82523d5f602084013e61244c565b606091505b50915050808060200190518101906123ad91906137a2565b5f612470846020015190565b90506001600160a01b0383166124915761248c81836001611cbd565b611179565b608084015167ffffffffffffffff16156124ee575f6124bf856080015167ffffffffffffffff166012612502565b90508034146124e157604051636e51edcd60e11b815260040160405180910390fd5b6124ec82825f611cbd565b505b6111796001600160a01b0384168284612252565b5f60088260ff1611156125325761251a6008836137bd565b61252590600a6138b1565b61252f9084613624565b92505b5090919050565b7f99e766e06bd9dc43c056e2b2fc007c5b9e73c190b2daeb448fa24530d97c18e661256583600461259a565b61257084600c611c52565b6040805163ffffffff90931683526020830191909152810183905260600160405180910390a15050565b5f6125a682600461352e565b835110156125f65760405162461bcd60e51b815260206004820152601460248201527f746f55696e7433325f6f75744f66426f756e64730000000000000000000000006044820152606401610642565b50016004015190565b6040805160e080820183525f80835260208301819052828401819052606083018190526080830181905260a0830181905260c08301528251908101909252908061264e611db8609460e461352e565b60ff168152602001612665611dd6609460e461352e565b8152602001612684612679609460e461352e565b611e1f90602161352e565b67ffffffffffffffff1681526020016126ad6126a2609460e461352e565b611e1f90602961352e565b67ffffffffffffffff1681526020016126d66126cb609460e461352e565b6108da90603161352e565b81526020016126f56126ea609460e461352e565b611db890605161352e565b60ff16815260200161271761270c609460e461352e565b6108da90605261352e565b905292915050565b60405160ff80881660248301526001600160a01b038088166044840152606483018790528086166084840152841660a4830152821660c48201525f9081906127c690620f424090839060209060e40160408051601f198184030181529190526020810180516001600160e01b03167f1e47aaa0000000000000000000000000000000000000000000000000000000001790526001546001600160a01b031693929190612d67565b9150505f6020825110156127db57505f6127f2565b818060200190518101906127ef91906135e5565b90505b98975050505050505050565b60015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb906044016020604051808303815f875af192505050801561286c575060408051601f3d908101601f19168201909252612869918101906135b7565b60015b1561287357505b6040516001600160a01b03808516602483015283166044820152606481018290526128fd90620f4240905f9060209060840160408051601f198184030181529190526020810180516001600160e01b03167f1c432455000000000000000000000000000000000000000000000000000000001790526001546001600160a01b031693929190612d67565b5050505050565b8051602080830151604080850151606086810151608088015160a089015160c0808b0151965160f89a8b1b7fff000000000000000000000000000000000000000000000000000000000000009081169a82019a909a52602181019890985294851b6001600160c01b031990811660418901529290941b90911660498601526051850152941b90921660718201526072810191909152609201611b9c565b5f6129f5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ded9092919063ffffffff16565b905080515f1480612a15575080806020019051810190612a1591906135b7565b610a185760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610642565b801580612aff5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612ad9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612afd91906135e5565b155b612b715760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610642565b6040516001600160a01b038316602482015260448101829052610a189084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611a5e565b6040805160e084901b6001600160e01b031916602080830191909152606084901b6bffffffffffffffffffffffff1916602483015282516018818403018152603890920183528151918101919091205f908152600290915290812054806123ad576040517e6130e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b63ffffffff81165f9081526003602052604090205480612c98576040517f4ceffc8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b5f612ca982600161352e565b83511015612cf95760405162461bcd60e51b815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152606401610642565b50016001015190565b5f612d0e82600861352e565b83511015612d5e5760405162461bcd60e51b815260206004820152601460248201527f746f55696e7436345f6f75744f66426f756e64730000000000000000000000006044820152606401610642565b50016008015190565b5f60605f5f5f8661ffff1667ffffffffffffffff811115612d8a57612d8a612fdc565b6040519080825280601f01601f191660200182016040528015612db4576020820181803683370190505b5090505f5f8751602089018b8e8ef191503d925086831115612dd4578692505b828152825f602083013e90999098509650505050505050565b6060612dfb84845f85612e03565b949350505050565b606082471015612e7b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610642565b5f5f866001600160a01b03168587604051612e9691906135fc565b5f6040518083038185875af1925050503d805f8114612ed0576040519150601f19603f3d011682016040523d82523d5f602084013e612ed5565b606091505b5091509150612ee687838387612ef1565b979650505050505050565b60608315612f5f5782515f03612f58576001600160a01b0385163b612f585760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610642565b5081612dfb565b612dfb8383815115612f745781518083602001fd5b8060405162461bcd60e51b81526004016106429190613612565b803563ffffffff81168114612c98575f5ffd5b5f60208284031215612fb1575f5ffd5b6123ad82612f8e565b6001600160a01b0381168114612fce575f5ffd5b50565b8035612c9881612fba565b634e487b7160e01b5f52604160045260245ffd5b604051610140810167ffffffffffffffff8111828210171561301457613014612fdc565b60405290565b60ff81168114612fce575f5ffd5b8035612c988161301a565b803567ffffffffffffffff81168114612c98575f5ffd5b5f5f5f5f5f5f8688036101e0811215613061575f5ffd5b873561306c81612fba565b9650602088013595506040880135945061308860608901612f8e565b935061309660808901612f8e565b9250610140609f19820112156130aa575f5ffd5b506130b3612ff0565b6130bf60a08901613028565b815260c0880135602082015260e088013560408201526130e26101008901613033565b60608201526130f46101208901613033565b60808201526131066101408901613033565b60a08201526131186101608901613033565b60c082015261312a6101808901613033565b60e08201526101a08801356101008201526131486101c08901613028565b610120820152809150509295509295509295565b5f6020828403121561316c575f5ffd5b81356123ad81612fba565b5f60208284031215613187575f5ffd5b5035919050565b5f5f6040838503121561319f575f5ffd5b6131a883612f8e565b946020939093013593505050565b8015158114612fce575f5ffd5b5f5f604083850312156131d4575f5ffd5b82356131df81612fba565b915060208301356131ef816131b6565b809150509250929050565b5f82601f830112613209575f5ffd5b813567ffffffffffffffff81111561322357613223612fdc565b604051601f8201601f19908116603f0116810167ffffffffffffffff8111828210171561325257613252612fdc565b604052818152838201602001851015613269575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215613296575f5ffd5b823567ffffffffffffffff8111156132ac575f5ffd5b6132b8858286016131fa565b925050602083013567ffffffffffffffff8111156132d4575f5ffd5b6132e0858286016131fa565b9150509250929050565b5f5f604083850312156132fb575f5ffd5b8235915060208301356131ef81612fba565b5f6020828403121561331d575f5ffd5b81356123ad816131b6565b5f5f5f5f6080858703121561333b575f5ffd5b843567ffffffffffffffff811115613351575f5ffd5b61335d878288016131fa565b945050602085013567ffffffffffffffff811115613379575f5ffd5b613385878288016131fa565b935050604085013561339681612fba565b9150606085013567ffffffffffffffff8111156133b1575f5ffd5b6133bd878288016131fa565b91505092959194509250565b5f5f5f606084860312156133db575f5ffd5b6133e484612f8e565b925060208401356133f481612fba565b929592945050506040919091013590565b5f5f5f5f5f5f5f5f5f5f5f5f6101808d8f031215613421575f5ffd5b61342a8d612fd1565b9b5060208d01359a5061343f60408e01613033565b995060608d0135985061345460808e01613033565b975060a08d0135965061346960c08e01612f8e565b955060e08d0135945061347f6101008e01613028565b935061348e6101208e01613028565b925061349d6101408e01612f8e565b915067ffffffffffffffff6101608e013511156134b8575f5ffd5b6134c98e6101608f01358f016131fa565b90509295989b509295989b509295989b565b5f5f5f606084860312156134ed575f5ffd5b83356134f881612fba565b925060208401359150604084013561350f81612fba565b809150509250925092565b634e487b7160e01b5f52601160045260245ffd5b80820180821115611cb757611cb761351a565b5f60208284031215613551575f5ffd5b81516123ad81612fba565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b604081525f61359c604083018561355c565b82810360208401526135ae818561355c565b95945050505050565b5f602082840312156135c7575f5ffd5b81516123ad816131b6565b81810381811115611cb757611cb761351a565b5f602082840312156135f5575f5ffd5b5051919050565b5f82518060208501845e5f920191825250919050565b602081525f6123ad602083018461355c565b8082028115828204841417611cb757611cb761351a565b5f8261365557634e487b7160e01b5f52601260045260245ffd5b500490565b7fff000000000000000000000000000000000000000000000000000000000000008b60f81b1681528960018201528860218201526001600160c01b03198860c01b1660418201526001600160c01b03198760c01b1660498201526001600160c01b03198660c01b1660518201526136e0605982018660c01b6001600160c01b0319169052565b6136f9606182018560c01b6001600160c01b0319169052565b826069820152613730608982018360f81b7fff00000000000000000000000000000000000000000000000000000000000000169052565b608a019a9950505050505050505050565b88815263ffffffff881660208201528660408201526001600160a01b03861660608201528460808201528360a082015263ffffffff831660c082015261010060e08201525f61379461010083018461355c565b9a9950505050505050505050565b5f602082840312156137b2575f5ffd5b81516123ad8161301a565b60ff8281168282160390811115611cb757611cb761351a565b6001815b6001841115612318578085048111156137f5576137f561351a565b600184161561380357908102905b60019390931c9280026137da565b5f8261381f57506001611cb7565b8161382b57505f611cb7565b8160018114613841576002811461384b57613867565b6001915050611cb7565b60ff84111561385c5761385c61351a565b50506001821b611cb7565b5060208310610133831016604e8410600b841016171561388a575081810a611cb7565b6138965f1984846137d6565b805f19048211156138a9576138a961351a565b029392505050565b5f6123ad60ff84168361381156fea26469706673582212203da4dccb65e3bea444aeb48e97bfb77305a3fa1ea57afd170c3391d455bb18c564736f6c634300081c0033

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

00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d000000000000000000000000598400ba0d8ba9c3b57ad424a68183f1d17c7e56

-----Decoded View---------------
Arg [0] : _cctpTokenMessengerV2 (address): 0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d
Arg [1] : _feeManager (address): 0x598400bA0d8BA9C3b57ad424A68183f1D17c7e56

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000028b5a0e9c621a5badaa536219b3a228c8168cf5d
Arg [1] : 000000000000000000000000598400ba0d8ba9c3b57ad424a68183f1d17c7e56


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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
0xC1062b7C5Dc8E4b1Df9F200fe360cDc0eD6e7741
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.