Source Code
Overview
XDC Balance
XDC Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 92624025 | 85 days ago | Contract Creation | 0 XDC |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
TokenMessengerV2
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 100000 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
/*
* 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.7.6;
pragma abicoder v2;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {BaseTokenMessenger} from "./BaseTokenMessenger.sol";
import {ITokenMinterV2} from "../interfaces/v2/ITokenMinterV2.sol";
import {AddressUtils} from "../messages/v2/AddressUtils.sol";
import {IRelayerV2} from "../interfaces/v2/IRelayerV2.sol";
import {IMessageHandlerV2} from "../interfaces/v2/IMessageHandlerV2.sol";
import {TypedMemView} from "@memview-sol/contracts/TypedMemView.sol";
import {BurnMessageV2} from "../messages/v2/BurnMessageV2.sol";
import {TOKEN_MESSENGER_MIN_FINALITY_THRESHOLD} from "./FinalityThresholds.sol";
/**
* @title TokenMessengerV2
* @notice Sends and receives messages to/from MessageTransmitters
* and to/from TokenMinters.
*/
contract TokenMessengerV2 is IMessageHandlerV2, BaseTokenMessenger {
// ============ Structs ============
struct TokenMessengerV2Roles {
address owner;
address rescuer;
address feeRecipient;
address denylister;
address tokenMinter;
address minFeeController;
}
// ============ Events ============
/**
* @notice Emitted when a DepositForBurn message is sent
* @param burnToken address of token burnt on source domain
* @param amount deposit amount
* @param depositor address where deposit is transferred from
* @param mintRecipient address receiving minted tokens on destination domain as bytes32
* @param destinationDomain destination domain
* @param destinationTokenMessenger address of TokenMessenger on destination domain as bytes32
* @param destinationCaller authorized caller as bytes32 of receiveMessage() on destination domain.
* If equal to bytes32(0), any address can broadcast the message.
* @param maxFee maximum fee to pay on destination domain, in units of burnToken
* @param minFinalityThreshold the minimum finality at which the message should be attested to.
* @param hookData optional hook for execution on destination domain
*/
event DepositForBurn(
address indexed burnToken,
uint256 amount,
address indexed depositor,
bytes32 mintRecipient,
uint32 destinationDomain,
bytes32 destinationTokenMessenger,
bytes32 destinationCaller,
uint256 maxFee,
uint32 indexed minFinalityThreshold,
bytes hookData
);
// ============ Libraries ============
using AddressUtils for address;
using AddressUtils for address payable;
using AddressUtils for bytes32;
using BurnMessageV2 for bytes29;
using TypedMemView for bytes;
using TypedMemView for bytes29;
using SafeMath for uint256;
// ============ Constructor ============
/**
* @param _messageTransmitter Message transmitter address
* @param _messageBodyVersion Message body version
*/
constructor(
address _messageTransmitter,
uint32 _messageBodyVersion
) BaseTokenMessenger(_messageTransmitter, _messageBodyVersion) {
_disableInitializers();
}
// ============ Initializers ============
/**
* @notice Initializes the contract
* @dev Reverts if any of the roles are the zero address
* @dev Reverts if `remoteDomains_` and `remoteTokenMessengers_` are unequal length
* @dev Each remoteTokenMessenger address must correspond to the remote domain at the same
* index in respective arrays.
* @dev Reverts if any `remoteTokenMessengers_` entry equals bytes32(0)
* @param roles Roles configuration
* @param minFee_ Minimum fee
* @param remoteDomains_ Array of remote domains to configure
* @param remoteTokenMessengers_ Array of remote token messenger addresses
*/
function initialize(
TokenMessengerV2Roles calldata roles,
uint256 minFee_,
uint32[] calldata remoteDomains_,
bytes32[] calldata remoteTokenMessengers_
) external initializer {
require(roles.owner != address(0), "Owner is the zero address");
require(
remoteDomains_.length == remoteTokenMessengers_.length,
"Invalid remote domain configuration"
);
// Roles
_transferOwnership(roles.owner);
_updateRescuer(roles.rescuer);
_updateDenylister(roles.denylister);
_setFeeRecipient(roles.feeRecipient);
// Local minter configuration
_setLocalMinter(roles.tokenMinter);
// Fee configuration
_setMinFeeController(roles.minFeeController);
_setMinFee(minFee_);
// Remote token messenger configuration
uint256 _remoteDomainsLength = remoteDomains_.length;
for (uint256 i; i < _remoteDomainsLength; ++i) {
_addRemoteTokenMessenger(
remoteDomains_[i],
remoteTokenMessengers_[i]
);
}
}
// ============ External Functions ============
/**
* @notice Deposits and burns tokens from sender to be minted on destination domain.
* Emits a `DepositForBurn` event.
* @dev reverts if:
* - given burnToken is not supported
* - given destinationDomain has no TokenMessenger registered
* - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance
* to this contract is less than `amount`.
* - burn() reverts. For example, if `amount` is 0.
* - maxFee is greater than or equal to `amount`.
* - maxFee is less than `amount * minFee / MIN_FEE_MULTIPLIER`.
* - MessageTransmitterV2#sendMessage reverts.
* @param amount amount of tokens to burn
* @param destinationDomain destination domain to receive message on
* @param mintRecipient address of mint recipient on destination domain
* @param burnToken token to burn `amount` of, on local domain
* @param destinationCaller authorized caller on the destination domain, as bytes32. If equal to bytes32(0),
* any address can broadcast the message.
* @param maxFee maximum fee to pay on the destination domain, specified in units of burnToken
* @param minFinalityThreshold the minimum finality at which a burn message will be attested to.
*/
function depositForBurn(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken,
bytes32 destinationCaller,
uint256 maxFee,
uint32 minFinalityThreshold
) external notDenylistedCallers {
bytes calldata _emptyHookData = msg.data[0:0];
_depositForBurn(
amount,
destinationDomain,
mintRecipient,
burnToken,
destinationCaller,
maxFee,
minFinalityThreshold,
_emptyHookData
);
}
/**
* @notice Deposits and burns tokens from sender to be minted on destination domain.
* Emits a `DepositForBurn` event.
* @dev reverts if:
* - `hookData` is zero-length
* - `burnToken` is not supported
* - `destinationDomain` has no TokenMessenger registered
* - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance
* to this contract is less than `amount`.
* - burn() reverts. For example, if `amount` is 0.
* - maxFee is greater than or equal to `amount`.
* - maxFee is less than `amount * minFee / MIN_FEE_MULTIPLIER`.
* - MessageTransmitterV2#sendMessage reverts.
* @param amount amount of tokens to burn
* @param destinationDomain destination domain to receive message on
* @param mintRecipient address of mint recipient on destination domain, as bytes32
* @param burnToken token to burn `amount` of, on local domain
* @param destinationCaller authorized caller on the destination domain, as bytes32. If equal to bytes32(0),
* any address can broadcast the message.
* @param maxFee maximum fee to pay on the destination domain, specified in units of burnToken
* @param hookData hook data to append to burn message for interpretation on destination domain
*/
function depositForBurnWithHook(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken,
bytes32 destinationCaller,
uint256 maxFee,
uint32 minFinalityThreshold,
bytes calldata hookData
) external notDenylistedCallers {
require(hookData.length > 0, "Hook data is empty");
_depositForBurn(
amount,
destinationDomain,
mintRecipient,
burnToken,
destinationCaller,
maxFee,
minFinalityThreshold,
hookData
);
}
/**
* @notice Handles an incoming finalized message received by the local MessageTransmitter,
* and takes the appropriate action. For a burn message, mints the
* associated token to the requested recipient on the local domain.
* @dev Validates the local sender is the local MessageTransmitter, and the
* remote sender is a registered remote TokenMessenger for `remoteDomain`.
* @param remoteDomain The domain where the message originated from.
* @param sender The sender of the message (remote TokenMessenger).
* @param messageBody The message body bytes.
* @return success Bool, true if successful.
*/
function handleReceiveFinalizedMessage(
uint32 remoteDomain,
bytes32 sender,
uint32,
bytes calldata messageBody
)
external
override
onlyLocalMessageTransmitter
onlyRemoteTokenMessenger(remoteDomain, sender)
returns (bool)
{
return _handleReceiveMessage(messageBody.ref(0), remoteDomain);
}
/**
* @notice Handles an incoming unfinalized message received by the local MessageTransmitter,
* and takes the appropriate action. For a burn message, mints the
* associated token to the requested recipient on the local domain, less fees.
* Fees are separately minted to the currently set `feeRecipient` address.
* @dev Validates the local sender is the local MessageTransmitter, and the
* remote sender is a registered remote TokenMessenger for `remoteDomain`.
* @dev Validates that `finalityThresholdExecuted` is at least 500.
* @param remoteDomain The domain where the message originated from.
* @param sender The sender of the message (remote TokenMessenger).
* @param finalityThresholdExecuted The level of finality at which the message was attested to
* @param messageBody The message body bytes.
* @return success Bool, true if successful.
*/
function handleReceiveUnfinalizedMessage(
uint32 remoteDomain,
bytes32 sender,
uint32 finalityThresholdExecuted,
bytes calldata messageBody
)
external
override
onlyLocalMessageTransmitter
onlyRemoteTokenMessenger(remoteDomain, sender)
returns (bool)
{
require(
finalityThresholdExecuted >= TOKEN_MESSENGER_MIN_FINALITY_THRESHOLD,
"Unsupported finality threshold"
);
return _handleReceiveMessage(messageBody.ref(0), remoteDomain);
}
/**
* @notice Returns the minimum fee for a given amount
* @param amount The amount for which to calculate the minimum fee
* @return The minimum fee for the given amount
*/
function getMinFeeAmount(uint256 amount) external view returns (uint256) {
if (minFee == 0) return 0;
require(amount > 1, "Amount too low");
return _calcMinFeeAmount(amount);
}
// ============ Internal Utils ============
/**
* Calculates the minimum fee amount for a given amount.
* @dev Amount should be constrained to be greater than 1.
* @dev Assumes `minFee` is non-zero.
* @param _amount The amount for which to calculate the minimum fee.
* @return The minimum fee for the given amount.
*/
function _calcMinFeeAmount(
uint256 _amount
) internal view returns (uint256) {
uint256 _minFeeAmount = _amount.mul(minFee) / MIN_FEE_MULTIPLIER;
return _minFeeAmount == 0 ? 1 : _minFeeAmount;
}
/**
* @notice Deposits and burns tokens from sender to be minted on destination domain.
* Emits a `DepositForBurn` event.
* @param _amount amount of tokens to burn (must be non-zero)
* @param _destinationDomain destination domain
* @param _mintRecipient address of mint recipient on destination domain
* @param _burnToken address of the token burned on the source chain
* @param _destinationCaller caller on the destination domain, as bytes32
* @param _maxFee maximum fee to pay on destination chain
* @param _hookData optional hook data for interpretation on destination chain
*/
function _depositForBurn(
uint256 _amount,
uint32 _destinationDomain,
bytes32 _mintRecipient,
address _burnToken,
bytes32 _destinationCaller,
uint256 _maxFee,
uint32 _minFinalityThreshold,
bytes calldata _hookData
) internal {
require(_amount > 0, "Amount must be nonzero");
require(_mintRecipient != bytes32(0), "Mint recipient must be nonzero");
require(_maxFee < _amount, "Max fee must be less than amount");
// Verify minimum fee
if (minFee > 0) {
// Implicitly constrains `_amount` to be greater than 1
// 0 < minFeeAmount <= maxFee < amount
require(
_maxFee >= _calcMinFeeAmount(_amount),
"Insufficient max fee"
);
}
bytes32 _destinationTokenMessenger = _getRemoteTokenMessenger(
_destinationDomain
);
// Deposit and burn tokens
_depositAndBurn(_burnToken, msg.sender, _amount);
// Format message body
bytes memory _burnMessage = BurnMessageV2._formatMessageForRelay(
messageBodyVersion,
_burnToken.toBytes32(),
_mintRecipient,
_amount,
msg.sender.toBytes32(),
_maxFee,
_hookData
);
// Send message
IRelayerV2(localMessageTransmitter).sendMessage(
_destinationDomain,
_destinationTokenMessenger,
_destinationCaller,
_minFinalityThreshold,
_burnMessage
);
emit DepositForBurn(
_burnToken,
_amount,
msg.sender,
_mintRecipient,
_destinationDomain,
_destinationTokenMessenger,
_destinationCaller,
_maxFee,
_minFinalityThreshold,
_hookData
);
}
/**
* @notice Validates a received message and mints the token to the mintRecipient, less fees.
* @dev Reverts if _validatedReceivedMessage fails to validate the message.
* @dev Reverts if the mint operation fails.
* @param _msg Received message
* @param _remoteDomain The domain where the message originated from
* @return success Bool, true if successful.
*/
function _handleReceiveMessage(
bytes29 _msg,
uint32 _remoteDomain
) internal returns (bool) {
// Validate message and unpack fields
(
address _mintRecipient,
bytes32 _burnToken,
uint256 _amount,
uint256 _fee
) = _validatedReceivedMessage(_msg);
// Mint tokens
_mintAndWithdraw(
_remoteDomain,
_burnToken,
_mintRecipient,
_amount - _fee,
_fee
);
return true;
}
/**
* @notice Validates a BurnMessage and unpacks relevant fields.
* @dev Reverts if the BurnMessage is malformed
* @dev Reverts if the BurnMessage version isn't supported
* @dev Reverts if the BurnMessage has expired
* @dev Reverts if the fee equals or exceeds the amount
* @dev Reverts if the fee exceeds the max fee specified on the source chain
* @param _msg Finalized message
* @return _mintRecipient The recipient of the mint, as bytes32
* @return _burnToken The address of the token burned on the source chain
* @return _amount The amount of burnToken burned
* @return _fee The fee executed
*/
function _validatedReceivedMessage(
bytes29 _msg
)
internal
view
returns (
address _mintRecipient,
bytes32 _burnToken,
uint256 _amount,
uint256 _fee
)
{
_msg._validateBurnMessageFormat();
require(
_msg._getVersion() == messageBodyVersion,
"Invalid message body version"
);
// Enforce message expiration
uint256 _expirationBlock = _msg._getExpirationBlock();
require(
_expirationBlock == 0 || _expirationBlock > block.number,
"Message expired and must be re-signed"
);
// Validate fee
_amount = _msg._getAmount();
_fee = _msg._getFeeExecuted();
require(_fee == 0 || _fee < _amount, "Fee equals or exceeds amount");
require(_fee <= _msg._getMaxFee(), "Fee exceeds max fee");
_mintRecipient = _msg._getMintRecipient().toAddress();
_burnToken = _msg._getBurnToken();
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}/*
* 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.7.6;
import {ITokenMinterV2} from "../interfaces/v2/ITokenMinterV2.sol";
import {Rescuable} from "../roles/Rescuable.sol";
import {Denylistable} from "../roles/v2/Denylistable.sol";
import {IMintBurnToken} from "../interfaces/IMintBurnToken.sol";
import {Initializable} from "../proxy/Initializable.sol";
/**
* @title BaseTokenMessenger
* @notice Base administrative functionality for TokenMessenger implementations,
* including managing remote token messengers and the local token minter.
*/
abstract contract BaseTokenMessenger is Rescuable, Denylistable, Initializable {
// ============ Events ============
/**
* @notice Emitted when a remote TokenMessenger is added
* @param domain remote domain
* @param tokenMessenger TokenMessenger on remote domain
*/
event RemoteTokenMessengerAdded(uint32 domain, bytes32 tokenMessenger);
/**
* @notice Emitted when a remote TokenMessenger is removed
* @param domain remote domain
* @param tokenMessenger TokenMessenger on remote domain
*/
event RemoteTokenMessengerRemoved(uint32 domain, bytes32 tokenMessenger);
/**
* @notice Emitted when the local minter is added
* @param localMinter address of local minter
*/
event LocalMinterAdded(address localMinter);
/**
* @notice Emitted when the local minter is removed
* @param localMinter address of local minter
*/
event LocalMinterRemoved(address localMinter);
/**
* @notice Emitted when the fee recipient is set
* @param feeRecipient address of fee recipient set
*/
event FeeRecipientSet(address feeRecipient);
/**
* @notice Emitted when the minimum fee controller is set
* @param minFeeController address of minimum fee controller
*/
event MinFeeControllerSet(address minFeeController);
/**
* @notice Emitted when the minimum fee is set
* @param minFee minimum fee
*/
event MinFeeSet(uint256 minFee);
/**
* @notice Emitted when tokens are minted
* @param mintRecipient recipient address of minted tokens
* @param amount amount of minted tokens received by `mintRecipient`
* @param mintToken contract address of minted token
* @param feeCollected fee collected for mint
*/
event MintAndWithdraw(
address indexed mintRecipient,
uint256 amount,
address indexed mintToken,
uint256 feeCollected
);
// ============ State Variables ============
// Local Message Transmitter responsible for sending and receiving messages to/from remote domains
address public immutable localMessageTransmitter;
// Version of message body format
uint32 public immutable messageBodyVersion;
// Minter responsible for minting and burning tokens on the local domain
ITokenMinterV2 public localMinter;
// Valid TokenMessengers on remote domains
mapping(uint32 => bytes32) public remoteTokenMessengers;
// Address to receive collected fees
address public feeRecipient;
// Minimum fee controller address
address public minFeeController;
// Minimum fee for all transfers in 1/1000 basis points
uint256 public minFee;
// Minimum fee multiplier to support 1/1000 basis point precision
uint256 public constant MIN_FEE_MULTIPLIER = 10_000_000;
// ============ Modifiers ============
/**
* @notice Only accept messages from a registered TokenMessenger contract on given remote domain
* @param domain The remote domain
* @param tokenMessenger The address of the TokenMessenger contract for the given remote domain
*/
modifier onlyRemoteTokenMessenger(uint32 domain, bytes32 tokenMessenger) {
require(
_isRemoteTokenMessenger(domain, tokenMessenger),
"Remote TokenMessenger unsupported"
);
_;
}
/**
* @notice Only accept messages from the registered message transmitter on local domain
*/
modifier onlyLocalMessageTransmitter() {
// Caller must be the registered message transmitter for this domain
require(_isLocalMessageTransmitter(), "Invalid message transmitter");
_;
}
/**
* @notice Reverts if called by any account other than the min fee controller
*/
modifier onlyMinFeeController() {
require(
msg.sender == minFeeController,
"Caller is not the min fee controller"
);
_;
}
// ============ Constructor ============
/**
* @param _messageTransmitter Message transmitter address
* @param _messageBodyVersion Message body version
*/
constructor(address _messageTransmitter, uint32 _messageBodyVersion) {
require(
_messageTransmitter != address(0),
"MessageTransmitter not set"
);
localMessageTransmitter = _messageTransmitter;
messageBodyVersion = _messageBodyVersion;
}
// ============ External Functions ============
/**
* @notice Add the TokenMessenger for a remote domain.
* @dev Reverts if there is already a TokenMessenger set for domain.
* @param domain Domain of remote TokenMessenger.
* @param tokenMessenger Address of remote TokenMessenger as bytes32.
*/
function addRemoteTokenMessenger(
uint32 domain,
bytes32 tokenMessenger
) external onlyOwner {
_addRemoteTokenMessenger(domain, tokenMessenger);
}
/**
* @notice Remove the TokenMessenger for a remote domain.
* @dev Reverts if there is no TokenMessenger set for `domain`.
* @param domain Domain of remote TokenMessenger
*/
function removeRemoteTokenMessenger(uint32 domain) external onlyOwner {
// No TokenMessenger set for given remote domain.
require(
remoteTokenMessengers[domain] != bytes32(0),
"No TokenMessenger set"
);
bytes32 _removedTokenMessenger = remoteTokenMessengers[domain];
delete remoteTokenMessengers[domain];
emit RemoteTokenMessengerRemoved(domain, _removedTokenMessenger);
}
/**
* @notice Add minter for the local domain.
* @dev Reverts if a minter is already set for the local domain.
* @param newLocalMinter The address of the minter on the local domain.
*/
function addLocalMinter(address newLocalMinter) external onlyOwner {
_setLocalMinter(newLocalMinter);
}
/**
* @notice Remove the minter for the local domain.
* @dev Reverts if the minter of the local domain is not set.
*/
function removeLocalMinter() external onlyOwner {
address _localMinterAddress = address(localMinter);
require(_localMinterAddress != address(0), "No local minter is set.");
delete localMinter;
emit LocalMinterRemoved(_localMinterAddress);
}
/**
* @notice Sets the fee recipient address
* @dev Reverts if not called by the owner
* @dev Reverts if `_feeRecipient` is the zero address
* @param _feeRecipient Address of fee recipient
*/
function setFeeRecipient(address _feeRecipient) external onlyOwner {
_setFeeRecipient(_feeRecipient);
}
/**
* @notice Sets the minimum fee controller address
* @dev Reverts if not called by the owner
* @dev Reverts if `_minFeeController` is the zero address
* @param _minFeeController Address of minimum fee controller
*/
function setMinFeeController(address _minFeeController) external onlyOwner {
_setMinFeeController(_minFeeController);
}
/**
* @notice Sets the minimum fee for all transfers in 1/1000 basis points
* @dev Reverts if not called by the min fee controller
* @dev Reverts if the minimum fee is equal to or greater than MIN_FEE_MULTIPLIER
* @param _minFee Minimum fee
*/
function setMinFee(uint256 _minFee) external onlyMinFeeController {
_setMinFee(_minFee);
}
/**
* @notice Returns the current initialized version
*/
function initializedVersion() external view returns (uint64) {
return _getInitializedVersion();
}
// ============ Internal Utils ============
/**
* @notice return the remote TokenMessenger for the given `_domain` if one exists, else revert.
* @param _domain The domain for which to get the remote TokenMessenger
* @return _tokenMessenger The address of the TokenMessenger on `_domain` as bytes32
*/
function _getRemoteTokenMessenger(
uint32 _domain
) internal view returns (bytes32) {
bytes32 _tokenMessenger = remoteTokenMessengers[_domain];
require(_tokenMessenger != bytes32(0), "No TokenMessenger for domain");
return _tokenMessenger;
}
/**
* @notice return the local minter address if it is set, else revert.
* @return local minter as ITokenMinter.
*/
function _getLocalMinter() internal view returns (ITokenMinterV2) {
require(address(localMinter) != address(0), "Local minter is not set");
return localMinter;
}
/**
* @notice Return true if the given remote domain and TokenMessenger is registered
* on this TokenMessenger.
* @param _domain The remote domain of the message.
* @param _tokenMessenger The address of the TokenMessenger on remote domain.
* @return true if a remote TokenMessenger is registered for `_domain` and `_tokenMessenger`,
* on this TokenMessenger.
*/
function _isRemoteTokenMessenger(
uint32 _domain,
bytes32 _tokenMessenger
) internal view returns (bool) {
return
_tokenMessenger != bytes32(0) &&
remoteTokenMessengers[_domain] == _tokenMessenger;
}
/**
* @notice Returns true if the message sender is the local registered MessageTransmitter
* @return true if message sender is the registered local message transmitter
*/
function _isLocalMessageTransmitter() internal view returns (bool) {
return msg.sender == localMessageTransmitter;
}
/**
* @notice Deposits tokens from `_from` address and burns them
* @param _burnToken address of contract to burn deposited tokens, on local domain
* @param _from address depositing the funds
* @param _amount deposit amount
*/
function _depositAndBurn(
address _burnToken,
address _from,
uint256 _amount
) internal {
ITokenMinterV2 _localMinter = _getLocalMinter();
IMintBurnToken _mintBurnToken = IMintBurnToken(_burnToken);
require(
_mintBurnToken.transferFrom(_from, address(_localMinter), _amount),
"Transfer operation failed"
);
_localMinter.burn(_burnToken, _amount);
}
/**
* @notice Mints tokens to a recipient and optionally a fee to the
* currently set fee recipient.
* @param _remoteDomain domain where burned tokens originate from
* @param _burnToken address of token burned
* @param _mintRecipient recipient address of minted tokens
* @param _amount amount of tokens to mint to `_mintRecipient`
* @param _fee fee collected for mint
*/
function _mintAndWithdraw(
uint32 _remoteDomain,
bytes32 _burnToken,
address _mintRecipient,
uint256 _amount,
uint256 _fee
) internal {
ITokenMinterV2 _minter = _getLocalMinter();
address _mintToken;
if (_fee > 0) {
_mintToken = _minter.mint(
_remoteDomain,
_burnToken,
_mintRecipient,
feeRecipient,
_amount,
_fee
);
} else {
_mintToken = _minter.mint(
_remoteDomain,
_burnToken,
_mintRecipient,
_amount
);
}
emit MintAndWithdraw(_mintRecipient, _amount, _mintToken, _fee);
}
/**
* @notice Sets the fee recipient address
* @dev Reverts if `_feeRecipient` is the zero address
* @param _feeRecipient Address of fee recipient
*/
function _setFeeRecipient(address _feeRecipient) internal {
require(_feeRecipient != address(0), "Zero address not allowed");
feeRecipient = _feeRecipient;
emit FeeRecipientSet(_feeRecipient);
}
/**
* @notice Sets the local minter for the local domain.
* @dev Reverts if a minter is already set for the local domain.
* @param _newLocalMinter The address of the minter on the local domain.
*/
function _setLocalMinter(address _newLocalMinter) internal {
require(_newLocalMinter != address(0), "Zero address not allowed");
require(
address(localMinter) == address(0),
"Local minter is already set."
);
localMinter = ITokenMinterV2(_newLocalMinter);
emit LocalMinterAdded(_newLocalMinter);
}
/**
* @notice Sets the minimum fee controller address
* @dev Reverts if `_minFeeController` is the zero address
* @param _minFeeController Address of minimum fee controller
*/
function _setMinFeeController(address _minFeeController) internal {
require(_minFeeController != address(0), "Zero address not allowed");
minFeeController = _minFeeController;
emit MinFeeControllerSet(_minFeeController);
}
/**
* @notice Sets the minimum fee for all transfers
* @dev Reverts if the minimum fee is equal to or greater than MIN_FEE_MULTIPLIER
* @param _minFee Minimum fee
*/
function _setMinFee(uint256 _minFee) internal {
require(_minFee < MIN_FEE_MULTIPLIER, "Min fee too high");
minFee = _minFee;
emit MinFeeSet(_minFee);
}
/**
* @notice Add the TokenMessenger for a remote domain.
* @dev Reverts if there is already a TokenMessenger set for domain.
* @param _domain Domain of remote TokenMessenger.
* @param _tokenMessenger Address of remote TokenMessenger as bytes32.
*/
function _addRemoteTokenMessenger(
uint32 _domain,
bytes32 _tokenMessenger
) internal {
require(_tokenMessenger != bytes32(0), "bytes32(0) not allowed");
require(
remoteTokenMessengers[_domain] == bytes32(0),
"TokenMessenger already set"
);
remoteTokenMessengers[_domain] = _tokenMessenger;
emit RemoteTokenMessengerAdded(_domain, _tokenMessenger);
}
}/*
* 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.7.6;
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);
}/*
* 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.7.6;
/**
* @title AddressUtils Library
* @notice Helper functions for converting addresses to and from bytes
**/
library AddressUtils {
/**
* @notice Converts an address to bytes32 by left-padding with zeros (alignment preserving cast.)
* @param addr The address to convert to bytes32
*/
function toBytes32(address addr) internal pure returns (bytes32) {
return bytes32(uint256(uint160(addr)));
}
/**
* @notice Converts bytes32 to address (alignment preserving cast.)
* @dev Warning: it is possible to have different input values _buf map to the same address.
* For use cases where this is not acceptable, validate that the first 12 bytes of _buf are zero-padding.
* @param _buf the bytes32 to convert to address
*/
function toAddress(bytes32 _buf) internal pure returns (address) {
return address(uint160(uint256(_buf)));
}
}/*
* 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.7.6;
/**
* @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 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.7.6;
/**
* @title IMessageHandlerV2
* @notice Handles messages on the destination domain, forwarded from
* an IReceiverV2.
*/
interface IMessageHandlerV2 {
/**
* @notice Handles an incoming finalized message from an IReceiverV2
* @dev Finalized messages have finality threshold values greater than or equal to 2000
* @param sourceDomain The source domain of the message
* @param sender The sender of the message
* @param finalityThresholdExecuted the finality threshold at which the message was attested to
* @param messageBody The raw bytes of the message body
* @return success True, if successful; false, if not.
*/
function handleReceiveFinalizedMessage(
uint32 sourceDomain,
bytes32 sender,
uint32 finalityThresholdExecuted,
bytes calldata messageBody
) external returns (bool);
/**
* @notice Handles an incoming unfinalized message from an IReceiverV2
* @dev Unfinalized messages have finality threshold values less than 2000
* @param sourceDomain The source domain of the message
* @param sender The sender of the message
* @param finalityThresholdExecuted The finality threshold at which the message was attested to
* @param messageBody The raw bytes of the message body
* @return success True, if successful; false, if not.
*/
function handleReceiveUnfinalizedMessage(
uint32 sourceDomain,
bytes32 sender,
uint32 finalityThresholdExecuted,
bytes calldata messageBody
) external returns (bool);
}// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.5.10 <0.8.0;
import {SafeMath} from "./SafeMath.sol";
library TypedMemView {
using SafeMath for uint256;
// Why does this exist?
// the solidity `bytes memory` type has a few weaknesses.
// 1. You can't index ranges effectively
// 2. You can't slice without copying
// 3. The underlying data may represent any type
// 4. Solidity never deallocates memory, and memory costs grow
// superlinearly
// By using a memory view instead of a `bytes memory` we get the following
// advantages:
// 1. Slices are done on the stack, by manipulating the pointer
// 2. We can index arbitrary ranges and quickly convert them to stack types
// 3. We can insert type info into the pointer, and typecheck at runtime
// This makes `TypedMemView` a useful tool for efficient zero-copy
// algorithms.
// Why bytes29?
// We want to avoid confusion between views, digests, and other common
// types so we chose a large and uncommonly used odd number of bytes
//
// Note that while bytes are left-aligned in a word, integers and addresses
// are right-aligned. This means when working in assembly we have to
// account for the 3 unused bytes on the righthand side
//
// First 5 bytes are a type flag.
// - ff_ffff_fffe is reserved for unknown type.
// - ff_ffff_ffff is reserved for invalid types/errors.
// next 12 are memory address
// next 12 are len
// bottom 3 bytes are empty
// Assumptions:
// - non-modification of memory.
// - No Solidity updates
// - - wrt free mem point
// - - wrt bytes representation in memory
// - - wrt memory addressing in general
// Usage:
// - create type constants
// - use `assertType` for runtime type assertions
// - - unfortunately we can't do this at compile time yet :(
// - recommended: implement modifiers that perform type checking
// - - e.g.
// - - `uint40 constant MY_TYPE = 3;`
// - - ` modifer onlyMyType(bytes29 myView) { myView.assertType(MY_TYPE); }`
// - instantiate a typed view from a bytearray using `ref`
// - use `index` to inspect the contents of the view
// - use `slice` to create smaller views into the same memory
// - - `slice` can increase the offset
// - - `slice can decrease the length`
// - - must specify the output type of `slice`
// - - `slice` will return a null view if you try to overrun
// - - make sure to explicitly check for this with `notNull` or `assertType`
// - use `equal` for typed comparisons.
// The null view
bytes29 public constant NULL = hex"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
// Mask a low uint96
uint256 constant LOW_12_MASK = 0xffffffffffffffffffffffff;
// Shift constants
uint8 constant SHIFT_TO_LEN = 24;
uint8 constant SHIFT_TO_LOC = 96 + 24;
uint8 constant SHIFT_TO_TYPE = 96 + 96 + 24;
// For nibble encoding
bytes private constant NIBBLE_LOOKUP = "0123456789abcdef";
/**
* @notice Returns the encoded hex character that represents the lower 4 bits of the argument.
* @param _byte The byte
* @return _char The encoded hex character
*/
function nibbleHex(uint8 _byte) internal pure returns (uint8 _char) {
uint8 _nibble = _byte & 0x0f; // keep bottom 4, 0 top 4
_char = uint8(NIBBLE_LOOKUP[_nibble]);
}
/**
* @notice Returns a uint16 containing the hex-encoded byte.
* @param _b The byte
* @return encoded - The hex-encoded byte
*/
function byteHex(uint8 _b) internal pure returns (uint16 encoded) {
encoded |= nibbleHex(_b >> 4); // top 4 bits
encoded <<= 8;
encoded |= nibbleHex(_b); // lower 4 bits
}
/**
* @notice Encodes the uint256 to hex. `first` contains the encoded top 16 bytes.
* `second` contains the encoded lower 16 bytes.
*
* @param _b The 32 bytes as uint256
* @return first - The top 16 bytes
* @return second - The bottom 16 bytes
*/
function encodeHex(uint256 _b) internal pure returns (uint256 first, uint256 second) {
for (uint8 i = 31; i > 15; i -= 1) {
uint8 _byte = uint8(_b >> (i * 8));
first |= byteHex(_byte);
if (i != 16) {
first <<= 16;
}
}
// abusing underflow here =_=
for (uint8 i = 15; i < 255 ; i -= 1) {
uint8 _byte = uint8(_b >> (i * 8));
second |= byteHex(_byte);
if (i != 0) {
second <<= 16;
}
}
}
/**
* @notice Changes the endianness of a uint256.
* @dev https://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel
* @param _b The unsigned integer to reverse
* @return v - The reversed value
*/
function reverseUint256(uint256 _b) internal pure returns (uint256 v) {
v = _b;
// swap bytes
v = ((v >> 8) & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) |
((v & 0x00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF) << 8);
// swap 2-byte long pairs
v = ((v >> 16) & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) |
((v & 0x0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF) << 16);
// swap 4-byte long pairs
v = ((v >> 32) & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) |
((v & 0x00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF) << 32);
// swap 8-byte long pairs
v = ((v >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) |
((v & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);
// swap 16-byte long pairs
v = (v >> 128) | (v << 128);
}
/**
* @notice Create a mask with the highest `_len` bits set.
* @param _len The length
* @return mask - The mask
*/
function leftMask(uint8 _len) private pure returns (uint256 mask) {
// ugly. redo without assembly?
assembly {
// solium-disable-previous-line security/no-inline-assembly
mask := sar(
sub(_len, 1),
0x8000000000000000000000000000000000000000000000000000000000000000
)
}
}
/**
* @notice Return the null view.
* @return bytes29 - The null view
*/
function nullView() internal pure returns (bytes29) {
return NULL;
}
/**
* @notice Check if the view is null.
* @return bool - True if the view is null
*/
function isNull(bytes29 memView) internal pure returns (bool) {
return memView == NULL;
}
/**
* @notice Check if the view is not null.
* @return bool - True if the view is not null
*/
function notNull(bytes29 memView) internal pure returns (bool) {
return !isNull(memView);
}
/**
* @notice Check if the view is of a valid type and points to a valid location
* in memory.
* @dev We perform this check by examining solidity's unallocated memory
* pointer and ensuring that the view's upper bound is less than that.
* @param memView The view
* @return ret - True if the view is valid
*/
function isValid(bytes29 memView) internal pure returns (bool ret) {
if (typeOf(memView) == 0xffffffffff) {return false;}
uint256 _end = end(memView);
assembly {
// solhint-disable-previous-line no-inline-assembly
ret := iszero(gt(_end, mload(0x40)))
}
}
/**
* @notice Require that a typed memory view be valid.
* @dev Returns the view for easy chaining.
* @param memView The view
* @return bytes29 - The validated view
*/
function assertValid(bytes29 memView) internal pure returns (bytes29) {
require(isValid(memView), "Validity assertion failed");
return memView;
}
/**
* @notice Return true if the memview is of the expected type. Otherwise false.
* @param memView The view
* @param _expected The expected type
* @return bool - True if the memview is of the expected type
*/
function isType(bytes29 memView, uint40 _expected) internal pure returns (bool) {
return typeOf(memView) == _expected;
}
/**
* @notice Require that a typed memory view has a specific type.
* @dev Returns the view for easy chaining.
* @param memView The view
* @param _expected The expected type
* @return bytes29 - The view with validated type
*/
function assertType(bytes29 memView, uint40 _expected) internal pure returns (bytes29) {
if (!isType(memView, _expected)) {
(, uint256 g) = encodeHex(uint256(typeOf(memView)));
(, uint256 e) = encodeHex(uint256(_expected));
string memory err = string(
abi.encodePacked(
"Type assertion failed. Got 0x",
uint80(g),
". Expected 0x",
uint80(e)
)
);
revert(err);
}
return memView;
}
/**
* @notice Return an identical view with a different type.
* @param memView The view
* @param _newType The new type
* @return newView - The new view with the specified type
*/
function castTo(bytes29 memView, uint40 _newType) internal pure returns (bytes29 newView) {
// then | in the new type
uint256 _typeShift = SHIFT_TO_TYPE;
uint256 _typeBits = 40;
assembly {
// solium-disable-previous-line security/no-inline-assembly
// shift off the top 5 bytes
newView := or(newView, shr(_typeBits, shl(_typeBits, memView)))
newView := or(newView, shl(_typeShift, _newType))
}
}
/**
* @notice Unsafe raw pointer construction. This should generally not be called
* directly. Prefer `ref` wherever possible.
* @dev Unsafe raw pointer construction. This should generally not be called
* directly. Prefer `ref` wherever possible.
* @param _type The type
* @param _loc The memory address
* @param _len The length
* @return newView - The new view with the specified type, location and length
*/
function unsafeBuildUnchecked(uint256 _type, uint256 _loc, uint256 _len) private pure returns (bytes29 newView) {
uint256 _uint96Bits = 96;
uint256 _emptyBits = 24;
assembly {
// solium-disable-previous-line security/no-inline-assembly
newView := shl(_uint96Bits, or(newView, _type)) // insert type
newView := shl(_uint96Bits, or(newView, _loc)) // insert loc
newView := shl(_emptyBits, or(newView, _len)) // empty bottom 3 bytes
}
}
/**
* @notice Instantiate a new memory view. This should generally not be called
* directly. Prefer `ref` wherever possible.
* @dev Instantiate a new memory view. This should generally not be called
* directly. Prefer `ref` wherever possible.
* @param _type The type
* @param _loc The memory address
* @param _len The length
* @return newView - The new view with the specified type, location and length
*/
function build(uint256 _type, uint256 _loc, uint256 _len) internal pure returns (bytes29 newView) {
uint256 _end = _loc.add(_len);
assembly {
// solium-disable-previous-line security/no-inline-assembly
if gt(_end, mload(0x40)) {
_end := 0
}
}
if (_end == 0) {
return NULL;
}
newView = unsafeBuildUnchecked(_type, _loc, _len);
}
/**
* @notice Instantiate a memory view from a byte array.
* @dev Note that due to Solidity memory representation, it is not possible to
* implement a deref, as the `bytes` type stores its len in memory.
* @param arr The byte array
* @param newType The type
* @return bytes29 - The memory view
*/
function ref(bytes memory arr, uint40 newType) internal pure returns (bytes29) {
uint256 _len = arr.length;
uint256 _loc;
assembly {
// solium-disable-previous-line security/no-inline-assembly
_loc := add(arr, 0x20) // our view is of the data, not the struct
}
return build(newType, _loc, _len);
}
/**
* @notice Return the associated type information.
* @param memView The memory view
* @return _type - The type associated with the view
*/
function typeOf(bytes29 memView) internal pure returns (uint40 _type) {
uint256 _shift = SHIFT_TO_TYPE;
assembly {
// solium-disable-previous-line security/no-inline-assembly
_type := shr(_shift, memView) // shift out lower 27 bytes
}
}
/**
* @notice Optimized type comparison. Checks that the 5-byte type flag is equal.
* @param left The first view
* @param right The second view
* @return bool - True if the 5-byte type flag is equal
*/
function sameType(bytes29 left, bytes29 right) internal pure returns (bool) {
return (left ^ right) >> SHIFT_TO_TYPE == 0;
}
/**
* @notice Return the memory address of the underlying bytes.
* @param memView The view
* @return _loc - The memory address
*/
function loc(bytes29 memView) internal pure returns (uint96 _loc) {
uint256 _mask = LOW_12_MASK; // assembly can't use globals
uint256 _shift = SHIFT_TO_LOC;
assembly {
// solium-disable-previous-line security/no-inline-assembly
_loc := and(shr(_shift, memView), _mask)
}
}
/**
* @notice The number of memory words this memory view occupies, rounded up.
* @param memView The view
* @return uint256 - The number of memory words
*/
function words(bytes29 memView) internal pure returns (uint256) {
return uint256(len(memView)).add(31) / 32;
}
/**
* @notice The in-memory footprint of a fresh copy of the view.
* @param memView The view
* @return uint256 - The in-memory footprint of a fresh copy of the view.
*/
function footprint(bytes29 memView) internal pure returns (uint256) {
return words(memView) * 32;
}
/**
* @notice The number of bytes of the view.
* @param memView The view
* @return _len - The length of the view
*/
function len(bytes29 memView) internal pure returns (uint96 _len) {
uint256 _mask = LOW_12_MASK; // assembly can't use globals
uint256 _emptyBits = 24;
assembly {
// solium-disable-previous-line security/no-inline-assembly
_len := and(shr(_emptyBits, memView), _mask)
}
}
/**
* @notice Returns the endpoint of `memView`.
* @param memView The view
* @return uint256 - The endpoint of `memView`
*/
function end(bytes29 memView) internal pure returns (uint256) {
return loc(memView) + len(memView);
}
/**
* @notice Safe slicing without memory modification.
* @param memView The view
* @param _index The start index
* @param _len The length
* @param newType The new type
* @return bytes29 - The new view
*/
function slice(bytes29 memView, uint256 _index, uint256 _len, uint40 newType) internal pure returns (bytes29) {
uint256 _loc = loc(memView);
// Ensure it doesn't overrun the view
if (_loc.add(_index).add(_len) > end(memView)) {
return NULL;
}
_loc = _loc.add(_index);
return build(newType, _loc, _len);
}
/**
* @notice Shortcut to `slice`. Gets a view representing the first `_len` bytes.
* @param memView The view
* @param _len The length
* @param newType The new type
* @return bytes29 - The new view
*/
function prefix(bytes29 memView, uint256 _len, uint40 newType) internal pure returns (bytes29) {
return slice(memView, 0, _len, newType);
}
/**
* @notice Shortcut to `slice`. Gets a view representing the last `_len` byte.
* @param memView The view
* @param _len The length
* @param newType The new type
* @return bytes29 - The new view
*/
function postfix(bytes29 memView, uint256 _len, uint40 newType) internal pure returns (bytes29) {
return slice(memView, uint256(len(memView)).sub(_len), _len, newType);
}
/**
* @notice Construct an error message for an indexing overrun.
* @param _loc The memory address
* @param _len The length
* @param _index The index
* @param _slice The slice where the overrun occurred
* @return err - The err
*/
function indexErrOverrun(
uint256 _loc,
uint256 _len,
uint256 _index,
uint256 _slice
) internal pure returns (string memory err) {
(, uint256 a) = encodeHex(_loc);
(, uint256 b) = encodeHex(_len);
(, uint256 c) = encodeHex(_index);
(, uint256 d) = encodeHex(_slice);
err = string(
abi.encodePacked(
"TypedMemView/index - Overran the view. Slice is at 0x",
uint48(a),
" with length 0x",
uint48(b),
". Attempted to index at offset 0x",
uint48(c),
" with length 0x",
uint48(d),
"."
)
);
}
/**
* @notice Load up to 32 bytes from the view onto the stack.
* @dev Returns a bytes32 with only the `_bytes` highest bytes set.
* This can be immediately cast to a smaller fixed-length byte array.
* To automatically cast to an integer, use `indexUint`.
* @param memView The view
* @param _index The index
* @param _bytes The bytes
* @return result - The 32 byte result
*/
function index(bytes29 memView, uint256 _index, uint8 _bytes) internal pure returns (bytes32 result) {
if (_bytes == 0) {return bytes32(0);}
if (_index.add(_bytes) > len(memView)) {
revert(indexErrOverrun(loc(memView), len(memView), _index, uint256(_bytes)));
}
require(_bytes <= 32, "TypedMemView/index - Attempted to index more than 32 bytes");
uint8 bitLength = _bytes * 8;
uint256 _loc = loc(memView);
uint256 _mask = leftMask(bitLength);
assembly {
// solium-disable-previous-line security/no-inline-assembly
result := and(mload(add(_loc, _index)), _mask)
}
}
/**
* @notice Parse an unsigned integer from the view at `_index`.
* @dev Requires that the view have >= `_bytes` bytes following that index.
* @param memView The view
* @param _index The index
* @param _bytes The bytes
* @return result - The unsigned integer
*/
function indexUint(bytes29 memView, uint256 _index, uint8 _bytes) internal pure returns (uint256 result) {
return uint256(index(memView, _index, _bytes)) >> ((32 - _bytes) * 8);
}
/**
* @notice Parse an unsigned integer from LE bytes.
* @param memView The view
* @param _index The index
* @param _bytes The bytes
* @return result - The unsigned integer
*/
function indexLEUint(bytes29 memView, uint256 _index, uint8 _bytes) internal pure returns (uint256 result) {
return reverseUint256(uint256(index(memView, _index, _bytes)));
}
/**
* @notice Parse an address from the view at `_index`. Requires that the view have >= 20 bytes
* following that index.
* @param memView The view
* @param _index The index
* @return address - The address
*/
function indexAddress(bytes29 memView, uint256 _index) internal pure returns (address) {
return address(uint160(indexUint(memView, _index, 20)));
}
/**
* @notice Return the keccak256 hash of the underlying memory
* @param memView The view
* @return digest - The keccak256 hash of the underlying memory
*/
function keccak(bytes29 memView) internal pure returns (bytes32 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
assembly {
// solium-disable-previous-line security/no-inline-assembly
digest := keccak256(_loc, _len)
}
}
/**
* @notice Return the sha2 digest of the underlying memory.
* @dev We explicitly deallocate memory afterwards.
* @param memView The view
* @return digest - The sha2 hash of the underlying memory
*/
function sha2(bytes29 memView) internal view returns (bytes32 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
bool res;
assembly {
// solium-disable-previous-line security/no-inline-assembly
let ptr := mload(0x40)
res := staticcall(gas(), 2, _loc, _len, ptr, 0x20) // sha2 #1
digest := mload(ptr)
}
require(res, "sha2 OOG");
}
/**
* @notice Implements bitcoin's hash160 (rmd160(sha2()))
* @param memView The pre-image
* @return digest - the Digest
*/
function hash160(bytes29 memView) internal view returns (bytes20 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
bool res;
assembly {
// solium-disable-previous-line security/no-inline-assembly
let ptr := mload(0x40)
res := staticcall(gas(), 2, _loc, _len, ptr, 0x20) // sha2
res := and(res, staticcall(gas(), 3, ptr, 0x20, ptr, 0x20)) // rmd160
digest := mload(add(ptr, 0xc)) // return value is 0-prefixed.
}
require(res, "hash160 OOG");
}
/**
* @notice Implements bitcoin's hash256 (double sha2)
* @param memView A view of the preimage
* @return digest - the Digest
*/
function hash256(bytes29 memView) internal view returns (bytes32 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
bool res;
assembly {
// solium-disable-previous-line security/no-inline-assembly
let ptr := mload(0x40)
res := staticcall(gas(), 2, _loc, _len, ptr, 0x20) // sha2 #1
res := and(res, staticcall(gas(), 2, ptr, 0x20, ptr, 0x20)) // sha2 #2
digest := mload(ptr)
}
require(res, "hash256 OOG");
}
/**
* @notice Return true if the underlying memory is equal. Else false.
* @param left The first view
* @param right The second view
* @return bool - True if the underlying memory is equal
*/
function untypedEqual(bytes29 left, bytes29 right) internal pure returns (bool) {
return (loc(left) == loc(right) && len(left) == len(right)) || keccak(left) == keccak(right);
}
/**
* @notice Return false if the underlying memory is equal. Else true.
* @param left The first view
* @param right The second view
* @return bool - False if the underlying memory is equal
*/
function untypedNotEqual(bytes29 left, bytes29 right) internal pure returns (bool) {
return !untypedEqual(left, right);
}
/**
* @notice Compares type equality.
* @dev Shortcuts if the pointers are identical, otherwise compares type and digest.
* @param left The first view
* @param right The second view
* @return bool - True if the types are the same
*/
function equal(bytes29 left, bytes29 right) internal pure returns (bool) {
return left == right || (typeOf(left) == typeOf(right) && keccak(left) == keccak(right));
}
/**
* @notice Compares type inequality.
* @dev Shortcuts if the pointers are identical, otherwise compares type and digest.
* @param left The first view
* @param right The second view
* @return bool - True if the types are not the same
*/
function notEqual(bytes29 left, bytes29 right) internal pure returns (bool) {
return !equal(left, right);
}
/**
* @notice Copy the view to a location, return an unsafe memory reference
* @dev Super Dangerous direct memory access.
*
* This reference can be overwritten if anything else modifies memory (!!!).
* As such it MUST be consumed IMMEDIATELY.
* This function is private to prevent unsafe usage by callers.
* @param memView The view
* @param _newLoc The new location
* @return written - the unsafe memory reference
*/
function unsafeCopyTo(bytes29 memView, uint256 _newLoc) private view returns (bytes29 written) {
require(notNull(memView), "TypedMemView/copyTo - Null pointer deref");
require(isValid(memView), "TypedMemView/copyTo - Invalid pointer deref");
uint256 _len = len(memView);
uint256 _oldLoc = loc(memView);
uint256 ptr;
bool res;
assembly {
// solium-disable-previous-line security/no-inline-assembly
ptr := mload(0x40)
// revert if we're writing in occupied memory
if gt(ptr, _newLoc) {
revert(0x60, 0x20) // empty revert message
}
// use the identity precompile to copy
res := staticcall(gas(), 4, _oldLoc, _len, _newLoc, _len)
}
require(res, "identity OOG");
written = unsafeBuildUnchecked(typeOf(memView), _newLoc, _len);
}
/**
* @notice Copies the referenced memory to a new loc in memory, returning a `bytes` pointing to
* the new memory
* @dev Shortcuts if the pointers are identical, otherwise compares type and digest.
* @param memView The view
* @return ret - The view pointing to the new memory
*/
function clone(bytes29 memView) internal view returns (bytes memory ret) {
uint256 ptr;
uint256 _len = len(memView);
assembly {
// solium-disable-previous-line security/no-inline-assembly
ptr := mload(0x40) // load unused memory pointer
ret := ptr
}
unsafeCopyTo(memView, ptr + 0x20);
assembly {
// solium-disable-previous-line security/no-inline-assembly
mstore(0x40, add(add(ptr, _len), 0x20)) // write new unused pointer
mstore(ptr, _len) // write len of new array (in bytes)
}
}
/**
* @notice Join the views in memory, return an unsafe reference to the memory.
* @dev Super Dangerous direct memory access.
*
* This reference can be overwritten if anything else modifies memory (!!!).
* As such it MUST be consumed IMMEDIATELY.
* This function is private to prevent unsafe usage by callers.
* @param memViews The views
* @param _location The location in memory to which to copy & concatenate
* @return unsafeView - The conjoined view pointing to the new memory
*/
function unsafeJoin(bytes29[] memory memViews, uint256 _location) private view returns (bytes29 unsafeView) {
assembly {
// solium-disable-previous-line security/no-inline-assembly
let ptr := mload(0x40)
// revert if we're writing in occupied memory
if gt(ptr, _location) {
revert(0x60, 0x20) // empty revert message
}
}
uint256 _offset = 0;
for (uint256 i = 0; i < memViews.length; i ++) {
bytes29 memView = memViews[i];
unsafeCopyTo(memView, _location + _offset);
_offset += len(memView);
}
unsafeView = unsafeBuildUnchecked(0, _location, _offset);
}
/**
* @notice Produce the keccak256 digest of the concatenated contents of multiple views.
* @param memViews The views
* @return bytes32 - The keccak256 digest
*/
function joinKeccak(bytes29[] memory memViews) internal view returns (bytes32) {
uint256 ptr;
assembly {
// solium-disable-previous-line security/no-inline-assembly
ptr := mload(0x40) // load unused memory pointer
}
return keccak(unsafeJoin(memViews, ptr));
}
/**
* @notice Produce the sha256 digest of the concatenated contents of multiple views.
* @param memViews The views
* @return bytes32 - The sha256 digest
*/
function joinSha2(bytes29[] memory memViews) internal view returns (bytes32) {
uint256 ptr;
assembly {
// solium-disable-previous-line security/no-inline-assembly
ptr := mload(0x40) // load unused memory pointer
}
return sha2(unsafeJoin(memViews, ptr));
}
/**
* @notice copies all views, joins them into a new bytearray.
* @param memViews The views
* @return ret - The new byte array
*/
function join(bytes29[] memory memViews) internal view returns (bytes memory ret) {
uint256 ptr;
assembly {
// solium-disable-previous-line security/no-inline-assembly
ptr := mload(0x40) // load unused memory pointer
}
bytes29 _newView = unsafeJoin(memViews, ptr + 0x20);
uint256 _written = len(_newView);
uint256 _footprint = footprint(_newView);
assembly {
// solium-disable-previous-line security/no-inline-assembly
// store the legnth
mstore(ptr, _written)
// new pointer is old + 0x20 + the footprint of the body
mstore(0x40, add(add(ptr, _footprint), 0x20))
ret := ptr
}
}
}/*
* 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.7.6;
import {TypedMemView} from "@memview-sol/contracts/TypedMemView.sol";
import {BurnMessage} from "../BurnMessage.sol";
/**
* @title BurnMessageV2 Library
* @notice Library for formatted V2 BurnMessages used by TokenMessengerV2.
* @dev BurnMessageV2 format:
* Field Bytes Type Index
* version 4 uint32 0
* burnToken 32 bytes32 4
* mintRecipient 32 bytes32 36
* amount 32 uint256 68
* messageSender 32 bytes32 100
* maxFee 32 uint256 132
* feeExecuted 32 uint256 164
* expirationBlock 32 uint256 196
* hookData dynamic bytes 228
* @dev Additions from v1:
* - maxFee
* - feeExecuted
* - expirationBlock
* - hookData
**/
library BurnMessageV2 {
using TypedMemView for bytes;
using TypedMemView for bytes29;
using BurnMessage for bytes29;
// Field indices
uint8 private constant MAX_FEE_INDEX = 132;
uint8 private constant FEE_EXECUTED_INDEX = 164;
uint8 private constant EXPIRATION_BLOCK_INDEX = 196;
uint8 private constant HOOK_DATA_INDEX = 228;
uint256 private constant EMPTY_FEE_EXECUTED = 0;
uint256 private constant EMPTY_EXPIRATION_BLOCK = 0;
/**
* @notice Formats a V2 burn message
* @param _version The message body version
* @param _burnToken The burn token address on the source domain, as bytes32
* @param _mintRecipient The mint recipient address as bytes32
* @param _amount The burn amount
* @param _messageSender The message sender
* @param _maxFee The maximum fee to be paid on destination domain
* @param _hookData Optional hook data for processing on the destination domain
* @return Formatted message bytes.
*/
function _formatMessageForRelay(
uint32 _version,
bytes32 _burnToken,
bytes32 _mintRecipient,
uint256 _amount,
bytes32 _messageSender,
uint256 _maxFee,
bytes calldata _hookData
) internal pure returns (bytes memory) {
return
abi.encodePacked(
_version,
_burnToken,
_mintRecipient,
_amount,
_messageSender,
_maxFee,
EMPTY_FEE_EXECUTED,
EMPTY_EXPIRATION_BLOCK,
_hookData
);
}
// @notice Returns _message's version field
function _getVersion(bytes29 _message) internal pure returns (uint32) {
return _message._getVersion();
}
// @notice Returns _message's burnToken field
function _getBurnToken(bytes29 _message) internal pure returns (bytes32) {
return _message._getBurnToken();
}
// @notice Returns _message's mintRecipient field
function _getMintRecipient(
bytes29 _message
) internal pure returns (bytes32) {
return _message._getMintRecipient();
}
// @notice Returns _message's amount field
function _getAmount(bytes29 _message) internal pure returns (uint256) {
return _message._getAmount();
}
// @notice Returns _message's messageSender field
function _getMessageSender(
bytes29 _message
) internal pure returns (bytes32) {
return _message._getMessageSender();
}
// @notice Returns _message's maxFee field
function _getMaxFee(bytes29 _message) internal pure returns (uint256) {
return _message.indexUint(MAX_FEE_INDEX, 32);
}
// @notice Returns _message's feeExecuted field
function _getFeeExecuted(bytes29 _message) internal pure returns (uint256) {
return _message.indexUint(FEE_EXECUTED_INDEX, 32);
}
// @notice Returns _message's expirationBlock field
function _getExpirationBlock(
bytes29 _message
) internal pure returns (uint256) {
return _message.indexUint(EXPIRATION_BLOCK_INDEX, 32);
}
// @notice Returns _message's hookData field
function _getHookData(bytes29 _message) internal pure returns (bytes29) {
return
_message.slice(
HOOK_DATA_INDEX,
_message.len() - HOOK_DATA_INDEX,
0
);
}
/**
* @notice Reverts if burn message is malformed or invalid length
* @param _message The burn message as bytes29
*/
function _validateBurnMessageFormat(bytes29 _message) internal pure {
require(_message.isValid(), "Malformed message");
require(
_message.len() >= HOOK_DATA_INDEX,
"Invalid burn message: too short"
);
}
}/* * 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.7.6; // The threshold at which (and above) messages are considered finalized. uint32 constant FINALITY_THRESHOLD_FINALIZED = 2000; // The threshold at which (and above) messages are considered confirmed. uint32 constant FINALITY_THRESHOLD_CONFIRMED = 1000; // The minimum allowed level of finality accepted by TokenMessenger uint32 constant TOKEN_MESSENGER_MIN_FINALITY_THRESHOLD = 500;
/*
* 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.7.6;
import "./Ownable2Step.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
/**
* @notice Base contract which allows children to rescue ERC20 locked in their contract.
* @dev Forked from https://github.com/centrehq/centre-tokens/blob/0d3cab14ebd133a83fc834dbd48d0468bdf0b391/contracts/v1.1/Rescuable.sol
* Modifications:
* 1. Update Solidity version from 0.6.12 to 0.7.6 (8/23/2022)
* 2. Add internal _updateRescuer (10/8/2024)
*/
contract Rescuable is Ownable2Step {
using SafeERC20 for IERC20;
address private _rescuer;
event RescuerChanged(address indexed newRescuer);
/**
* @notice Returns current rescuer
* @return Rescuer's address
*/
function rescuer() external view returns (address) {
return _rescuer;
}
/**
* @notice Revert if called by any account other than the rescuer.
*/
modifier onlyRescuer() {
require(msg.sender == _rescuer, "Rescuable: caller is not the rescuer");
_;
}
/**
* @notice Rescue ERC20 tokens locked up in this contract.
* @param tokenContract ERC20 token contract address
* @param to Recipient address
* @param amount Amount to withdraw
*/
function rescueERC20(
IERC20 tokenContract,
address to,
uint256 amount
) external onlyRescuer {
tokenContract.safeTransfer(to, amount);
}
/**
* @notice Assign the rescuer role to a given address.
* @param newRescuer New rescuer's address
*/
function updateRescuer(address newRescuer) external onlyOwner {
_updateRescuer(newRescuer);
}
/**
* @notice Assign the rescuer role to a given address.
* @param newRescuer New rescuer's address
*/
function _updateRescuer(address newRescuer) internal {
require(
newRescuer != address(0),
"Rescuable: new rescuer is the zero address"
);
_rescuer = newRescuer;
emit RescuerChanged(newRescuer);
}
}/*
* 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.7.6;
import {Ownable2Step} from "../Ownable2Step.sol";
/**
* @title Denylistable
* @notice Contract that allows the management and application of a denylist
*/
abstract contract Denylistable is Ownable2Step {
// ============ Events ============
/**
* @notice Emitted when the denylister is updated
* @param oldDenylister Address of the previous Denylister
* @param newDenylister Address of the new Denylister
*/
event DenylisterChanged(
address indexed oldDenylister,
address indexed newDenylister
);
/**
* @notice Emitted when `account` is added to the denylist
* @param account Address added to the denylist
*/
event Denylisted(address indexed account);
/**
* @notice Emitted when `account` is removed from the denylist
* @param account Address removed from the denylist
*/
event UnDenylisted(address indexed account);
// ============ Constants ============
// A true boolean representation in uint256
uint256 private constant _TRUE = 1;
// A false boolean representation in uint256
uint256 private constant _FALSE = 0;
// ============ State Variables ============
// The currently set denylister
address internal _denylister;
// A mapping indicating whether an account is on the denylist. 1 indicates that an
// address is on the denylist; 0 otherwise.
mapping(address => uint256) internal _denylist;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[20] private __gap;
// ============ Modifiers ============
/**
* @dev Throws if called by any account other than the denylister.
*/
modifier onlyDenylister() {
require(
msg.sender == _denylister,
"Denylistable: caller is not denylister"
);
_;
}
/**
* @dev Performs denylist checks on the msg.sender and tx.origin addresses
*/
modifier notDenylistedCallers() {
_requireNotDenylisted(msg.sender);
if (msg.sender != tx.origin) {
_requireNotDenylisted(tx.origin);
}
_;
}
// ============ External Functions ============
/**
* @notice Updates the currently set Denylister
* @dev Reverts if not called by the Owner
* @dev Reverts if the new denylister address is the zero address
* @param newDenylister The new denylister address
*/
function updateDenylister(address newDenylister) external onlyOwner {
_updateDenylister(newDenylister);
}
/**
* @notice Adds an address to the denylist
* @param account Address to add to the denylist
*/
function denylist(address account) external onlyDenylister {
_denylist[account] = _TRUE;
emit Denylisted(account);
}
/**
* @notice Removes an address from the denylist
* @param account Address to remove from the denylist
*/
function unDenylist(address account) external onlyDenylister {
_denylist[account] = _FALSE;
emit UnDenylisted(account);
}
/**
* @notice Returns the currently set Denylister
* @return Denylister address
*/
function denylister() external view returns (address) {
return _denylister;
}
/**
* @notice Returns whether an address is currently on the denylist
* @param account Address to check
* @return True if the account is on the deny list and false if the account is not.
*/
function isDenylisted(address account) external view returns (bool) {
return _denylist[account] == _TRUE;
}
// ============ Internal Utils ============
/**
* @notice Updates the currently set denylister
* @param _newDenylister The new denylister address
*/
function _updateDenylister(address _newDenylister) internal {
require(
_newDenylister != address(0),
"Denylistable: new denylister is the zero address"
);
address _oldDenylister = _denylister;
_denylister = _newDenylister;
emit DenylisterChanged(_oldDenylister, _newDenylister);
}
/**
* @notice Checks an address against the denylist
* @dev Reverts if address is on the denylist
*/
function _requireNotDenylisted(address _address) internal view {
require(
_denylist[_address] == _FALSE,
"Denylistable: account is on denylist"
);
}
}/*
* 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.7.6;
import "../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
/**
* @title IMintBurnToken
* @notice interface for mintable and burnable ERC20 token
*/
interface IMintBurnToken is IERC20 {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param amount The amount of tokens to mint. Must be less than or equal
* to the minterAllowance of the caller.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address to, uint256 amount) external returns (bool);
/**
* @dev allows a minter to burn some of its own tokens
* Validates that caller is a minter and that sender is not blacklisted
* amount is less than or equal to the minter's account balance
* @param amount uint256 the amount of tokens to be burned
*/
function burn(uint256 amount) external;
}/*
* 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.7.6;
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
/**
* @title Initializable
* @notice Base class to support implementation contracts behind a proxy
* @dev Forked from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/3e6c86392c97fbc30d3d20a378a6f58beba08eba/contracts/proxy/utils/Initializable.sol
* Modifications (10/5/2024):
* - Pinned to Solidity 0.7.6
* - Replaced errors with revert strings
* - Replaced address.code call with Address.isContract for Solidity 0.7.6
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
// Indicates that the contract has been initialized.
uint64 _initialized;
// Indicates that the contract is in the process of being initialized.
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE =
0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
// 10/5/2024 fork: use Address.isContract instead of address(this).code.length for Solidity 0.7.6.
bool construction = initialized == 1 &&
!Address.isContract(address(this));
// 10/5/2024 fork: convert custom error to require statement
require(
initialSetup || construction,
"Initializable: invalid initialization"
);
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// 10/5/2024 fork: convert custom error to require statement
require(
!$._initializing && $._initialized < version,
"Initializable: invalid initialization"
);
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
// 10/5/2024 fork: convert custom error to require statement
require(_isInitializing(), "Initializable: not initializing");
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// 10/5/2024 fork: convert custom error to require statement
require(!$._initializing, "Initializable: invalid initialization");
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage()
private
pure
returns (InitializableStorage storage $)
{
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}/*
* 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.7.6;
/**
* @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;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.5.10;
/*
The MIT License (MIT)
Copyright (c) 2016 Smart Contract Solutions, Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
require(c / _a == _b, "Overflow during multiplication.");
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a, "Underflow during subtraction.");
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
require(c >= _a, "Overflow during addition.");
return c;
}
}/*
* 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.7.6;
import "@memview-sol/contracts/TypedMemView.sol";
/**
* @title BurnMessage Library
* @notice Library for formatted BurnMessages used by TokenMessenger.
* @dev BurnMessage format:
* Field Bytes Type Index
* version 4 uint32 0
* burnToken 32 bytes32 4
* mintRecipient 32 bytes32 36
* amount 32 uint256 68
* messageSender 32 bytes32 100
**/
library BurnMessage {
using TypedMemView for bytes;
using TypedMemView for bytes29;
uint8 private constant VERSION_INDEX = 0;
uint8 private constant VERSION_LEN = 4;
uint8 private constant BURN_TOKEN_INDEX = 4;
uint8 private constant BURN_TOKEN_LEN = 32;
uint8 private constant MINT_RECIPIENT_INDEX = 36;
uint8 private constant MINT_RECIPIENT_LEN = 32;
uint8 private constant AMOUNT_INDEX = 68;
uint8 private constant AMOUNT_LEN = 32;
uint8 private constant MSG_SENDER_INDEX = 100;
uint8 private constant MSG_SENDER_LEN = 32;
// 4 byte version + 32 bytes burnToken + 32 bytes mintRecipient + 32 bytes amount + 32 bytes messageSender
uint8 private constant BURN_MESSAGE_LEN = 132;
/**
* @notice Formats Burn message
* @param _version The message body version
* @param _burnToken The burn token address on source domain as bytes32
* @param _mintRecipient The mint recipient address as bytes32
* @param _amount The burn amount
* @param _messageSender The message sender
* @return Burn formatted message.
*/
function _formatMessage(
uint32 _version,
bytes32 _burnToken,
bytes32 _mintRecipient,
uint256 _amount,
bytes32 _messageSender
) internal pure returns (bytes memory) {
return
abi.encodePacked(
_version,
_burnToken,
_mintRecipient,
_amount,
_messageSender
);
}
/**
* @notice Retrieves the burnToken from a DepositForBurn BurnMessage
* @param _message The message
* @return sourceToken address as bytes32
*/
function _getMessageSender(bytes29 _message)
internal
pure
returns (bytes32)
{
return _message.index(MSG_SENDER_INDEX, MSG_SENDER_LEN);
}
/**
* @notice Retrieves the burnToken from a DepositForBurn BurnMessage
* @param _message The message
* @return sourceToken address as bytes32
*/
function _getBurnToken(bytes29 _message) internal pure returns (bytes32) {
return _message.index(BURN_TOKEN_INDEX, BURN_TOKEN_LEN);
}
/**
* @notice Retrieves the mintRecipient from a BurnMessage
* @param _message The message
* @return mintRecipient
*/
function _getMintRecipient(bytes29 _message)
internal
pure
returns (bytes32)
{
return _message.index(MINT_RECIPIENT_INDEX, MINT_RECIPIENT_LEN);
}
/**
* @notice Retrieves the amount from a BurnMessage
* @param _message The message
* @return amount
*/
function _getAmount(bytes29 _message) internal pure returns (uint256) {
return _message.indexUint(AMOUNT_INDEX, AMOUNT_LEN);
}
/**
* @notice Retrieves the version from a Burn message
* @param _message The message
* @return version
*/
function _getVersion(bytes29 _message) internal pure returns (uint32) {
return uint32(_message.indexUint(VERSION_INDEX, VERSION_LEN));
}
/**
* @notice Reverts if burn message is malformed or invalid length
* @param _message The burn message as bytes29
*/
function _validateBurnMessageFormat(bytes29 _message) internal pure {
require(_message.isValid(), "Malformed message");
require(_message.len() == BURN_MESSAGE_LEN, "Invalid message length");
}
}/*
* 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.7.6;
import "./Ownable.sol";
/**
* @dev forked from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/7c5f6bc2c8743d83443fa46395d75f2f3f99054a/contracts/access/Ownable2Step.sol
* Modifications:
* 1. Update Solidity version from 0.8.0 to 0.7.6. Version 0.8.0 was used
* as base because this contract was added to OZ repo after version 0.8.0.
*
* Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner)
public
virtual
override
onlyOwner
{
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() external {
address sender = _msgSender();
require(
pendingOwner() == sender,
"Ownable2Step: caller is not the new owner"
);
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}/*
* 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.7.6;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev forked from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/7c5f6bc2c8743d83443fa46395d75f2f3f99054a/contracts/access/Ownable.sol
* Modifications:
* 1. Update Solidity version from 0.8.0 to 0.7.6 (11/9/2022). (v8 was used
* as base because it includes internal _transferOwnership method.)
* 2. Remove renounceOwnership function
*
* Description
* Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}{
"remappings": [
"@memview-sol/=lib/memview-sol/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"ds-test/=lib/ds-test/src/",
"forge-std/=lib/forge-std/src/",
"centre-tokens.git/=lib/centre-tokens.git/",
"memview-sol/=lib/memview-sol/contracts/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 100000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "istanbul",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_messageTransmitter","type":"address"},{"internalType":"uint32","name":"_messageBodyVersion","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"Denylisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldDenylister","type":"address"},{"indexed":true,"internalType":"address","name":"newDenylister","type":"address"}],"name":"DenylisterChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"burnToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"bytes32","name":"mintRecipient","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"destinationTokenMessenger","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"destinationCaller","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"maxFee","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"minFinalityThreshold","type":"uint32"},{"indexed":false,"internalType":"bytes","name":"hookData","type":"bytes"}],"name":"DepositForBurn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeRecipient","type":"address"}],"name":"FeeRecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"localMinter","type":"address"}],"name":"LocalMinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"localMinter","type":"address"}],"name":"LocalMinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minFeeController","type":"address"}],"name":"MinFeeControllerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minFee","type":"uint256"}],"name":"MinFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"mintRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"mintToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeCollected","type":"uint256"}],"name":"MintAndWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"domain","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"tokenMessenger","type":"bytes32"}],"name":"RemoteTokenMessengerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"domain","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"tokenMessenger","type":"bytes32"}],"name":"RemoteTokenMessengerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRescuer","type":"address"}],"name":"RescuerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"UnDenylisted","type":"event"},{"inputs":[],"name":"MIN_FEE_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newLocalMinter","type":"address"}],"name":"addLocalMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"domain","type":"uint32"},{"internalType":"bytes32","name":"tokenMessenger","type":"bytes32"}],"name":"addRemoteTokenMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"denylist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"denylister","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"internalType":"bytes32","name":"mintRecipient","type":"bytes32"},{"internalType":"address","name":"burnToken","type":"address"},{"internalType":"bytes32","name":"destinationCaller","type":"bytes32"},{"internalType":"uint256","name":"maxFee","type":"uint256"},{"internalType":"uint32","name":"minFinalityThreshold","type":"uint32"}],"name":"depositForBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"internalType":"bytes32","name":"mintRecipient","type":"bytes32"},{"internalType":"address","name":"burnToken","type":"address"},{"internalType":"bytes32","name":"destinationCaller","type":"bytes32"},{"internalType":"uint256","name":"maxFee","type":"uint256"},{"internalType":"uint32","name":"minFinalityThreshold","type":"uint32"},{"internalType":"bytes","name":"hookData","type":"bytes"}],"name":"depositForBurnWithHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getMinFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"remoteDomain","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes","name":"messageBody","type":"bytes"}],"name":"handleReceiveFinalizedMessage","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"remoteDomain","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint32","name":"finalityThresholdExecuted","type":"uint32"},{"internalType":"bytes","name":"messageBody","type":"bytes"}],"name":"handleReceiveUnfinalizedMessage","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"rescuer","type":"address"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"address","name":"denylister","type":"address"},{"internalType":"address","name":"tokenMinter","type":"address"},{"internalType":"address","name":"minFeeController","type":"address"}],"internalType":"struct TokenMessengerV2.TokenMessengerV2Roles","name":"roles","type":"tuple"},{"internalType":"uint256","name":"minFee_","type":"uint256"},{"internalType":"uint32[]","name":"remoteDomains_","type":"uint32[]"},{"internalType":"bytes32[]","name":"remoteTokenMessengers_","type":"bytes32[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializedVersion","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isDenylisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"localMessageTransmitter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"localMinter","outputs":[{"internalType":"contract ITokenMinterV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageBodyVersion","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minFeeController","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"remoteTokenMessengers","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeLocalMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"domain","type":"uint32"}],"name":"removeRemoteTokenMessenger","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"tokenContract","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescuer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minFee","type":"uint256"}],"name":"setMinFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_minFeeController","type":"address"}],"name":"setMinFeeController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"unDenylist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newDenylister","type":"address"}],"name":"updateDenylister","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRescuer","type":"address"}],"name":"updateRescuer","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c06040523480156200001157600080fd5b50604051620042893803806200428983398101604081905262000034916200023c565b81816200004a62000044620000db565b620000df565b6001600160a01b038216620000a6576040805162461bcd60e51b815260206004820152601a60248201527f4d6573736167655472616e736d6974746572206e6f7420736574000000000000604482015290519081900360640190fd5b60609190911b6001600160601b03191660805260e01b6001600160e01b03191660a052620000d362000109565b50506200028b565b3390565b600180546001600160a01b03191690556200010681620001c8602090811b6200124617901c565b50565b60006200011562000218565b805490915068010000000000000000900460ff1615620001675760405162461bcd60e51b8152600401808060200182810382526025815260200180620042646025913960400191505060405180910390fd5b80546001600160401b0390811614620001065780546001600160401b0319166001600160401b03908117825560408051918252517fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29181900360200190a150565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b600080604083850312156200024f578182fd5b82516001600160a01b038116811462000266578283fd5b602084015190925063ffffffff8116811462000280578182fd5b809150509250929050565b60805160601c60a05160e01c613f9b620002c960003980610f4a5280611d8c52806120315250806108ce5280611a6c5280611e1d5250613f9b6000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c80638da5cb5b1161012a578063b2118a8d116100bd578063e30c39781161008c578063e877a52611610071578063e877a5261461042a578063f2fde38b1461043d578063f79fd08e1461045057610226565b8063e30c39781461040f578063e74b981b1461041757610226565b8063b2118a8d146103d9578063bcc76c60146103ec578063cb75c11c146103f4578063da87e448146103fc57610226565b80639cab0c1c116100f95780639cab0c1c1461038b5780639cdbb1811461039e578063a5b8d04e146103b3578063a946de04146103c657610226565b80638da5cb5b146103605780638e0250ee1461036857806391f178881461037b578063966dfbd51461038357610226565b8063369c4f1b116101bd578063779b432d1161018c5780637c92f219116101715780637c92f219146103275780638197beb91461033a57806382a5e6651461034d57610226565b8063779b432d1461030c57806379ba50971461031f57610226565b8063369c4f1b146102e157806338a63183146102e957806346904840146102f1578063516990e3146102f957610226565b80632ab60045116101f95780632ab60045146102935780632c121921146102a657806331ac9920146102bb5780633371bfff146102ce57610226565b806302db402e1461022b57806308828eb71461024057806311cffb671461025e57806324ec75901461027e575b600080fd5b61023e6102393660046135d8565b610463565b005b610248610774565b6040516102559190613caa565b60405180910390f35b61027161026c3660046137cd565b610783565b604051610255919061385b565b6102866108b2565b6040516102559190613866565b61023e6102a136600461357c565b6108b8565b6102ae6108cc565b604051610255919061383a565b61023e6102c9366004613668565b6108f0565b61023e6102dc36600461357c565b610969565b6102ae610a2b565b6102ae610a47565b6102ae610a63565b610286610307366004613668565b610a7f565b61023e61031a3660046136eb565b610adf565b61023e610b4b565b6102716103353660046137cd565b610beb565b61023e61034836600461357c565b610d03565b61028661035b36600461378a565b610d14565b6102ae610d26565b61023e610376366004613680565b610d42565b61023e610d7f565b610286610e80565b61023e61039936600461357c565b610e87565b6103a6610f48565b6040516102559190613c00565b61023e6103c136600461357c565b610f6c565b61023e6103d436600461357c565b610f7d565b61023e6103e7366004613598565b610f8e565b6102ae611024565b6102ae611040565b61023e61040a3660046137a4565b61105c565b6102ae611072565b61023e61042536600461357c565b61108e565b61027161043836600461357c565b61109f565b61023e61044b36600461357c565b6110ca565b61023e61045e36600461378a565b611162565b600061046d6112bb565b805490915060ff68010000000000000000820416159067ffffffffffffffff1660008115801561049a5750825b905060008267ffffffffffffffff1660011480156104be57506104bc306112df565b155b905081806104c95750805b61051e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d0a6025913960400191505060405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561057f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b600061058e60208d018d61357c565b73ffffffffffffffffffffffffffffffffffffffff1614156105e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc906139cc565b60405180910390fd5b87861461061e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc906138db565b61063361062e60208d018d61357c565b6112e5565b61064b61064660408d0160208e0161357c565b611316565b61066361065e60808d0160608e0161357c565b6113f1565b61067b61067660608d0160408e0161357c565b6114d4565b61069361068e60a08d0160808e0161357c565b6115cf565b6106ab6106a660c08d0160a08e0161357c565b61174f565b6106b48a61184a565b8760005b81811015610704576106fc8b8b838181106106cf57fe5b90506020020160208101906106e4919061378a565b8a8a848181106106f057fe5b905060200201356118f6565b6001016106b8565b505083156107675784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604080516001815290517fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29181900360200190a15b5050505050505050505050565b600061077e611a3a565b905090565b600061078d611a54565b6107f857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e76616c6964206d657373616765207472616e736d69747465720000000000604482015290519081900360640190fd5b85856108048282611a90565b610859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613db26021913960400191505060405180910390fd5b6108a66108a0600087878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050611abe9050565b89611ae2565b98975050505050505050565b601d5481565b6108c0611b17565b6108c981611316565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b601c5473ffffffffffffffffffffffffffffffffffffffff163314610960576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613ebd6024913960400191505060405180910390fd5b6108c98161184a565b60035473ffffffffffffffffffffffffffffffffffffffff1633146109d9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613f0b6026913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526004602052604080822060019055517ffa4507bc1f9c730e6e95897024f1fe7d576cf2deb53579d55c14f1ac3439e1149190a250565b601c5473ffffffffffffffffffffffffffffffffffffffff1681565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b601b5473ffffffffffffffffffffffffffffffffffffffff1681565b6000601d5460001415610a9457506000610ada565b60018211610ace576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613b4d565b610ad782611bc1565b90505b919050565b610ae833611bfd565b333214610af857610af832611bfd565b80610b2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613a3a565b610b40898989898989898989611c79565b505050505050505050565b6000610b55611f13565b90508073ffffffffffffffffffffffffffffffffffffffff16610b76611072565b73ffffffffffffffffffffffffffffffffffffffff1614610be2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d2f6029913960400191505060405180910390fd5b6108c9816112e5565b6000610bf5611a54565b610c6057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e76616c6964206d657373616765207472616e736d69747465720000000000604482015290519081900360640190fd5b8585610c6c8282611a90565b610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613db26021913960400191505060405180910390fd5b6101f463ffffffff87161015610859576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613a71565b610d0b611b17565b6108c9816115cf565b601a6020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b610d4b33611bfd565b333214610d5b57610d5b32611bfd565b366000610d6a81808481613cbf565b91509150610b40898989898989898989611c79565b610d87611b17565b60195473ffffffffffffffffffffffffffffffffffffffff1680610e0c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4e6f206c6f63616c206d696e746572206973207365742e000000000000000000604482015290519081900360640190fd5b601980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556040805173ffffffffffffffffffffffffffffffffffffffff8316815290517f2db49fbf671271826a27b02ebc496209c85fffffb4bccc67430d2a0f22b4d1ac9181900360200190a150565b6298968081565b60035473ffffffffffffffffffffffffffffffffffffffff163314610ef7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613f0b6026913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260046020526040808220829055517fc904e1b03de0c20d7fcf9dbd056daf1bd3815e93f251199de815fd0f0b96e1669190a250565b7f000000000000000000000000000000000000000000000000000000000000000081565b610f74611b17565b6108c98161174f565b610f85611b17565b6108c9816113f1565b60025473ffffffffffffffffffffffffffffffffffffffff163314610ffe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e1a6024913960400191505060405180910390fd5b61101f73ffffffffffffffffffffffffffffffffffffffff84168383611f17565b505050565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b60195473ffffffffffffffffffffffffffffffffffffffff1681565b611064611b17565b61106e82826118f6565b5050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b611096611b17565b6108c9816114d4565b73ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604090205460011490565b6110d2611b17565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915561111d610d26565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61116a611b17565b63ffffffff81166000908152601a60205260409020546111eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f20546f6b656e4d657373656e676572207365740000000000000000000000604482015290519081900360640190fd5b63ffffffff81166000818152601a6020908152604080832080549390558051938452908301829052805191927f3dcea012093dbca2bb8ed7fd2b2ff90305ab70bddda8bbb94d4152735a98f0b1929081900390910190a15050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b3b151590565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556108c981611246565b73ffffffffffffffffffffffffffffffffffffffff8116611382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d58602a913960400191505060405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fe475e580d85111348e40d8ca33cfdd74c30fe1655c2d8537a13abc10065ffa5a90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661145d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180613d826030913960400191505060405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907fe144e84038182cefebda68c192c222085b2c12a85d135d3c938498c0165c01d390600090a35050565b73ffffffffffffffffffffffffffffffffffffffff811661155657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f7765640000000000000000604482015290519081900360640190fd5b601b805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fbf9a9534339a9d6b81696e05dcfb614b7dc518a31d48be3cfb757988381fb3239181900360200190a150565b73ffffffffffffffffffffffffffffffffffffffff811661165157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f7765640000000000000000604482015290519081900360640190fd5b60195473ffffffffffffffffffffffffffffffffffffffff16156116d657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4c6f63616c206d696e74657220697320616c7265616479207365742e00000000604482015290519081900360640190fd5b6019805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f109bb3e70cbf1931e295b49e75c67013b85ff80d64e6f1d321f37157b90c38309181900360200190a150565b73ffffffffffffffffffffffffffffffffffffffff81166117d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f7765640000000000000000604482015290519081900360640190fd5b601c805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f4a381820aeb373f402117f6280a310f11cf06f1ef064b9550f5b6f94f1aaa2a89181900360200190a150565b6298968081106118bb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4d696e2066656520746f6f206869676800000000000000000000000000000000604482015290519081900360640190fd5b601d8190556040805182815290517fd4c19c993aeeb50b76da8b158f84806c9d235eff5b86f3a36f12a2e1dd4e6eac9181900360200190a150565b8061196257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f62797465733332283029206e6f7420616c6c6f77656400000000000000000000604482015290519081900360640190fd5b63ffffffff82166000908152601a6020526040902054156119e457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e4d657373656e67657220616c726561647920736574000000000000604482015290519081900360640190fd5b63ffffffff82166000818152601a60209081526040918290208490558151928352820183905280517f4bba2b08298cf59661b4895e384cc2ac3962ce2d71f1b7c11bca52e1169f95999281900390910190a15050565b6000611a446112bb565b5467ffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161490565b60008115801590611ab5575063ffffffff83166000908152601a602052604090205482145b90505b92915050565b815160009060208401611ad964ffffffffff85168284611fa4565b95945050505050565b6000806000806000611af387611ffa565b9350935093509350611b0a86848684860385612294565b5060019695505050505050565b611b1f611f13565b73ffffffffffffffffffffffffffffffffffffffff16611b3d610d26565b73ffffffffffffffffffffffffffffffffffffffff1614611bbf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b565b60008062989680611bdd601d54856124aa90919063ffffffff16565b81611be457fe5b0490508015611bf35780611bf6565b60015b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902054156108c9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e996024913960400191505060405180910390fd5b60008911611cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613995565b86611cea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613adf565b888410611d23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc9061386f565b601d5415611d6d57611d3489611bc1565b841015611d6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613aa8565b6000611d788961251d565b9050611d8587338c61259f565b6000611ddd7f0000000000000000000000000000000000000000000000000000000000000000611dca8a73ffffffffffffffffffffffffffffffffffffffff1661274b565b8b8e611dd53361274b565b8b8a8a612764565b6040517f14b157ab00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906314b157ab90611e5a908d9086908c908b908890600401613c11565b600060405180830381600087803b158015611e7457600080fd5b505af1158015611e88573d6000803e3d6000fd5b505050508463ffffffff163373ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f0c8c1cbdc5190613ebd485511d4e2812cfa45eecb79d845893331fedad5130a58e8d8f888e8e8d8d604051611efe989796959493929190613b84565b60405180910390a45050505050505050505050565b3390565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261101f9084906127e7565b600080611fb184846128bf565b9050604051811115611fc1575060005b80611fef577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000915050611bf6565b611ad9858585612931565b600080808061202a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008616612944565b63ffffffff7f00000000000000000000000000000000000000000000000000000000000000001661207c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612a82565b63ffffffff16146120b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc906138a4565b60006120e67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612aaf565b90508015806120f457504381115b61212a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613938565b6121557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612ae0565b92506121827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612b0d565b915081158061219057508282105b6121c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613a03565b6121f17fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612b3e565b82111561222a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613b16565b61225d6122587fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008816612b6f565b612b9c565b945061228a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612b9f565b9350509193509193565b600061229e612bcc565b90506000821561237957601b54604080517f8dfcfa9000000000000000000000000000000000000000000000000000000000815263ffffffff8a1660048201526024810189905273ffffffffffffffffffffffffffffffffffffffff888116604483015292831660648201526084810187905260a48101869052905191841691638dfcfa909160c4808201926020929091908290030181600087803b15801561234657600080fd5b505af115801561235a573d6000803e3d6000fd5b505050506040513d602081101561237057600080fd5b50519050612434565b604080517fd54de06f00000000000000000000000000000000000000000000000000000000815263ffffffff891660048201526024810188905273ffffffffffffffffffffffffffffffffffffffff87811660448301526064820187905291519184169163d54de06f916084808201926020929091908290030181600087803b15801561240557600080fd5b505af1158015612419573d6000803e3d6000fd5b505050506040513d602081101561242f57600080fd5b505190505b8073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f50c55e915134d457debfa58eb6f4342956f8b0616d51a89a3659360178e1ab638686604051808381526020018281526020019250505060405180910390a350505050505050565b6000826124b957506000611ab8565b828202828482816124c657fe5b0414611ab5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e3e6021913960400191505060405180910390fd5b63ffffffff81166000908152601a602052604081205480610ad757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4e6f20546f6b656e4d657373656e67657220666f7220646f6d61696e00000000604482015290519081900360640190fd5b60006125a9612bcc565b604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff868116600483015280841660248301526044820186905291519293508692918316916323b872dd916064808201926020929091908290030181600087803b15801561262f57600080fd5b505af1158015612643573d6000803e3d6000fd5b505050506040513d602081101561265957600080fd5b50516126c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5472616e73666572206f7065726174696f6e206661696c656400000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16639dc29fac86856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561273757600080fd5b505af1158015610b40573d6000803e3d6000fd5b73ffffffffffffffffffffffffffffffffffffffff1690565b60608888888888886000808a8a604051602001808b63ffffffff1660e01b81526004018a8152602001898152602001888152602001878152602001868152602001858152602001848152602001838380828437808301925050509a5050505050505050505050604051602081830303815290604052905098975050505050505050565b6000612849826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c709092919063ffffffff16565b80519091501561101f5780806020019051602081101561286857600080fd5b505161101f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613ee1602a913960400191505060405180910390fd5b81810182811015611ab857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f766572666c6f7720647572696e67206164646974696f6e2e00000000000000604482015290519081900360640190fd5b606092831b9190911790911b1760181b90565b61296f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008216612c87565b6129da57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4d616c666f726d6564206d657373616765000000000000000000000000000000604482015290519081900360640190fd5b60e4612a077fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612cc4565b6bffffffffffffffffffffffff1610156108c957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f496e76616c6964206275726e206d6573736167653a20746f6f2073686f727400604482015290519081900360640190fd5b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612cd8565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660c46020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612d25565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660a46020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660846020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612d56565b90565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612d87565b60195460009073ffffffffffffffffffffffffffffffffffffffff16612c5357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f63616c206d696e746572206973206e6f7420736574000000000000000000604482015290519081900360640190fd5b5060195473ffffffffffffffffffffffffffffffffffffffff1690565b6060612c7f8484600085612db8565b949350505050565b6000612c9282612f72565b64ffffffffff1664ffffffffff1415612cad57506000610ada565b6000612cb883612f78565b60405110159392505050565b60181c6bffffffffffffffffffffffff1690565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000083168260045b60008160200360080260ff16612d1b858585612fa2565b901c949350505050565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660446020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660246020612fa2565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660046020612fa2565b606082471015612e13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613dd36026913960400191505060405180910390fd5b612e1c856112df565b612e8757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310612ef057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612eb3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612f52576040519150601f19603f3d011682016040523d82523d6000602084013e612f57565b606091505b5091509150612f6782828661314d565b979650505050505050565b60d81c90565b6000612f8382612cc4565b612f8c836131cd565b016bffffffffffffffffffffffff169050919050565b600060ff8216612fb457506000611bf6565b612fbd84612cc4565b6bffffffffffffffffffffffff16612fd88460ff85166128bf565b11156130b757613019612fea856131cd565b6bffffffffffffffffffffffff1661300186612cc4565b6bffffffffffffffffffffffff16858560ff166131e1565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561307c578181015183820152602001613064565b50505050905090810190601f1680156130a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60208260ff161115613114576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180613e5f603a913960400191505060405180910390fd5b600882026000613123866131cd565b6bffffffffffffffffffffffff169050600061313e8361333c565b91909501511695945050505050565b6060831561315c575081611bf6565b82511561316c5782518084602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815284516024840152845185939192839260440191908501908083836000831561307c578181015183820152602001613064565b60781c6bffffffffffffffffffffffff1690565b606060006131ee86613385565b91505060006131fc86613385565b915050600061320a86613385565b915050600061321886613385565b915050838383836040516020018080613f31603591397fffffffffffff000000000000000000000000000000000000000000000000000060d087811b821660358401527f2077697468206c656e6774682030780000000000000000000000000000000000603b84015286901b16604a8201526050016021613df982397fffffffffffff000000000000000000000000000000000000000000000000000060d094851b811660218301527f2077697468206c656e677468203078000000000000000000000000000000000060278301529290931b9091166036830152507f2e00000000000000000000000000000000000000000000000000000000000000603c82015260408051601d818403018152603d90920190529b9a5050505050505050505050565b7f80000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9091011d90565b600080601f5b600f8160ff1611156133ed5760ff600882021684901c6133aa81613459565b61ffff16841793508160ff166010146133c557601084901b93505b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0161338b565b50600f5b60ff8160ff1610156134535760ff600882021684901c61341081613459565b61ffff16831792508160ff1660001461342b57601083901b92505b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016133f1565b50915091565b600061346b60048360ff16901c613489565b60ff161760081b62ffff001661348082613489565b60ff1617919050565b6040805180820190915260108082527f30313233343536373839616263646566000000000000000000000000000000006020830152600091600f841691829081106134d057fe5b016020015160f81c9392505050565b60008083601f8401126134f0578182fd5b50813567ffffffffffffffff811115613507578182fd5b602083019150836020808302850101111561352157600080fd5b9250929050565b60008083601f840112613539578182fd5b50813567ffffffffffffffff811115613550578182fd5b60208301915083602082850101111561352157600080fd5b803563ffffffff81168114610ada57600080fd5b60006020828403121561358d578081fd5b8135611ab581613ce7565b6000806000606084860312156135ac578182fd5b83356135b781613ce7565b925060208401356135c781613ce7565b929592945050506040919091013590565b6000806000806000808688036101208112156135f2578283fd5b60c08112156135ff578283fd5b5086955060c0870135945060e087013567ffffffffffffffff80821115613624578384fd5b6136308a838b016134df565b9096509450610100890135915080821115613649578384fd5b5061365689828a016134df565b979a9699509497509295939492505050565b600060208284031215613679578081fd5b5035919050565b600080600080600080600060e0888a03121561369a578081fd5b873596506136aa60208901613568565b95506040880135945060608801356136c181613ce7565b93506080880135925060a088013591506136dd60c08901613568565b905092959891949750929550565b60008060008060008060008060006101008a8c031215613709578182fd5b8935985061371960208b01613568565b975060408a0135965060608a013561373081613ce7565b955060808a0135945060a08a0135935061374c60c08b01613568565b925060e08a013567ffffffffffffffff811115613767578283fd5b6137738c828d01613528565b915080935050809150509295985092959850929598565b60006020828403121561379b578081fd5b611ab582613568565b600080604083850312156137b6578182fd5b6137bf83613568565b946020939093013593505050565b6000806000806000608086880312156137e4578081fd5b6137ed86613568565b94506020860135935061380260408701613568565b9250606086013567ffffffffffffffff81111561381d578182fd5b61382988828901613528565b969995985093965092949392505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b901515815260200190565b90815260200190565b6020808252818101527f4d617820666565206d757374206265206c657373207468616e20616d6f756e74604082015260600190565b6020808252601c908201527f496e76616c6964206d65737361676520626f64792076657273696f6e00000000604082015260600190565b60208082526023908201527f496e76616c69642072656d6f746520646f6d61696e20636f6e6669677572617460408201527f696f6e0000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f4d657373616765206578706972656420616e64206d7573742062652072652d7360408201527f69676e6564000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526016908201527f416d6f756e74206d757374206265206e6f6e7a65726f00000000000000000000604082015260600190565b60208082526019908201527f4f776e657220697320746865207a65726f206164647265737300000000000000604082015260600190565b6020808252601c908201527f46656520657175616c73206f72206578636565647320616d6f756e7400000000604082015260600190565b60208082526012908201527f486f6f6b206461746120697320656d7074790000000000000000000000000000604082015260600190565b6020808252601e908201527f556e737570706f727465642066696e616c697479207468726573686f6c640000604082015260600190565b60208082526014908201527f496e73756666696369656e74206d617820666565000000000000000000000000604082015260600190565b6020808252601e908201527f4d696e7420726563697069656e74206d757374206265206e6f6e7a65726f0000604082015260600190565b60208082526013908201527f4665652065786365656473206d61782066656500000000000000000000000000604082015260600190565b6020808252600e908201527f416d6f756e7420746f6f206c6f77000000000000000000000000000000000000604082015260600190565b600089825288602083015263ffffffff881660408301528660608301528560808301528460a083015260e060c08301528260e0830152610100838582850137828401810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101979650505050505050565b63ffffffff91909116815260200190565b600063ffffffff808816835260208781850152866040850152818616606085015260a06080850152845191508160a0850152825b82811015613c615785810182015185820160c001528101613c45565b82811115613c72578360c084870101525b5050601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160c0019695505050505050565b67ffffffffffffffff91909116815260200190565b60008085851115613cce578182fd5b83861115613cda578182fd5b5050820193919092039150565b73ffffffffffffffffffffffffffffffffffffffff811681146108c957600080fdfe496e697469616c697a61626c653a20696e76616c696420696e697469616c697a6174696f6e4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206e6577206f776e6572526573637561626c653a206e6577207265736375657220697320746865207a65726f206164647265737344656e796c69737461626c653a206e65772064656e796c697374657220697320746865207a65726f206164647265737352656d6f746520546f6b656e4d657373656e67657220756e737570706f72746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c2e20417474656d7074656420746f20696e646578206174206f6666736574203078526573637561626c653a2063616c6c6572206973206e6f74207468652072657363756572536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754797065644d656d566965772f696e646578202d20417474656d7074656420746f20696e646578206d6f7265207468616e20333220627974657344656e796c69737461626c653a206163636f756e74206973206f6e2064656e796c69737443616c6c6572206973206e6f7420746865206d696e2066656520636f6e74726f6c6c65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656444656e796c69737461626c653a2063616c6c6572206973206e6f742064656e796c697374657254797065644d656d566965772f696e646578202d204f76657272616e2074686520766965772e20536c696365206973206174203078a264697066735822122015e830bad8e277f4cac7ef6e08e6592b7a7c2ccbfece2d2eb557ad23a0ef2f9964736f6c63430007060033496e697469616c697a61626c653a20696e76616c696420696e697469616c697a6174696f6e00000000000000000000000081d40f21f12a8f0e3252bccb954d722d4c464b640000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102265760003560e01c80638da5cb5b1161012a578063b2118a8d116100bd578063e30c39781161008c578063e877a52611610071578063e877a5261461042a578063f2fde38b1461043d578063f79fd08e1461045057610226565b8063e30c39781461040f578063e74b981b1461041757610226565b8063b2118a8d146103d9578063bcc76c60146103ec578063cb75c11c146103f4578063da87e448146103fc57610226565b80639cab0c1c116100f95780639cab0c1c1461038b5780639cdbb1811461039e578063a5b8d04e146103b3578063a946de04146103c657610226565b80638da5cb5b146103605780638e0250ee1461036857806391f178881461037b578063966dfbd51461038357610226565b8063369c4f1b116101bd578063779b432d1161018c5780637c92f219116101715780637c92f219146103275780638197beb91461033a57806382a5e6651461034d57610226565b8063779b432d1461030c57806379ba50971461031f57610226565b8063369c4f1b146102e157806338a63183146102e957806346904840146102f1578063516990e3146102f957610226565b80632ab60045116101f95780632ab60045146102935780632c121921146102a657806331ac9920146102bb5780633371bfff146102ce57610226565b806302db402e1461022b57806308828eb71461024057806311cffb671461025e57806324ec75901461027e575b600080fd5b61023e6102393660046135d8565b610463565b005b610248610774565b6040516102559190613caa565b60405180910390f35b61027161026c3660046137cd565b610783565b604051610255919061385b565b6102866108b2565b6040516102559190613866565b61023e6102a136600461357c565b6108b8565b6102ae6108cc565b604051610255919061383a565b61023e6102c9366004613668565b6108f0565b61023e6102dc36600461357c565b610969565b6102ae610a2b565b6102ae610a47565b6102ae610a63565b610286610307366004613668565b610a7f565b61023e61031a3660046136eb565b610adf565b61023e610b4b565b6102716103353660046137cd565b610beb565b61023e61034836600461357c565b610d03565b61028661035b36600461378a565b610d14565b6102ae610d26565b61023e610376366004613680565b610d42565b61023e610d7f565b610286610e80565b61023e61039936600461357c565b610e87565b6103a6610f48565b6040516102559190613c00565b61023e6103c136600461357c565b610f6c565b61023e6103d436600461357c565b610f7d565b61023e6103e7366004613598565b610f8e565b6102ae611024565b6102ae611040565b61023e61040a3660046137a4565b61105c565b6102ae611072565b61023e61042536600461357c565b61108e565b61027161043836600461357c565b61109f565b61023e61044b36600461357c565b6110ca565b61023e61045e36600461378a565b611162565b600061046d6112bb565b805490915060ff68010000000000000000820416159067ffffffffffffffff1660008115801561049a5750825b905060008267ffffffffffffffff1660011480156104be57506104bc306112df565b155b905081806104c95750805b61051e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d0a6025913960400191505060405180910390fd5b84547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000166001178555831561057f5784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff16680100000000000000001785555b600061058e60208d018d61357c565b73ffffffffffffffffffffffffffffffffffffffff1614156105e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc906139cc565b60405180910390fd5b87861461061e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc906138db565b61063361062e60208d018d61357c565b6112e5565b61064b61064660408d0160208e0161357c565b611316565b61066361065e60808d0160608e0161357c565b6113f1565b61067b61067660608d0160408e0161357c565b6114d4565b61069361068e60a08d0160808e0161357c565b6115cf565b6106ab6106a660c08d0160a08e0161357c565b61174f565b6106b48a61184a565b8760005b81811015610704576106fc8b8b838181106106cf57fe5b90506020020160208101906106e4919061378a565b8a8a848181106106f057fe5b905060200201356118f6565b6001016106b8565b505083156107675784547fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff168555604080516001815290517fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29181900360200190a15b5050505050505050505050565b600061077e611a3a565b905090565b600061078d611a54565b6107f857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e76616c6964206d657373616765207472616e736d69747465720000000000604482015290519081900360640190fd5b85856108048282611a90565b610859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613db26021913960400191505060405180910390fd5b6108a66108a0600087878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293925050611abe9050565b89611ae2565b98975050505050505050565b601d5481565b6108c0611b17565b6108c981611316565b50565b7f00000000000000000000000081d40f21f12a8f0e3252bccb954d722d4c464b6481565b601c5473ffffffffffffffffffffffffffffffffffffffff163314610960576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613ebd6024913960400191505060405180910390fd5b6108c98161184a565b60035473ffffffffffffffffffffffffffffffffffffffff1633146109d9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613f0b6026913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526004602052604080822060019055517ffa4507bc1f9c730e6e95897024f1fe7d576cf2deb53579d55c14f1ac3439e1149190a250565b601c5473ffffffffffffffffffffffffffffffffffffffff1681565b60025473ffffffffffffffffffffffffffffffffffffffff1690565b601b5473ffffffffffffffffffffffffffffffffffffffff1681565b6000601d5460001415610a9457506000610ada565b60018211610ace576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613b4d565b610ad782611bc1565b90505b919050565b610ae833611bfd565b333214610af857610af832611bfd565b80610b2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613a3a565b610b40898989898989898989611c79565b505050505050505050565b6000610b55611f13565b90508073ffffffffffffffffffffffffffffffffffffffff16610b76611072565b73ffffffffffffffffffffffffffffffffffffffff1614610be2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d2f6029913960400191505060405180910390fd5b6108c9816112e5565b6000610bf5611a54565b610c6057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e76616c6964206d657373616765207472616e736d69747465720000000000604482015290519081900360640190fd5b8585610c6c8282611a90565b610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613db26021913960400191505060405180910390fd5b6101f463ffffffff87161015610859576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613a71565b610d0b611b17565b6108c9816115cf565b601a6020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b610d4b33611bfd565b333214610d5b57610d5b32611bfd565b366000610d6a81808481613cbf565b91509150610b40898989898989898989611c79565b610d87611b17565b60195473ffffffffffffffffffffffffffffffffffffffff1680610e0c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4e6f206c6f63616c206d696e746572206973207365742e000000000000000000604482015290519081900360640190fd5b601980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556040805173ffffffffffffffffffffffffffffffffffffffff8316815290517f2db49fbf671271826a27b02ebc496209c85fffffb4bccc67430d2a0f22b4d1ac9181900360200190a150565b6298968081565b60035473ffffffffffffffffffffffffffffffffffffffff163314610ef7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613f0b6026913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260046020526040808220829055517fc904e1b03de0c20d7fcf9dbd056daf1bd3815e93f251199de815fd0f0b96e1669190a250565b7f000000000000000000000000000000000000000000000000000000000000000181565b610f74611b17565b6108c98161174f565b610f85611b17565b6108c9816113f1565b60025473ffffffffffffffffffffffffffffffffffffffff163314610ffe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e1a6024913960400191505060405180910390fd5b61101f73ffffffffffffffffffffffffffffffffffffffff84168383611f17565b505050565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b60195473ffffffffffffffffffffffffffffffffffffffff1681565b611064611b17565b61106e82826118f6565b5050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b611096611b17565b6108c9816114d4565b73ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604090205460011490565b6110d2611b17565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915561111d610d26565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61116a611b17565b63ffffffff81166000908152601a60205260409020546111eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f20546f6b656e4d657373656e676572207365740000000000000000000000604482015290519081900360640190fd5b63ffffffff81166000818152601a6020908152604080832080549390558051938452908301829052805191927f3dcea012093dbca2bb8ed7fd2b2ff90305ab70bddda8bbb94d4152735a98f0b1929081900390910190a15050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0090565b3b151590565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556108c981611246565b73ffffffffffffffffffffffffffffffffffffffff8116611382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d58602a913960400191505060405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fe475e580d85111348e40d8ca33cfdd74c30fe1655c2d8537a13abc10065ffa5a90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661145d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180613d826030913960400191505060405180910390fd5b6003805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907fe144e84038182cefebda68c192c222085b2c12a85d135d3c938498c0165c01d390600090a35050565b73ffffffffffffffffffffffffffffffffffffffff811661155657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f7765640000000000000000604482015290519081900360640190fd5b601b805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fbf9a9534339a9d6b81696e05dcfb614b7dc518a31d48be3cfb757988381fb3239181900360200190a150565b73ffffffffffffffffffffffffffffffffffffffff811661165157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f7765640000000000000000604482015290519081900360640190fd5b60195473ffffffffffffffffffffffffffffffffffffffff16156116d657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4c6f63616c206d696e74657220697320616c7265616479207365742e00000000604482015290519081900360640190fd5b6019805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f109bb3e70cbf1931e295b49e75c67013b85ff80d64e6f1d321f37157b90c38309181900360200190a150565b73ffffffffffffffffffffffffffffffffffffffff81166117d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f7765640000000000000000604482015290519081900360640190fd5b601c805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f4a381820aeb373f402117f6280a310f11cf06f1ef064b9550f5b6f94f1aaa2a89181900360200190a150565b6298968081106118bb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4d696e2066656520746f6f206869676800000000000000000000000000000000604482015290519081900360640190fd5b601d8190556040805182815290517fd4c19c993aeeb50b76da8b158f84806c9d235eff5b86f3a36f12a2e1dd4e6eac9181900360200190a150565b8061196257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f62797465733332283029206e6f7420616c6c6f77656400000000000000000000604482015290519081900360640190fd5b63ffffffff82166000908152601a6020526040902054156119e457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f546f6b656e4d657373656e67657220616c726561647920736574000000000000604482015290519081900360640190fd5b63ffffffff82166000818152601a60209081526040918290208490558151928352820183905280517f4bba2b08298cf59661b4895e384cc2ac3962ce2d71f1b7c11bca52e1169f95999281900390910190a15050565b6000611a446112bb565b5467ffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000081d40f21f12a8f0e3252bccb954d722d4c464b64161490565b60008115801590611ab5575063ffffffff83166000908152601a602052604090205482145b90505b92915050565b815160009060208401611ad964ffffffffff85168284611fa4565b95945050505050565b6000806000806000611af387611ffa565b9350935093509350611b0a86848684860385612294565b5060019695505050505050565b611b1f611f13565b73ffffffffffffffffffffffffffffffffffffffff16611b3d610d26565b73ffffffffffffffffffffffffffffffffffffffff1614611bbf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b565b60008062989680611bdd601d54856124aa90919063ffffffff16565b81611be457fe5b0490508015611bf35780611bf6565b60015b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902054156108c9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e996024913960400191505060405180910390fd5b60008911611cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613995565b86611cea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613adf565b888410611d23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc9061386f565b601d5415611d6d57611d3489611bc1565b841015611d6d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613aa8565b6000611d788961251d565b9050611d8587338c61259f565b6000611ddd7f0000000000000000000000000000000000000000000000000000000000000001611dca8a73ffffffffffffffffffffffffffffffffffffffff1661274b565b8b8e611dd53361274b565b8b8a8a612764565b6040517f14b157ab00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000081d40f21f12a8f0e3252bccb954d722d4c464b6416906314b157ab90611e5a908d9086908c908b908890600401613c11565b600060405180830381600087803b158015611e7457600080fd5b505af1158015611e88573d6000803e3d6000fd5b505050508463ffffffff163373ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f0c8c1cbdc5190613ebd485511d4e2812cfa45eecb79d845893331fedad5130a58e8d8f888e8e8d8d604051611efe989796959493929190613b84565b60405180910390a45050505050505050505050565b3390565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261101f9084906127e7565b600080611fb184846128bf565b9050604051811115611fc1575060005b80611fef577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000915050611bf6565b611ad9858585612931565b600080808061202a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008616612944565b63ffffffff7f00000000000000000000000000000000000000000000000000000000000000011661207c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612a82565b63ffffffff16146120b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc906138a4565b60006120e67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612aaf565b90508015806120f457504381115b61212a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613938565b6121557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612ae0565b92506121827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612b0d565b915081158061219057508282105b6121c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613a03565b6121f17fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612b3e565b82111561222a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105dc90613b16565b61225d6122587fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008816612b6f565b612b9c565b945061228a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008716612b9f565b9350509193509193565b600061229e612bcc565b90506000821561237957601b54604080517f8dfcfa9000000000000000000000000000000000000000000000000000000000815263ffffffff8a1660048201526024810189905273ffffffffffffffffffffffffffffffffffffffff888116604483015292831660648201526084810187905260a48101869052905191841691638dfcfa909160c4808201926020929091908290030181600087803b15801561234657600080fd5b505af115801561235a573d6000803e3d6000fd5b505050506040513d602081101561237057600080fd5b50519050612434565b604080517fd54de06f00000000000000000000000000000000000000000000000000000000815263ffffffff891660048201526024810188905273ffffffffffffffffffffffffffffffffffffffff87811660448301526064820187905291519184169163d54de06f916084808201926020929091908290030181600087803b15801561240557600080fd5b505af1158015612419573d6000803e3d6000fd5b505050506040513d602081101561242f57600080fd5b505190505b8073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f50c55e915134d457debfa58eb6f4342956f8b0616d51a89a3659360178e1ab638686604051808381526020018281526020019250505060405180910390a350505050505050565b6000826124b957506000611ab8565b828202828482816124c657fe5b0414611ab5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e3e6021913960400191505060405180910390fd5b63ffffffff81166000908152601a602052604081205480610ad757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4e6f20546f6b656e4d657373656e67657220666f7220646f6d61696e00000000604482015290519081900360640190fd5b60006125a9612bcc565b604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff868116600483015280841660248301526044820186905291519293508692918316916323b872dd916064808201926020929091908290030181600087803b15801561262f57600080fd5b505af1158015612643573d6000803e3d6000fd5b505050506040513d602081101561265957600080fd5b50516126c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5472616e73666572206f7065726174696f6e206661696c656400000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16639dc29fac86856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561273757600080fd5b505af1158015610b40573d6000803e3d6000fd5b73ffffffffffffffffffffffffffffffffffffffff1690565b60608888888888886000808a8a604051602001808b63ffffffff1660e01b81526004018a8152602001898152602001888152602001878152602001868152602001858152602001848152602001838380828437808301925050509a5050505050505050505050604051602081830303815290604052905098975050505050505050565b6000612849826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612c709092919063ffffffff16565b80519091501561101f5780806020019051602081101561286857600080fd5b505161101f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613ee1602a913960400191505060405180910390fd5b81810182811015611ab857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f766572666c6f7720647572696e67206164646974696f6e2e00000000000000604482015290519081900360640190fd5b606092831b9190911790911b1760181b90565b61296f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008216612c87565b6129da57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4d616c666f726d6564206d657373616765000000000000000000000000000000604482015290519081900360640190fd5b60e4612a077fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612cc4565b6bffffffffffffffffffffffff1610156108c957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f496e76616c6964206275726e206d6573736167653a20746f6f2073686f727400604482015290519081900360640190fd5b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612cd8565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660c46020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612d25565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660a46020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660846020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612d56565b90565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000008316612d87565b60195460009073ffffffffffffffffffffffffffffffffffffffff16612c5357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4c6f63616c206d696e746572206973206e6f7420736574000000000000000000604482015290519081900360640190fd5b5060195473ffffffffffffffffffffffffffffffffffffffff1690565b6060612c7f8484600085612db8565b949350505050565b6000612c9282612f72565b64ffffffffff1664ffffffffff1415612cad57506000610ada565b6000612cb883612f78565b60405110159392505050565b60181c6bffffffffffffffffffffffff1690565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000083168260045b60008160200360080260ff16612d1b858585612fa2565b901c949350505050565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660446020612d04565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660246020612fa2565b6000610ad77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000831660046020612fa2565b606082471015612e13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613dd36026913960400191505060405180910390fd5b612e1c856112df565b612e8757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310612ef057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612eb3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612f52576040519150601f19603f3d011682016040523d82523d6000602084013e612f57565b606091505b5091509150612f6782828661314d565b979650505050505050565b60d81c90565b6000612f8382612cc4565b612f8c836131cd565b016bffffffffffffffffffffffff169050919050565b600060ff8216612fb457506000611bf6565b612fbd84612cc4565b6bffffffffffffffffffffffff16612fd88460ff85166128bf565b11156130b757613019612fea856131cd565b6bffffffffffffffffffffffff1661300186612cc4565b6bffffffffffffffffffffffff16858560ff166131e1565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561307c578181015183820152602001613064565b50505050905090810190601f1680156130a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60208260ff161115613114576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180613e5f603a913960400191505060405180910390fd5b600882026000613123866131cd565b6bffffffffffffffffffffffff169050600061313e8361333c565b91909501511695945050505050565b6060831561315c575081611bf6565b82511561316c5782518084602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815284516024840152845185939192839260440191908501908083836000831561307c578181015183820152602001613064565b60781c6bffffffffffffffffffffffff1690565b606060006131ee86613385565b91505060006131fc86613385565b915050600061320a86613385565b915050600061321886613385565b915050838383836040516020018080613f31603591397fffffffffffff000000000000000000000000000000000000000000000000000060d087811b821660358401527f2077697468206c656e6774682030780000000000000000000000000000000000603b84015286901b16604a8201526050016021613df982397fffffffffffff000000000000000000000000000000000000000000000000000060d094851b811660218301527f2077697468206c656e677468203078000000000000000000000000000000000060278301529290931b9091166036830152507f2e00000000000000000000000000000000000000000000000000000000000000603c82015260408051601d818403018152603d90920190529b9a5050505050505050505050565b7f80000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9091011d90565b600080601f5b600f8160ff1611156133ed5760ff600882021684901c6133aa81613459565b61ffff16841793508160ff166010146133c557601084901b93505b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0161338b565b50600f5b60ff8160ff1610156134535760ff600882021684901c61341081613459565b61ffff16831792508160ff1660001461342b57601083901b92505b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016133f1565b50915091565b600061346b60048360ff16901c613489565b60ff161760081b62ffff001661348082613489565b60ff1617919050565b6040805180820190915260108082527f30313233343536373839616263646566000000000000000000000000000000006020830152600091600f841691829081106134d057fe5b016020015160f81c9392505050565b60008083601f8401126134f0578182fd5b50813567ffffffffffffffff811115613507578182fd5b602083019150836020808302850101111561352157600080fd5b9250929050565b60008083601f840112613539578182fd5b50813567ffffffffffffffff811115613550578182fd5b60208301915083602082850101111561352157600080fd5b803563ffffffff81168114610ada57600080fd5b60006020828403121561358d578081fd5b8135611ab581613ce7565b6000806000606084860312156135ac578182fd5b83356135b781613ce7565b925060208401356135c781613ce7565b929592945050506040919091013590565b6000806000806000808688036101208112156135f2578283fd5b60c08112156135ff578283fd5b5086955060c0870135945060e087013567ffffffffffffffff80821115613624578384fd5b6136308a838b016134df565b9096509450610100890135915080821115613649578384fd5b5061365689828a016134df565b979a9699509497509295939492505050565b600060208284031215613679578081fd5b5035919050565b600080600080600080600060e0888a03121561369a578081fd5b873596506136aa60208901613568565b95506040880135945060608801356136c181613ce7565b93506080880135925060a088013591506136dd60c08901613568565b905092959891949750929550565b60008060008060008060008060006101008a8c031215613709578182fd5b8935985061371960208b01613568565b975060408a0135965060608a013561373081613ce7565b955060808a0135945060a08a0135935061374c60c08b01613568565b925060e08a013567ffffffffffffffff811115613767578283fd5b6137738c828d01613528565b915080935050809150509295985092959850929598565b60006020828403121561379b578081fd5b611ab582613568565b600080604083850312156137b6578182fd5b6137bf83613568565b946020939093013593505050565b6000806000806000608086880312156137e4578081fd5b6137ed86613568565b94506020860135935061380260408701613568565b9250606086013567ffffffffffffffff81111561381d578182fd5b61382988828901613528565b969995985093965092949392505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b901515815260200190565b90815260200190565b6020808252818101527f4d617820666565206d757374206265206c657373207468616e20616d6f756e74604082015260600190565b6020808252601c908201527f496e76616c6964206d65737361676520626f64792076657273696f6e00000000604082015260600190565b60208082526023908201527f496e76616c69642072656d6f746520646f6d61696e20636f6e6669677572617460408201527f696f6e0000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f4d657373616765206578706972656420616e64206d7573742062652072652d7360408201527f69676e6564000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526016908201527f416d6f756e74206d757374206265206e6f6e7a65726f00000000000000000000604082015260600190565b60208082526019908201527f4f776e657220697320746865207a65726f206164647265737300000000000000604082015260600190565b6020808252601c908201527f46656520657175616c73206f72206578636565647320616d6f756e7400000000604082015260600190565b60208082526012908201527f486f6f6b206461746120697320656d7074790000000000000000000000000000604082015260600190565b6020808252601e908201527f556e737570706f727465642066696e616c697479207468726573686f6c640000604082015260600190565b60208082526014908201527f496e73756666696369656e74206d617820666565000000000000000000000000604082015260600190565b6020808252601e908201527f4d696e7420726563697069656e74206d757374206265206e6f6e7a65726f0000604082015260600190565b60208082526013908201527f4665652065786365656473206d61782066656500000000000000000000000000604082015260600190565b6020808252600e908201527f416d6f756e7420746f6f206c6f77000000000000000000000000000000000000604082015260600190565b600089825288602083015263ffffffff881660408301528660608301528560808301528460a083015260e060c08301528260e0830152610100838582850137828401810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101979650505050505050565b63ffffffff91909116815260200190565b600063ffffffff808816835260208781850152866040850152818616606085015260a06080850152845191508160a0850152825b82811015613c615785810182015185820160c001528101613c45565b82811115613c72578360c084870101525b5050601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160c0019695505050505050565b67ffffffffffffffff91909116815260200190565b60008085851115613cce578182fd5b83861115613cda578182fd5b5050820193919092039150565b73ffffffffffffffffffffffffffffffffffffffff811681146108c957600080fdfe496e697469616c697a61626c653a20696e76616c696420696e697469616c697a6174696f6e4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206e6577206f776e6572526573637561626c653a206e6577207265736375657220697320746865207a65726f206164647265737344656e796c69737461626c653a206e65772064656e796c697374657220697320746865207a65726f206164647265737352656d6f746520546f6b656e4d657373656e67657220756e737570706f72746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c2e20417474656d7074656420746f20696e646578206174206f6666736574203078526573637561626c653a2063616c6c6572206973206e6f74207468652072657363756572536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7754797065644d656d566965772f696e646578202d20417474656d7074656420746f20696e646578206d6f7265207468616e20333220627974657344656e796c69737461626c653a206163636f756e74206973206f6e2064656e796c69737443616c6c6572206973206e6f7420746865206d696e2066656520636f6e74726f6c6c65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656444656e796c69737461626c653a2063616c6c6572206973206e6f742064656e796c697374657254797065644d656d566965772f696e646578202d204f76657272616e2074686520766965772e20536c696365206973206174203078a264697066735822122015e830bad8e277f4cac7ef6e08e6592b7a7c2ccbfece2d2eb557ad23a0ef2f9964736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000081d40f21f12a8f0e3252bccb954d722d4c464b640000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _messageTransmitter (address): 0x81D40F21F12A8F0E3252Bccb954D722d4c464B64
Arg [1] : _messageBodyVersion (uint32): 1
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000081d40f21f12a8f0e3252bccb954d722d4c464b64
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.