Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
DeBridgeRouter
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 999999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "./DeBridgeRouterBase.sol";
import {IDlnDestination} from "./interfaces/IDlnDestination.sol";
import "./libraries/Permit.sol";
import "./libraries/SignatureUtil.sol";
contract DeBridgeRouter is DeBridgeRouterBase {
using SafeERC20Upgradeable for IERC20Upgradeable;
using SignatureUtil for bytes;
address public constant NATIVE_TOKEN = address(0);
address public deBridgeGate;
mapping(address => bool) public supportedRouters;
/* ========== Events ========== */
event SupportedRouter(address srcSwapRouter, bool isSupported);
event SwapExecuted(
address router,
address tokenIn,
uint256 amountIn,
address tokenOut,
uint256 amountOut
);
event Refund(address token, uint256 amount, address recipient);
/* ========== ERRORS ========== */
// swap router didn't put target tokens on this (forwarder's) address
error SwapEmptyResult(address srcTokenOut);
error SwapFailed(address srcRouter);
error NotEnoughSrcFundsIn(uint256 amount);
error NotSupportedRouter();
error CallFailed(address target, bytes data);
error CallCausedBalanceDiscrepancy(
address target,
address token,
uint256 expectedBalance,
uint256 actualBalance
);
/* ========== STRUCTS ========== */
struct SwapDetails {
/// @dev address of a router to call to swap token
address swapRouter;
/// @dev calldata for the router
bytes swapCalldata;
/// @dev address of an outcome token of a swap described in swapCalladata
address tokenOut;
/// @dev expected outcome of a swap
uint256 tokenOutExpectedAmount;
/// @dev remainder of swap outcome (which lefts after subtracting tokenOutExpectedAmount and tokenOutMaxExcessiveAmount
/// from the swap outcome)
address tokenOutRefundRecipient;
}
/* ========== INITIALIZERS ========== */
function initialize(address _deBridgeGate) external initializer {
DeBridgeRouterBase._initializeBase();
deBridgeGate = _deBridgeGate;
}
/* ========== PUBLIC METHODS ========== */
/// @dev Performs swap against arbitrary input token, refunds excessive outcome of such swap (if any),
/// and calls the specified receiver supplying the outcome of the swap
/// @param _srcTokenIn arbitrary input token to swap from
/// @param _srcAmountIn amount of input token to swap
/// @param _srcTokenInPermitEnvelope optional permit envelope to grab the token from the caller. bytes (amount + deadline + signature)
/// @param _swapDetails details on how to deal with swap outcome
/// @param _target DLN contract to call after successful swap
/// @param _targetData calldata to call against _target
/// @param _orderId Id of an order to be fulfilled
function strictlySwapAndCallDln(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermitEnvelope,
SwapDetails calldata _swapDetails,
address _target,
bytes calldata _targetData,
bytes32 _orderId
) external payable {
// check order status as early as possible to safe gas: DLN market is highly concurrent, and txns attempting
// to fulfill the same order may occur in the same block
// _target is checked later when invoking _callCustom()
{
(
uint8 status /*address takerAddress*/ /*uint256 giveChainId*/,
,
) = IDlnDestination(_target).takeOrders(_orderId);
// use require() instead of custom error because string error gives more clarity:
// it is shown on Etherscan as well as on Tenderly
require(status == 0, "ORDER_FULFILLED_OR_CANCELLED");
}
_strictlySwapAndCall(
_srcTokenIn,
_srcAmountIn,
_srcTokenInPermitEnvelope,
_swapDetails.swapRouter,
_swapDetails.swapCalldata,
_swapDetails.tokenOut,
_swapDetails.tokenOutExpectedAmount,
_swapDetails.tokenOutRefundRecipient,
_target,
_targetData
);
}
/// @dev Performs swap against arbitrary input token, refunds excessive outcome of such swap (if any),
/// and calls the specified receiver supplying the outcome of the swap
/// @param _srcTokenIn arbitrary input token to swap from
/// @param _srcAmountIn amount of input token to swap
/// @param _srcTokenInPermitEnvelope optional permit envelope to grab the token from the caller. bytes (amount + deadline + signature)
/// @param _srcSwapRouter contract to call that performs swap from the input token to the output token
/// @param _srcSwapCalldata calldata to call against _srcSwapRouter
/// @param _srcTokenOut arbitrary output token to swap to
/// @param _srcTokenExpectedAmountOut minimum acceptable outcome of the swap to provide to _target
/// @param _srcTokenRefundRecipient address to send excessive outcome of the swap
/// @param _target contract to call after successful swap
/// @param _targetData calldata to call against _target
function strictlySwapAndCall(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermitEnvelope,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut,
uint256 _srcTokenExpectedAmountOut,
address _srcTokenRefundRecipient,
address _target,
bytes calldata _targetData
) external payable {
_strictlySwapAndCall(
_srcTokenIn,
_srcAmountIn,
_srcTokenInPermitEnvelope,
_srcSwapRouter,
_srcSwapCalldata,
_srcTokenOut,
_srcTokenExpectedAmountOut,
_srcTokenRefundRecipient,
_target,
_targetData
);
}
function simulateSwap(
address _srcTokenIn,
uint256 _srcAmountIn,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut
) external payable returns (uint256 srcAmountOut) {
_obtainSrcTokenIn(_srcTokenIn, _srcAmountIn, "");
(srcAmountOut, ) = _performSwap(
_srcTokenIn,
_srcAmountIn,
msg.value,
_srcSwapRouter,
_srcSwapCalldata,
_srcTokenOut
);
}
/* ========== INTERNAL METHODS ========== */
function _strictlySwapAndCall(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermitEnvelope,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut,
uint256 _srcTokenExpectedAmountOut,
address _srcTokenRefundRecipient,
address _target,
bytes calldata _targetData
) internal {
//
// pull the srcInToken from msg.sender
//
_obtainSrcTokenIn(_srcTokenIn, _srcAmountIn, _srcTokenInPermitEnvelope);
//
// swap srcInToken to srcOutToken
//
(uint256 srcAmountOut, uint256 msgValueAfterSwap) = _performSwap(
_srcTokenIn,
_srcAmountIn,
msg.value,
_srcSwapRouter,
_srcSwapCalldata,
_srcTokenOut
);
//
// refund excessive srcTokenOut
//
if (_srcTokenExpectedAmountOut > srcAmountOut) {
// swap returned less than expected - revert the whole txn
revert NotEnoughSrcFundsIn(_srcTokenExpectedAmountOut);
} else if (_srcTokenExpectedAmountOut < srcAmountOut) {
// swap returned more than expected - refund
uint256 refundAmount = srcAmountOut - _srcTokenExpectedAmountOut;
// for native token - don't forget to decrease msg.value
if (_srcTokenOut == NATIVE_TOKEN) {
_safeTransferETH(_srcTokenRefundRecipient, refundAmount);
msgValueAfterSwap -= refundAmount;
} else {
IERC20Upgradeable(_srcTokenOut).safeTransfer(
_srcTokenRefundRecipient,
refundAmount
);
}
emit Refund(_srcTokenOut, refundAmount, _srcTokenRefundRecipient);
}
//
// do the target call
//
_performTargetCall(
_target,
_targetData,
msgValueAfterSwap,
_srcTokenOut,
_srcTokenExpectedAmountOut
);
}
function _performTargetCall(
address _target,
bytes calldata _targetData,
uint256 _targetValue,
address _srcTokenOut,
uint256 _srcAmountOut
) internal {
// we check both native and erc-20 balance before the call
// For sure, we can use only one call of _getBalance, but we still must be
// sure that native currency has the correct accounting after the call
// where erc-20 was used
uint256 tokenBalanceBeforeCall = _getBalance(_srcTokenOut);
uint256 balanceBeforeCall = _getBalance(address(0));
// do the call
if (_srcTokenOut != NATIVE_TOKEN) {
_lazyApprove(_srcTokenOut, _target, _srcAmountOut);
}
_callCustom(_target, _targetData, _targetValue);
// check balances
uint256 tokenBalanceAfterCall = _getBalance(_srcTokenOut);
uint256 balanceAfterCall = _getBalance(address(0));
// ensure _target has pulled all tokens from this contract
if ((tokenBalanceBeforeCall - tokenBalanceAfterCall) < _srcAmountOut) {
revert CallCausedBalanceDiscrepancy(
_target,
_srcTokenOut,
tokenBalanceBeforeCall - _srcAmountOut,
tokenBalanceBeforeCall - tokenBalanceAfterCall
);
}
if ((balanceBeforeCall - balanceAfterCall) < _targetValue) {
revert CallCausedBalanceDiscrepancy(
_target,
address(0),
tokenBalanceBeforeCall - _targetValue,
balanceBeforeCall - balanceAfterCall
);
}
}
function _getBalance(address _token) internal view returns (uint256) {
if (_token == NATIVE_TOKEN) {
return payable(this).balance;
} else {
return IERC20Upgradeable(_token).balanceOf(address(this));
}
}
function _obtainSrcTokenIn(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermitEnvelope
) internal {
if (_srcTokenIn == NATIVE_TOKEN) {
// TODO check that msg.value = srcAmountIn + globalFixedNativeFee,
if (address(this).balance < _srcAmountIn)
revert NotEnoughSrcFundsIn(_srcAmountIn);
} else {
uint256 srcAmountCleared = _collectSrcERC20In(
IERC20Upgradeable(_srcTokenIn),
_srcAmountIn,
_srcTokenInPermitEnvelope
);
if (srcAmountCleared < _srcAmountIn)
revert NotEnoughSrcFundsIn(_srcAmountIn);
}
}
function _performSwap(
address _srcTokenIn,
uint256 _srcAmountIn,
uint256 _msgValue,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut
) internal returns (uint256 srcAmountOut, uint256 msgValueAfterSwap) {
if (!supportedRouters[_srcSwapRouter]) revert NotSupportedRouter();
uint256 ethBalanceBefore = address(this).balance - _msgValue;
if (_srcTokenIn == NATIVE_TOKEN) {
srcAmountOut = _swapToERC20Via(
_srcSwapRouter,
_srcSwapCalldata,
_srcAmountIn,
IERC20Upgradeable(_srcTokenOut)
);
} else {
_lazyApprove(_srcTokenIn, _srcSwapRouter, _srcAmountIn);
if (_srcTokenOut == NATIVE_TOKEN) {
srcAmountOut = _swapToETHVia(_srcSwapRouter, _srcSwapCalldata);
} else {
srcAmountOut = _swapToERC20Via(
_srcSwapRouter,
_srcSwapCalldata,
0 /*value*/,
IERC20Upgradeable(_srcTokenOut)
);
}
}
emit SwapExecuted(
_srcSwapRouter,
_srcTokenIn,
_srcAmountIn,
_srcTokenOut,
srcAmountOut
);
msgValueAfterSwap = address(this).balance - ethBalanceBefore;
}
function _collectSrcERC20In(
IERC20Upgradeable _token,
uint256 _amount,
bytes memory _permitEnvelope
) internal returns (uint256) {
uint256 balanceBefore = _token.balanceOf(address(this));
Permit.executePermit(address(_token), _permitEnvelope);
_token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 balanceAfter = _token.balanceOf(address(this));
if (!(balanceAfter > balanceBefore))
revert NotEnoughSrcFundsIn(_amount);
return (balanceAfter - balanceBefore);
}
function _swapToETHVia(
address _router,
bytes calldata _calldata
) internal returns (uint256) {
uint256 balanceBefore = address(this).balance;
_callCustom(_router, _calldata, 0);
uint256 balanceAfter = address(this).balance;
if (balanceBefore >= balanceAfter) revert SwapEmptyResult(address(0));
uint256 swapDstTokenBalance = balanceAfter - balanceBefore;
return swapDstTokenBalance;
}
function _swapToERC20Via(
address _router,
bytes calldata _calldata,
uint256 _msgValue,
IERC20Upgradeable _targetToken
) internal returns (uint256) {
uint256 balanceBefore = _targetToken.balanceOf(address(this));
_callCustom(_router, _calldata, _msgValue);
uint256 balanceAfter = _targetToken.balanceOf(address(this));
if (balanceBefore >= balanceAfter)
revert SwapEmptyResult(address(_targetToken));
uint256 swapDstTokenBalance = balanceAfter - balanceBefore;
return swapDstTokenBalance;
}
function _lazyApprove(
address _tokenAddress,
address _spender,
uint256 _amount
) internal {
IERC20Upgradeable token = IERC20Upgradeable(_tokenAddress);
uint256 currentAllowance = token.allowance(address(this), _spender);
if (currentAllowance < _amount) {
// if an approval was issued before
token.safeApprove(_spender, 0);
// create permanent approve
token.safeApprove(_spender, type(uint256).max);
}
}
function _callCustom(
address _to,
bytes calldata _data,
uint256 _msgValue
) internal {
if (!supportedRouters[_to]) revert NotSupportedRouter();
(bool success, bytes memory returnData) = _to.call{value: _msgValue}(
_data
);
if (!success) {
revert CallFailed(_to, returnData);
}
}
// ============ ADM ============
function updateSupportedRouter(
address _srcSwapRouter,
bool _isSupported
) external onlyAdmin {
supportedRouters[_srcSwapRouter] = _isSupported;
emit SupportedRouter(_srcSwapRouter, _isSupported);
}
function rescueFunds(
address token,
address recipient,
uint256 amount
) external onlyAdmin {
if (token == NATIVE_TOKEN) {
_safeTransferETH(recipient, amount);
} else {
IERC20Upgradeable(token).safeTransfer(recipient, amount);
}
}
// ============ Version Control ============
/// @dev Get this contract's version
function version() external pure returns (uint256) {
return 300; // 3.0.0
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @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[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
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 proxied contracts do not make use of 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.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* 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 prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_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 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_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() {
require(_initializing, "Initializable: contract is 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 {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
using AddressUpgradeable for address;
function safeTransfer(
IERC20Upgradeable token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20Upgradeable 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(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// 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 {
}
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;
}
/**
* @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[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @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[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract DeBridgeRouterBase is Initializable, AccessControlUpgradeable {
/* ========== ERRORS ========== */
error EthTransferFailed();
error AdminBadRole();
/* ========== MODIFIERS ========== */
modifier onlyAdmin() {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert AdminBadRole();
_;
}
/* ========== INITIALIZERS ========== */
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function _initializeBase() internal initializer {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
function _externalCall(
address _destination,
bytes memory _data,
uint256 _value
) internal returns (bool result) {
assembly {
result := call(
gas(),
_destination,
_value,
add(_data, 0x20),
mload(_data),
0,
0
)
}
}
/*
* @dev transfer ETH to an address, revert if it fails.
* @param to recipient of the transfer
* @param value the amount to send
*/
function _safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
if (!success) revert EthTransferFailed();
}
receive() external payable {}
}// SPDX-License-Identifier: UNLICENSED
// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.6. SEE SOURCE BELOW. !!
pragma solidity ^0.8.4;
interface IDlnDestination {
function takeOrders(
bytes32
)
external
view
returns (uint8 status, address takerAddress, uint256 giveChainId);
}
// THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON:
/*
[{"inputs":[],"name":"AdminBadRole","type":"error"},{"inputs":[{"internalType":"bytes","name":"expectedBeneficiary","type":"bytes"}],"name":"AllowOnlyForBeneficiary","type":"error"},{"inputs":[],"name":"CallProxyBadRole","type":"error"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[],"name":"ExternalCallIsBlocked","type":"error"},{"inputs":[],"name":"GovMonitoringBadRole","type":"error"},{"inputs":[],"name":"IncorrectOrderStatus","type":"error"},{"inputs":[],"name":"MismatchGiveChainId","type":"error"},{"inputs":[],"name":"MismatchNativeTakerAmount","type":"error"},{"inputs":[],"name":"MismatchTakerAmount","type":"error"},{"inputs":[],"name":"MismatchedOrderId","type":"error"},{"inputs":[],"name":"MismatchedTransferAmount","type":"error"},{"inputs":[{"internalType":"bytes","name":"nativeSender","type":"bytes"},{"internalType":"uint256","name":"chainIdFrom","type":"uint256"}],"name":"NativeSenderBadRole","type":"error"},{"inputs":[],"name":"NotSupportedDstChain","type":"error"},{"inputs":[],"name":"ProposedFeeTooHigh","type":"error"},{"inputs":[],"name":"SignatureInvalidV","type":"error"},{"inputs":[],"name":"TheSameFromTo","type":"error"},{"inputs":[],"name":"TransferAmountNotCoverFees","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnexpectedBatchSize","type":"error"},{"inputs":[],"name":"UnknownEngine","type":"error"},{"inputs":[],"name":"WrongAddressLength","type":"error"},{"inputs":[],"name":"WrongArgument","type":"error"},{"inputs":[],"name":"WrongAutoArgument","type":"error"},{"inputs":[],"name":"WrongChain","type":"error"},{"inputs":[],"name":"WrongToken","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"orderTakeFinalAmount","type":"uint256"}],"name":"DecreasedTakeAmount","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"indexed":false,"internalType":"struct DlnBase.Order","name":"order","type":"tuple"},{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"unlockAuthority","type":"address"}],"name":"FulfilledOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"indexed":false,"internalType":"struct DlnBase.Order","name":"order","type":"tuple"},{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"cancelBeneficiary","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"submissionId","type":"bytes32"}],"name":"SentOrderCancel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"beneficiary","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"submissionId","type":"bytes32"}],"name":"SentOrderUnlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"chainIdFrom","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"dlnSourceAddress","type":"bytes"},{"indexed":false,"internalType":"enum DlnBase.ChainEngine","name":"chainEngine","type":"uint8"}],"name":"SetDlnSourceAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BPS_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EVM_ADDRESS_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVMONITORING_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ADDRESS_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ORDER_COUNT_PER_BATCH_EVM_UNLOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_AMOUNT_DIVIDER_FOR_TRANSFER_TO_SOLANA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOLANA_ADDRESS_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SOLANA_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainEngines","outputs":[{"internalType":"enum DlnBase.ChainEngine","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deBridgeGate","outputs":[{"internalType":"contract IDeBridgeGate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dlnSourceAddresses","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"internalType":"struct DlnBase.Order","name":"_order","type":"tuple"},{"internalType":"uint256","name":"_fulFillAmount","type":"uint256"},{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"bytes","name":"_permitEnvelope","type":"bytes"},{"internalType":"address","name":"_unlockAuthority","type":"address"}],"name":"fulfillOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"cid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"internalType":"struct DlnBase.Order","name":"_order","type":"tuple"}],"name":"getOrderId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDeBridgeGate","name":"_deBridgeGate","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"internalType":"struct DlnBase.Order","name":"_order","type":"tuple"},{"internalType":"uint256","name":"_newSubtrahend","type":"uint256"}],"name":"patchOrderTake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_orderIds","type":"bytes32[]"},{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_executionFee","type":"uint256"}],"name":"sendBatchEvmUnlock","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"internalType":"struct DlnBase.Order","name":"_order","type":"tuple"},{"internalType":"address","name":"_cancelBeneficiary","type":"address"},{"internalType":"uint256","name":"_executionFee","type":"uint256"}],"name":"sendEvmOrderCancel","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_orderId","type":"bytes32"},{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_executionFee","type":"uint256"}],"name":"sendEvmUnlock","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"internalType":"struct DlnBase.Order","name":"_order","type":"tuple"},{"internalType":"bytes32","name":"_cancelBeneficiary","type":"bytes32"},{"internalType":"uint256","name":"_executionFee","type":"uint256"},{"internalType":"uint64","name":"_reward1","type":"uint64"},{"internalType":"uint64","name":"_reward2","type":"uint64"}],"name":"sendSolanaOrderCancel","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"makerOrderNonce","type":"uint64"},{"internalType":"bytes","name":"makerSrc","type":"bytes"},{"internalType":"uint256","name":"giveChainId","type":"uint256"},{"internalType":"bytes","name":"giveTokenAddress","type":"bytes"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"bytes","name":"givePatchAuthoritySrc","type":"bytes"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"}],"internalType":"struct DlnBase.Order","name":"_order","type":"tuple"},{"internalType":"bytes32","name":"_beneficiary","type":"bytes32"},{"internalType":"uint256","name":"_executionFee","type":"uint256"},{"internalType":"uint64","name":"_solanaExternalCallReward1","type":"uint64"},{"internalType":"uint64","name":"_solanaExternalCallReward2","type":"uint64"}],"name":"sendSolanaUnlock","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainIdFrom","type":"uint256"},{"internalType":"bytes","name":"_dlnSourceAddress","type":"bytes"},{"internalType":"enum DlnBase.ChainEngine","name":"_chainEngine","type":"uint8"}],"name":"setDlnSourceAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"takeOrders","outputs":[{"internalType":"enum DlnDestination.OrderTakeStatus","name":"status","type":"uint8"},{"internalType":"address","name":"takerAddress","type":"address"},{"internalType":"uint256","name":"giveChainId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"takePatches","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]
*/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./SignatureUtil.sol";
library Permit {
using SignatureUtil for bytes;
function executePermit(
address _tokenAddress,
bytes memory _permitEnvelope
) internal {
if (_permitEnvelope.length > 0) {
uint256 permitAmount = _permitEnvelope.toUint256(0);
uint256 deadline = _permitEnvelope.toUint256(32);
(bytes32 r, bytes32 s, uint8 v) = _permitEnvelope.parseSignature(
64
);
try
IERC20Permit(_tokenAddress).permit(
msg.sender,
address(this),
permitAmount,
deadline,
v,
r,
s
)
{
return;
} catch {
if (
IERC20(_tokenAddress).allowance(
msg.sender,
address(this)
) >= permitAmount
) {
return;
}
}
revert("Permit failure");
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
library SignatureUtil {
/* ========== ERRORS ========== */
error WrongArgumentLength();
error SignatureInvalidLength();
error SignatureInvalidV();
/// @dev Prepares raw msg that was signed by the oracle.
/// @param _submissionId Submission identifier.
function getUnsignedMsg(
bytes32 _submissionId
) internal pure returns (bytes32) {
return
keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
_submissionId
)
);
}
/// @dev Splits signature bytes to r,s,v components.
/// @param _signature Signature bytes in format r+s+v.
function splitSignature(
bytes memory _signature
) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
if (_signature.length != 65) revert SignatureInvalidLength();
return parseSignature(_signature, 0);
}
function parseSignature(
bytes memory _signatures,
uint256 offset
) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
assembly {
r := mload(add(_signatures, add(32, offset)))
s := mload(add(_signatures, add(64, offset)))
v := and(mload(add(_signatures, add(65, offset))), 0xff)
}
if (v < 27) v += 27;
if (v != 27 && v != 28) revert SignatureInvalidV();
}
function toUint256(
bytes memory _bytes,
uint256 _offset
) internal pure returns (uint256 result) {
if (_bytes.length < _offset + 32) revert WrongArgumentLength();
assembly {
result := mload(add(add(_bytes, 0x20), _offset))
}
}
}{
"optimizer": {
"enabled": true,
"runs": 999999
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"AdminBadRole","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"expectedBalance","type":"uint256"},{"internalType":"uint256","name":"actualBalance","type":"uint256"}],"name":"CallCausedBalanceDiscrepancy","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"CallFailed","type":"error"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotEnoughSrcFundsIn","type":"error"},{"inputs":[],"name":"NotSupportedRouter","type":"error"},{"inputs":[],"name":"SignatureInvalidV","type":"error"},{"inputs":[{"internalType":"address","name":"srcTokenOut","type":"address"}],"name":"SwapEmptyResult","type":"error"},{"inputs":[{"internalType":"address","name":"srcRouter","type":"address"}],"name":"SwapFailed","type":"error"},{"inputs":[],"name":"WrongArgumentLength","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"srcSwapRouter","type":"address"},{"indexed":false,"internalType":"bool","name":"isSupported","type":"bool"}],"name":"SupportedRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"router","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"SwapExecuted","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deBridgeGate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_deBridgeGate","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"address","name":"_srcSwapRouter","type":"address"},{"internalType":"bytes","name":"_srcSwapCalldata","type":"bytes"},{"internalType":"address","name":"_srcTokenOut","type":"address"}],"name":"simulateSwap","outputs":[{"internalType":"uint256","name":"srcAmountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"bytes","name":"_srcTokenInPermitEnvelope","type":"bytes"},{"internalType":"address","name":"_srcSwapRouter","type":"address"},{"internalType":"bytes","name":"_srcSwapCalldata","type":"bytes"},{"internalType":"address","name":"_srcTokenOut","type":"address"},{"internalType":"uint256","name":"_srcTokenExpectedAmountOut","type":"uint256"},{"internalType":"address","name":"_srcTokenRefundRecipient","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_targetData","type":"bytes"}],"name":"strictlySwapAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"bytes","name":"_srcTokenInPermitEnvelope","type":"bytes"},{"components":[{"internalType":"address","name":"swapRouter","type":"address"},{"internalType":"bytes","name":"swapCalldata","type":"bytes"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"tokenOutExpectedAmount","type":"uint256"},{"internalType":"address","name":"tokenOutRefundRecipient","type":"address"}],"internalType":"struct DeBridgeRouter.SwapDetails","name":"_swapDetails","type":"tuple"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"bytes","name":"_targetData","type":"bytes"},{"internalType":"bytes32","name":"_orderId","type":"bytes32"}],"name":"strictlySwapAndCallDln","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supportedRouters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_srcSwapRouter","type":"address"},{"internalType":"bool","name":"_isSupported","type":"bool"}],"name":"updateSupportedRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052348015600f57600080fd5b506016601a565b60d8565b600054610100900460ff161560855760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101560d6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612d88806100e76000396000f3fe6080604052600436106101125760003560e01c80636e8f99c9116100a5578063c4d66de811610074578063ca777fbf11610059578063ca777fbf14610333578063d33f532e14610360578063d547741f1461038057600080fd5b8063c4d66de814610300578063c7a769691461032057600080fd5b80636e8f99c91461025557806391d14854146102685780639879c48d146102bb578063a217fddf146102eb57600080fd5b806336568abe116100e157806336568abe146101ed5780634d8160ba1461020d57806354fd4d50146102205780636ccae0541461023557600080fd5b806301ffc9a71461011e578063248a9ca3146101535780632f2ff15d1461019157806331f7d964146101b357600080fd5b3661011957005b600080fd5b34801561012a57600080fd5b5061013e610139366004612514565b6103a0565b60405190151581526020015b60405180910390f35b34801561015f57600080fd5b5061018361016e366004612556565b60009081526065602052604090206001015490565b60405190815260200161014a565b34801561019d57600080fd5b506101b16101ac36600461259c565b610439565b005b3480156101bf57600080fd5b506101c8600081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014a565b3480156101f957600080fd5b506101b161020836600461259c565b610463565b6101b161021b366004612710565b61051b565b34801561022c57600080fd5b5061012c610183565b34801561024157600080fd5b506101b1610250366004612821565b61053d565b610183610263366004612862565b6105eb565b34801561027457600080fd5b5061013e61028336600461259c565b600091825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156102c757600080fd5b5061013e6102d63660046128e7565b60986020526000908152604090205460ff1681565b3480156102f757600080fd5b50610183600081565b34801561030c57600080fd5b506101b161031b3660046128e7565b610622565b6101b161032e36600461291c565b6107f5565b34801561033f57600080fd5b506097546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b34801561036c57600080fd5b506101b161037b3660046129f9565b610953565b34801561038c57600080fd5b506101b161039b36600461259c565b610a42565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061043357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008281526065602052604090206001015461045481610a67565b61045e8383610a74565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116331461050d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105178282610b68565b5050565b61052f8c8c8c8c8c8c8c8c8c8c8c8c610c23565b505050505050505050505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff166105a5576040517fde8e41fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166105ca5761045e8282610d65565b61045e73ffffffffffffffffffffffffffffffffffffffff84168383610e19565b6000610607878760405180602001604052806000815250610eed565b61061687873488888888610f97565b50979650505050505050565b600054610100900460ff16158080156106425750600054600160ff909116105b8061065c5750303b15801561065c575060005460ff166001145b6106e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610504565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561074657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61074e6110f6565b609780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055801561051757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6040517f5b2f30e90000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff861690635b2f30e990602401606060405180830381865afa158015610863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108879190612a27565b505090508060ff166000146108f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f524445525f46554c46494c4c45445f4f525f43414e43454c4c4544000000006044820152606401610504565b5061094988888861090c60208a018a6128e7565b61091960208b018b612a71565b61092960608d0160408e016128e7565b8c606001358d608001602081019061094191906128e7565b8d8d8d610c23565b5050505050505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff166109bb576040517fde8e41fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526098602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f3fc30fe9d1afedc310e6ec6fd5f84b0ae3b800cdc1bcb04b65b986fdd35868f091016107e9565b600082815260656020526040902060010154610a5d81610a67565b61045e8383610b68565b610a71813361128a565b50565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661051757600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b0a3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561051757600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610c2e8c8c8c610eed565b600080610c408e8e348e8e8e8e610f97565b9150915081871115610c81576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101889052602401610504565b81871015610d47576000610c958884612b05565b905073ffffffffffffffffffffffffffffffffffffffff8916610ccd57610cbc8782610d65565b610cc68183612b05565b9150610cee565b610cee73ffffffffffffffffffffffffffffffffffffffff8a168883610e19565b6040805173ffffffffffffffffffffffffffffffffffffffff8b811682526020820184905289168183015290517f149635d19f798f6b7c74c74a500d362c89316a0ab808abe5e0c0de45da9b1d2c9181900360600190a1505b610d55858585848c8c611344565b5050505050505050505050505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051610d9c9190612b3c565b60006040518083038185875af1925050503d8060008114610dd9576040519150601f19603f3d011682016040523d82523d6000602084013e610dde565b606091505b505090508061045e576040517f6d963f8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261045e9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611466565b73ffffffffffffffffffffffffffffffffffffffff8316610f45578147101561045e576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101839052602401610504565b6000610f52848484611572565b905082811015610f91576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101849052602401610504565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260986020526040812054819060ff16610ff8576040517f2a070fb400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006110048847612b05565b905073ffffffffffffffffffffffffffffffffffffffff8a166110355761102e8787878c88611716565b9250611077565b6110408a888b6118b4565b73ffffffffffffffffffffffffffffffffffffffff84166110665761102e8787876119c3565b611074878787600088611716565b92505b6040805173ffffffffffffffffffffffffffffffffffffffff89811682528c811660208301528183018c9052861660608201526080810185905290517fdde2f3711ab09cdddcfee16ca03e54d21fb8cf3fa647b9797913c950d38ad6939181900360a00190a16110e78147612b05565b91505097509795505050505050565b600054610100900460ff16158080156111165750600054600160ff909116105b806111305750303b158015611130575060005460ff166001145b6111bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610504565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561121a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b611225600033611a26565b8015610a7157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610517576112ca81611a30565b6112d5836020611a4f565b6040516020016112e6929190612b58565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261050491600401612c23565b600061134f83611c99565b9050600061135d6000611c99565b905073ffffffffffffffffffffffffffffffffffffffff841615611386576113868489856118b4565b61139288888888611d50565b600061139d85611c99565b905060006113ab6000611c99565b9050846113b88386612b05565b10156114325789866113ca8787612b05565b6113d48588612b05565b6040517ff52b9cd600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff948516600482015293909216602484015260448301526064820152608401610504565b8661143d8285612b05565b101561145a578960006114508987612b05565b6113d48487612b05565b50505050505050505050565b60006114c8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611e649092919063ffffffff16565b80519091501561045e57808060200190518101906114e69190612c36565b61045e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610504565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156115e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116059190612c53565b90506116118584611e7b565b61163373ffffffffffffffffffffffffffffffffffffffff8616333087612071565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa1580156116a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c49190612c53565b9050818111611702576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101869052602401610504565b61170c8282612b05565b9695505050505050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a99190612c53565b90506117b787878787611d50565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118489190612c53565b905080821061189b576040517f5743851400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610504565b60006118a78383612b05565b9998505050505050505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152849160009183169063dd62ed3e90604401602060405180830381865afa15801561192b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194f9190612c53565b9050828110156119bc5761197b73ffffffffffffffffffffffffffffffffffffffff83168560006120cf565b6119bc73ffffffffffffffffffffffffffffffffffffffff8316857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6120cf565b5050505050565b6000476119d285858585611d50565b47808210611a0f576040517f5743851400000000000000000000000000000000000000000000000000000000815260006004820152602401610504565b6000611a1b8383612b05565b979650505050505050565b6105178282610a74565b606061043373ffffffffffffffffffffffffffffffffffffffff831660145b60606000611a5e836002612c6c565b611a69906002612c83565b67ffffffffffffffff811115611a8157611a816125cc565b6040519080825280601f01601f191660200182016040528015611aab576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611ae257611ae2612c96565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611b4557611b45612c96565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611b81846002612c6c565b611b8c906001612c83565b90505b6001811115611c29577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611bcd57611bcd612c96565b1a60f81b828281518110611be357611be3612c96565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611c2281612cc5565b9050611b8f565b508315611c92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610504565b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff8216611cbd575047919050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611d27573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104339190612c53565b919050565b73ffffffffffffffffffffffffffffffffffffffff841660009081526098602052604090205460ff16611daf576040517f2a070fb400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16838686604051611dda929190612cfa565b60006040518083038185875af1925050503d8060008114611e17576040519150601f19603f3d011682016040523d82523d6000602084013e611e1c565b606091505b509150915081611e5c5785816040517f6c544f33000000000000000000000000000000000000000000000000000000008152600401610504929190612d0a565b505050505050565b6060611e738484600085612251565b949350505050565b805115610517576000611e8e828261235f565b90506000611e9d83602061235f565b905060008080611eae8660406123af565b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018990526064810188905260ff8216608482015260a4810184905260c48101839052929550909350915073ffffffffffffffffffffffffffffffffffffffff88169063d505accf9060e401600060405180830381600087803b158015611f4857600080fd5b505af1925050508015611f59575060015b612006576040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152859073ffffffffffffffffffffffffffffffffffffffff89169063dd62ed3e90604401602060405180830381865afa158015611fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff39190612c53565b106120015750505050505050565b61200f565b50505050505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5065726d6974206661696c7572650000000000000000000000000000000000006044820152606401610504565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610f919085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610e6b565b80158061216f57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612149573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216d9190612c53565b155b6121fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610504565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261045e9084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610e6b565b6060824710156122e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610504565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161230c9190612b3c565b60006040518083038185875af1925050503d8060008114612349576040519150601f19603f3d011682016040523d82523d6000602084013e61234e565b606091505b5091509150611a1b87838387612435565b600061236c826020612c83565b835110156123a6576040517f40f0f32900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50016020015190565b8181016020810151604082015160419092015190919060ff16601b8110156123df576123dc601b82612d39565b90505b8060ff16601b141580156123f757508060ff16601c14155b1561242e576040517f18ce829400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250925092565b606083156124cb5782516000036124c45773ffffffffffffffffffffffffffffffffffffffff85163b6124c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610504565b5081611e73565b611e7383838151156124e05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105049190612c23565b60006020828403121561252657600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611c9257600080fd5b60006020828403121561256857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610a7157600080fd5b8035611d4b8161256f565b600080604083850312156125af57600080fd5b8235915060208301356125c18161256f565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261260c57600080fd5b813567ffffffffffffffff811115612626576126266125cc565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff82111715612692576126926125cc565b6040528181528382016020018510156126aa57600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f8401126126d957600080fd5b50813567ffffffffffffffff8111156126f157600080fd5b60208301915083602082850101111561270957600080fd5b9250929050565b6000806000806000806000806000806000806101408d8f03121561273357600080fd5b61273c8d612591565b9b5060208d01359a5067ffffffffffffffff60408e0135111561275e57600080fd5b61276e8e60408f01358f016125fb565b995061277c60608e01612591565b985067ffffffffffffffff60808e0135111561279757600080fd5b6127a78e60808f01358f016126c7565b90985096506127b860a08e01612591565b955060c08d013594506127cd60e08e01612591565b93506127dc6101008e01612591565b925067ffffffffffffffff6101208e013511156127f857600080fd5b6128098e6101208f01358f016126c7565b81935080925050509295989b509295989b509295989b565b60008060006060848603121561283657600080fd5b83356128418161256f565b925060208401356128518161256f565b929592945050506040919091013590565b60008060008060008060a0878903121561287b57600080fd5b86356128868161256f565b955060208701359450604087013561289d8161256f565b9350606087013567ffffffffffffffff8111156128b957600080fd5b6128c589828a016126c7565b90945092505060808701356128d98161256f565b809150509295509295509295565b6000602082840312156128f957600080fd5b8135611c928161256f565b600060a0828403121561291657600080fd5b50919050565b60008060008060008060008060e0898b03121561293857600080fd5b88356129438161256f565b975060208901359650604089013567ffffffffffffffff81111561296657600080fd5b6129728b828c016125fb565b965050606089013567ffffffffffffffff81111561298f57600080fd5b61299b8b828c01612904565b9550506129aa60808a01612591565b935060a089013567ffffffffffffffff8111156129c657600080fd5b6129d28b828c016126c7565b999c989b50969995989497949560c00135949350505050565b8015158114610a7157600080fd5b60008060408385031215612a0c57600080fd5b8235612a178161256f565b915060208301356125c1816129eb565b600080600060608486031215612a3c57600080fd5b835160ff81168114612a4d57600080fd5b6020850151909350612a5e8161256f565b6040949094015192959394509192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612aa657600080fd5b83018035915067ffffffffffffffff821115612ac157600080fd5b60200191503681900382131561270957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561043357610433612ad6565b60005b83811015612b33578181015183820152602001612b1b565b50506000910152565b60008251612b4e818460208701612b18565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612b90816017850160208801612b18565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612bcd816028840160208801612b18565b01602801949350505050565b60008151808452612bf1816020860160208601612b18565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000611c926020830184612bd9565b600060208284031215612c4857600080fd5b8151611c92816129eb565b600060208284031215612c6557600080fd5b5051919050565b808202811582820484141761043357610433612ad6565b8082018082111561043357610433612ad6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081612cd457612cd4612ad6565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b8183823760009101908152919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000611e736040830184612bd9565b60ff818116838216019081111561043357610433612ad656fea26469706673582212207bd6f7c3abac742495e8fe9601339a99b1857181251dbfe17d7eaa9e1d188e8a64736f6c634300081c0033
Deployed Bytecode
0x6080604052600436106101125760003560e01c80636e8f99c9116100a5578063c4d66de811610074578063ca777fbf11610059578063ca777fbf14610333578063d33f532e14610360578063d547741f1461038057600080fd5b8063c4d66de814610300578063c7a769691461032057600080fd5b80636e8f99c91461025557806391d14854146102685780639879c48d146102bb578063a217fddf146102eb57600080fd5b806336568abe116100e157806336568abe146101ed5780634d8160ba1461020d57806354fd4d50146102205780636ccae0541461023557600080fd5b806301ffc9a71461011e578063248a9ca3146101535780632f2ff15d1461019157806331f7d964146101b357600080fd5b3661011957005b600080fd5b34801561012a57600080fd5b5061013e610139366004612514565b6103a0565b60405190151581526020015b60405180910390f35b34801561015f57600080fd5b5061018361016e366004612556565b60009081526065602052604090206001015490565b60405190815260200161014a565b34801561019d57600080fd5b506101b16101ac36600461259c565b610439565b005b3480156101bf57600080fd5b506101c8600081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014a565b3480156101f957600080fd5b506101b161020836600461259c565b610463565b6101b161021b366004612710565b61051b565b34801561022c57600080fd5b5061012c610183565b34801561024157600080fd5b506101b1610250366004612821565b61053d565b610183610263366004612862565b6105eb565b34801561027457600080fd5b5061013e61028336600461259c565b600091825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156102c757600080fd5b5061013e6102d63660046128e7565b60986020526000908152604090205460ff1681565b3480156102f757600080fd5b50610183600081565b34801561030c57600080fd5b506101b161031b3660046128e7565b610622565b6101b161032e36600461291c565b6107f5565b34801561033f57600080fd5b506097546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b34801561036c57600080fd5b506101b161037b3660046129f9565b610953565b34801561038c57600080fd5b506101b161039b36600461259c565b610a42565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061043357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60008281526065602052604090206001015461045481610a67565b61045e8383610a74565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116331461050d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105178282610b68565b5050565b61052f8c8c8c8c8c8c8c8c8c8c8c8c610c23565b505050505050505050505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff166105a5576040517fde8e41fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166105ca5761045e8282610d65565b61045e73ffffffffffffffffffffffffffffffffffffffff84168383610e19565b6000610607878760405180602001604052806000815250610eed565b61061687873488888888610f97565b50979650505050505050565b600054610100900460ff16158080156106425750600054600160ff909116105b8061065c5750303b15801561065c575060005460ff166001145b6106e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610504565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561074657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61074e6110f6565b609780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055801561051757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6040517f5b2f30e90000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff861690635b2f30e990602401606060405180830381865afa158015610863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108879190612a27565b505090508060ff166000146108f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4f524445525f46554c46494c4c45445f4f525f43414e43454c4c4544000000006044820152606401610504565b5061094988888861090c60208a018a6128e7565b61091960208b018b612a71565b61092960608d0160408e016128e7565b8c606001358d608001602081019061094191906128e7565b8d8d8d610c23565b5050505050505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff166109bb576040517fde8e41fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526098602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f3fc30fe9d1afedc310e6ec6fd5f84b0ae3b800cdc1bcb04b65b986fdd35868f091016107e9565b600082815260656020526040902060010154610a5d81610a67565b61045e8383610b68565b610a71813361128a565b50565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661051757600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b0a3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561051757600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610c2e8c8c8c610eed565b600080610c408e8e348e8e8e8e610f97565b9150915081871115610c81576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101889052602401610504565b81871015610d47576000610c958884612b05565b905073ffffffffffffffffffffffffffffffffffffffff8916610ccd57610cbc8782610d65565b610cc68183612b05565b9150610cee565b610cee73ffffffffffffffffffffffffffffffffffffffff8a168883610e19565b6040805173ffffffffffffffffffffffffffffffffffffffff8b811682526020820184905289168183015290517f149635d19f798f6b7c74c74a500d362c89316a0ab808abe5e0c0de45da9b1d2c9181900360600190a1505b610d55858585848c8c611344565b5050505050505050505050505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051610d9c9190612b3c565b60006040518083038185875af1925050503d8060008114610dd9576040519150601f19603f3d011682016040523d82523d6000602084013e610dde565b606091505b505090508061045e576040517f6d963f8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261045e9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611466565b73ffffffffffffffffffffffffffffffffffffffff8316610f45578147101561045e576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101839052602401610504565b6000610f52848484611572565b905082811015610f91576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101849052602401610504565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260986020526040812054819060ff16610ff8576040517f2a070fb400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006110048847612b05565b905073ffffffffffffffffffffffffffffffffffffffff8a166110355761102e8787878c88611716565b9250611077565b6110408a888b6118b4565b73ffffffffffffffffffffffffffffffffffffffff84166110665761102e8787876119c3565b611074878787600088611716565b92505b6040805173ffffffffffffffffffffffffffffffffffffffff89811682528c811660208301528183018c9052861660608201526080810185905290517fdde2f3711ab09cdddcfee16ca03e54d21fb8cf3fa647b9797913c950d38ad6939181900360a00190a16110e78147612b05565b91505097509795505050505050565b600054610100900460ff16158080156111165750600054600160ff909116105b806111305750303b158015611130575060005460ff166001145b6111bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610504565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561121a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b611225600033611a26565b8015610a7157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610517576112ca81611a30565b6112d5836020611a4f565b6040516020016112e6929190612b58565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261050491600401612c23565b600061134f83611c99565b9050600061135d6000611c99565b905073ffffffffffffffffffffffffffffffffffffffff841615611386576113868489856118b4565b61139288888888611d50565b600061139d85611c99565b905060006113ab6000611c99565b9050846113b88386612b05565b10156114325789866113ca8787612b05565b6113d48588612b05565b6040517ff52b9cd600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff948516600482015293909216602484015260448301526064820152608401610504565b8661143d8285612b05565b101561145a578960006114508987612b05565b6113d48487612b05565b50505050505050505050565b60006114c8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611e649092919063ffffffff16565b80519091501561045e57808060200190518101906114e69190612c36565b61045e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610504565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8616906370a0823190602401602060405180830381865afa1580156115e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116059190612c53565b90506116118584611e7b565b61163373ffffffffffffffffffffffffffffffffffffffff8616333087612071565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa1580156116a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c49190612c53565b9050818111611702576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101869052602401610504565b61170c8282612b05565b9695505050505050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015611785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a99190612c53565b90506117b787878787611d50565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118489190612c53565b905080821061189b576040517f5743851400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610504565b60006118a78383612b05565b9998505050505050505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152849160009183169063dd62ed3e90604401602060405180830381865afa15801561192b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194f9190612c53565b9050828110156119bc5761197b73ffffffffffffffffffffffffffffffffffffffff83168560006120cf565b6119bc73ffffffffffffffffffffffffffffffffffffffff8316857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6120cf565b5050505050565b6000476119d285858585611d50565b47808210611a0f576040517f5743851400000000000000000000000000000000000000000000000000000000815260006004820152602401610504565b6000611a1b8383612b05565b979650505050505050565b6105178282610a74565b606061043373ffffffffffffffffffffffffffffffffffffffff831660145b60606000611a5e836002612c6c565b611a69906002612c83565b67ffffffffffffffff811115611a8157611a816125cc565b6040519080825280601f01601f191660200182016040528015611aab576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611ae257611ae2612c96565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611b4557611b45612c96565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611b81846002612c6c565b611b8c906001612c83565b90505b6001811115611c29577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611bcd57611bcd612c96565b1a60f81b828281518110611be357611be3612c96565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611c2281612cc5565b9050611b8f565b508315611c92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610504565b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff8216611cbd575047919050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611d27573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104339190612c53565b919050565b73ffffffffffffffffffffffffffffffffffffffff841660009081526098602052604090205460ff16611daf576040517f2a070fb400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16838686604051611dda929190612cfa565b60006040518083038185875af1925050503d8060008114611e17576040519150601f19603f3d011682016040523d82523d6000602084013e611e1c565b606091505b509150915081611e5c5785816040517f6c544f33000000000000000000000000000000000000000000000000000000008152600401610504929190612d0a565b505050505050565b6060611e738484600085612251565b949350505050565b805115610517576000611e8e828261235f565b90506000611e9d83602061235f565b905060008080611eae8660406123af565b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018990526064810188905260ff8216608482015260a4810184905260c48101839052929550909350915073ffffffffffffffffffffffffffffffffffffffff88169063d505accf9060e401600060405180830381600087803b158015611f4857600080fd5b505af1925050508015611f59575060015b612006576040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152859073ffffffffffffffffffffffffffffffffffffffff89169063dd62ed3e90604401602060405180830381865afa158015611fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ff39190612c53565b106120015750505050505050565b61200f565b50505050505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5065726d6974206661696c7572650000000000000000000000000000000000006044820152606401610504565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052610f919085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610e6b565b80158061216f57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612149573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216d9190612c53565b155b6121fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610504565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261045e9084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610e6b565b6060824710156122e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610504565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161230c9190612b3c565b60006040518083038185875af1925050503d8060008114612349576040519150601f19603f3d011682016040523d82523d6000602084013e61234e565b606091505b5091509150611a1b87838387612435565b600061236c826020612c83565b835110156123a6576040517f40f0f32900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50016020015190565b8181016020810151604082015160419092015190919060ff16601b8110156123df576123dc601b82612d39565b90505b8060ff16601b141580156123f757508060ff16601c14155b1561242e576040517f18ce829400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250925092565b606083156124cb5782516000036124c45773ffffffffffffffffffffffffffffffffffffffff85163b6124c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610504565b5081611e73565b611e7383838151156124e05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105049190612c23565b60006020828403121561252657600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611c9257600080fd5b60006020828403121561256857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610a7157600080fd5b8035611d4b8161256f565b600080604083850312156125af57600080fd5b8235915060208301356125c18161256f565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261260c57600080fd5b813567ffffffffffffffff811115612626576126266125cc565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff82111715612692576126926125cc565b6040528181528382016020018510156126aa57600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f8401126126d957600080fd5b50813567ffffffffffffffff8111156126f157600080fd5b60208301915083602082850101111561270957600080fd5b9250929050565b6000806000806000806000806000806000806101408d8f03121561273357600080fd5b61273c8d612591565b9b5060208d01359a5067ffffffffffffffff60408e0135111561275e57600080fd5b61276e8e60408f01358f016125fb565b995061277c60608e01612591565b985067ffffffffffffffff60808e0135111561279757600080fd5b6127a78e60808f01358f016126c7565b90985096506127b860a08e01612591565b955060c08d013594506127cd60e08e01612591565b93506127dc6101008e01612591565b925067ffffffffffffffff6101208e013511156127f857600080fd5b6128098e6101208f01358f016126c7565b81935080925050509295989b509295989b509295989b565b60008060006060848603121561283657600080fd5b83356128418161256f565b925060208401356128518161256f565b929592945050506040919091013590565b60008060008060008060a0878903121561287b57600080fd5b86356128868161256f565b955060208701359450604087013561289d8161256f565b9350606087013567ffffffffffffffff8111156128b957600080fd5b6128c589828a016126c7565b90945092505060808701356128d98161256f565b809150509295509295509295565b6000602082840312156128f957600080fd5b8135611c928161256f565b600060a0828403121561291657600080fd5b50919050565b60008060008060008060008060e0898b03121561293857600080fd5b88356129438161256f565b975060208901359650604089013567ffffffffffffffff81111561296657600080fd5b6129728b828c016125fb565b965050606089013567ffffffffffffffff81111561298f57600080fd5b61299b8b828c01612904565b9550506129aa60808a01612591565b935060a089013567ffffffffffffffff8111156129c657600080fd5b6129d28b828c016126c7565b999c989b50969995989497949560c00135949350505050565b8015158114610a7157600080fd5b60008060408385031215612a0c57600080fd5b8235612a178161256f565b915060208301356125c1816129eb565b600080600060608486031215612a3c57600080fd5b835160ff81168114612a4d57600080fd5b6020850151909350612a5e8161256f565b6040949094015192959394509192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612aa657600080fd5b83018035915067ffffffffffffffff821115612ac157600080fd5b60200191503681900382131561270957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561043357610433612ad6565b60005b83811015612b33578181015183820152602001612b1b565b50506000910152565b60008251612b4e818460208701612b18565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612b90816017850160208801612b18565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612bcd816028840160208801612b18565b01602801949350505050565b60008151808452612bf1816020860160208601612b18565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000611c926020830184612bd9565b600060208284031215612c4857600080fd5b8151611c92816129eb565b600060208284031215612c6557600080fd5b5051919050565b808202811582820484141761043357610433612ad6565b8082018082111561043357610433612ad6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081612cd457612cd4612ad6565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b8183823760009101908152919050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000611e736040830184612bd9565b60ff818116838216019081111561043357610433612ad656fea26469706673582212207bd6f7c3abac742495e8fe9601339a99b1857181251dbfe17d7eaa9e1d188e8a64736f6c634300081c0033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.