Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 24939452 | 147 days ago | Contract Creation | 0 FRAX |
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
BridgeFacet
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 300 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibAsset } from "../../Shared/Libraries/LibAsset.sol";
import { LibBridge } from "../../Shared/Libraries/LibBridge.sol";
import { LibValidator } from "../../Shared/Libraries/LibValidator.sol";
import { Swapper } from "../../Shared/Helpers/Swapper.sol";
import { RefundNative } from "../../Shared/Helpers/RefundNative.sol";
import { ReentrancyGuard } from "../../Shared/Helpers/ReentrancyGuard.sol";
import { Pausable } from "../../Shared/Helpers/Pausable.sol";
import { PermitBatchTransferFrom } from "../../Shared/Interfaces/IPermit2.sol";
import { IBridgeFacet } from "../Interfaces/IBridgeFacet.sol";
import { InputToken, BridgeSwapData, SwapExecutionData, AdapterInfo } from "../../Shared/Types.sol";
/**
* @title BridgeFacet
* @author DZap
* @dev Provide comprehensive bridging solutions with optional pre-bridge token swaps.
* Supports multiple bridge adapters and execution patterns.
*
* Key Features:
* - Direct token bridging
* - Swap-then-bridge operations
* - Multi-token batch bridging
* - Permit2 integration
* - Dynamic fee for integrators
* - Support bridging to non evm chains
*
* Bridge Adapters:
* - Generic bridges (most protocols)
* - Specialized adapters (Relay, GasZip, etc.)
* - Direct transfers (Near, Changenow, etc.)
*/
contract BridgeFacet is IBridgeFacet, Swapper, RefundNative, Pausable, ReentrancyGuard {
/* ========= EXTERNAL ========= */
/// @inheritdoc IBridgeFacet
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
uint256 _deadline,
InputToken calldata _intputTokens,
AdapterInfo calldata _adapterInfo
) external payable refundExcessNative(msg.sender) whenNotPaused nonReentrant {
LibValidator.handleFeeVerification(
msg.sender,
_deadline,
_transactionId,
keccak256(_feeData),
keccak256(abi.encode(_adapterInfo)),
_feeVerificationSignature
);
if (!LibAsset.isNativeToken(_intputTokens.token)) {
LibAsset.deposit(msg.sender, _intputTokens.token, _intputTokens.amount, _intputTokens.permit);
}
address integrator = LibBridge.takeFee(_feeData);
LibBridge.bridge(_adapterInfo);
emit DZapBridgeStarted(_transactionId, msg.sender, integrator);
}
/// @inheritdoc IBridgeFacet
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
uint256 _deadline,
InputToken calldata _intputTokens,
BridgeSwapData memory _swapData,
SwapExecutionData memory _swapExecutionData,
AdapterInfo calldata _adapterInfo
) external payable refundExcessNative(msg.sender) whenNotPaused nonReentrant {
LibValidator.handleFeeVerification(
msg.sender,
_deadline,
_transactionId,
keccak256(_feeData),
keccak256(abi.encode(_adapterInfo)),
_feeVerificationSignature
);
if (!LibAsset.isNativeToken(_intputTokens.token)) {
LibAsset.deposit(msg.sender, _intputTokens.token, _intputTokens.amount, _intputTokens.permit);
}
address integrator = LibBridge.takeFee(_feeData);
_executeBridgeSwap(_transactionId, msg.sender, integrator, _swapData, _swapExecutionData, false);
LibBridge.bridge(_adapterInfo);
emit DZapBridgeStarted(_transactionId, msg.sender, integrator);
}
/// @inheritdoc IBridgeFacet
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
uint256 _deadline,
InputToken[] calldata _erc20Token,
BridgeSwapData[] memory _swapData,
SwapExecutionData[] memory _swapExecutionData,
AdapterInfo[] calldata _adapterInfo
) external payable refundExcessNative(msg.sender) whenNotPaused nonReentrant {
LibValidator.handleFeeVerification(
msg.sender,
_deadline,
_transactionId,
keccak256(_feeData),
keccak256(abi.encode(_adapterInfo)),
_feeVerificationSignature
);
LibAsset.depositBatch(msg.sender, _erc20Token);
address integrator = LibBridge.takeFee(_feeData);
if (_swapData.length > 0) _executeBridgeSwaps(_transactionId, msg.sender, integrator, _swapData, _swapExecutionData, false);
LibBridge.bridge(_adapterInfo);
emit DZapBridgeStarted(_transactionId, msg.sender, integrator);
}
/// @inheritdoc IBridgeFacet
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
bytes calldata _batchDepositSignature,
uint256 _deadline,
PermitBatchTransferFrom calldata _tokenDepositDetails,
BridgeSwapData[] memory _swapData,
SwapExecutionData[] memory _swapExecutionData,
AdapterInfo[] calldata _adapterInfo
) external payable refundExcessNative(msg.sender) whenNotPaused nonReentrant {
LibValidator.handleFeeVerification(
msg.sender,
_deadline,
_transactionId,
keccak256(_feeData),
keccak256(abi.encode(_adapterInfo)),
_feeVerificationSignature
);
LibAsset.depositBatch(msg.sender, _tokenDepositDetails, _batchDepositSignature);
address integrator = LibBridge.takeFee(_feeData);
if (_swapData.length > 0) _executeBridgeSwaps(_transactionId, msg.sender, integrator, _swapData, _swapExecutionData, false);
LibBridge.bridge(_adapterInfo);
emit DZapBridgeStarted(_transactionId, msg.sender, integrator);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
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].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
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) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 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 256, 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 << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
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 = Math.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 `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.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);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { IBridge } from "../../Shared/Interfaces/IBridge.sol";
import { PermitBatchTransferFrom } from "../../Shared/Interfaces/IPermit2.sol";
import { InputToken, BridgeSwapData, SwapExecutionData, AdapterInfo } from "../../Shared/Types.sol";
/**
* @title IBridgeFacet
* @author DZap
*/
interface IBridgeFacet is IBridge {
/* ========= EXTERNAL ========= */
/**
* @notice Bridges tokens directly to another chain without pre-bridge swaps
* @dev Simplest bridging method for tokens natively supported by bridge protocols.
*
* @param _transactionId Unique identifier for bridge tracking
* @param _feeData Encoded FeeConfig containing integrator address and fees info.
* Used for fee distribution between integrator and protocol
* @param _feeVerificationSignature Oracle signature ensuring fee accuracy
* @param _deadline Expiration timestamp for fee quote validity
* @param _intputTokens Input token specification with amount and permissions
* @param _adapterInfo Bridge adapter configuration and parameters
*/
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
uint256 _deadline,
InputToken calldata _intputTokens,
AdapterInfo calldata _adapterInfo
) external payable;
/**
* @notice Bridges tokens with optional pre-bridge swap
* @dev Enables bridging of tokens not natively supported by target bridge.
* Automatically swaps input token to bridge-compatible token before bridging.
*
* @param _transactionId Unique identifier for the operation
* @param _feeData Encoded FeeConfig containing integrator address and fees info.
* Used for fee distribution between integrator and protocol
* @param _feeVerificationSignature Fee verification signature
* @param _deadline Fee quote expiration timestamp
* @param _intputTokens Input token for swap and/or bridge
* @param _swapData Swap configuration
* @param _swapExecutionData Swap execution parameters
* @param _adapterInfo Bridge adapter configuration
*/
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
uint256 _deadline,
InputToken calldata _intputTokens,
BridgeSwapData memory _swapData,
SwapExecutionData memory _swapExecutionData,
AdapterInfo calldata _adapterInfo
) external payable;
/**
* @notice Bridges multiple tokens to another chain with optional swaps
* @dev Advanced bridging for complex multi-token operations. Each token can have
* independent swap and bridge configurations for maximum flexibility.
*
* @param _transactionId Unique identifier for batch bridge operation
* @param _feeData Encoded FeeConfig containing integrator address and fees info.
* Used for fee distribution between integrator and protocol
* @param _feeVerificationSignature Oracle verification covering all fees
* @param _deadline Expiration for all fee quotes
* @param _intputTokens Array of input tokens with amounts
* @param _swapData Array of swap configurations (empty entries for direct bridge)
* @param _swapExecutionData Array of swap execution parameters
* @param _adapterInfo Array of bridge adapter configurations
*/
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
uint256 _deadline,
InputToken[] calldata _intputTokens,
BridgeSwapData[] memory _swapData,
SwapExecutionData[] memory _swapExecutionData,
AdapterInfo[] calldata _adapterInfo
) external payable;
/**
* @notice Bridges multiple tokens using Permit2 batch transfers
* @dev Ultimate bridge solution combining gas efficiency of Permit2 with
* flexibility of multi-token bridging. Single signature authorizes
* all token transfers and bridge operations.
*
* @param _transactionId Unique identifier for the operation
* @param _feeData Encoded FeeConfig containing integrator address and fees info.
* Used for fee distribution between integrator and protocol
* @param _feeVerificationSignature Oracle signature for fee verification
* @param _batchDepositSignature Permit2 batch transfer signature
* @param _deadline Fee quote expiration timestamp
* @param _tokenDepositDetails Permit2 batch transfer structure
* @param _swapData Array of swap configurations
* @param _swapExecutionData Array of swap execution data
* @param _adapterInfo Array of bridge adapter configurations
*/
function bridge(
bytes32 _transactionId,
bytes calldata _feeData,
bytes calldata _feeVerificationSignature,
bytes calldata _batchDepositSignature,
uint256 _deadline,
PermitBatchTransferFrom calldata _tokenDepositDetails,
BridgeSwapData[] memory _swapData,
SwapExecutionData[] memory _swapExecutionData,
AdapterInfo[] calldata _adapterInfo
) external payable;
}// SPDX-License-Identifier: MIT pragma solidity 0.8.19; // DZap Common Errors error OnlyContractOwner(); error UnauthorizedCaller(); error UnAuthorized(); error CannotAuthorizeSelf(); error AlreadyInitialized(); error InsufficientBalance(uint256 amount, uint256 contractBalance); error SlippageTooHigh(uint256 minAmount, uint256 returnAmount); error AmountExceedsMaximum(); error TransferAmountMismatch(); error NoBridgeFromZeroAmount(); error NoSwapFromZeroAmount(); error ZeroAddress(); error NoTransferToNullAddress(); error NullAddrIsNotAValidSpender(); error NullAddrIsNotAValidRecipient(); error NativeTokenNotSupported(); error InvalidEncodedAddress(); error NotAContract(); error BridgeNotWhitelisted(address bridge); error AdapterNotWhitelisted(address adapter); error DexNotWhitelisted(address dex); error InvalidPermitType(); error CannotBridgeToSameNetwork(); error SwapCallFailed(address target, bytes4 funSig, bytes reason); error BridgeCallFailed(address target, bytes4 funSig, bytes reason); error AdapterCallFailed(address adapter, bytes res); error NativeCallFailed(bytes reason); error Erc20CallFailed(bytes reason); error NativeTransferFailed();
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibGlobalStorage } from "../Libraries/LibGlobalStorage.sol";
/**
* @title Pausable
* @author DZap
* @notice Abstract contract that restricts function execution based on a global pause state.
* @dev Intended for use with a global storage library (LibGlobalStorage) that manages the pause flag.
*/
abstract contract Pausable {
/* ========= Errors ========= */
error ContractIsPaused();
error ContractIsNotPaused();
/* ========= Modifiers ========= */
modifier whenNotPaused() {
if (LibGlobalStorage.getPaused()) revert ContractIsPaused();
_;
}
modifier whenPaused() {
if (!LibGlobalStorage.getPaused()) revert ContractIsNotPaused();
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
/**
* @title ReentrancyGuard
* @author DZap
* @notice Abstract contract to provide protection against reentrancy
*/
abstract contract ReentrancyGuard {
/* ========= Storage ========= */
bytes32 private constant NAMESPACE = keccak256("dzap.reentrancyguard");
/* ========= Types ========= */
struct ReentrancyStorage {
uint256 status;
}
/* ========= Errors ========= */
error ReentrancyError();
/* ========= Constants ========= */
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
/* ========= Modifiers ========= */
modifier nonReentrant() {
ReentrancyStorage storage s = reentrancyStorage();
if (s.status == _ENTERED) revert ReentrancyError();
s.status = _ENTERED;
_;
s.status = _NOT_ENTERED;
}
/* ========= Private Methods ========= */
/// @dev fetch local storage
function reentrancyStorage() private pure returns (ReentrancyStorage storage data) {
bytes32 position = NAMESPACE;
// solhint-disable-next-line no-inline-assembly
assembly {
data.slot := position
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibAsset } from "../Libraries/LibAsset.sol";
/**
* @title RefundNative
* @author DZap
* @notice Abstract contract to provide functionality to refund native tokens
*/
abstract contract RefundNative {
/// @dev Refunds any excess native asset sent to the contract after the main function
/// @notice Refunds any excess native asset sent to the contract after the main function
/// @param _refundee Address to send refunds to
modifier refundExcessNative(address _refundee) {
uint256 initialBalance = address(this).balance - msg.value;
_;
uint256 finalBalance = address(this).balance;
if (finalBalance > initialBalance) LibAsset.transferNativeToken(_refundee, finalBalance - initialBalance);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibAllowList } from "../Libraries/LibAllowList.sol";
import { LibAsset } from "../Libraries/LibAsset.sol";
import { LibSwap } from "../Libraries/LibSwap.sol";
import { SwapData, SwapExecutionData, SwapInfo, BridgeSwapData } from "../Types.sol";
import { DexNotWhitelisted, NullAddrIsNotAValidRecipient, NoSwapFromZeroAmount } from "../Errors.sol";
/**
* @title Swapper
* @author DZap
* @notice Abstract contract to provide swap functionality
*/
abstract contract Swapper {
/* ========= EVENTS ========= */
event DZapTokenSwapped(bytes32 indexed transactionId, address indexed sender, address indexed integrator, SwapInfo swapInfo);
event DZapBatchTokenSwapped(bytes32 indexed transactionId, address indexed sender, address indexed integrator, SwapInfo[] swapInfo);
/* ========= INTERNAL ========= */
/// @notice Validates the swap data
function _validateSwapData(address _recipient, uint256 _fromAmount, SwapExecutionData memory _swapExecutionData) internal view {
if (!LibAllowList.isDexWhitelisted(_swapExecutionData.callTo)) revert DexNotWhitelisted(_swapExecutionData.callTo);
if (_recipient == address(0)) revert NullAddrIsNotAValidRecipient();
if (_fromAmount == 0) revert NoSwapFromZeroAmount();
}
/// @notice Executes a swap
function _executeSwap(
bytes32 _transactionId,
address _user,
address _integrator,
SwapData memory _swapData,
SwapExecutionData memory _swapExecutionData,
bool _withoutRevert
) internal {
_validateSwapData(_swapData.recipient, _swapData.fromAmount, _swapExecutionData);
uint256 returnToAmount = LibSwap.swap(
_user,
_swapData.recipient,
_swapData.from,
_swapData.to,
_swapData.fromAmount,
_swapData.minToAmount,
_swapExecutionData,
_withoutRevert
);
emit DZapTokenSwapped(
_transactionId,
_user,
_integrator,
SwapInfo(
_swapExecutionData.dex,
_swapExecutionData.callTo,
_swapData.recipient,
_swapData.from,
_swapData.to,
_swapData.fromAmount,
returnToAmount
)
);
}
/// @notice Executes multiple swaps
function _executeSwaps(
bytes32 _transactionId,
address _user,
address _integrator,
SwapData[] memory _swapData,
SwapExecutionData[] memory _swapExecutionData,
bool _withoutRevert
) internal {
uint256 length = _swapData.length;
uint256 i;
SwapInfo[] memory swapInfo = new SwapInfo[](length);
uint256 returnToAmount;
for (i; i < length; ) {
SwapData memory swapData = _swapData[i];
SwapExecutionData memory swapExecutionData = _swapExecutionData[i];
_validateSwapData(swapData.recipient, swapData.fromAmount, swapExecutionData);
returnToAmount = LibSwap.swap(
_user,
swapData.recipient,
swapData.from,
swapData.to,
swapData.fromAmount,
swapData.minToAmount,
swapExecutionData,
_withoutRevert
);
swapInfo[i] = SwapInfo(
swapExecutionData.dex,
swapExecutionData.callTo,
swapData.recipient,
swapData.from,
swapData.to,
swapData.fromAmount,
returnToAmount
);
unchecked {
++i;
}
}
if (length > 0) emit DZapBatchTokenSwapped(_transactionId, _user, _integrator, swapInfo);
}
/// @notice Executes a bridge swap
/// @dev Sweep dust if full return amount is not going to be used in bridge
function _executeBridgeSwap(
bytes32 _transactionId,
address _user,
address _integrator,
BridgeSwapData memory _swapData,
SwapExecutionData memory _swapExecutionData,
bool _withoutRevert
) internal {
_validateSwapData(_swapData.recipient, _swapData.fromAmount, _swapExecutionData);
uint256 returnToAmount = LibSwap.swap(
_user,
_swapData.recipient,
_swapData.from,
_swapData.to,
_swapData.fromAmount,
_swapData.minToAmount,
_swapExecutionData,
_withoutRevert
);
// sweep dust
if (_swapData.recipient == address(this) && !_swapData.updateBridgeInAmount) {
LibAsset.transferToken(_swapData.to, _user, returnToAmount - _swapData.minToAmount);
}
emit DZapTokenSwapped(
_transactionId,
_user,
_integrator,
SwapInfo(
_swapExecutionData.dex,
_swapExecutionData.callTo,
_swapData.recipient,
_swapData.from,
_swapData.to,
_swapData.fromAmount,
returnToAmount
)
);
}
/// @notice Executes multiple bridge swaps
/// @dev Sweep dust if full return amount is not going to be used in bridge
function _executeBridgeSwaps(
bytes32 _transactionId,
address _user,
address _integrator,
BridgeSwapData[] memory _swapData,
SwapExecutionData[] memory _swapExecutionData,
bool _withoutRevert
) internal {
uint256 length = _swapData.length;
uint256 i;
SwapInfo[] memory swapInfo = new SwapInfo[](length);
uint256 returnToAmount;
for (i; i < length; ) {
BridgeSwapData memory swapData = _swapData[i];
SwapExecutionData memory swapExecutionData = _swapExecutionData[i];
_validateSwapData(swapData.recipient, swapData.fromAmount, swapExecutionData);
returnToAmount = LibSwap.swap(
_user,
swapData.recipient,
swapData.from,
swapData.to,
swapData.fromAmount,
swapData.minToAmount,
swapExecutionData,
_withoutRevert
);
if (swapData.recipient == address(this) && !swapData.updateBridgeInAmount) {
LibAsset.transferToken(swapData.to, _user, returnToAmount - swapData.minToAmount);
}
swapInfo[i] = SwapInfo(
swapExecutionData.dex,
swapExecutionData.callTo,
swapData.recipient,
swapData.from,
swapData.to,
swapData.fromAmount,
returnToAmount
);
unchecked {
++i;
}
}
if (length > 0) emit DZapBatchTokenSwapped(_transactionId, _user, _integrator, swapInfo);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
/**
* @title IBridge
* @author DZap
*/
interface IBridge {
/* ========= EVENTS ========= */
event DZapBridgeStarted(bytes32 indexed transactionId, address indexed user, address indexed integrator);
event BridgeStarted(
bytes32 indexed transactionId,
address indexed user,
bytes receiver,
string bridge,
address bridgeAddress,
address from,
bytes to,
uint256 amount,
uint256 destinationChainId,
bytes destinationCalldata
);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
struct PermitDetails {
address token;
uint160 amount;
uint48 expiration;
uint48 nonce;
}
struct PermitSingle {
PermitDetails details;
address spender;
uint256 sigDeadline;
}
struct TokenPermissions {
address token;
uint256 amount;
}
struct PermitTransferFrom {
TokenPermissions permitted;
uint256 nonce;
uint256 deadline;
}
struct SignatureTransferDetails {
address to;
uint256 requestedAmount;
}
struct PermitBatchTransferFrom {
// the tokens and corresponding amounts permitted for a transfer
TokenPermissions[] permitted;
// a unique value for every token owner's signature to prevent signature replays
uint256 nonce;
// deadline on the permit signature
uint256 deadline;
}
interface IPermit2 {
function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;
function transferFrom(address from, address to, uint160 amount, address token) external;
function allowance(address, address, address) external view returns (uint160, uint48, uint48);
function permitWitnessTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
function permitWitnessTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibAsset } from "../Libraries/LibAsset.sol";
import { BridgeNotWhitelisted, AdapterNotWhitelisted, DexNotWhitelisted, CannotAuthorizeSelf, NotAContract, ZeroAddress } from "../Errors.sol";
struct AllowListStorage {
mapping(address => bool) dexAllowlist;
mapping(address => bool) adaptersAllowlist;
mapping(address => bool) bridgeAllowlist;
}
/**
* @title LibAllowList
* @author DZap
* @notice Library for managing and accessing the conract address allow list
*/
library LibAllowList {
bytes32 internal constant ALLOWLIST_NAMESPACE = keccak256("dzap.library.allow.whitelist");
/// @dev Fetch local storage struct
function allowListStorage() internal pure returns (AllowListStorage storage als) {
bytes32 position = ALLOWLIST_NAMESPACE;
// solhint-disable-next-line no-inline-assembly
assembly {
als.slot := position
}
}
/* ========= VIEWS ========= */
function isDexWhitelisted(address _dex) internal view returns (bool) {
return allowListStorage().dexAllowlist[_dex];
}
function isAdapterWhitelisted(address _adapter) internal view returns (bool) {
return allowListStorage().adaptersAllowlist[_adapter];
}
function isBridgeWhitelisted(address _bridge) internal view returns (bool) {
return allowListStorage().bridgeAllowlist[_bridge];
}
/* ========= MUTATIONS ========= */
function addDex(address _dex) internal {
if (_dex == address(0)) revert ZeroAddress();
if (_dex == address(this)) revert CannotAuthorizeSelf();
if (!LibAsset.isContract(_dex)) revert NotAContract();
allowListStorage().dexAllowlist[_dex] = true;
}
function addDexes(address[] memory _dexes) internal {
AllowListStorage storage als = allowListStorage();
for (uint256 i; i < _dexes.length; ++i) {
address dex = _dexes[i];
if (dex == address(0)) revert ZeroAddress();
if (dex == address(this)) revert CannotAuthorizeSelf();
if (!LibAsset.isContract(dex)) revert NotAContract();
als.dexAllowlist[dex] = true;
}
}
function removeDex(address _dex) internal {
AllowListStorage storage als = allowListStorage();
if (!als.dexAllowlist[_dex]) {
revert DexNotWhitelisted(_dex);
}
als.dexAllowlist[_dex] = false;
}
function removeDexes(address[] memory _dexes) internal {
AllowListStorage storage als = allowListStorage();
for (uint256 i; i < _dexes.length; ++i) {
if (!als.dexAllowlist[_dexes[i]]) {
revert DexNotWhitelisted(_dexes[i]);
}
als.dexAllowlist[_dexes[i]] = false;
}
}
function addBridge(address _bridge) internal {
if (_bridge == address(0)) revert ZeroAddress();
if (_bridge == address(this)) revert CannotAuthorizeSelf();
if (!LibAsset.isContract(_bridge)) revert NotAContract();
allowListStorage().bridgeAllowlist[_bridge] = true;
}
function addBridges(address[] memory _bridges) internal {
AllowListStorage storage als = allowListStorage();
for (uint256 i; i < _bridges.length; ++i) {
address bridge = _bridges[i];
if (bridge == address(0)) revert ZeroAddress();
if (bridge == address(this)) revert CannotAuthorizeSelf();
if (!LibAsset.isContract(bridge)) revert NotAContract();
als.bridgeAllowlist[bridge] = true;
}
}
function removeBridge(address _bridge) internal {
AllowListStorage storage als = allowListStorage();
if (!als.bridgeAllowlist[_bridge]) {
revert BridgeNotWhitelisted(_bridge);
}
als.bridgeAllowlist[_bridge] = false;
}
function removeBridges(address[] memory _bridges) internal {
AllowListStorage storage als = allowListStorage();
for (uint256 i; i < _bridges.length; ++i) {
if (!als.bridgeAllowlist[_bridges[i]]) {
revert BridgeNotWhitelisted(_bridges[i]);
}
als.bridgeAllowlist[_bridges[i]] = false;
}
}
function addAdapter(address _adapter) internal {
if (_adapter == address(0)) revert ZeroAddress();
if (_adapter == address(this)) revert CannotAuthorizeSelf();
if (!LibAsset.isContract(_adapter)) revert NotAContract();
allowListStorage().adaptersAllowlist[_adapter] = true;
}
function addAdapters(address[] memory _adapters) internal {
AllowListStorage storage als = allowListStorage();
for (uint256 i; i < _adapters.length; ++i) {
address adapter = _adapters[i];
if (adapter == address(0)) revert ZeroAddress();
if (adapter == address(this)) revert CannotAuthorizeSelf();
if (!LibAsset.isContract(adapter)) revert NotAContract();
als.adaptersAllowlist[adapter] = true;
}
}
function removeAdapter(address _adapter) internal {
AllowListStorage storage als = allowListStorage();
if (!als.adaptersAllowlist[_adapter]) {
revert AdapterNotWhitelisted(_adapter);
}
als.adaptersAllowlist[_adapter] = false;
}
function removeAdapters(address[] memory _adapters) internal {
AllowListStorage storage als = allowListStorage();
for (uint256 i; i < _adapters.length; ++i) {
if (!als.adaptersAllowlist[_adapters[i]]) {
revert AdapterNotWhitelisted(_adapters[i]);
}
als.adaptersAllowlist[_adapters[i]] = false;
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { LibPermit } from "../Libraries/LibPermit.sol";
import { PermitType, InputToken } from "../Types.sol";
import { PermitBatchTransferFrom } from "../Interfaces/IPermit2.sol";
import { NoTransferToNullAddress, NativeTransferFailed, NullAddrIsNotAValidSpender, InvalidPermitType, TransferAmountMismatch } from "../Errors.sol";
/**
* @title LibAsset
* @author DZap
* @notice This library contains helpers for dealing with onchain transfers
* of assets, including accounting for the native asset `assetId`
* conventions and any noncompliant ERC20 transfers
*/
library LibAsset {
// ============= CONSTANTS =============
address internal constant _NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// ============= BALANCE QUERY FUNCTIONS =============
/// @notice Gets the balance of the inheriting contract for the given asset
function getOwnBalance(address _token) internal view returns (uint256) {
return _token == _NATIVE_TOKEN ? address(this).balance : IERC20(_token).balanceOf(address(this));
}
/// @notice Gets the balance of the given asset for the given recipient
function getBalance(address _token, address _recipient) internal view returns (uint256) {
return _token == _NATIVE_TOKEN ? _recipient.balance : IERC20(_token).balanceOf(_recipient);
}
/// @notice Gets the balance of the given erc20 token for the given recipient
function getErc20Balance(address _token, address _recipient) internal view returns (uint256) {
return IERC20(_token).balanceOf(_recipient);
}
// ============= APPROVAL FUNCTIONS =============
/// @notice If the current allowance is insufficient, then MAX_UINT allowance for a given spender
function maxApproveERC20(address _token, address _spender, uint256 _amount) internal {
if (_spender == address(0)) revert NullAddrIsNotAValidSpender();
uint256 allowance = IERC20(_token).allowance(address(this), _spender);
if (allowance < _amount) {
SafeERC20.forceApprove(IERC20(_token), _spender, type(uint256).max);
}
}
// ============= TRANSFER FUNCTIONS =============
/// @notice Transfers ether from the inheriting contract to a given recipient
function transferNativeToken(address _recipient, uint256 _amount) internal {
if (_recipient == address(0)) revert NoTransferToNullAddress();
(bool success, ) = _recipient.call{ value: _amount }("");
if (!success) revert NativeTransferFailed();
}
/// @notice Transfers tokens from the inheriting contract to a given recipient
function transferERC20(address _token, address _recipient, uint256 _amount) internal {
if (_recipient == address(0)) revert NoTransferToNullAddress();
SafeERC20.safeTransfer(IERC20(_token), _recipient, _amount);
}
/// @notice Transfers tokens from the inheriting contract to a given recipient without checks
function transferERC20WithoutChecks(address _token, address _recipient, uint256 _amount) internal {
SafeERC20.safeTransfer(IERC20(_token), _recipient, _amount);
}
/// @notice Transfers tokens from a sender to a given recipient without checking the final balance
/// @dev need to handle deflationary, rebasing or share based tokens
function transferFromERC20WithoutChecks(address _token, address _from, address _to, uint256 _amount) internal {
SafeERC20.safeTransferFrom(IERC20(_token), _from, _to, _amount);
}
/// @notice Transfers tokens from the inheriting contract to a given recipient with balance check
function transferERC20WithBalanceCheck(address _token, address _recipient, uint256 _amount) internal {
if (_recipient == address(0)) revert NoTransferToNullAddress();
IERC20 token = IERC20(_token);
uint256 prevBalance = token.balanceOf(_recipient);
SafeERC20.safeTransfer(token, _recipient, _amount);
uint256 curr = token.balanceOf(_recipient);
if (curr < prevBalance || curr - prevBalance != _amount) {
revert TransferAmountMismatch();
}
}
/// @notice Transfers tokens from a sender to a given recipient with balance check
function transferFromERC20WithBalanceCheck(address _token, address _sender, address _recipient, uint256 _amount) internal {
if (_recipient == address(0)) revert NoTransferToNullAddress();
IERC20 token = IERC20(_token);
uint256 prevBalance = token.balanceOf(_recipient);
SafeERC20.safeTransferFrom(token, _sender, _recipient, _amount);
uint256 curr = token.balanceOf(_recipient);
if (curr < prevBalance || curr - prevBalance != _amount) {
revert TransferAmountMismatch();
}
}
/// @notice Wrapper function to transfer a given asset (native or erc20) to
/// some recipient. Should handle all non-compliant return value
/// tokens as well by using the SafeERC20 contract by open zeppelin.
function transferToken(address _token, address _recipient, uint256 _amount) internal {
if (_amount != 0) {
if (_token == _NATIVE_TOKEN) transferNativeToken(_recipient, _amount);
else transferERC20(_token, _recipient, _amount);
}
}
// ============= DEPOSIT FUNCTIONS =============
/// @notice Deposits tokens from a sender to the inheriting contract
/// @dev only handles erc20 token
function deposit(address _from, address _token, uint256 _amount, bytes calldata _permit) internal {
(PermitType permitType, bytes memory data) = abi.decode(_permit, (PermitType, bytes));
if (permitType == PermitType.PERMIT2_WITNESS_TRANSFER) {
LibPermit.permit2WitnessTransferFrom(_from, address(this), _token, _amount, data);
} else if (permitType == PermitType.PERMIT) {
if (data.length != 0) LibPermit.eip2612Permit(_from, address(this), _token, _amount, data);
transferFromERC20WithoutChecks(_token, _from, address(this), _amount);
} else if (permitType == PermitType.PERMIT2_APPROVE) {
LibPermit.permit2ApproveAndTransfer(_from, address(this), _token, uint160(_amount), data);
} else {
revert InvalidPermitType();
}
}
/// @notice Deposits tokens from a sender to the inheriting contract
function depositBatch(address _from, InputToken[] calldata erc20Tokens) internal {
uint256 i;
uint256 length = erc20Tokens.length;
for (i; i < length; ) {
deposit(_from, erc20Tokens[i].token, erc20Tokens[i].amount, erc20Tokens[i].permit);
unchecked {
++i;
}
}
}
function depositBatch(address _from, PermitBatchTransferFrom calldata permit, bytes calldata permitSignature) internal {
LibPermit.permit2BatchWitnessTransferFrom(_from, address(this), permit, permitSignature);
}
// ============= UTILITY FUNCTIONS =============
/// @notice Determines whether the given token is the native token
function isNativeToken(address _token) internal pure returns (bool) {
return _token == _NATIVE_TOKEN;
}
/// @dev Checks whether the given address is a contract and contains code
function isContract(address _contractAddr) internal view returns (bool) {
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(_contractAddr)
}
return size != 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibAllowList } from "../../Shared/Libraries/LibAllowList.sol";
import { LibGlobalStorage } from "../../Shared/Libraries/LibGlobalStorage.sol";
import { LibValidator } from "../../Shared/Libraries/LibValidator.sol";
import { LibAsset } from "../../Shared/Libraries/LibAsset.sol";
import { AdapterInfo } from "../Types.sol";
import { FeeConfig } from "../../Shared/Types.sol";
import { AdapterNotWhitelisted, AdapterCallFailed } from "../../Shared/Errors.sol";
/**
* @title LibBridge
* @author DZap
* @notice This library contains helpers for bridging tokens
*/
library LibBridge {
/// @notice Returns true if the adapter is whitelisted
function isAdapterWhitelisted(address _adapter) internal view returns (bool) {
return LibAllowList.isAdapterWhitelisted(_adapter);
}
/// @notice Returns true if the bridge is whitelisted
function isBridgeWhitelisted(address _bridge) internal view returns (bool) {
return LibAllowList.isBridgeWhitelisted(_bridge);
}
/// @notice Verifies and takes fee
function verifyAndTakeFee(
address _user,
uint256 _deadline,
bytes32 _transactionIdHash,
bytes32 _adapterInfoHash,
bytes calldata _feeData,
bytes calldata _signature
) internal returns (address integrator) {
LibValidator.handleFeeVerification(_user, _deadline, _transactionIdHash, keccak256(_feeData), _adapterInfoHash, _signature);
return takeFee(_feeData);
}
/// @notice Takes fee
function takeFee(bytes calldata _feeData) internal returns (address integrator) {
FeeConfig memory feeInfo = abi.decode(_feeData, (FeeConfig));
address protocolFeeVault = LibGlobalStorage.getProtocolFeeVault();
uint256 i;
uint256 length = feeInfo.fees.length;
for (i; i < length; ) {
LibAsset.transferToken(feeInfo.fees[i].token, feeInfo.integrator, feeInfo.fees[i].integratorFeeAmount);
LibAsset.transferToken(feeInfo.fees[i].token, protocolFeeVault, feeInfo.fees[i].protocolFeeAmount);
unchecked {
++i;
}
}
return feeInfo.integrator;
}
/// @notice Bridges tokens
function bridge(AdapterInfo[] calldata _adapterInfo) internal {
uint256 i;
uint256 length = _adapterInfo.length;
for (i; i < length; ) {
bridge(_adapterInfo[i]);
unchecked {
++i;
}
}
}
/// @notice Bridges tokens
function bridge(AdapterInfo calldata _adapterInfo) internal {
address adapter = _adapterInfo.adapter;
if (!isAdapterWhitelisted(adapter)) revert AdapterNotWhitelisted(adapter);
(bool success, bytes memory res) = adapter.delegatecall(_adapterInfo.adapterData);
if (!success) revert AdapterCallFailed(adapter, res);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
struct GlobalStorage {
bool initialized;
address protocolFeeVault;
address feeValidator;
address permit2;
address refundVault;
bool paused;
}
/**
* @title LibGlobalStorage
* @author DZap
* @notice This library provides functionality for managing global storage
*/
library LibGlobalStorage {
bytes32 internal constant _GLOBAL_NAMESPACE = keccak256("dzap.storage.library.global");
function globalStorage() internal pure returns (GlobalStorage storage ds) {
bytes32 slot = _GLOBAL_NAMESPACE;
assembly {
ds.slot := slot
}
}
function getRefundVault() internal view returns (address) {
return globalStorage().refundVault;
}
function getProtocolFeeVault() internal view returns (address) {
return globalStorage().protocolFeeVault;
}
function getFeeValidator() internal view returns (address) {
return globalStorage().feeValidator;
}
function getPermit2() internal view returns (address) {
return globalStorage().permit2;
}
function getPaused() internal view returns (bool) {
return globalStorage().paused;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import { LibGlobalStorage } from "./LibGlobalStorage.sol";
import { PermitTransferFrom, PermitBatchTransferFrom, SignatureTransferDetails, PermitSingle, PermitDetails, TokenPermissions, IPermit2 } from "../Interfaces/IPermit2.sol";
/**
* @title LibPermit
* @author DZap
* @notice This library contains helpers for using permit and permit2
*/
library LibPermit {
// ============= ERRORS =============
error InvalidPermit(string reason);
// ============= CONSTANTS =============
string internal constant _DZAP_TRANSFER_WITNESS_TYPE_STRING =
"DZapTransferWitness witness)DZapTransferWitness(address owner,address recipient)TokenPermissions(address token,uint256 amount)";
bytes32 internal constant _DZAP_TRANSFER_WITNESS_TYPEHASH = keccak256("DZapTransferWitness(address owner,address recipient)");
// ============= VIEW =============
/// @notice Returns the permit2 address
function permit2() private view returns (address) {
return LibGlobalStorage.getPermit2();
}
// ============= EIP-2612 PERMIT FUNCTIONS =============
/// @notice Handles eip2612 permit
function eip2612Permit(address _owner, address _spender, address _token, uint256 _amount, bytes memory _data) internal {
(uint256 deadline, uint8 v, bytes32 r, bytes32 s) = abi.decode(_data, (uint256, uint8, bytes32, bytes32));
try IERC20Permit(_token).permit(_owner, _spender, _amount, deadline, v, r, s) {} catch Error(string memory reason) {
if (IERC20(_token).allowance(_owner, _spender) < _amount) {
revert InvalidPermit(reason);
}
}
}
// ============= PERMIT2 FUNCTIONS =============
/// @notice Handles permit2 approve and transfer
function permit2ApproveAndTransfer(address _owner, address _spender, address _token, uint160 _amount, bytes memory data) internal {
permit2Approve(_owner, _spender, _token, _amount, data);
IPermit2(permit2()).transferFrom(_owner, _spender, uint160(_amount), _token);
}
/// @notice Handles permit2 approve
function permit2Approve(address _owner, address _spender, address _token, uint160 _amount, bytes memory _data) internal {
if (_data.length == 0) return;
IPermit2 permit2Contract = IPermit2(permit2());
(uint48 nonce, uint48 expiration, uint256 sigDeadline, bytes memory signature) = abi.decode(_data, (uint48, uint48, uint256, bytes));
try
permit2Contract.permit(_owner, PermitSingle(PermitDetails(_token, _amount, expiration, nonce), _spender, sigDeadline), signature)
{} catch Error(string memory reason) {
(uint256 currentAllowance, uint256 allowanceExpiration, ) = permit2Contract.allowance(_owner, _token, _spender);
if (currentAllowance < _amount || allowanceExpiration < block.timestamp) revert InvalidPermit(reason);
}
}
/// @notice Handles permit2 witness transfer from
function permit2WitnessTransferFrom(address _owner, address _recipient, address _token, uint256 _amount, bytes memory _data) internal {
(uint256 nonce, uint256 deadline, bytes memory _signature) = abi.decode(_data, (uint256, uint256, bytes));
IPermit2(permit2()).permitWitnessTransferFrom(
PermitTransferFrom(TokenPermissions(_token, _amount), nonce, deadline),
SignatureTransferDetails(_recipient, _amount),
_owner,
_createWitnessTransferFromHash(_owner, _recipient),
_DZAP_TRANSFER_WITNESS_TYPE_STRING,
_signature
);
}
/// @notice Handles permit2 batch witness transfer from
function permit2BatchWitnessTransferFrom(
address _owner,
address _recipient,
PermitBatchTransferFrom calldata permit,
bytes calldata _signature
) internal {
uint256 length = permit.permitted.length;
SignatureTransferDetails[] memory details = new SignatureTransferDetails[](length);
for (uint256 i; i < length; ) {
details[i] = SignatureTransferDetails(_recipient, permit.permitted[i].amount);
unchecked {
++i;
}
}
IPermit2(permit2()).permitWitnessTransferFrom(
permit,
details,
_owner,
_createWitnessTransferFromHash(_owner, _recipient),
_DZAP_TRANSFER_WITNESS_TYPE_STRING,
_signature
);
}
/// @notice Handles permit2 batch witness transfer from
function permit2BatchWitnessTransferFrom(
address _owner,
address _recipient,
bytes32 _witness,
PermitBatchTransferFrom calldata permit,
bytes calldata _signature,
string memory _witnessTypeString
) internal {
uint256 length = permit.permitted.length;
SignatureTransferDetails[] memory details = new SignatureTransferDetails[](length);
for (uint256 i; i < length; ) {
details[i] = SignatureTransferDetails(_recipient, permit.permitted[i].amount);
unchecked {
++i;
}
}
IPermit2(permit2()).permitWitnessTransferFrom(permit, details, _owner, _witness, _witnessTypeString, _signature);
}
/* ========= PRIVATE ========= */
function _createWitnessTransferFromHash(address _owner, address _recipient) private pure returns (bytes32) {
return keccak256(abi.encode(_DZAP_TRANSFER_WITNESS_TYPEHASH, _owner, _recipient));
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibAsset } from "../Libraries/LibAsset.sol";
import { SwapExecutionData } from "../Types.sol";
import { SwapCallFailed, SlippageTooHigh } from "../Errors.sol";
/**
* @title LibSwap
* @author DZap
* @notice This library contains helpers for doing swap
*/
library LibSwap {
function swap(
address _user,
address _recipient,
address _from,
address _to,
uint256 _fromAmount,
uint256 _minToAmount,
SwapExecutionData memory _swapExecutionData,
bool _withoutRevert
) internal returns (uint256 returnToAmount) {
address recipient = _swapExecutionData.isDirectTransfer ? _recipient : address(this);
uint256 initialToBalance = LibAsset.getBalance(_to, recipient);
uint256 nativeValue;
if (LibAsset.isNativeToken(_from)) {
nativeValue = _fromAmount;
} else {
LibAsset.maxApproveERC20(_from, _swapExecutionData.approveTo, _fromAmount);
}
(bool success, bytes memory res) = _swapExecutionData.callTo.call{ value: nativeValue }(_swapExecutionData.swapCallData);
if (!success) {
if (_withoutRevert) {
LibAsset.transferToken(_from, _user, _fromAmount);
return (0);
}
revert SwapCallFailed(_swapExecutionData.callTo, bytes4(_swapExecutionData.swapCallData), res);
}
returnToAmount = LibAsset.getBalance(_to, recipient) - initialToBalance;
if (returnToAmount < _minToAmount) revert SlippageTooHigh(_minToAmount, returnToAmount);
if (!_swapExecutionData.isDirectTransfer && _recipient != address(this)) LibAsset.transferToken(_to, _recipient, returnToAmount);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import { LibGlobalStorage } from "./LibGlobalStorage.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
struct ValidatorStorage {
mapping(address => uint256) nonce;
}
/**
* @title LibValidator
* @author DZap
* @notice This library contains helpers for validating signatures
*/
library LibValidator {
error SigDeadlineExpired();
error UnauthorizedSigner();
bytes32 internal constant _VALIDATOR_NAMESPACE = keccak256("dzap.storage.library.validator");
bytes32 private constant _DOMAIN_TYPEHASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)");
bytes32 private constant _SIGNED_GASLESS_DATA_TYPEHASH =
keccak256("SignedGasLessSwapData(bytes32 txId,address user,uint256 nonce,uint256 deadline,bytes32 executorFeesHash,bytes32 swapDataHash)");
bytes32 private constant _SIGNED_GASLESS_BRIDGE_DATA_TYPEHASH =
keccak256(
"SignedGasLessBridgeData(bytes32 txId,address user,uint256 nonce,uint256 deadline,bytes32 executorFeesHash,bytes32 adapterDataHash)"
);
bytes32 private constant _SIGNED_GASLESS_SWAP_BRIDGE_DATA_TYPEHASH =
keccak256(
"SignedGasLessSwapBridgeData(bytes32 txId,address user,uint256 nonce,uint256 deadline,bytes32 executorFeesHash,bytes32 swapDataHash,bytes32 adapterDataHash)"
);
bytes32 private constant _SIGNED_FEE_DATA_TYPEHASH =
keccak256("SignedFeeData(bytes32 txId,address user,uint256 nonce,uint256 deadline,bytes32 feeDataHash,bytes32 adapterDataHash)");
string private constant _DOMAIN_NAME = "DZapVerifier";
string private constant _VERSION = "1";
bytes32 private constant _SALT = keccak256("DZap-v0.1");
function validatorStorage() internal pure returns (ValidatorStorage storage ds) {
bytes32 slot = _VALIDATOR_NAMESPACE;
assembly {
ds.slot := slot
}
}
/// @notice Returns the nonce for a given user
function getNonce(address _user) internal view returns (uint256) {
return validatorStorage().nonce[_user];
}
/// @notice Handles gasless swap verification
function handleGasLessSwapVerification(
address _user,
uint256 _deadline,
bytes32 _transactionId,
bytes32 _executorFeesHash,
bytes32 _swapDataHash,
bytes calldata _signature
) internal {
if (_deadline < block.timestamp) revert SigDeadlineExpired();
uint256 nonce = getNonce(_user);
bytes32 msgHash = keccak256(
abi.encode(_SIGNED_GASLESS_DATA_TYPEHASH, _transactionId, _user, nonce, _deadline, _executorFeesHash, _swapDataHash)
);
_verifySignature(_user, msgHash, _signature);
_incrementNonce(_user);
}
/// @notice Handles gasless bridge verification
function handleGasLessBridgeVerification(
address _user,
uint256 _deadline,
bytes32 _transactionId,
bytes32 _executorFeesHash,
bytes32 _adapterDataHash,
bytes calldata _signature
) internal {
if (_deadline < block.timestamp) revert SigDeadlineExpired();
uint256 nonce = getNonce(_user);
bytes32 msgHash = keccak256(
abi.encode(_SIGNED_GASLESS_BRIDGE_DATA_TYPEHASH, _transactionId, _user, nonce, _deadline, _executorFeesHash, _adapterDataHash)
);
_verifySignature(_user, msgHash, _signature);
_incrementNonce(_user);
}
/// @notice Handles gasless swap bridge verification
function handleGasLessSwapBridgeVerification(
address _user,
uint256 _deadline,
bytes32 _transactionId,
bytes32 _executorFeesHash,
bytes32 _swapDataHash,
bytes32 _adapterDataHash,
bytes calldata _signature
) internal {
if (_deadline < block.timestamp) revert SigDeadlineExpired();
uint256 nonce = getNonce(_user);
bytes32 msgHash = keccak256(
abi.encode(
_SIGNED_GASLESS_SWAP_BRIDGE_DATA_TYPEHASH,
_transactionId,
_user,
nonce,
_deadline,
_executorFeesHash,
_swapDataHash,
_adapterDataHash
)
);
_verifySignature(_user, msgHash, _signature);
_incrementNonce(_user);
}
/// @notice Handles fee verification
function handleFeeVerification(
address _user,
uint256 _deadline,
bytes32 _transactionId,
bytes32 _feeDataHash,
bytes32 _adapterDataHash,
bytes calldata _signature
) internal {
if (_deadline < block.timestamp) revert SigDeadlineExpired();
address validator = LibGlobalStorage.getFeeValidator();
uint256 nonce = getNonce(_user);
bytes32 msgHash = keccak256(abi.encode(_SIGNED_FEE_DATA_TYPEHASH, _transactionId, _user, nonce, _deadline, _feeDataHash, _adapterDataHash));
_verifySignature(validator, msgHash, _signature);
_incrementNonce(_user);
}
/* ========= PRIVATE ========= */
function _getDomainSeparator() private view returns (bytes32) {
return
keccak256(abi.encode(_DOMAIN_TYPEHASH, keccak256(bytes(_DOMAIN_NAME)), keccak256(bytes(_VERSION)), block.chainid, address(this), _SALT));
}
function _verifySignature(address _signer, bytes32 _msgHash, bytes calldata _signature) private view {
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", _getDomainSeparator(), _msgHash));
if (ECDSA.recover(digest, _signature) != _signer) revert UnauthorizedSigner();
}
function _incrementNonce(address _user) private {
validatorStorage().nonce[_user]++;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
/// @title DZap Types
enum PermitType {
PERMIT, // EIP2612
PERMIT2_APPROVE,
PERMIT2_WITNESS_TRANSFER,
BATCH_PERMIT2_WITNESS_TRANSFER
}
struct InputToken {
address token;
uint256 amount;
bytes permit;
}
struct SwapInfo {
string dex;
address callTo;
address recipient;
address fromToken;
address toToken;
uint256 fromAmount;
uint256 returnToAmount;
}
struct SwapData {
address recipient;
address from;
address to;
uint256 fromAmount;
uint256 minToAmount;
}
struct BridgeSwapData {
address recipient;
address from;
address to;
uint256 fromAmount;
uint256 minToAmount;
bool updateBridgeInAmount;
}
struct SwapExecutionData {
string dex;
address callTo;
address approveTo;
bytes swapCallData;
bool isDirectTransfer;
}
struct TokenInfo {
address token;
uint256 amount;
}
struct Fees {
address token;
uint256 integratorFeeAmount;
uint256 protocolFeeAmount;
}
struct FeeConfig {
address integrator;
Fees[] fees;
}
struct AdapterInfo {
address adapter;
bytes adapterData;
}{
"optimizer": {
"enabled": true,
"runs": 300
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"bytes","name":"res","type":"bytes"}],"name":"AdapterCallFailed","type":"error"},{"inputs":[{"internalType":"address","name":"adapter","type":"address"}],"name":"AdapterNotWhitelisted","type":"error"},{"inputs":[],"name":"ContractIsNotPaused","type":"error"},{"inputs":[],"name":"ContractIsPaused","type":"error"},{"inputs":[{"internalType":"address","name":"dex","type":"address"}],"name":"DexNotWhitelisted","type":"error"},{"inputs":[{"internalType":"string","name":"reason","type":"string"}],"name":"InvalidPermit","type":"error"},{"inputs":[],"name":"InvalidPermitType","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NoSwapFromZeroAmount","type":"error"},{"inputs":[],"name":"NoTransferToNullAddress","type":"error"},{"inputs":[],"name":"NullAddrIsNotAValidRecipient","type":"error"},{"inputs":[],"name":"NullAddrIsNotAValidSpender","type":"error"},{"inputs":[],"name":"ReentrancyError","type":"error"},{"inputs":[],"name":"SigDeadlineExpired","type":"error"},{"inputs":[{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"name":"SlippageTooHigh","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"funSig","type":"bytes4"},{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"SwapCallFailed","type":"error"},{"inputs":[],"name":"UnauthorizedSigner","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bytes","name":"receiver","type":"bytes"},{"indexed":false,"internalType":"string","name":"bridge","type":"string"},{"indexed":false,"internalType":"address","name":"bridgeAddress","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes","name":"to","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"destinationCalldata","type":"bytes"}],"name":"BridgeStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"integrator","type":"address"},{"components":[{"internalType":"string","name":"dex","type":"string"},{"internalType":"address","name":"callTo","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"returnToAmount","type":"uint256"}],"indexed":false,"internalType":"struct SwapInfo[]","name":"swapInfo","type":"tuple[]"}],"name":"DZapBatchTokenSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"integrator","type":"address"}],"name":"DZapBridgeStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"integrator","type":"address"},{"components":[{"internalType":"string","name":"dex","type":"string"},{"internalType":"address","name":"callTo","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"returnToAmount","type":"uint256"}],"indexed":false,"internalType":"struct SwapInfo","name":"swapInfo","type":"tuple"}],"name":"DZapTokenSwapped","type":"event"},{"inputs":[{"internalType":"bytes32","name":"_transactionId","type":"bytes32"},{"internalType":"bytes","name":"_feeData","type":"bytes"},{"internalType":"bytes","name":"_feeVerificationSignature","type":"bytes"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct InputToken","name":"_intputTokens","type":"tuple"},{"components":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"bytes","name":"adapterData","type":"bytes"}],"internalType":"struct AdapterInfo","name":"_adapterInfo","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_transactionId","type":"bytes32"},{"internalType":"bytes","name":"_feeData","type":"bytes"},{"internalType":"bytes","name":"_feeVerificationSignature","type":"bytes"},{"internalType":"bytes","name":"_batchDepositSignature","type":"bytes"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct TokenPermissions[]","name":"permitted","type":"tuple[]"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct PermitBatchTransferFrom","name":"_tokenDepositDetails","type":"tuple"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"minToAmount","type":"uint256"},{"internalType":"bool","name":"updateBridgeInAmount","type":"bool"}],"internalType":"struct BridgeSwapData[]","name":"_swapData","type":"tuple[]"},{"components":[{"internalType":"string","name":"dex","type":"string"},{"internalType":"address","name":"callTo","type":"address"},{"internalType":"address","name":"approveTo","type":"address"},{"internalType":"bytes","name":"swapCallData","type":"bytes"},{"internalType":"bool","name":"isDirectTransfer","type":"bool"}],"internalType":"struct SwapExecutionData[]","name":"_swapExecutionData","type":"tuple[]"},{"components":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"bytes","name":"adapterData","type":"bytes"}],"internalType":"struct AdapterInfo[]","name":"_adapterInfo","type":"tuple[]"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_transactionId","type":"bytes32"},{"internalType":"bytes","name":"_feeData","type":"bytes"},{"internalType":"bytes","name":"_feeVerificationSignature","type":"bytes"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct InputToken[]","name":"_erc20Token","type":"tuple[]"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"minToAmount","type":"uint256"},{"internalType":"bool","name":"updateBridgeInAmount","type":"bool"}],"internalType":"struct BridgeSwapData[]","name":"_swapData","type":"tuple[]"},{"components":[{"internalType":"string","name":"dex","type":"string"},{"internalType":"address","name":"callTo","type":"address"},{"internalType":"address","name":"approveTo","type":"address"},{"internalType":"bytes","name":"swapCallData","type":"bytes"},{"internalType":"bool","name":"isDirectTransfer","type":"bool"}],"internalType":"struct SwapExecutionData[]","name":"_swapExecutionData","type":"tuple[]"},{"components":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"bytes","name":"adapterData","type":"bytes"}],"internalType":"struct AdapterInfo[]","name":"_adapterInfo","type":"tuple[]"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_transactionId","type":"bytes32"},{"internalType":"bytes","name":"_feeData","type":"bytes"},{"internalType":"bytes","name":"_feeVerificationSignature","type":"bytes"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct InputToken","name":"_intputTokens","type":"tuple"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"minToAmount","type":"uint256"},{"internalType":"bool","name":"updateBridgeInAmount","type":"bool"}],"internalType":"struct BridgeSwapData","name":"_swapData","type":"tuple"},{"components":[{"internalType":"string","name":"dex","type":"string"},{"internalType":"address","name":"callTo","type":"address"},{"internalType":"address","name":"approveTo","type":"address"},{"internalType":"bytes","name":"swapCallData","type":"bytes"},{"internalType":"bool","name":"isDirectTransfer","type":"bool"}],"internalType":"struct SwapExecutionData","name":"_swapExecutionData","type":"tuple"},{"components":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"bytes","name":"adapterData","type":"bytes"}],"internalType":"struct AdapterInfo","name":"_adapterInfo","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
60808060405234610016576130c0908161001c8239f35b600080fdfe610100604052600436101561001357600080fd5b600060c05260003560e01c80630d91e8a714610e92578063969ce56e14610982578063b3aaab5d146107525763bfbb8fb51461004e57600080fd5b6003196101a03682011261074c576001600160401b0360243581811161074c5761007c90369060040161105d565b60449291923582811161074c5761009790369060040161105d565b919093836084351161074c576060866084353603011261074c5760c03660a31901126106bd57604051956100ca876110e9565b60a4356001600160a01b03811681036106bd57875260c4356001600160a01b03811681036106bd57602088015260e4356001600160a01b03811681036106bd5760408801526101043560608801526101243560808801526101443580151581036106bd5760a08801526101643585811161074c5761014c9036906004016112e5565b94610184351161074c57604090610184353603011261074c5761016f344761143c565b9460ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a57600260008051602061306b8339815191525414610728576102579361022191600260008051602061306b833981519152556101d8368686611290565b6020815191012060405160208082015261020d816101ff6040820161018435600401611480565b03601f198101835282611155565b602081519101209060043560643533612c17565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0361024c6084356004016114d9565b16036106ef576123b8565b610271826001600160a01b03865116606087015190611640565b6001600160a01b03845116936001600160a01b03602082015116906001600160a01b036040820151166060820151608083015193608087015115156000146106e85788905b6102c08285612b81565b9260009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8103610551575090505b6000806001600160a01b0360208b0151169260608b0193845191602083519301915af161030e611c4d565b90156104d6575050906103246103299284612b81565b61143c565b928084106104b857508285969760806001600160a01b0397015115806104ae575b61049d575b50505030848251161480610491575b61046c575b8360208651960151169084815116856020830151169060608760408501511693015193604051986103938a6110ce565b8952602089015260408801526060870152608086015260a085015260c084015216809160405190602082527f247ededb7c64e43522ee8e8356d61630dfd566c20710e93ab33d5ae4d8a4ab8a3392806103f36004359460208301906115df565b0390a461040561018435600401612572565b60c05133907f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e6004359180a4600160008051602061306b8339815191525547818111610452575b60c05180f35b6104659161045f9161143c565b33611c7d565b388061044c565b61048c8460408301511661048460808401518561143c565b903390611cc9565b610363565b5060a08101511561035e565b6104a692611cc9565b38828161034f565b503081141561034a565b6044908460405191633b5d56ed60e11b835260048301526024820152fd5b6001600160a01b0360208a015116915191602083519301519163ffffffff60e01b808416936004861061053a575b509061053691604051948594639c7cc24360e01b865260048601521660248401526060604484015260648301906115ba565b0390fd5b909460040360031b85901b16841692508385610504565b6001600160a01b0360408b0151169182156106d657604051636eb1769f60e11b81523060048201526001600160a01b0384166024820152602081604481865afa9081156106ca57600091610693575b50106105ae575b50506102e3565b60405163095ea7b360e01b602082018181526001600160a01b0385166024840152600019604480850191909152835290939192919060009081906105f3606487611155565b85519082865af1610602611c4d565b81610664575b508061065a575b1561061c575b50506105a7565b6106519361064c91604051916020830152602482015260006044820152604481526106468161111f565b82611d56565b611d56565b38808080610615565b50813b151561060f565b8051801592508215610679575b505038610608565b61068c9250602080918301019101611d3e565b3880610671565b90506020813d6020116106c2575b816106ae60209383611155565b810103126106bd5751386105a0565b600080fd5b3d91506106a1565b6040513d6000823e3d90fd5b6040516363ba9bff60e01b8152600490fd5b30906102b6565b6107236107006084356004016114d9565b6107146044608435016084356004016114ed565b91602460843501359033611ed5565b6123b8565b6040516329f745a760e01b8152600490fd5b6040516306d39fcd60e41b8152600490fd5b60c05180fd5b61010036600319011261074c576004356001600160401b0360243581811161074c5761078290369060040161105d565b91909260443582811161074c5761079d90369060040161105d565b92909460843582811161074c576107b890369060040161140c565b96909560a43584811161074c576107d39036906004016111ae565b9060c43585811161074c576107ec90369060040161138c565b9460e43590811161074c5761080590369060040161140c565b949093610812344761143c565b9960ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a5760008051602061306b8339815191529960028b54146107285761089a9060028c5561086b368787611290565b938451602080960120896101ff61088c8d6040519283918b8301958661151f565b519020908d60643533612c17565b60c0515b8c8110610933578b60018c8c8c6108ca8d8d8d6108bb8e8e6123b8565b948151610920575b5050612536565b6001600160a01b0360c0519116917f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e339280a4554781811161090c5760c05180f35b6109199161045f9161143c565b808061044c565b61092c918633896116ff565b88806108c3565b8061097c8e61094d6109486001958388612396565b6114d9565b610973610969858961096082878c612396565b01359489612396565b60408101906114ed565b92909133611ed5565b0161089e565b61012036600319011261074c576024356001600160401b03811161074c576109ae90369060040161105d565b6044356001600160401b03811161074c576109cd90369060040161105d565b90926064356001600160401b03811161074c576109ee90369060040161105d565b93906001600160401b0360a4351161074c57606060a4353603600319011261074c5760c4356001600160401b03811161074c57610a2f9036906004016111ae565b9560e4356001600160401b03811161074c57610a4f90369060040161138c565b608052610104356001600160401b03811161074c57610a7290369060040161140c565b60e05294610a80344761143c565b60a05260ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a57600260008051602061306b833981519152541461072857610b1791600260008051602061306b83398151915255610ae7368688611290565b602081519101206040516020810190610b07816101ff60e0518d8661151f565b5190209060043560843533612c17565b610b26600460a4350180612af7565b959050610b3286611176565b95610b406040519788611155565b808752610b4c81611176565b60c0515b601f1982018110610e6b57505060c0515b818110610dfe5750506001600160a01b037f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541690610ba03033612b2c565b96610ba9612a4c565b833b1561074c576040519863fe8ec1a760e01b8a5260c060048b015260a4356004013560221960a43536030181121561074c5760a435016001600160401b0360048201351161074c57600481013560061b3603602482011361074c57908a9594939291606060c4880152610124870160048201359052610144870190602481019060c0515b60048201358110610dbb57505050602460a435013560e4880152604460a43501356101048801526003198782030160248801526020808551928381520194019060c0515b818110610d7c57505033604488015250606486015284820360031901608486015284928392610cbb92610ca591906115ba565b906003198483030160a485015260c0519761145f565b039160c051905af1918215610d6f57610cef94610cdd93610d60575b506123b8565b928051610d49575b5060e05190612536565b6001600160a01b0360c05191169033907f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e6004359180a4600160008051602061306b8339815191525560a0514781811161090c5760c05180f35b608051610d5a9185336004356116ff565b83610ce5565b610d69906110bb565b86610cd7565b6040513d60c051823e3d90fd5b91959697509192936020604082610da96001948a51602080916001600160a01b0381511684520151910152565b0196019101918c979695949392610c72565b91939495969798509160016040806004936001600160a01b03610ddd8961118d565b1681526020880135602082015201950192018e999897969594939150610c2e565b610e0d600460a4350180612af7565b8291921015610e5357600191602060405191610e288361108a565b3083528360061b0101356020820152610e41828b6116d5565b52610e4c818a6116d5565b5001610b61565b634e487b7160e01b60c051526032600452602460c051fd5b602090604051610e7a8161108a565b60c051815260c0518382015282828c01015201610b50565b60031960c0368201126106bd57600435906001600160401b036024358181116106bd57610ec390369060040161105d565b9390916044358181116106bd57610ede90369060040161105d565b9490608435958387116106bd57866004019260608189360301126106bd5760a4359485116106bd576040908560040195360301126106bd57610f20344761143c565b9760ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a5760008051602061306b83398151915296600288541461072857600198610fb6610fec94610ff29660028c55610f83368787611290565b602081519101208a604051610fa8816101ff6020820194602086526040830190611480565b519020908c60643533612c17565b6001600160a01b039573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee87610fde836114d9565b160361102c575b50506123b8565b92612572565b60c0519116917f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e339280a4554781811161090c5760c05180f35b611056918161104a61103f6024946114d9565b9160448401906114ed565b93909201359033611ed5565b8a80610fe5565b9181601f840112156106bd578235916001600160401b0383116106bd57602083818601950101116106bd57565b604081019081106001600160401b038211176110a557604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116110a557604052565b60e081019081106001600160401b038211176110a557604052565b60c081019081106001600160401b038211176110a557604052565b606081019081106001600160401b038211176110a557604052565b608081019081106001600160401b038211176110a557604052565b60a081019081106001600160401b038211176110a557604052565b90601f801991011681019081106001600160401b038211176110a557604052565b6001600160401b0381116110a55760051b60200190565b35906001600160a01b03821682036106bd57565b359081151582036106bd57565b81601f820112156106bd578035906111c582611176565b926040906111d582519586611155565b838552602091828601918360c0809702860101948186116106bd578401925b858410611205575050505050505090565b86848303126106bd57848791845161121c816110e9565b6112258761118d565b815261123283880161118d565b8382015261124186880161118d565b86820152606080880135908201526080808801359082015260a06112668189016111a1565b908201528152019301926111f4565b6001600160401b0381116110a557601f01601f191660200190565b92919261129c82611275565b916112aa6040519384611155565b8294818452818301116106bd578281602093846000960137010152565b9080601f830112156106bd578160206112e293359101611290565b90565b91909160a0818403126106bd57604051906001600160401b0360a08301818111848210176110a557604052829482358281116106bd57830181601f820112156106bd578181602061133893359101611290565b84526113466020840161118d565b60208501526113576040840161118d565b604085015260608301359182116106bd578261137c60809492611387948694016112c7565b6060860152016111a1565b910152565b9080601f830112156106bd578135906113a482611176565b926113b26040519485611155565b828452602092838086019160051b830101928084116106bd57848301915b8483106113e05750505050505090565b82356001600160401b0381116106bd578691611401848480948901016112e5565b8152019201916113d0565b9181601f840112156106bd578235916001600160401b0383116106bd576020808501948460051b0101116106bd57565b9190820391821161144957565b634e487b7160e01b600052601160045260246000fd5b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160a01b036114918261118d565b1682526020810135601e19823603018112156106bd5701602081359101906001600160401b0381116106bd5780360382136106bd576040838160206112e2960152019161145f565b356001600160a01b03811681036106bd5790565b903590601e19813603018212156106bd57018035906001600160401b0382116106bd576020019181360383136106bd57565b916020908082850183865252604084019160408260051b8601019484600080925b85841061155257505050505050505090565b9091929394959697603f198282030188528835603e1985360301811215611593578661158360019387839401611480565b9a01980196959401929190611540565b8380fd5b60005b8381106115aa5750506000910152565b818101518382015260200161159a565b906020916115d381518092818552858086019101611597565b601f01601f1916010190565b9060c0806115f6845160e0855260e08501906115ba565b936001600160a01b03806020830151166020860152806040830151166040860152806060830151166060860152608082015116608085015260a081015160a0850152015191015290565b9091602001906001600160a01b0391828151166000527f03ef279dff7badd98b43464ec17f797a88e435619b3aa2c30c6c31214479119560205260ff60406000205416156116ba575016156116a8571561169657565b6040516357b3d85d60e11b8152600490fd5b604051637c13399160e11b8152600490fd5b5160405163740bb42360e11b81529083166004820152602490fd5b80518210156116e95760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9190939280519060009461171283611176565b956117206040519788611155565b838752601f1961172f85611176565b01815b818110611c055750505b8381106117ee57505050611751575b50505050565b604051906020808301818452855180915260408401918060408360051b8701019701926000905b8382106117c257505050505090807fc9a96626eddfa02e342d5a828eed18ad376bb804eed233dcba5ec5d792df2cc2926001600160a01b038091169616940390a43880808061174b565b909192939783806117df600193603f198b82030186528c516115df565b9a019201920190939291611778565b6117f881846116d5565b5161180382846116d5565b519061181f826001600160a01b03835116606084015190611640565b6001600160a01b03815116906001600160a01b03602082015116916001600160a01b0360408301511690606083015160808401519460808701511515600014611bfe5782905b61186f8286612b81565b9260009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8103611a80575090505b6000806001600160a01b0360208b0151169260608b0193845191602083519301915af16118bd611c4d565b9015611a09575050906103246118d39285612b81565b938085106119eb5750908385949392608060019897015115806119e1575b6119d0575b505050306001600160a01b0382511614806119c4575b611999575b6001600160a01b036020845194015116906001600160a01b038151166001600160a01b036020830151169060606001600160a01b03604085015116930151936040519661195d886110ce565b8752602087015260408601526060850152608084015260a083015260c0820152611987828a6116d5565b5261199281896116d5565b500161173c565b6119bf6001600160a01b036040830151168d6119b960808501518661143c565b91611cc9565b611911565b5060a08101511561190c565b6119d992611cc9565b3882816118f6565b50308114156118f1565b6044908560405191633b5d56ed60e11b835260048301526024820152fd5b6105366001600160a01b0360208b0151169251916020835193015163ffffffff60e01b818180931690600496878110611a6b575b50509050604051958695639c7cc24360e01b87528601521660248401526060604484015260648301906115ba565b83919250870360031b1b161681908780611a3d565b6001600160a01b0360408b0151169182156106d657604051636eb1769f60e11b81523060048201526001600160a01b0384166024820152602081604481865afa908115611bf3578591611bbd575b5010611adc575b5050611892565b604051906020820163095ea7b360e01b8082528580602493611b2a87611b1c8a8883019190916001600160a01b0360408201931681526020600019910152565b03601f198101895288611155565b86519082875af1611b39611c4d565b81611b8e575b5080611b84575b15611b54575b505050611ad5565b611b7a9461064c926040519260208401528201526044868183015281526106468161111f565b3880808080611b4c565b50823b1515611b46565b8051801592508215611ba3575b505038611b3f565b611bb69250602080918301019101611d3e565b3880611b9b565b90506020813d602011611beb575b81611bd860209383611155565b81010312611be7575138611ace565b8480fd5b3d9150611bcb565b6040513d87823e3d90fd5b3090611865565b602090604095939551611c17816110ce565b606080825287849181838501528160408501528301528760808301528760a08301528760c0830152828c01015201939193611732565b3d15611c78573d90611c5e82611275565b91611c6c6040519384611155565b82523d6000602084013e565b606090565b6001600160a01b03811615611cb757600080809381935af1611c9d611c4d565b5015611ca557565b604051633d2cec6f60e21b8152600490fd5b6040516321f7434560e01b8152600490fd5b82611cd357505050565b6001600160a01b039081169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8203611d0857505090611d0691611c7d565b565b909116908115611cb757611d06926040519263a9059cbb60e01b6020850152602484015260448301526044825261064c8261111f565b908160209103126106bd575180151581036106bd5790565b604051611db4916001600160a01b0316611d6f8261108a565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611dae611c4d565b91611e3c565b805190828215928315611e24575b50505015611dcd5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b611e349350820181019101611d3e565b388281611dc2565b91929015611e9e5750815115611e50575090565b3b15611e595790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015611eb15750805190602001fd5b60405162461bcd60e51b8152602060048201529081906105369060248301906115ba565b929093810191600094604093848482031261239257833595600491828810156122cb57602090818701356001600160401b03978882116120b757611f1a9291016112c7565b97600281036120bf575087518801976060818a03126120bb578181015196888201519960608301519182116120b757611f5992908401910183016126d5565b916001600160a01b03807f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541696818a5197611f948961108a565b1687528084880152895196611fa888611104565b87528387019889528987019a8b52895193611fc28561108a565b308552840152611fd23083612b2c565b91611fdb612a4c565b93883b156120b357918c999897969492918a9694928c519d8e9b8c9a8b996309be14ff60e11b8b528a0190519061202491602080916001600160a01b0381511684520151910152565b51604489015251606488015280516001600160a01b031660848801526020015160a48701521660c485015260e484015261010483016101409052610144830161206c916115ba565b82810360031901610124840152612082916115ba565b03925af19081156120aa5750612096575050565b6120a082916110bb565b6120a75750565b80fd5b513d84823e3d90fd5b8c80fd5b8b80fd5b8980fd5b98999890979196939550806122cf575080518061211c575b505050611d0695965051936323b872dd60e01b908501526001600160a01b0380931660248501523060448501526064840152606483526121168361113a565b16611d56565b81608091810103126122cb578681015190838101519060ff82168092036122c75760806060820151910151906001600160a01b039283891694853b156122c357875163d505accf60e01b8152948b1687860152306024860152604485018990526064850152608484015260a483015260c4820152898160e48183865af190816122b0575b506122a3576001916121b0612636565b6308c379a0146121da575b50506121d157611d069596505b869538806120d7565b513d87823e3d90fd5b6121e2612654565b806121ee575b506121bb565b8451636eb1769f60e11b81526001600160a01b0389168184019081523060208201528c95509293919290918a918391908290819060400103915afa908115612299579086918c91612268575b501061224657806121e8565b83516352c3687b60e11b815291820188905281906105369060248301906115ba565b8092508a8092503d8311612292575b6122818183611155565b810103126106bd578590513861223a565b503d612277565b85513d8d823e3d90fd5b5050611d069596506121c8565b6122bc909a919a6110bb565b98386121a0565b8d80fd5b8a80fd5b8880fd5b6001919397509895939491979814600014612382576122fc6001600160a01b038095169283833087612717565b837f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541691823b1561237e57608492858796959387938a519b8c988997631b63c28b60e11b8952169087015230602487015260448601521660648401525af191821561237457505061236b5750565b611d06906110bb565b51903d90823e3d90fd5b8580fd5b8551632091924d60e21b81528790fd5b8680fd5b91908110156116e95760051b81013590605e19813603018212156106bd570190565b90810160209081838203126106bd5782356001600160401b03938482116106bd57019160409384848403126106bd578451936123f38561108a565b6123fc8161118d565b8552828101359182116106bd570182601f820112156106bd5780359061242182611176565b9361242e87519586611155565b82855283850190846060809502840101928184116106bd578501915b8383106124f9575050505050808301908282526001600160a01b0394857f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322d5460081c169160009451945b8581106124a657505050505050511690565b806124d4896124b860019489516116d5565b5151168a8a5116856124cb858b516116d5565b51015191611cc9565b6124f3896124e38389516116d5565b51511686866124cb858b516116d5565b01612494565b84838303126106bd578585918a5161251081611104565b6125198661118d565b815282860135838201528b8601358c82015281520192019161244a565b90600091825b8281106125495750505050565b8060051b820135603e1983360301811215611be7579061256c6001928401612572565b0161253c565b61257b816114d9565b6001600160a01b03811691826000527f03ef279dff7badd98b43464ec17f797a88e435619b3aa2c30c6c31214479119660205260ff604060002054161561261d576000916125ce826020859401906114ed565b90816040519283928337810184815203915af4906125ea611c4d565b91156125f4575050565b610536604051928392632e546bb560e21b845260048401526040602484015260448301906115ba565b60405163616d132960e01b815260048101849052602490fd5b60009060033d1161264357565b905060046000803e60005160e01c90565b600060443d106112e257604051600319913d83016004833e81516001600160401b03918282113d6024840111176126b1578184019485519384116126b9573d850101602084870101116126b157506112e292910160200190611155565b949350505050565b50949350505050565b519065ffffffffffff821682036106bd57565b81601f820112156106bd5780516126eb81611275565b926126f96040519485611155565b818452602082840101116106bd576112e29160208085019101611597565b9190918451916000958315612a43576001600160a01b037f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541693810195608082880312612a3f5761276b602083016126c2565b93612778604084016126c2565b9460608401519360808101516001600160401b039a8b82116120b3576127a59260209182019201016126d5565b926040519960808b01908b821090821117612a2b576001600160a01b0365ffffffffffff939284926040528189168d5216978860208d01521660408b0152166060890152604051976127f689611104565b885260208801916001600160a01b038816835260408901938452863b156120bb579089929160405194859384936302b67b5760e41b85526001600160a01b03169b8c60048601525180516001600160a01b0316602486015260208101516001600160a01b03166044860152604081015165ffffffffffff1660648601526060015165ffffffffffff166084850152516001600160a01b031660a48401525160c483015260e48201610100905261010482016128b0916115ba565b038183885af19081612a18575b50612a10576001946128cd612636565b6308c379a0146128f0575b50505050506128e45750565b604051903d90823e3d90fd5b6128f8612654565b9384612905575b506128d8565b6001600160a01b039495965060609291606491868a99604051988996879563927da10560e01b875260048701521660248501521660448301525afa918215611bf357859086936129aa575b506001600160a01b031610908115612997575b506129725780808080806128ff565b6040516352c3687b60e11b8152602060048201529081906105369060248301906115ba565b905065ffffffffffff4291161038612963565b9250506060823d606011612a08575b816129c660609383611155565b81010312611be75781516001600160a01b038116810361237e576001600160a01b0390612a0160406129fa602087016126c2565b95016126c2565b5090612950565b3d91506129b9565b505050505050565b612a24909791976110bb565b95386128bd565b634e487b7160e01b8c52604160045260248cfd5b8780fd5b50505050505050565b60405190612a598261113a565b607e82527f286164647265737320746f6b656e2c75696e7432353620616d6f756e742900006080837f445a61705472616e736665725769746e657373207769746e65737329445a617060208201527f5472616e736665725769746e6573732861646472657373206f776e65722c616460408201527f647265737320726563697069656e7429546f6b656e5065726d697373696f6e7360608201520152565b903590601e19813603018212156106bd57018035906001600160401b0382116106bd57602001918160061b360383136106bd57565b6040519060208201927f266a51557d4733337e3bc8128e6cd4856463d454dce2a9f9dfcb38e4f603714084526001600160a01b03809216604084015216606082015260608152612b7b8161111f565b51902090565b6001600160a01b0380911660009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8214600014612bb4575050503190565b6024602092939460405194859384926370a0823160e01b84521660048301525afa9182156128e4578092612be757505090565b9091506020823d8211612c0f575b81612c0260209383611155565b810103126120a757505190565b3d9150612bf5565b90949195428610612e77576001600160a01b039081807f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322e5416931693600080998682527f4f9314598fc24317d901f4a94cc5def9e3c745b0f73ff0b0e154b9953457cf83986020988a8a5260409b8c809520548551948c8601967fcbfee2c0e15f500ddc78e4d48ba409a821bc03215264d8922169947bac0ef17888528601528a6060860152608085015260a084015260c083015260e082015260e081526101008101918183106001600160401b03841117612a2b5792826b222d30b82b32b934b334b2b960a11b610120612e2494600c8f98612e329a98612e2a9a528251902094612d228161108a565b520152603160f81b8a8d51612d368161108a565b6001815201528b80517fa1d9b1587d1cdcf2a70ea404b54a42fe06f3d0742dc8c87336986927bf1279428c8201927fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647284528201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201527fab458d135ef5ffc786fd5ac1655b88a6fdc7589e65e154b5381ad419272f0c6260c082015260c08152612def816110ce565b519020908c51908b82019261190160f01b84526022830152604282015260428152612e198161111f565b519020923691611290565b90612fa3565b919091612e89565b1603612e66578452528120805490916000198214612e5257506001019055565b634e487b7160e01b81526011600452602490fd5b8351636518c33d60e11b8152600490fd5b60405163e354457160e01b8152600490fd5b6005811015612f8d5780612e9a5750565b60018103612ee75760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b60028103612f345760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b600314612f3d57565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b906041815114600014612fd157612fcd916020820151906060604084015193015160001a90612fdb565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161305e5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156130515781516001600160a01b0381161561304b579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea4b36ced7e8b039500cc9c7c393a04e0c8af96ee265b143e79175cc5679ca539a2646970667358221220d079815f985935352d6d0d609fabf881f714da460949e118f687085c1004aa6464736f6c63430008130033
Deployed Bytecode
0x610100604052600436101561001357600080fd5b600060c05260003560e01c80630d91e8a714610e92578063969ce56e14610982578063b3aaab5d146107525763bfbb8fb51461004e57600080fd5b6003196101a03682011261074c576001600160401b0360243581811161074c5761007c90369060040161105d565b60449291923582811161074c5761009790369060040161105d565b919093836084351161074c576060866084353603011261074c5760c03660a31901126106bd57604051956100ca876110e9565b60a4356001600160a01b03811681036106bd57875260c4356001600160a01b03811681036106bd57602088015260e4356001600160a01b03811681036106bd5760408801526101043560608801526101243560808801526101443580151581036106bd5760a08801526101643585811161074c5761014c9036906004016112e5565b94610184351161074c57604090610184353603011261074c5761016f344761143c565b9460ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a57600260008051602061306b8339815191525414610728576102579361022191600260008051602061306b833981519152556101d8368686611290565b6020815191012060405160208082015261020d816101ff6040820161018435600401611480565b03601f198101835282611155565b602081519101209060043560643533612c17565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0361024c6084356004016114d9565b16036106ef576123b8565b610271826001600160a01b03865116606087015190611640565b6001600160a01b03845116936001600160a01b03602082015116906001600160a01b036040820151166060820151608083015193608087015115156000146106e85788905b6102c08285612b81565b9260009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8103610551575090505b6000806001600160a01b0360208b0151169260608b0193845191602083519301915af161030e611c4d565b90156104d6575050906103246103299284612b81565b61143c565b928084106104b857508285969760806001600160a01b0397015115806104ae575b61049d575b50505030848251161480610491575b61046c575b8360208651960151169084815116856020830151169060608760408501511693015193604051986103938a6110ce565b8952602089015260408801526060870152608086015260a085015260c084015216809160405190602082527f247ededb7c64e43522ee8e8356d61630dfd566c20710e93ab33d5ae4d8a4ab8a3392806103f36004359460208301906115df565b0390a461040561018435600401612572565b60c05133907f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e6004359180a4600160008051602061306b8339815191525547818111610452575b60c05180f35b6104659161045f9161143c565b33611c7d565b388061044c565b61048c8460408301511661048460808401518561143c565b903390611cc9565b610363565b5060a08101511561035e565b6104a692611cc9565b38828161034f565b503081141561034a565b6044908460405191633b5d56ed60e11b835260048301526024820152fd5b6001600160a01b0360208a015116915191602083519301519163ffffffff60e01b808416936004861061053a575b509061053691604051948594639c7cc24360e01b865260048601521660248401526060604484015260648301906115ba565b0390fd5b909460040360031b85901b16841692508385610504565b6001600160a01b0360408b0151169182156106d657604051636eb1769f60e11b81523060048201526001600160a01b0384166024820152602081604481865afa9081156106ca57600091610693575b50106105ae575b50506102e3565b60405163095ea7b360e01b602082018181526001600160a01b0385166024840152600019604480850191909152835290939192919060009081906105f3606487611155565b85519082865af1610602611c4d565b81610664575b508061065a575b1561061c575b50506105a7565b6106519361064c91604051916020830152602482015260006044820152604481526106468161111f565b82611d56565b611d56565b38808080610615565b50813b151561060f565b8051801592508215610679575b505038610608565b61068c9250602080918301019101611d3e565b3880610671565b90506020813d6020116106c2575b816106ae60209383611155565b810103126106bd5751386105a0565b600080fd5b3d91506106a1565b6040513d6000823e3d90fd5b6040516363ba9bff60e01b8152600490fd5b30906102b6565b6107236107006084356004016114d9565b6107146044608435016084356004016114ed565b91602460843501359033611ed5565b6123b8565b6040516329f745a760e01b8152600490fd5b6040516306d39fcd60e41b8152600490fd5b60c05180fd5b61010036600319011261074c576004356001600160401b0360243581811161074c5761078290369060040161105d565b91909260443582811161074c5761079d90369060040161105d565b92909460843582811161074c576107b890369060040161140c565b96909560a43584811161074c576107d39036906004016111ae565b9060c43585811161074c576107ec90369060040161138c565b9460e43590811161074c5761080590369060040161140c565b949093610812344761143c565b9960ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a5760008051602061306b8339815191529960028b54146107285761089a9060028c5561086b368787611290565b938451602080960120896101ff61088c8d6040519283918b8301958661151f565b519020908d60643533612c17565b60c0515b8c8110610933578b60018c8c8c6108ca8d8d8d6108bb8e8e6123b8565b948151610920575b5050612536565b6001600160a01b0360c0519116917f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e339280a4554781811161090c5760c05180f35b6109199161045f9161143c565b808061044c565b61092c918633896116ff565b88806108c3565b8061097c8e61094d6109486001958388612396565b6114d9565b610973610969858961096082878c612396565b01359489612396565b60408101906114ed565b92909133611ed5565b0161089e565b61012036600319011261074c576024356001600160401b03811161074c576109ae90369060040161105d565b6044356001600160401b03811161074c576109cd90369060040161105d565b90926064356001600160401b03811161074c576109ee90369060040161105d565b93906001600160401b0360a4351161074c57606060a4353603600319011261074c5760c4356001600160401b03811161074c57610a2f9036906004016111ae565b9560e4356001600160401b03811161074c57610a4f90369060040161138c565b608052610104356001600160401b03811161074c57610a7290369060040161140c565b60e05294610a80344761143c565b60a05260ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a57600260008051602061306b833981519152541461072857610b1791600260008051602061306b83398151915255610ae7368688611290565b602081519101206040516020810190610b07816101ff60e0518d8661151f565b5190209060043560843533612c17565b610b26600460a4350180612af7565b959050610b3286611176565b95610b406040519788611155565b808752610b4c81611176565b60c0515b601f1982018110610e6b57505060c0515b818110610dfe5750506001600160a01b037f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541690610ba03033612b2c565b96610ba9612a4c565b833b1561074c576040519863fe8ec1a760e01b8a5260c060048b015260a4356004013560221960a43536030181121561074c5760a435016001600160401b0360048201351161074c57600481013560061b3603602482011361074c57908a9594939291606060c4880152610124870160048201359052610144870190602481019060c0515b60048201358110610dbb57505050602460a435013560e4880152604460a43501356101048801526003198782030160248801526020808551928381520194019060c0515b818110610d7c57505033604488015250606486015284820360031901608486015284928392610cbb92610ca591906115ba565b906003198483030160a485015260c0519761145f565b039160c051905af1918215610d6f57610cef94610cdd93610d60575b506123b8565b928051610d49575b5060e05190612536565b6001600160a01b0360c05191169033907f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e6004359180a4600160008051602061306b8339815191525560a0514781811161090c5760c05180f35b608051610d5a9185336004356116ff565b83610ce5565b610d69906110bb565b86610cd7565b6040513d60c051823e3d90fd5b91959697509192936020604082610da96001948a51602080916001600160a01b0381511684520151910152565b0196019101918c979695949392610c72565b91939495969798509160016040806004936001600160a01b03610ddd8961118d565b1681526020880135602082015201950192018e999897969594939150610c2e565b610e0d600460a4350180612af7565b8291921015610e5357600191602060405191610e288361108a565b3083528360061b0101356020820152610e41828b6116d5565b52610e4c818a6116d5565b5001610b61565b634e487b7160e01b60c051526032600452602460c051fd5b602090604051610e7a8161108a565b60c051815260c0518382015282828c01015201610b50565b60031960c0368201126106bd57600435906001600160401b036024358181116106bd57610ec390369060040161105d565b9390916044358181116106bd57610ede90369060040161105d565b9490608435958387116106bd57866004019260608189360301126106bd5760a4359485116106bd576040908560040195360301126106bd57610f20344761143c565b9760ff7f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd9206332305460a01c1661073a5760008051602061306b83398151915296600288541461072857600198610fb6610fec94610ff29660028c55610f83368787611290565b602081519101208a604051610fa8816101ff6020820194602086526040830190611480565b519020908c60643533612c17565b6001600160a01b039573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee87610fde836114d9565b160361102c575b50506123b8565b92612572565b60c0519116917f2f784d79e0ac264e2b2b087fdba506b5763d153d8f2fe8077b404d20a2a7109e339280a4554781811161090c5760c05180f35b611056918161104a61103f6024946114d9565b9160448401906114ed565b93909201359033611ed5565b8a80610fe5565b9181601f840112156106bd578235916001600160401b0383116106bd57602083818601950101116106bd57565b604081019081106001600160401b038211176110a557604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116110a557604052565b60e081019081106001600160401b038211176110a557604052565b60c081019081106001600160401b038211176110a557604052565b606081019081106001600160401b038211176110a557604052565b608081019081106001600160401b038211176110a557604052565b60a081019081106001600160401b038211176110a557604052565b90601f801991011681019081106001600160401b038211176110a557604052565b6001600160401b0381116110a55760051b60200190565b35906001600160a01b03821682036106bd57565b359081151582036106bd57565b81601f820112156106bd578035906111c582611176565b926040906111d582519586611155565b838552602091828601918360c0809702860101948186116106bd578401925b858410611205575050505050505090565b86848303126106bd57848791845161121c816110e9565b6112258761118d565b815261123283880161118d565b8382015261124186880161118d565b86820152606080880135908201526080808801359082015260a06112668189016111a1565b908201528152019301926111f4565b6001600160401b0381116110a557601f01601f191660200190565b92919261129c82611275565b916112aa6040519384611155565b8294818452818301116106bd578281602093846000960137010152565b9080601f830112156106bd578160206112e293359101611290565b90565b91909160a0818403126106bd57604051906001600160401b0360a08301818111848210176110a557604052829482358281116106bd57830181601f820112156106bd578181602061133893359101611290565b84526113466020840161118d565b60208501526113576040840161118d565b604085015260608301359182116106bd578261137c60809492611387948694016112c7565b6060860152016111a1565b910152565b9080601f830112156106bd578135906113a482611176565b926113b26040519485611155565b828452602092838086019160051b830101928084116106bd57848301915b8483106113e05750505050505090565b82356001600160401b0381116106bd578691611401848480948901016112e5565b8152019201916113d0565b9181601f840112156106bd578235916001600160401b0383116106bd576020808501948460051b0101116106bd57565b9190820391821161144957565b634e487b7160e01b600052601160045260246000fd5b908060209392818452848401376000828201840152601f01601f1916010190565b6001600160a01b036114918261118d565b1682526020810135601e19823603018112156106bd5701602081359101906001600160401b0381116106bd5780360382136106bd576040838160206112e2960152019161145f565b356001600160a01b03811681036106bd5790565b903590601e19813603018212156106bd57018035906001600160401b0382116106bd576020019181360383136106bd57565b916020908082850183865252604084019160408260051b8601019484600080925b85841061155257505050505050505090565b9091929394959697603f198282030188528835603e1985360301811215611593578661158360019387839401611480565b9a01980196959401929190611540565b8380fd5b60005b8381106115aa5750506000910152565b818101518382015260200161159a565b906020916115d381518092818552858086019101611597565b601f01601f1916010190565b9060c0806115f6845160e0855260e08501906115ba565b936001600160a01b03806020830151166020860152806040830151166040860152806060830151166060860152608082015116608085015260a081015160a0850152015191015290565b9091602001906001600160a01b0391828151166000527f03ef279dff7badd98b43464ec17f797a88e435619b3aa2c30c6c31214479119560205260ff60406000205416156116ba575016156116a8571561169657565b6040516357b3d85d60e11b8152600490fd5b604051637c13399160e11b8152600490fd5b5160405163740bb42360e11b81529083166004820152602490fd5b80518210156116e95760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9190939280519060009461171283611176565b956117206040519788611155565b838752601f1961172f85611176565b01815b818110611c055750505b8381106117ee57505050611751575b50505050565b604051906020808301818452855180915260408401918060408360051b8701019701926000905b8382106117c257505050505090807fc9a96626eddfa02e342d5a828eed18ad376bb804eed233dcba5ec5d792df2cc2926001600160a01b038091169616940390a43880808061174b565b909192939783806117df600193603f198b82030186528c516115df565b9a019201920190939291611778565b6117f881846116d5565b5161180382846116d5565b519061181f826001600160a01b03835116606084015190611640565b6001600160a01b03815116906001600160a01b03602082015116916001600160a01b0360408301511690606083015160808401519460808701511515600014611bfe5782905b61186f8286612b81565b9260009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8103611a80575090505b6000806001600160a01b0360208b0151169260608b0193845191602083519301915af16118bd611c4d565b9015611a09575050906103246118d39285612b81565b938085106119eb5750908385949392608060019897015115806119e1575b6119d0575b505050306001600160a01b0382511614806119c4575b611999575b6001600160a01b036020845194015116906001600160a01b038151166001600160a01b036020830151169060606001600160a01b03604085015116930151936040519661195d886110ce565b8752602087015260408601526060850152608084015260a083015260c0820152611987828a6116d5565b5261199281896116d5565b500161173c565b6119bf6001600160a01b036040830151168d6119b960808501518661143c565b91611cc9565b611911565b5060a08101511561190c565b6119d992611cc9565b3882816118f6565b50308114156118f1565b6044908560405191633b5d56ed60e11b835260048301526024820152fd5b6105366001600160a01b0360208b0151169251916020835193015163ffffffff60e01b818180931690600496878110611a6b575b50509050604051958695639c7cc24360e01b87528601521660248401526060604484015260648301906115ba565b83919250870360031b1b161681908780611a3d565b6001600160a01b0360408b0151169182156106d657604051636eb1769f60e11b81523060048201526001600160a01b0384166024820152602081604481865afa908115611bf3578591611bbd575b5010611adc575b5050611892565b604051906020820163095ea7b360e01b8082528580602493611b2a87611b1c8a8883019190916001600160a01b0360408201931681526020600019910152565b03601f198101895288611155565b86519082875af1611b39611c4d565b81611b8e575b5080611b84575b15611b54575b505050611ad5565b611b7a9461064c926040519260208401528201526044868183015281526106468161111f565b3880808080611b4c565b50823b1515611b46565b8051801592508215611ba3575b505038611b3f565b611bb69250602080918301019101611d3e565b3880611b9b565b90506020813d602011611beb575b81611bd860209383611155565b81010312611be7575138611ace565b8480fd5b3d9150611bcb565b6040513d87823e3d90fd5b3090611865565b602090604095939551611c17816110ce565b606080825287849181838501528160408501528301528760808301528760a08301528760c0830152828c01015201939193611732565b3d15611c78573d90611c5e82611275565b91611c6c6040519384611155565b82523d6000602084013e565b606090565b6001600160a01b03811615611cb757600080809381935af1611c9d611c4d565b5015611ca557565b604051633d2cec6f60e21b8152600490fd5b6040516321f7434560e01b8152600490fd5b82611cd357505050565b6001600160a01b039081169073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8203611d0857505090611d0691611c7d565b565b909116908115611cb757611d06926040519263a9059cbb60e01b6020850152602484015260448301526044825261064c8261111f565b908160209103126106bd575180151581036106bd5790565b604051611db4916001600160a01b0316611d6f8261108a565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af1611dae611c4d565b91611e3c565b805190828215928315611e24575b50505015611dcd5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b611e349350820181019101611d3e565b388281611dc2565b91929015611e9e5750815115611e50575090565b3b15611e595790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015611eb15750805190602001fd5b60405162461bcd60e51b8152602060048201529081906105369060248301906115ba565b929093810191600094604093848482031261239257833595600491828810156122cb57602090818701356001600160401b03978882116120b757611f1a9291016112c7565b97600281036120bf575087518801976060818a03126120bb578181015196888201519960608301519182116120b757611f5992908401910183016126d5565b916001600160a01b03807f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541696818a5197611f948961108a565b1687528084880152895196611fa888611104565b87528387019889528987019a8b52895193611fc28561108a565b308552840152611fd23083612b2c565b91611fdb612a4c565b93883b156120b357918c999897969492918a9694928c519d8e9b8c9a8b996309be14ff60e11b8b528a0190519061202491602080916001600160a01b0381511684520151910152565b51604489015251606488015280516001600160a01b031660848801526020015160a48701521660c485015260e484015261010483016101409052610144830161206c916115ba565b82810360031901610124840152612082916115ba565b03925af19081156120aa5750612096575050565b6120a082916110bb565b6120a75750565b80fd5b513d84823e3d90fd5b8c80fd5b8b80fd5b8980fd5b98999890979196939550806122cf575080518061211c575b505050611d0695965051936323b872dd60e01b908501526001600160a01b0380931660248501523060448501526064840152606483526121168361113a565b16611d56565b81608091810103126122cb578681015190838101519060ff82168092036122c75760806060820151910151906001600160a01b039283891694853b156122c357875163d505accf60e01b8152948b1687860152306024860152604485018990526064850152608484015260a483015260c4820152898160e48183865af190816122b0575b506122a3576001916121b0612636565b6308c379a0146121da575b50506121d157611d069596505b869538806120d7565b513d87823e3d90fd5b6121e2612654565b806121ee575b506121bb565b8451636eb1769f60e11b81526001600160a01b0389168184019081523060208201528c95509293919290918a918391908290819060400103915afa908115612299579086918c91612268575b501061224657806121e8565b83516352c3687b60e11b815291820188905281906105369060248301906115ba565b8092508a8092503d8311612292575b6122818183611155565b810103126106bd578590513861223a565b503d612277565b85513d8d823e3d90fd5b5050611d069596506121c8565b6122bc909a919a6110bb565b98386121a0565b8d80fd5b8a80fd5b8880fd5b6001919397509895939491979814600014612382576122fc6001600160a01b038095169283833087612717565b837f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541691823b1561237e57608492858796959387938a519b8c988997631b63c28b60e11b8952169087015230602487015260448601521660648401525af191821561237457505061236b5750565b611d06906110bb565b51903d90823e3d90fd5b8580fd5b8551632091924d60e21b81528790fd5b8680fd5b91908110156116e95760051b81013590605e19813603018212156106bd570190565b90810160209081838203126106bd5782356001600160401b03938482116106bd57019160409384848403126106bd578451936123f38561108a565b6123fc8161118d565b8552828101359182116106bd570182601f820112156106bd5780359061242182611176565b9361242e87519586611155565b82855283850190846060809502840101928184116106bd578501915b8383106124f9575050505050808301908282526001600160a01b0394857f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322d5460081c169160009451945b8581106124a657505050505050511690565b806124d4896124b860019489516116d5565b5151168a8a5116856124cb858b516116d5565b51015191611cc9565b6124f3896124e38389516116d5565b51511686866124cb858b516116d5565b01612494565b84838303126106bd578585918a5161251081611104565b6125198661118d565b815282860135838201528b8601358c82015281520192019161244a565b90600091825b8281106125495750505050565b8060051b820135603e1983360301811215611be7579061256c6001928401612572565b0161253c565b61257b816114d9565b6001600160a01b03811691826000527f03ef279dff7badd98b43464ec17f797a88e435619b3aa2c30c6c31214479119660205260ff604060002054161561261d576000916125ce826020859401906114ed565b90816040519283928337810184815203915af4906125ea611c4d565b91156125f4575050565b610536604051928392632e546bb560e21b845260048401526040602484015260448301906115ba565b60405163616d132960e01b815260048101849052602490fd5b60009060033d1161264357565b905060046000803e60005160e01c90565b600060443d106112e257604051600319913d83016004833e81516001600160401b03918282113d6024840111176126b1578184019485519384116126b9573d850101602084870101116126b157506112e292910160200190611155565b949350505050565b50949350505050565b519065ffffffffffff821682036106bd57565b81601f820112156106bd5780516126eb81611275565b926126f96040519485611155565b818452602082840101116106bd576112e29160208085019101611597565b9190918451916000958315612a43576001600160a01b037f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322f541693810195608082880312612a3f5761276b602083016126c2565b93612778604084016126c2565b9460608401519360808101516001600160401b039a8b82116120b3576127a59260209182019201016126d5565b926040519960808b01908b821090821117612a2b576001600160a01b0365ffffffffffff939284926040528189168d5216978860208d01521660408b0152166060890152604051976127f689611104565b885260208801916001600160a01b038816835260408901938452863b156120bb579089929160405194859384936302b67b5760e41b85526001600160a01b03169b8c60048601525180516001600160a01b0316602486015260208101516001600160a01b03166044860152604081015165ffffffffffff1660648601526060015165ffffffffffff166084850152516001600160a01b031660a48401525160c483015260e48201610100905261010482016128b0916115ba565b038183885af19081612a18575b50612a10576001946128cd612636565b6308c379a0146128f0575b50505050506128e45750565b604051903d90823e3d90fd5b6128f8612654565b9384612905575b506128d8565b6001600160a01b039495965060609291606491868a99604051988996879563927da10560e01b875260048701521660248501521660448301525afa918215611bf357859086936129aa575b506001600160a01b031610908115612997575b506129725780808080806128ff565b6040516352c3687b60e11b8152602060048201529081906105369060248301906115ba565b905065ffffffffffff4291161038612963565b9250506060823d606011612a08575b816129c660609383611155565b81010312611be75781516001600160a01b038116810361237e576001600160a01b0390612a0160406129fa602087016126c2565b95016126c2565b5090612950565b3d91506129b9565b505050505050565b612a24909791976110bb565b95386128bd565b634e487b7160e01b8c52604160045260248cfd5b8780fd5b50505050505050565b60405190612a598261113a565b607e82527f286164647265737320746f6b656e2c75696e7432353620616d6f756e742900006080837f445a61705472616e736665725769746e657373207769746e65737329445a617060208201527f5472616e736665725769746e6573732861646472657373206f776e65722c616460408201527f647265737320726563697069656e7429546f6b656e5065726d697373696f6e7360608201520152565b903590601e19813603018212156106bd57018035906001600160401b0382116106bd57602001918160061b360383136106bd57565b6040519060208201927f266a51557d4733337e3bc8128e6cd4856463d454dce2a9f9dfcb38e4f603714084526001600160a01b03809216604084015216606082015260608152612b7b8161111f565b51902090565b6001600160a01b0380911660009173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8214600014612bb4575050503190565b6024602092939460405194859384926370a0823160e01b84521660048301525afa9182156128e4578092612be757505090565b9091506020823d8211612c0f575b81612c0260209383611155565b810103126120a757505190565b3d9150612bf5565b90949195428610612e77576001600160a01b039081807f0e1ba6b8f4f66ef33154e3c1bb6c4c32cda48e0a34207b9eeeb11bd92063322e5416931693600080998682527f4f9314598fc24317d901f4a94cc5def9e3c745b0f73ff0b0e154b9953457cf83986020988a8a5260409b8c809520548551948c8601967fcbfee2c0e15f500ddc78e4d48ba409a821bc03215264d8922169947bac0ef17888528601528a6060860152608085015260a084015260c083015260e082015260e081526101008101918183106001600160401b03841117612a2b5792826b222d30b82b32b934b334b2b960a11b610120612e2494600c8f98612e329a98612e2a9a528251902094612d228161108a565b520152603160f81b8a8d51612d368161108a565b6001815201528b80517fa1d9b1587d1cdcf2a70ea404b54a42fe06f3d0742dc8c87336986927bf1279428c8201927fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647284528201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201527fab458d135ef5ffc786fd5ac1655b88a6fdc7589e65e154b5381ad419272f0c6260c082015260c08152612def816110ce565b519020908c51908b82019261190160f01b84526022830152604282015260428152612e198161111f565b519020923691611290565b90612fa3565b919091612e89565b1603612e66578452528120805490916000198214612e5257506001019055565b634e487b7160e01b81526011600452602490fd5b8351636518c33d60e11b8152600490fd5b60405163e354457160e01b8152600490fd5b6005811015612f8d5780612e9a5750565b60018103612ee75760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b60028103612f345760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b600314612f3d57565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b906041815114600014612fd157612fcd916020820151906060604084015193015160001a90612fdb565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161305e5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156130515781516001600160a01b0381161561304b579190565b50600190565b50604051903d90823e3d90fd5b5050505060009060039056fea4b36ced7e8b039500cc9c7c393a04e0c8af96ee265b143e79175cc5679ca539a2646970667358221220d079815f985935352d6d0d609fabf881f714da460949e118f687085c1004aa6464736f6c63430008130033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.