Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- BridgeV2
- Optimization enabled
- true
- Compiler version
- v0.8.7+commit.e28d00a7
- Optimization runs
- 2000
- EVM Version
- default
- Verified at
- 2025-07-15T14:24:44.158225Z
contracts/synth-core/bridge/BridgeV2.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@uniswap/lib/contracts/libraries/TransferHelper.sol";
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import "../../utils/AdminableUpgradeable.sol";
import "../../utils/RevertMessageParser.sol";
contract BridgeV2 is Initializable, AdminableUpgradeable {
/// ** PUBLIC states **
address public newMPC;
address public oldMPC;
uint256 public newMPCEffectiveTime;
mapping(address => bool) public isTransmitter;
/// ** EVENTS **
event LogChangeMPC(
address indexed oldMPC,
address indexed newMPC,
uint256 indexed effectiveTime,
uint256 chainId
);
event SetTransmitterStatus(address indexed transmitter, bool status);
event OracleRequest(
address bridge,
bytes callData,
address receiveSide,
address oppositeBridge,
uint256 chainId
);
/// ** MODIFIERs **
modifier onlyMPC() {
require(msg.sender == mpc(), "BridgeV2: forbidden");
_;
}
modifier onlyTransmitter() {
require(isTransmitter[msg.sender], "BridgeV2: not a transmitter");
_;
}
modifier onlyOwnerOrMPC() {
require(
mpc() == msg.sender || owner() == msg.sender,
"BridgeV2: only owner or MPC can call"
);
_;
}
modifier onlySignedByMPC(bytes32 hash, bytes memory signature) {
require(SignatureChecker.isValidSignatureNow(mpc(), hash, signature), "BridgeV2: invalid signature");
_;
}
/// ** INITIALIZER **
function initialize(address _mpc) public virtual initializer {
__Ownable_init();
newMPC = _mpc;
newMPCEffectiveTime = block.timestamp;
}
/// ** VIEW functions **
/**
* @notice Returns MPC
*/
function mpc() public view returns (address) {
if (block.timestamp >= newMPCEffectiveTime) {
return newMPC;
}
return oldMPC;
}
/**
* @notice Returns chain ID of block
*/
function currentChainId() public view returns (uint256) {
return block.chainid;
}
/// ** MPC functions **
/**
* @notice Receives requests
*/
function receiveRequestV2(bytes memory _callData, address _receiveSide)
external
onlyMPC
{
_processRequest(_callData, _receiveSide);
}
/**
* @notice Receives requests
*/
function receiveRequestV2Signed(bytes memory _callData, address _receiveSide, bytes memory signature)
external
onlySignedByMPC(keccak256(bytes.concat("receiveRequestV2", _callData, bytes20(_receiveSide),
bytes32(block.chainid), bytes20(address(this)))), signature)
{
_processRequest(_callData, _receiveSide);
}
/// ** TRANSMITTER functions **
/**
* @notice transmits request
*/
function transmitRequestV2(
bytes memory _callData,
address _receiveSide,
address _oppositeBridge,
uint256 _chainId
) public onlyTransmitter {
emit OracleRequest(
address(this),
_callData,
_receiveSide,
_oppositeBridge,
_chainId
);
}
/// ** OWNER functions **
/**
* @notice Sets transmitter status
*/
function setTransmitterStatus(address _transmitter, bool _status)
external
onlyOwner
{
isTransmitter[_transmitter] = _status;
emit SetTransmitterStatus(_transmitter, _status);
}
/**
* @notice Changes MPC by owner or MPC
*/
function changeMPC(address _newMPC) external onlyOwnerOrMPC returns (bool) {
return _changeMPC(_newMPC);
}
/**
* @notice Changes MPC with signature
*/
function changeMPCSigned(address _newMPC, bytes memory signature)
external
onlySignedByMPC(keccak256(bytes.concat("changeMPC", bytes20(_newMPC), bytes32(block.chainid),
bytes20(address(this)))), signature)
returns (bool)
{
return _changeMPC(_newMPC);
}
/**
* @notice Withdraw fee by owner or admin
*/
function withdrawFee(address token, address to, uint256 amount) external onlyOwnerOrAdmin returns (bool) {
TransferHelper.safeTransfer(token, to, amount);
return true;
}
/// ** Private functions **
/**
* @notice Private function that handles request processing
*/
function _processRequest(bytes memory _callData, address _receiveSide)
private
{
require(isTransmitter[_receiveSide], "BridgeV2: untrusted transmitter");
(bool success, bytes memory data) = _receiveSide.call(_callData);
if (!success) {
revert(RevertMessageParser.getRevertMessage(data, "BridgeV2: call failed"));
}
}
/**
* @notice Private function that changes MPC
*/
function _changeMPC(address _newMPC) private returns (bool) {
require(_newMPC != address(0), "BridgeV2: address(0x0)");
oldMPC = mpc();
newMPC = _newMPC;
newMPCEffectiveTime = block.timestamp;
emit LogChangeMPC(
oldMPC,
newMPC,
newMPCEffectiveTime,
currentChainId()
);
return true;
}
}
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @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);
}
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
* initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() initializer {}
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
// If the contract is initializing we ignore whether _initialized is set in order to support multiple
// inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
// contract may have been reentered.
require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} modifier, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
function _isConstructor() private view returns (bool) {
return !AddressUpgradeable.isContract(address(this));
}
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
__Context_init_unchained();
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
uint256[50] private __gap;
}
@openzeppelin/contracts/interfaces/IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*
* _Available since v4.1._
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
@openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
import "../Address.sol";
import "../../interfaces/IERC1271.sol";
/**
* @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and
* ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with
* smart contract wallets such as Argent and Gnosis.
*
* Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change
* through time. It could return true at block N and false at block N+1 (or the opposite).
*
* _Available since v4.1._
*/
library SignatureChecker {
function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
if (error == ECDSA.RecoverError.NoError && recovered == signer) {
return true;
}
(bool success, bytes memory result) = signer.staticcall(
abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
);
return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);
}
}
@uniswap/lib/contracts/libraries/TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
contracts/utils/AdminableUpgradeable.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
abstract contract AdminableUpgradeable is OwnableUpgradeable {
mapping(address => bool) public isAdmin;
event SetAdminPermission(address indexed admin, bool permission);
modifier onlyAdmin {
require(isAdmin[msg.sender], "Only admin can call");
_;
}
modifier onlyOwnerOrAdmin {
require((owner() == msg.sender) || isAdmin[msg.sender], "Only owner or admin can call");
_;
}
function __Adminable_init() internal onlyInitializing {
__Ownable_init();
}
function setAdminPermission(address _user, bool _permission) external onlyOwner {
isAdmin[_user] = _permission;
emit SetAdminPermission(_user, _permission);
}
}
contracts/utils/RevertMessageParser.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
library RevertMessageParser {
function getRevertMessage(bytes memory _data, string memory _defaultMessage) internal pure returns (string memory) {
// If the _data length is less than 68, then the transaction failed silently (without a revert message)
if (_data.length < 68) return _defaultMessage;
assembly {
// Slice the sighash
_data := add(_data, 0x04)
}
return abi.decode(_data, (string));
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":2000,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"event","name":"LogChangeMPC","inputs":[{"type":"address","name":"oldMPC","internalType":"address","indexed":true},{"type":"address","name":"newMPC","internalType":"address","indexed":true},{"type":"uint256","name":"effectiveTime","internalType":"uint256","indexed":true},{"type":"uint256","name":"chainId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OracleRequest","inputs":[{"type":"address","name":"bridge","internalType":"address","indexed":false},{"type":"bytes","name":"callData","internalType":"bytes","indexed":false},{"type":"address","name":"receiveSide","internalType":"address","indexed":false},{"type":"address","name":"oppositeBridge","internalType":"address","indexed":false},{"type":"uint256","name":"chainId","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SetAdminPermission","inputs":[{"type":"address","name":"admin","internalType":"address","indexed":true},{"type":"bool","name":"permission","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"SetTransmitterStatus","inputs":[{"type":"address","name":"transmitter","internalType":"address","indexed":true},{"type":"bool","name":"status","internalType":"bool","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"changeMPC","inputs":[{"type":"address","name":"_newMPC","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"changeMPCSigned","inputs":[{"type":"address","name":"_newMPC","internalType":"address"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentChainId","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_mpc","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAdmin","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTransmitter","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"mpc","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"newMPC","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"newMPCEffectiveTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"oldMPC","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"receiveRequestV2","inputs":[{"type":"bytes","name":"_callData","internalType":"bytes"},{"type":"address","name":"_receiveSide","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"receiveRequestV2Signed","inputs":[{"type":"bytes","name":"_callData","internalType":"bytes"},{"type":"address","name":"_receiveSide","internalType":"address"},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAdminPermission","inputs":[{"type":"address","name":"_user","internalType":"address"},{"type":"bool","name":"_permission","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTransmitterStatus","inputs":[{"type":"address","name":"_transmitter","internalType":"address"},{"type":"bool","name":"_status","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transmitRequestV2","inputs":[{"type":"bytes","name":"_callData","internalType":"bytes"},{"type":"address","name":"_receiveSide","internalType":"address"},{"type":"address","name":"_oppositeBridge","internalType":"address"},{"type":"uint256","name":"_chainId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"withdrawFee","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50611969806100206000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80636fac3007116100cd578063c00f8a3d11610081578063f2fde38b11610066578063f2fde38b146102bf578063f75c2664146102d2578063f7f1baf0146102da57600080fd5b8063c00f8a3d14610299578063c4d66de8146102ac57600080fd5b806375f3974b116100b257806375f3974b1461026257806384d61c97146102755780638da5cb5b1461028857600080fd5b80636fac300714610237578063715018a61461025a57600080fd5b8063405fb4f7116101245780635b7b018c116101095780635b7b018c1461020b5780636cbadbfa1461021e5780636cebc9c21461022457600080fd5b8063405fb4f7146101c9578063474a245a146101e057600080fd5b80631095b6d71461015657806319117d931461017e57806324d7806c1461019357806338899935146101b6575b600080fd5b610169610164366004611465565b6102ed565b60405190151581526020015b60405180910390f35b61019161018c3660046114a1565b61038d565b005b6101696101a136600461144a565b60656020526000908152604090205460ff1681565b6101696101c43660046114d8565b610447565b6101d260685481565b604051908152602001610175565b6066546101f3906001600160a01b031681565b6040516001600160a01b039091168152602001610175565b61016961021936600461144a565b610526565b466101d2565b6101916102323660046115d3565b6105e1565b61016961024536600461144a565b60696020526000908152604090205460ff1681565b610191610685565b6101916102703660046114a1565b6106eb565b610191610283366004611639565b61079d565b6033546001600160a01b03166101f3565b6067546101f3906001600160a01b031681565b6101916102ba36600461144a565b610839565b6101916102cd36600461144a565b610970565b6101f3610a52565b6101916102e8366004611585565b610a7d565b6000336103026033546001600160a01b031690565b6001600160a01b0316148061032657503360009081526065602052604090205460ff165b6103775760405162461bcd60e51b815260206004820152601c60248201527f4f6e6c79206f776e6572206f722061646d696e2063616e2063616c6c0000000060448201526064015b60405180910390fd5b610382848484610aef565b5060015b9392505050565b6033546001600160a01b031633146103e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6001600160a01b038216600081815260696020908152604091829020805460ff191685151590811790915591519182527feeec8b4e2d317fc608f301f859237a6081b9813f150a3fcfb02fd54276c8be4091015b60405180910390a25050565b6040517f6368616e67654d5043000000000000000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606084811b8216602984015246603d84015230901b16605d82015260009060710160405160208183030381529060405280519060200120826104c86104c1610a52565b8383610c57565b6105145760405162461bcd60e51b815260206004820152601b60248201527f42726964676556323a20696e76616c6964207369676e61747572650000000000604482015260640161036e565b61051d85610e01565b95945050505050565b600033610531610a52565b6001600160a01b0316148061055f5750336105546033546001600160a01b031690565b6001600160a01b0316145b6105d05760405162461bcd60e51b8152602060048201526024808201527f42726964676556323a206f6e6c79206f776e6572206f72204d50432063616e2060448201527f63616c6c00000000000000000000000000000000000000000000000000000000606482015260840161036e565b6105d982610e01565b90505b919050565b3360009081526069602052604090205460ff166106405760405162461bcd60e51b815260206004820152601b60248201527f42726964676556323a206e6f742061207472616e736d69747465720000000000604482015260640161036e565b7f532dbb6d061eee97ab4370060f60ede10b3dc361cc1214c07ae5e34dd86e6aaf30858585856040516106779594939291906117cf565b60405180910390a150505050565b6033546001600160a01b031633146106df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6106e96000610ee6565b565b6033546001600160a01b031633146107455760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6001600160a01b038216600081815260656020908152604091829020805460ff191685151590811790915591519182527f0e7bea53cb2b3130dd1aac8d56b61cc8da7ebab0432e2d1622513523d848f2e7910161043b565b6040516107ba908490606085811b91469130901b90602001611763565b60405160208183030381529060405280519060200120816107dc6104c1610a52565b6108285760405162461bcd60e51b815260206004820152601b60248201527f42726964676556323a20696e76616c6964207369676e61747572650000000000604482015260640161036e565b6108328585610f45565b5050505050565b600054610100900460ff166108545760005460ff1615610858565b303b155b6108ca5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161036e565b600054610100900460ff1615801561090957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b610911611072565b6066805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905542606855801561096c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050565b6033546001600160a01b031633146109ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6001600160a01b038116610a465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161036e565b610a4f81610ee6565b50565b60006068544210610a6d57506066546001600160a01b031690565b506067546001600160a01b031690565b610a85610a52565b6001600160a01b0316336001600160a01b031614610ae55760405162461bcd60e51b815260206004820152601360248201527f42726964676556323a20666f7262696464656e00000000000000000000000000604482015260640161036e565b61096c8282610f45565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691610b799190611747565b6000604051808303816000865af19150503d8060008114610bb6576040519150601f19603f3d011682016040523d82523d6000602084013e610bbb565b606091505b5091509150818015610be5575080511580610be5575080806020019051810190610be59190611526565b6108325760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161036e565b6000806000610c6685856110ff565b90925090506000816004811115610c7f57610c7f6118c7565b148015610c9d5750856001600160a01b0316826001600160a01b0316145b15610cad57600192505050610386565b600080876001600160a01b0316631626ba7e60e01b8888604051602401610cd592919061180e565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610d409190611747565b600060405180830381855afa9150503d8060008114610d7b576040519150601f19603f3d011682016040523d82523d6000602084013e610d80565b606091505b5091509150818015610d93575080516020145b8015610df5575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090610dd19083016020908101908401611543565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60006001600160a01b038216610e595760405162461bcd60e51b815260206004820152601660248201527f42726964676556323a2061646472657373283078302900000000000000000000604482015260640161036e565b610e61610a52565b606780546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff19918216811790925560668054938616939091168317905542606881905591907fcda32bc39904597666dfa9f9c845714756e1ffffad55b52e0d344673a2198121610ecd4690565b60405190815260200160405180910390a4506001919050565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811660009081526069602052604090205460ff16610fad5760405162461bcd60e51b815260206004820152601f60248201527f42726964676556323a20756e74727573746564207472616e736d697474657200604482015260640161036e565b600080826001600160a01b031684604051610fc89190611747565b6000604051808303816000865af19150503d8060008114611005576040519150601f19603f3d011682016040523d82523d6000602084013e61100a565b606091505b50915091508161106c57611053816040518060400160405280601581526020017f42726964676556323a2063616c6c206661696c6564000000000000000000000081525061116f565b60405162461bcd60e51b815260040161036e919061182f565b50505050565b600054610100900460ff166110ef5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161036e565b6110f76111a5565b6106e9611222565b6000808251604114156111365760208301516040840151606085015160001a61112a878285856112a8565b94509450505050611168565b8251604014156111605760208301516040840151611155868383611395565b935093505050611168565b506000905060025b9250929050565b606060448351101561118257508061119f565b6004830192508280602001905181019061119c91906116ad565b90505b92915050565b600054610100900460ff166106e95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161036e565b600054610100900460ff1661129f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161036e565b6106e933610ee6565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156112df575060009050600361138c565b8460ff16601b141580156112f757508460ff16601c14155b15611308575060009050600461138c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561135c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113855760006001925092505061138c565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016113cf878288856112a8565b935093505050935093915050565b80356001600160a01b03811681146105dc57600080fd5b600082601f83011261140557600080fd5b813561141861141382611873565b611842565b81815284602083860101111561142d57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561145c57600080fd5b61119c826113dd565b60008060006060848603121561147a57600080fd5b611483846113dd565b9250611491602085016113dd565b9150604084013590509250925092565b600080604083850312156114b457600080fd5b6114bd836113dd565b915060208301356114cd81611925565b809150509250929050565b600080604083850312156114eb57600080fd5b6114f4836113dd565b9150602083013567ffffffffffffffff81111561151057600080fd5b61151c858286016113f4565b9150509250929050565b60006020828403121561153857600080fd5b815161038681611925565b60006020828403121561155557600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461038657600080fd5b6000806040838503121561159857600080fd5b823567ffffffffffffffff8111156115af57600080fd5b6115bb858286016113f4565b9250506115ca602084016113dd565b90509250929050565b600080600080608085870312156115e957600080fd5b843567ffffffffffffffff81111561160057600080fd5b61160c878288016113f4565b94505061161b602086016113dd565b9250611629604086016113dd565b9396929550929360600135925050565b60008060006060848603121561164e57600080fd5b833567ffffffffffffffff8082111561166657600080fd5b611672878388016113f4565b9450611680602087016113dd565b9350604086013591508082111561169657600080fd5b506116a3868287016113f4565b9150509250925092565b6000602082840312156116bf57600080fd5b815167ffffffffffffffff8111156116d657600080fd5b8201601f810184136116e757600080fd5b80516116f561141382611873565b81815285602083850101111561170a57600080fd5b61051d82602083016020860161189b565b6000815180845261173381602086016020860161189b565b601f01601f19169290920160200192915050565b6000825161175981846020870161189b565b9190910192915050565b7f726563656976655265717565737456320000000000000000000000000000000081526000855161179b816010850160208a0161189b565b6bffffffffffffffffffffffff19958616601093909101928301525060248101929092529091166044820152605801919050565b60006001600160a01b03808816835260a060208401526117f260a084018861171b565b9581166040840152939093166060820152608001525092915050565b828152604060208201526000611827604083018461171b565b949350505050565b60208152600061119c602083018461171b565b604051601f8201601f1916810167ffffffffffffffff8111828210171561186b5761186b6118f6565b604052919050565b600067ffffffffffffffff82111561188d5761188d6118f6565b50601f01601f191660200190565b60005b838110156118b657818101518382015260200161189e565b8381111561106c5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610a4f57600080fdfea264697066735822122057711c626814ddd47a6259f319706fb9b4731630f0016ca88b247e99db3f45de64736f6c63430008070033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101515760003560e01c80636fac3007116100cd578063c00f8a3d11610081578063f2fde38b11610066578063f2fde38b146102bf578063f75c2664146102d2578063f7f1baf0146102da57600080fd5b8063c00f8a3d14610299578063c4d66de8146102ac57600080fd5b806375f3974b116100b257806375f3974b1461026257806384d61c97146102755780638da5cb5b1461028857600080fd5b80636fac300714610237578063715018a61461025a57600080fd5b8063405fb4f7116101245780635b7b018c116101095780635b7b018c1461020b5780636cbadbfa1461021e5780636cebc9c21461022457600080fd5b8063405fb4f7146101c9578063474a245a146101e057600080fd5b80631095b6d71461015657806319117d931461017e57806324d7806c1461019357806338899935146101b6575b600080fd5b610169610164366004611465565b6102ed565b60405190151581526020015b60405180910390f35b61019161018c3660046114a1565b61038d565b005b6101696101a136600461144a565b60656020526000908152604090205460ff1681565b6101696101c43660046114d8565b610447565b6101d260685481565b604051908152602001610175565b6066546101f3906001600160a01b031681565b6040516001600160a01b039091168152602001610175565b61016961021936600461144a565b610526565b466101d2565b6101916102323660046115d3565b6105e1565b61016961024536600461144a565b60696020526000908152604090205460ff1681565b610191610685565b6101916102703660046114a1565b6106eb565b610191610283366004611639565b61079d565b6033546001600160a01b03166101f3565b6067546101f3906001600160a01b031681565b6101916102ba36600461144a565b610839565b6101916102cd36600461144a565b610970565b6101f3610a52565b6101916102e8366004611585565b610a7d565b6000336103026033546001600160a01b031690565b6001600160a01b0316148061032657503360009081526065602052604090205460ff165b6103775760405162461bcd60e51b815260206004820152601c60248201527f4f6e6c79206f776e6572206f722061646d696e2063616e2063616c6c0000000060448201526064015b60405180910390fd5b610382848484610aef565b5060015b9392505050565b6033546001600160a01b031633146103e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6001600160a01b038216600081815260696020908152604091829020805460ff191685151590811790915591519182527feeec8b4e2d317fc608f301f859237a6081b9813f150a3fcfb02fd54276c8be4091015b60405180910390a25050565b6040517f6368616e67654d5043000000000000000000000000000000000000000000000060208201526bffffffffffffffffffffffff19606084811b8216602984015246603d84015230901b16605d82015260009060710160405160208183030381529060405280519060200120826104c86104c1610a52565b8383610c57565b6105145760405162461bcd60e51b815260206004820152601b60248201527f42726964676556323a20696e76616c6964207369676e61747572650000000000604482015260640161036e565b61051d85610e01565b95945050505050565b600033610531610a52565b6001600160a01b0316148061055f5750336105546033546001600160a01b031690565b6001600160a01b0316145b6105d05760405162461bcd60e51b8152602060048201526024808201527f42726964676556323a206f6e6c79206f776e6572206f72204d50432063616e2060448201527f63616c6c00000000000000000000000000000000000000000000000000000000606482015260840161036e565b6105d982610e01565b90505b919050565b3360009081526069602052604090205460ff166106405760405162461bcd60e51b815260206004820152601b60248201527f42726964676556323a206e6f742061207472616e736d69747465720000000000604482015260640161036e565b7f532dbb6d061eee97ab4370060f60ede10b3dc361cc1214c07ae5e34dd86e6aaf30858585856040516106779594939291906117cf565b60405180910390a150505050565b6033546001600160a01b031633146106df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6106e96000610ee6565b565b6033546001600160a01b031633146107455760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6001600160a01b038216600081815260656020908152604091829020805460ff191685151590811790915591519182527f0e7bea53cb2b3130dd1aac8d56b61cc8da7ebab0432e2d1622513523d848f2e7910161043b565b6040516107ba908490606085811b91469130901b90602001611763565b60405160208183030381529060405280519060200120816107dc6104c1610a52565b6108285760405162461bcd60e51b815260206004820152601b60248201527f42726964676556323a20696e76616c6964207369676e61747572650000000000604482015260640161036e565b6108328585610f45565b5050505050565b600054610100900460ff166108545760005460ff1615610858565b303b155b6108ca5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161036e565b600054610100900460ff1615801561090957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b610911611072565b6066805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841617905542606855801561096c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050565b6033546001600160a01b031633146109ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036e565b6001600160a01b038116610a465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161036e565b610a4f81610ee6565b50565b60006068544210610a6d57506066546001600160a01b031690565b506067546001600160a01b031690565b610a85610a52565b6001600160a01b0316336001600160a01b031614610ae55760405162461bcd60e51b815260206004820152601360248201527f42726964676556323a20666f7262696464656e00000000000000000000000000604482015260640161036e565b61096c8282610f45565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691610b799190611747565b6000604051808303816000865af19150503d8060008114610bb6576040519150601f19603f3d011682016040523d82523d6000602084013e610bbb565b606091505b5091509150818015610be5575080511580610be5575080806020019051810190610be59190611526565b6108325760405162461bcd60e51b815260206004820152602d60248201527f5472616e7366657248656c7065723a3a736166655472616e736665723a20747260448201527f616e73666572206661696c656400000000000000000000000000000000000000606482015260840161036e565b6000806000610c6685856110ff565b90925090506000816004811115610c7f57610c7f6118c7565b148015610c9d5750856001600160a01b0316826001600160a01b0316145b15610cad57600192505050610386565b600080876001600160a01b0316631626ba7e60e01b8888604051602401610cd592919061180e565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610d409190611747565b600060405180830381855afa9150503d8060008114610d7b576040519150601f19603f3d011682016040523d82523d6000602084013e610d80565b606091505b5091509150818015610d93575080516020145b8015610df5575080517f1626ba7e0000000000000000000000000000000000000000000000000000000090610dd19083016020908101908401611543565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b60006001600160a01b038216610e595760405162461bcd60e51b815260206004820152601660248201527f42726964676556323a2061646472657373283078302900000000000000000000604482015260640161036e565b610e61610a52565b606780546001600160a01b0392831673ffffffffffffffffffffffffffffffffffffffff19918216811790925560668054938616939091168317905542606881905591907fcda32bc39904597666dfa9f9c845714756e1ffffad55b52e0d344673a2198121610ecd4690565b60405190815260200160405180910390a4506001919050565b603380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811660009081526069602052604090205460ff16610fad5760405162461bcd60e51b815260206004820152601f60248201527f42726964676556323a20756e74727573746564207472616e736d697474657200604482015260640161036e565b600080826001600160a01b031684604051610fc89190611747565b6000604051808303816000865af19150503d8060008114611005576040519150601f19603f3d011682016040523d82523d6000602084013e61100a565b606091505b50915091508161106c57611053816040518060400160405280601581526020017f42726964676556323a2063616c6c206661696c6564000000000000000000000081525061116f565b60405162461bcd60e51b815260040161036e919061182f565b50505050565b600054610100900460ff166110ef5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161036e565b6110f76111a5565b6106e9611222565b6000808251604114156111365760208301516040840151606085015160001a61112a878285856112a8565b94509450505050611168565b8251604014156111605760208301516040840151611155868383611395565b935093505050611168565b506000905060025b9250929050565b606060448351101561118257508061119f565b6004830192508280602001905181019061119c91906116ad565b90505b92915050565b600054610100900460ff166106e95760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161036e565b600054610100900460ff1661129f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840161036e565b6106e933610ee6565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156112df575060009050600361138c565b8460ff16601b141580156112f757508460ff16601c14155b15611308575060009050600461138c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561135c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166113855760006001925092505061138c565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016113cf878288856112a8565b935093505050935093915050565b80356001600160a01b03811681146105dc57600080fd5b600082601f83011261140557600080fd5b813561141861141382611873565b611842565b81815284602083860101111561142d57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561145c57600080fd5b61119c826113dd565b60008060006060848603121561147a57600080fd5b611483846113dd565b9250611491602085016113dd565b9150604084013590509250925092565b600080604083850312156114b457600080fd5b6114bd836113dd565b915060208301356114cd81611925565b809150509250929050565b600080604083850312156114eb57600080fd5b6114f4836113dd565b9150602083013567ffffffffffffffff81111561151057600080fd5b61151c858286016113f4565b9150509250929050565b60006020828403121561153857600080fd5b815161038681611925565b60006020828403121561155557600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461038657600080fd5b6000806040838503121561159857600080fd5b823567ffffffffffffffff8111156115af57600080fd5b6115bb858286016113f4565b9250506115ca602084016113dd565b90509250929050565b600080600080608085870312156115e957600080fd5b843567ffffffffffffffff81111561160057600080fd5b61160c878288016113f4565b94505061161b602086016113dd565b9250611629604086016113dd565b9396929550929360600135925050565b60008060006060848603121561164e57600080fd5b833567ffffffffffffffff8082111561166657600080fd5b611672878388016113f4565b9450611680602087016113dd565b9350604086013591508082111561169657600080fd5b506116a3868287016113f4565b9150509250925092565b6000602082840312156116bf57600080fd5b815167ffffffffffffffff8111156116d657600080fd5b8201601f810184136116e757600080fd5b80516116f561141382611873565b81815285602083850101111561170a57600080fd5b61051d82602083016020860161189b565b6000815180845261173381602086016020860161189b565b601f01601f19169290920160200192915050565b6000825161175981846020870161189b565b9190910192915050565b7f726563656976655265717565737456320000000000000000000000000000000081526000855161179b816010850160208a0161189b565b6bffffffffffffffffffffffff19958616601093909101928301525060248101929092529091166044820152605801919050565b60006001600160a01b03808816835260a060208401526117f260a084018861171b565b9581166040840152939093166060820152608001525092915050565b828152604060208201526000611827604083018461171b565b949350505050565b60208152600061119c602083018461171b565b604051601f8201601f1916810167ffffffffffffffff8111828210171561186b5761186b6118f6565b604052919050565b600067ffffffffffffffff82111561188d5761188d6118f6565b50601f01601f191660200190565b60005b838110156118b657818101518382015260200161189e565b8381111561106c5750506000910152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610a4f57600080fdfea264697066735822122057711c626814ddd47a6259f319706fb9b4731630f0016ca88b247e99db3f45de64736f6c63430008070033