Source Code
Latest 25 from a total of 34 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Fill | 24575432 | 2 days ago | IN | 0 ETH | 0.00002236 | ||||
| Fill | 24575425 | 2 days ago | IN | 0 ETH | 0.0000212 | ||||
| Batch Claim | 24575315 | 2 days ago | IN | 0 ETH | 0.0000075 | ||||
| Initiate | 24575291 | 2 days ago | IN | 0 ETH | 0.0000032 | ||||
| Fill | 24575272 | 2 days ago | IN | 0 ETH | 0.00002378 | ||||
| Initiate | 24575261 | 2 days ago | IN | 0 ETH | 0.00001283 | ||||
| Batch Claim | 24568420 | 2 days ago | IN | 0 ETH | 0.00000672 | ||||
| Fill | 24568415 | 2 days ago | IN | 0 ETH | 0.00001613 | ||||
| Batch Claim | 24568381 | 3 days ago | IN | 0 ETH | 0.00000754 | ||||
| Fill | 24568369 | 3 days ago | IN | 0 ETH | 0.00002099 | ||||
| Initiate | 24568351 | 3 days ago | IN | 0 ETH | 0.00001392 | ||||
| Initiate | 24568272 | 3 days ago | IN | 0 ETH | 0.00001918 | ||||
| Batch Claim | 24568257 | 3 days ago | IN | 0 ETH | 0.00001016 | ||||
| Fill | 24568243 | 3 days ago | IN | 0 ETH | 0.00002586 | ||||
| Initiate | 24568227 | 3 days ago | IN | 0 ETH | 0.00001957 | ||||
| Batch Claim | 24568158 | 3 days ago | IN | 0 ETH | 0.00001013 | ||||
| Initiate | 24568123 | 3 days ago | IN | 0 ETH | 0.00001292 | ||||
| Initiate | 24568113 | 3 days ago | IN | 0 ETH | 0.00001214 | ||||
| Fill | 24567931 | 3 days ago | IN | 0 ETH | 0.00001875 | ||||
| Refund For | 24555047 | 4 days ago | IN | 0 ETH | 0.00000416 | ||||
| Batch Claim | 24554562 | 4 days ago | IN | 0 ETH | 0.00000916 | ||||
| Fill | 24554522 | 4 days ago | IN | 0 ETH | 0.00002707 | ||||
| Initiate | 24554506 | 4 days ago | IN | 0 ETH | 0.00002442 | ||||
| Batch Claim | 24554453 | 4 days ago | IN | 0 ETH | 0.0000132 | ||||
| Initiate | 24554397 | 4 days ago | IN | 0 ETH | 0.00003431 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
NativeBridge
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 2000000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {EIP712, ECDSA} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import "../libraries/ConstantsLib.sol";
import {IWETH9} from "../interfaces/IWETH9.sol";
import {SafeERC20} from "../libraries/SafeERC20.sol";
import {ErrorsLib} from "../libraries/ErrorsLib.sol";
import {IQuote} from "../interfaces/INativeRouter.sol";
import {INativeRouter} from "../interfaces/INativeRouter.sol";
import {TransferHelper} from "../libraries/TransferHelper.sol";
import {INativeBridge, ICreditVault} from "../interfaces/INativeBridge.sol";
import {ReentrancyGuardTransient} from "../libraries/ReentrancyGuardTransient.sol";
/// @title Native Bridge - Intent-based Cross-chain Token Swap Protocol
//
/// @notice Facilitates cross-chain token swaps using an intent-based architecture with market maker fulfillment.
/// @notice This bridge operates as a trustless intermediary where users express cross-chain swap intents,
/// @notice and market makers compete to fulfill these intents by providing liquidity on the destination chain.
//
/// @dev CROSS-CHAIN LIFECYCLE:
/**
* SOURCE CHAIN DESTINATION CHAIN
*
* [1] initiate()
* ├─ Lock sellerToken
* ├─ Store: sourceOrder
* └─ Emit: OrderCreated
* │
* │ (Off-chain relay)
* ▼
* [2] fill()
* ├─ Call router.tradeRFQT()
* ├─ Deliver buyerToken to recipient
* ├─ Store: destOrder
* └─ Emit: Filled
* │
* (Backend confirms fill) │
* │◄─────────────────────────┘
* ▼
* [3] claim()
* ├─ Validate filled orders
* ├─ Call router.tradeRFQT()
* ├─ Deposit to CreditVault
* ├─ Update: sourceOrder[].state = Completed
* └─ Emit: Claimed
*
* [Alternative: User refund after timeout]
* [4] refund()
* ├─ Check: block.timestamp > orderTimestamp + refundBuffer
* ├─ Verify: backend signature
* ├─ Return: sellerToken to user
* └─ Emit: Refunded
*/
///
/// @dev FALLBACK PATH (EXTERNAL BRIDGE):
/// @dev - When RFQ market makers/settlers cannot fill user intents, backend can route the order via an external bridge aggregator
/// @dev - Source chain emits ExternalBridged and does not track destination balance changes; settlement occurs asynchronously, so users must rely on the external bridge’s own APIs/explorer to monitor completion
contract NativeBridge is INativeBridge, EIP712, Ownable2Step, Pausable, ReentrancyGuardTransient {
using SafeERC20 for IERC20;
/*//////////////////////////////////////////////////////////////
STATE VARIABLES
//////////////////////////////////////////////////////////////*/
/// @notice The NativeRouter contract used for executing RFQ trades.
/// @dev This contract handles the actual token swaps via tradeRFQT().
INativeRouter public router;
/// @notice The CreditVault contract where market maker positions are tracked.
/// @dev Immutable to prevent unauthorized vault changes after deployment.
address public immutable vault;
/// @notice The Wrapped Ether (WETH9) contract address.
address public immutable WETH9;
/// @notice Authorized refund executor who can refund orders on behalf of users.
address public refundExecutor;
/// @notice Minimum refund buffer period in seconds (30 minutes).
uint256 public constant MIN_REFUND_BUFFER = 1800;
/// @notice Time buffer in seconds after order creation before refunds are permitted.
uint256 public refundBuffer;
/// @notice Authorized signers who can sign refund authorization signatures.
mapping(address => bool) public signers;
/// @notice Authorized market maker signers who can sign refund requests.
mapping(address => bool) public marketMakerSigners;
/// @notice Tracks which destination chains are enabled for bridging.
mapping(uint32 => bool) public enabledDestination;
/// @notice Whitelist of bridge routers allowed for fallback external bridging.
mapping(address => bool) public externalBridgeRouters;
/// @notice Tracks fallback external bridge orders per user by quoteId.
mapping(address => mapping(bytes16 => ExternalBridgeOrder)) public externalBridgeOrders;
/// @notice Stores order information for users on the source chain.
/// @dev Mapping: swapper address => quoteId => Order
/// @dev Created in initiate(), updated in claim() or refund()
/// @dev Order.token = sellerToken (locked asset)
/// @dev Order.amount = sellerTokenAmount (locked amount)
mapping(address => mapping(bytes16 => INativeBridge.Order)) public sourceOrder;
/// @notice Records filled orders on the destination chain.
/// @dev Mapping: recipient address => quoteId => Order
/// @dev Created in fill() when MM delivers tokens to recipient
/// @dev Order.token = buyerToken (delivered asset)
/// @dev Order.amount = buyerTokenAmount (actual delivered amount)
mapping(address => mapping(bytes16 => INativeBridge.Order)) public destOrder;
/// @notice EIP-712 typehash for market maker refund signatures.
/// @dev keccak256("MMRefund(address user,bytes16 quoteId)")
bytes32 private constant MM_REFUND_ORDER_TYPEHASH =
0xe91459739c65339c6f9d9d4aaf76070d6e580cec363432da7d718b215c8a0f4a;
/// @notice EIP-712 typehash for backend refund authorization signatures.
/// @dev keccak256("Refund(address user,bytes16 quoteId,bytes32 mmSignatureHash)")
bytes32 private constant REFUND_ORDER_TYPEHASH = 0x22a6a1ee4ce3c203e6c5050f89b76de80922c621972f1f2c715343fd02e30379;
/// @notice EIP-712 typehash for fallback external bridge signatures.
/// @dev keccak256("ExternalBridge(address bridgerRouter,address spender,address recipient,address inputToken,address outputToken,uint256 inputTokenAmount,uint256 outputTokenAmount,uint256 minOutputAmount,uint256 destChainId,uint256 deadlineTimestamp,bytes16 quoteId,bytes callData)")
bytes32 private constant EXTERNAL_BRIDGE_TYPEHASH =
0x13cd64c20705b67ed42e8bcab4a2563dfb42bb2a709ffdc8106905de262ca135;
/// @notice EIP-712 typehash for external bridge refund authorizations.
/// @dev keccak256("ExternalBridgeRefund(address user,bytes16 quoteId,address externalBridge,bytes refundCallData,bytes32 mmSignatureHash)")
bytes32 private constant EXTERNAL_BRIDGE_REFUND_TYPEHASH =
0x2e8b423aa04051ad929f93dc9ea2cc49896ca12aa24d3dade9e5f8faeb110713;
/*//////////////////////////////////////////////////////////////
RECEIVE FUNCTION
//////////////////////////////////////////////////////////////*/
/// @notice Allows the contract to receive native ETH.
receive() external payable {}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
/// @notice Initializes the NativeBridge contract with core parameters.
/// @param _router The NativeRouter contract address for executing trades
/// @param _WETH9 The Wrapped Ether (WETH9) contract address
/// @param _signer The initial authorized signer for refund signatures
/// @param _vault The CreditVault contract address for market maker accounting
/// @param _refundBuffer The initial refund buffer period in seconds
constructor(
INativeRouter _router,
address _WETH9,
address _signer,
address _vault,
uint256 _refundBuffer
) EIP712("Native Bridge", "1") {
require(_refundBuffer >= MIN_REFUND_BUFFER, ErrorsLib.InvalidAmount());
router = _router;
WETH9 = _WETH9;
vault = _vault;
refundBuffer = _refundBuffer;
setSigner(_signer, true);
}
/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Initiates a cross-chain bridge order by locking tokens on the source chain.
/// @dev This is the entry point for users to start a cross-chain swap.
/// @dev The function locks sellerToken in this contract and emits an event for backend/market makers to observe.
//
/// @param initDeadline The deadline timestamp by which this order must be initiated (anti-replay protection)
/// @param destChainId The destination chain ID where the order will be filled by market makers
/// @param quote The market maker's signed RFQ quote containing token addresses, amounts, recipient, and signature
/// @param refundTo Address to receive refund if order is refunded
function initiate(
uint32 initDeadline,
uint32 destChainId,
address refundTo,
RFQTQuote calldata quote
) public payable nonReentrant whenNotPaused {
require(enabledDestination[destChainId], InvalidDestChain());
require(sourceOrder[msg.sender][quote.quoteId].orderState == OrderState.None, InvalidQuoteId());
require(block.timestamp < initDeadline && initDeadline < quote.deadlineTimestamp, DeadlineExpired());
// Handle token transfer based on seller token type
if (msg.value > 0) {
require(msg.value == quote.sellerTokenAmount, ErrorsLib.InvalidAmount());
require(quote.sellerToken == WETH9, InvalidToken());
IWETH9(WETH9).deposit{value: msg.value}();
} else {
uint256 balanceBefore = IERC20(quote.sellerToken).balanceOf(address(this));
IERC20(quote.sellerToken).safeTransferFrom(msg.sender, address(this), quote.sellerTokenAmount);
require(
IERC20(quote.sellerToken).balanceOf(address(this)) - balanceBefore >= quote.sellerTokenAmount,
ErrorsLib.InsufficientAmount()
);
}
address _refundTo = refundTo == address(0) ? msg.sender : refundTo;
sourceOrder[msg.sender][quote.quoteId] = Order({
recipient: quote.recipient,
token: quote.sellerToken,
amount: quote.sellerTokenAmount,
orderTimestamp: block.timestamp,
settler: quote.signer,
refundTo: _refundTo,
orderState: OrderState.Committed
});
emit OrderCreated(
msg.sender,
quote.recipient,
quote.quoteId,
quote.sellerToken,
quote.sellerTokenAmount,
quote.buyerToken,
quote.buyerTokenAmount,
quote.signer,
_refundTo,
destChainId
);
}
/// @notice Fills an order on the destination chain by delivering tokens to the recipient.
/// @dev This is called by market makers on the destination chain after observing an OrderCreated event.
//
/// @dev IMPORTANT: sellerToken is NOT required on destination chain because it's already
/// @dev locked on source chain. We only need to deliver buyerToken here.
//
/// @param quote The market maker's signed quote (must match the one used in initiate on source chain)
function fill(RFQTQuote memory quote) external nonReentrant whenNotPaused {
// Validate order state on destination chain
require(destOrder[quote.recipient][quote.quoteId].orderState == OrderState.None, OrderCompleted());
// SellerToken already locked on source chain, no need to pay on dest chain
require(quote.sellerTokenAmount == 0, ErrorsLib.InvalidAmount());
uint256 initialBalance = quote.buyerToken == address(0)
? address(quote.recipient).balance
: IERC20(quote.buyerToken).balanceOf(quote.recipient);
router.tradeRFQT(quote, 0, 0);
// This is required as tradeRFQT doesn't return amountOut
uint256 buyerTokenAmount = quote.buyerToken == address(0)
? address(quote.recipient).balance - initialBalance
: IERC20(quote.buyerToken).balanceOf(quote.recipient) - initialBalance;
require(
buyerTokenAmount
>= quote.buyerTokenAmount - (quote.widgetFee.feeRate * quote.buyerTokenAmount / BPS_DENOMINATOR),
ErrorsLib.InsufficientAmount()
);
destOrder[quote.recipient][quote.quoteId] = Order({
recipient: quote.recipient,
token: quote.buyerToken,
amount: buyerTokenAmount,
orderTimestamp: block.timestamp,
settler: quote.signer,
refundTo: address(0), // dest chain fill: no refund on this chain, default to zero
orderState: OrderState.Completed
});
emit Filled(
quote.recipient, quote.quoteId, quote.signer, quote.buyerToken, buyerTokenAmount, uint32(block.chainid)
);
}
/// @notice Processes a single batch claim for multiple filled orders on the source chain.
/// @dev This is called by market makers on the source chain after filling orders on the destination chain.
/// @dev All orders in a single claim must have the same sellerToken and settler (MM).
/// @param claimData The claim data containing quote (with MM signature), user addresses, and quoteIds
function claim(ClaimData calldata claimData) external nonReentrant whenNotPaused {
_claim(claimData);
}
/// @notice Processes multiple batch claims in a single transaction for gas efficiency.
/// @dev Each claim can have a different sellerToken, but within each claim all orders must share the same token.
/// @dev Useful when MM needs to claim multiple token types simultaneously (e.g., USDC orders + WETH orders).
/// @param claimData Array of claim data to process sequentially
function batchClaim(ClaimData[] calldata claimData) external nonReentrant whenNotPaused {
for (uint256 i; i < claimData.length; ++i) {
_claim(claimData[i]);
}
}
/// @notice Executes a fallback external bridge call using pre-authorized parameters.
/// @dev Used when market makers do not provide RFQ bridge swap, falling back to external bridge instead.
/// @param params The external bridge parameters signed off-chain by an authorized backend
function externalBridge(ExternalBridge calldata params) external payable nonReentrant whenNotPaused {
require(block.timestamp <= params.deadlineTimestamp, DeadlineExpired());
require(externalBridgeRouters[params.bridgerRouter], InvalidBridgeRouter());
ExternalBridgeOrder storage order = externalBridgeOrders[msg.sender][params.quoteId];
require(order.state == ExternalBridgeState.None, InvalidQuoteId());
bytes32 structHash = keccak256(
abi.encode(
EXTERNAL_BRIDGE_TYPEHASH,
params.bridgerRouter,
params.spender,
params.recipient,
params.inputToken,
params.outputToken,
params.inputTokenAmount,
params.outputTokenAmount,
params.minOutputAmount,
params.destChainId,
params.deadlineTimestamp,
params.quoteId,
keccak256(params.callData)
)
);
_verifySignature(structHash, params.signature);
if (params.inputToken == address(0)) {
// Native token
require(msg.value == params.inputTokenAmount, ErrorsLib.InvalidAmount());
} else {
// ERC20 token
require(msg.value == 0, ErrorsLib.UnexpectedMsgValue());
IERC20(params.inputToken).safeTransferFrom(msg.sender, address(this), params.inputTokenAmount);
// Approve the spender to use exact amount
IERC20(params.inputToken).safeApprove(params.spender, params.inputTokenAmount);
}
(bool success,) = params.bridgerRouter.call{value: msg.value}(params.callData);
require(success, ErrorsLib.ExternalCallFailed());
externalBridgeOrders[msg.sender][params.quoteId] = ExternalBridgeOrder({
inputToken: params.inputToken,
inputTokenAmount: params.inputTokenAmount,
orderTimestamp: block.timestamp,
state: ExternalBridgeState.Committed
});
emit ExternalBridged(
params.bridgerRouter,
params.recipient,
params.inputToken,
params.outputToken,
params.inputTokenAmount,
params.outputTokenAmount,
params.minOutputAmount,
params.destChainId,
params.quoteId
);
}
/// @notice Allows a user to request a refund for an unfilled order after the timeout period.
//
/// @dev VALIDATIONS:
/// @dev - Order must be in Committed state (not already completed or refunded)
/// @dev - Sufficient time must have passed (refundBuffer protection for MMs)
/// @dev - Market maker signature must be verified first
/// @dev - Backend signature must be from authorized signer (prevents unauthorized refunds)
//
/// @param quoteId The unique identifier of the order to refund
/// @param mmSignature EIP-712 signature from market maker authorizing this refund
/// @param refundSignature EIP-712 signature from backend signer authorizing this refund (includes mmSignature hash)
function refund(
bytes16 quoteId,
bytes calldata mmSignature,
bytes calldata refundSignature
) external nonReentrant whenNotPaused {
_refund(msg.sender, quoteId, mmSignature, refundSignature);
}
/// @notice Allows a refund executor to refund an order on behalf of a user.
/// @dev Executor just initiates the refund; refunded tokens are transferred to order.refundTo.
/// @param user The address of the user whose order will be refunded
/// @param quoteId The unique identifier of the order to refund
/// @param mmSignature EIP-712 signature from market maker authorizing this refund
/// @param refundSignature EIP-712 signature from backend signer authorizing this refund (includes mmSignature hash)
function refundFor(
address user,
bytes16 quoteId,
bytes calldata mmSignature,
bytes calldata refundSignature
) external nonReentrant whenNotPaused {
require(msg.sender == refundExecutor, NotRefundExecutor());
_refund(user, quoteId, mmSignature, refundSignature);
}
/// @notice Refunds funds for a fallback external bridge order when the external bridge fails.
/// @param quoteId The identifier of the external bridge order to refund
/// @param mmSignature EIP-712 signature from market maker authorizing this refund
/// @param refundSignature EIP-712 signature from backend signer authorizing this refund (includes mmSignature hash)
/// @param bridge The external bridge contract address to call for refund
/// @param refundCallData The calldata to call on externalBridge
function refundExternalBridge(
bytes16 quoteId,
bytes calldata mmSignature,
bytes calldata refundSignature,
address bridge, // optional, can be address(0)
bytes calldata refundCallData // optional, can be empty
) external nonReentrant whenNotPaused {
_refundExternalBridge(msg.sender, quoteId, mmSignature, refundSignature, bridge, refundCallData);
}
/// @notice Allows a refund executor to refund an external bridge order on behalf of a user.
/// @dev Executor just initiates the refund; refunded tokens are still transferred to the user.
/// @param user The address of the user whose order will be refunded
/// @param quoteId The identifier of the external bridge order to refund
/// @param mmSignature EIP-712 signature from market maker authorizing this refund
/// @param refundSignature EIP-712 signature from backend signer authorizing this refund (includes mmSignature hash)
/// @param bridge The external bridge contract address to call for refund
/// @param refundCallData The calldata to call on externalBridge
function refundExternalBridgeFor(
address user,
bytes16 quoteId,
bytes calldata mmSignature,
bytes calldata refundSignature,
address bridge, // optional, can be address(0)
bytes calldata refundCallData // optional, can be empty
) external nonReentrant whenNotPaused {
require(msg.sender == refundExecutor, NotRefundExecutor());
_refundExternalBridge(user, quoteId, mmSignature, refundSignature, bridge, refundCallData);
}
/*//////////////////////////////////////////////////////////////
ADMIN FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Sets the authorization status for a refund signer.
/// @dev Authorized signers can create EIP-712 signatures to approve user refund requests.
/// @param signer The address to authorize or revoke as a refund signer
/// @param isSigner True to authorize the signer, false to revoke authorization
function setSigner(address signer, bool isSigner) public onlyOwner {
require(signer != address(0), ErrorsLib.ZeroAddress());
signers[signer] = isSigner;
emit SignerUpdated(signer, isSigner);
}
/// @notice Sets the authorization status for a market maker signer.
/// @param signer The address to authorize or revoke as a market maker signer
/// @param isSigner True to authorize the signer, false to revoke authorization
function setMarketMakerSigner(address signer, bool isSigner) external onlyOwner {
require(signer != address(0), ErrorsLib.ZeroAddress());
marketMakerSigners[signer] = isSigner;
emit MMSignerUpdated(signer, isSigner);
}
/// @notice Sets the refund executor address.
/// @dev The refund executor can call refundFor() to refund orders on behalf of users.
/// @param newExecutor The address of the new refund executor (can be address(0) to disable)
function setRefundExecutor(address newExecutor) external onlyOwner {
address oldExecutor = refundExecutor;
refundExecutor = newExecutor;
emit RefundExecutorUpdated(oldExecutor, newExecutor);
}
/// @notice Updates the NativeRouter contract address.
/// @dev The router is responsible for executing tradeRFQT() for swaps.
/// @param newRouter The address of the new NativeRouter contract
function setRouter(address newRouter) external onlyOwner {
require(newRouter != address(0), ErrorsLib.ZeroAddress());
address oldRouter = address(router);
router = INativeRouter(newRouter);
emit RouterUpdated(oldRouter, newRouter);
}
/// @notice Updates whitelist status for an external bridge router.
/// @param bridgeRouter The router address to update
/// @param allowed True to whitelist, false to remove
function setExternalBridgeRouter(address bridgeRouter, bool allowed) external onlyOwner {
require(bridgeRouter != address(0), ErrorsLib.ZeroAddress());
externalBridgeRouters[bridgeRouter] = allowed;
emit ExternalBridgeRouterUpdated(bridgeRouter, allowed);
}
/// @notice Sets whether destination chains are enabled for bridging.
/// @dev Allows owner to disable problematic chains or enable new chains in batch.
/// @param destChainIds Array of chain IDs to enable or disable
/// @param statuses Array of status flags (true to enable, false to disable)
function setDestinationChains(uint32[] calldata destChainIds, bool[] calldata statuses) external onlyOwner {
require(destChainIds.length == statuses.length, ErrorsLib.InvalidAmount());
for (uint256 i = 0; i < destChainIds.length; ++i) {
enabledDestination[destChainIds[i]] = statuses[i];
emit DestinationStatusUpdated(destChainIds[i], statuses[i]);
}
}
/// @notice Sets the refund buffer period.
/// @dev The refund buffer protects market makers by ensuring they have time to fill orders.
/// @param newRefundBuffer The new refund buffer period in seconds
function setRefundBuffer(uint256 newRefundBuffer) external onlyOwner {
require(newRefundBuffer >= MIN_REFUND_BUFFER, ErrorsLib.InvalidAmount());
uint256 oldBuffer = refundBuffer;
refundBuffer = newRefundBuffer;
emit RefundBufferUpdated(oldBuffer, newRefundBuffer);
}
/// @notice Pauses the contract, disabling initiate, fill, claim, and refund functions.
/// @dev Used as an emergency circuit breaker in case of discovered vulnerabilities or attacks.
function pause() external onlyOwner {
_pause();
}
/// @notice Unpauses the contract, re-enabling all functions.
function unpause() external onlyOwner {
_unpause();
}
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
function _claim(ClaimData memory claimData) internal {
// BuyerToken already paid on dest chain, no need to pay on source chain
require(claimData.quote.buyerTokenAmount == 0, ErrorsLib.InvalidAmount());
uint256 totalAmount;
address claimToken = claimData.quote.sellerToken;
address signer = claimData.quote.signer;
require(msg.sender == signer, "Only the setter can claim");
for (uint256 i; i < claimData.quoteIds.length; ++i) {
Order memory orderInfo = sourceOrder[claimData.users[i]][claimData.quoteIds[i]];
// Ensure all orders in this claim are for the same token
require(orderInfo.token == claimToken, InvalidToken());
require(orderInfo.settler == signer, ErrorsLib.InvalidSigner());
require(orderInfo.orderState == OrderState.Committed, OrderCompleted());
totalAmount = totalAmount + orderInfo.amount;
// Mark order as completed on source chain
sourceOrder[claimData.users[i]][claimData.quoteIds[i]].orderState = OrderState.Completed;
}
// Verify that MM's signed amount matches the actual total
require(claimData.quote.sellerTokenAmount == totalAmount, ErrorsLib.InvalidAmount());
uint256 initialBalance = IERC20(claimToken).balanceOf(vault);
int256 initialPosition = ICreditVault(vault).positions(signer, claimToken);
IERC20(claimToken).safeApprove(address(router), totalAmount);
router.tradeRFQT(claimData.quote, 0, 0);
require(IERC20(claimToken).balanceOf(vault) - initialBalance >= totalAmount, ErrorsLib.InsufficientAmount());
// validate market maker's position
require(
ICreditVault(vault).positions(signer, claimToken) - initialPosition >= int256(totalAmount),
ErrorsLib.InsufficientAmount()
);
emit Claimed(signer, claimToken, totalAmount, claimData.users, claimData.quoteIds);
}
/// @notice Internal function to process a refund for a user's order.
/// @dev Verifies both market maker signature and backend signer signature before processing refund.
/// @param user The address of the user whose order will be refunded
/// @param quoteId The unique identifier of the order to refund
/// @param mmSignature EIP-712 signature from market maker
/// @param refundSignature EIP-712 signature from backend signer (includes mmSignature hash)
function _refund(
address user,
bytes16 quoteId,
bytes calldata mmSignature,
bytes calldata refundSignature
) internal {
Order storage order = sourceOrder[user][quoteId];
require(order.orderState == OrderState.Committed, InvalidQuoteId());
require(block.timestamp > order.orderTimestamp + refundBuffer, NotRefundable());
// Step 1: Verify market maker signature
bytes32 mmStructHash = keccak256(abi.encode(MM_REFUND_ORDER_TYPEHASH, user, quoteId));
_verifyMMSignature(mmStructHash, mmSignature);
// Step 2: Verify backend signer signature (includes mmSignature hash)
bytes32 refundStructHash = keccak256(abi.encode(REFUND_ORDER_TYPEHASH, user, quoteId, keccak256(mmSignature)));
_verifySignature(refundStructHash, refundSignature);
order.orderState = OrderState.Refunded;
IERC20(order.token).safeTransfer(order.refundTo, order.amount);
emit Refunded(user, order.refundTo, quoteId, order.token, order.amount);
}
/// @notice Internal function to process a refund for an external bridge order.
/// @dev Verifies both market maker signature and backend signer signature before processing refund.
/// @param user The address of the user whose order will be refunded
/// @param quoteId The identifier of the external bridge order to refund
/// @param mmSignature EIP-712 signature from market maker
/// @param refundSignature EIP-712 signature from backend signer (includes mmSignature hash)
/// @param bridge The external bridge contract address to call for refund
/// @param refundCallData The calldata to call on externalBridge
function _refundExternalBridge(
address user,
bytes16 quoteId,
bytes calldata mmSignature,
bytes calldata refundSignature,
address bridge,
bytes calldata refundCallData
) internal {
ExternalBridgeOrder storage order = externalBridgeOrders[user][quoteId];
require(order.state == ExternalBridgeState.Committed, InvalidQuoteId());
require(block.timestamp > order.orderTimestamp + refundBuffer, NotRefundable());
// Step 1: Verify market maker signature
bytes32 mmStructHash = keccak256(abi.encode(MM_REFUND_ORDER_TYPEHASH, user, quoteId));
_verifyMMSignature(mmStructHash, mmSignature);
// Step 2: Verify backend signer signature (includes mmSignature hash)
bytes32 refundStructHash = keccak256(
abi.encode(
EXTERNAL_BRIDGE_REFUND_TYPEHASH,
user,
quoteId,
bridge,
keccak256(refundCallData),
keccak256(mmSignature)
)
);
_verifySignature(refundStructHash, refundSignature);
// Call external bridge to initiate refund if provided.
// Normally cross-chain transactions don't fail, and most bridges auto-refund on failure.
// However, some bridge protocols require active refund requests instead of automatic refunds.
// This optional call provides fault tolerance for bridges that don't support automatic refunds.
if (bridge != address(0)) {
// validate external bridge is whitelisted
require(externalBridgeRouters[bridge], InvalidBridgeRouter());
(bool success,) = bridge.call(refundCallData);
require(success, ErrorsLib.ExternalCallFailed());
}
order.state = ExternalBridgeState.Refunded;
if (order.inputToken == address(0)) {
TransferHelper.safeTransferETH(user, order.inputTokenAmount);
} else {
IERC20(order.inputToken).safeTransfer(user, order.inputTokenAmount);
}
emit ExternalBridgeRefunded(msg.sender, user, quoteId, order.inputToken, order.inputTokenAmount);
}
/// @notice Verifies market maker signature for refund requests.
/// @param structHash The struct hash to verify
/// @param signature The market maker's signature
function _verifyMMSignature(bytes32 structHash, bytes calldata signature) internal view {
address recoveredSigner = ECDSA.recover(_hashTypedDataV4(structHash), signature);
require(marketMakerSigners[recoveredSigner], ErrorsLib.InvalidSignature());
}
/// @notice Verifies backend signer signature for refund requests.
/// @param structHash The struct hash to verify
/// @param signature The backend signer's signature
function _verifySignature(bytes32 structHash, bytes calldata signature) internal view {
address recoveredSigner = ECDSA.recover(_hashTypedDataV4(structHash), signature);
require(signers[recoveredSigner], ErrorsLib.InvalidSignature());
}
}// 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.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.8;
import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* _Available since v3.4._
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant _TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
string private _nameFallback;
string private _versionFallback;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {EIP-5267}.
*
* _Available since v4.9._
*/
function eip712Domain()
public
view
virtual
override
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_name.toStringWithFallback(_nameFallback),
_version.toStringWithFallback(_versionFallback),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
/// @dev Minimum shares permanently locked to prevent first depositor attacks
uint256 constant MINIMUM_SHARE = 10 ** 3;
/// @dev Every interval, the system performs an epoch update to calculate and settle funding fees between traders
uint256 constant EPOCH_UPDATE_INTERVAL = 8 hours;
/// @dev Maximum seller token amount upward deviation in basis points (10%)
uint256 constant MAX_AMOUNT_UPWARD_DEVIATION_BPS = 1000;
/// @dev Maximum seller token amount downward deviation in basis points (50%)
uint256 constant MAX_AMOUNT_DOWNWARD_DEVIATION_BPS = 5000;
/// @dev Maximum early withdrawal fee in basis points (10%)
uint256 constant MAX_EARLY_WITHDRAW_FEE_BIPS = 1000;
/// @dev Maximum widget fee in basis points (20%)
uint256 constant MAX_WIDGET_FEE_BIPS = 2000;
/// @dev Maximum confidence factor E
uint256 constant MAX_CONFIDENCE_FACTOR_E = 3;
/// @dev Basis points denominator
uint256 constant BPS_DENOMINATOR = 10_000;
/// @dev The EIP-712 typeHash for Settle Market Maker Position Authorization.
bytes32 constant SETTLEMENT_REQUEST_SIGNATURE_HASH = keccak256(
"SettlementRequest(uint256 nonce,uint256 deadline,address trader,bytes32 positionUpdates,address recipient)"
);
/// @dev The EIP-712 typeHash for Remove Collateral Authorization.
bytes32 constant REMOVE_COLLATERAL_REQUEST_SIGNATURE_HASH =
keccak256("RemoveCollateralRequest(uint256 nonce,uint256 deadline,address trader,bytes32 tokens,address recipient)");
/// @dev The EIP-712 typeHash for Liquidation Authorization.
bytes32 constant LIQUIDATION_REQUEST_SIGNATURE_HASH = keccak256(
"LiquidationRequest(uint256 nonce,uint256 deadline,address trader,bytes32 positionUpdates,bytes32 claimCollaterals,address recipient)"
);
/// @dev The EIP-712 typeHash for Market Maker RFQ Quote Authorization.
bytes32 constant ORDER_SIGNATURE_HASH = keccak256(
"Order(uint256 nonce,address signer,address buyerToken,address sellerToken,uint256 buyerTokenAmount,uint256 sellerTokenAmount,uint256 deadlineTimestamp,uint256 confidenceExtractedValueT,uint256 confidenceExtractedValueN,uint256 confidenceExtractedValueE,uint256 confidenceExtractedValueM,bytes16 quoteId)"
);
/// @dev The EIP-712 typeHash for RFQ Quote Widget Authorization.
bytes32 constant RFQ_QUOTE_WIDGET_SIGNATURE_HASH =
keccak256("RFQTQuote(bytes32 quote,address widgetFeeRecipient,uint256 widgetFeeRate)");
/// @dev The EIP-712 typeHash for External Swap Authorization.
bytes32 constant EXTERNAL_SWAP_SIGNATURE_HASH = keccak256(
"ExternalSwap(address source,address spender,address recipient,address sellerToken,uint256 sellerTokenAmount,address buyerToken,uint256 amountOutMinimum,uint256 deadlineTimestamp,bytes16 quoteId,bytes callData)"
);// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title Interface for WETH9
interface IWETH9 is IERC20 {
event Deposit(address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);
/// @notice Deposit ether to get wrapped ether
function deposit() external payable;
/// @notice Withdraw wrapped ether to get ether
function withdraw(uint256) external;
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.28;
import "openzeppelin/token/ERC20/IERC20.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
forceApprove(token, 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.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @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.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
/// @title Custom error definitions for the protocol
/// @notice This library contains all the error definitions used throughout the contract
/// @dev The errors are arranged in alphabetical order
library ErrorsLib {
/// @notice Thrown when actual amount deviation exceeds 10%
error AmountDeviationExceeds();
/// @notice Thrown when deposit amount is below minimum required
error BelowMinimumDeposit();
/// @notice Thrown when epoch update is attempted before minimum interval
error EpochUpdateInCoolDown();
/// @notice Thrown when LP token exchange rate increases more than allowed
error ExchangeRateIncreaseTooMuch();
/// @notice Thrown when external call fails
error ExternalCallFailed();
/// @notice Thrown when feature is paused
error FeaturePaused();
/// @notice Thrown when token amount is insufficient
error InsufficientAmount();
/// @notice Thrown when there are insufficient funding fees to withdraw
error InsufficientFundingFees();
/// @notice Thrown when LP token shares are insufficient
error InsufficientShares();
/// @notice Thrown when LP token underlying is insufficient
error InsufficientUnderlying();
/// @notice Thrown when there is insufficient WETH9 to unwrap
error InsufficientWETH9();
/// @notice Thrown when an amount parameter is invalid
error InvalidAmount();
/// @notice Thrown when confidence factor E is invalid
error InvalidConfidenceFactorE();
/// @notice Thrown when confidence factor N is invalid
error InvalidConfidenceFactorN();
/// @notice Thrown when fee rate in basis points exceeds maximum (10000)
error InvalidFeeBips();
/// @notice Thrown when LP token address is invalid
error InvalidLPToken();
/// @notice Thrown when underlying are not supported in the credit vault
error InvalidUnderlying();
/// @notice Thrown when market (LP token) is invalid
error InvalidMarket();
/// @notice Thrown when position update amount is invalid
error InvalidPositionUpdateAmount();
/// @notice Thrown when the pool address is invalid Native pool
error InvalidNativePool();
/// @notice Thrown when the external swap source is not whitelisted
error InvalidExternalSwapSource();
/// @notice Thrown when signature verification fails
error InvalidSignature();
/// @notice Thrown when signer is not authorized
error InvalidSigner();
/// @notice Thrown when WETH9 unwrap amount is zero or exceeds balance
error InvalidWETH9Amount();
/// @notice Thrown when widget fee rate is invalid
error InvalidWidgetFeeRate();
/// @notice Thrown when liquidator and recipient are the same
error LiquidatorRecipientConflict();
/// @notice Thrown when nonce is used
error NonceUsed();
/// @notice Thrown when output amount is less than minimum required
error NotEnoughAmountOut(uint256 amountOut, uint256 amountOutMinimum);
/// @notice Thrown the address is not a trader or liquidator
error NotTraderOrLiquidator();
/// @notice Error when caller is not a trusted operator
error NotTrustedOperator();
/// @notice Thrown when there is no yield to distribute
error NoYieldToDistribute();
/// @notice Thrown when caller is not the credit pool
error OnlyCreditPool();
/// @notice Thrown when caller is not the credit vault
error OnlyCreditVault();
/// @notice Thrown when caller is not the epoch updater
error OnlyEpochUpdater();
/// @notice Thrown when caller is not the fee withdrawer
error OnlyFeeWithdrawer();
/// @notice Thrown when caller is not an authorized liquidator
error OnlyLiquidator();
/// @notice Thrown when caller is not an LP token
error OnlyLpToken();
/// @notice Thrown when caller is not the native router
error OnlyNativeRouter();
/// @notice Thrown when caller is not an authorized trader
error OnlyTrader();
/// @notice Thrown when caller is not the WETH9 contract
error OnlyWETH9();
/// @notice Thrown when arithmetic operation would overflow
error Overflow();
/// @notice Thrown when LP pool has no deposits yet
error PoolNotInitialized();
/// @notice Thrown when quote has expired
error QuoteExpired();
/// @notice Thrown when rebalance limit is exceeded
error RebalanceLimitExceeded();
/// @notice Thrown when request has expired
error RequestExpired();
/// @notice Thrown when token is already listed
error TokenAlreadyListed();
/// @notice Thrown when trader, settler and recipient are the same
error TraderRecipientConflict();
/// @notice Thrown when transfer is in cooldown period
error TransferInCooldown();
/// @notice Thrown when transfer to self
error TransferSelf();
/// @notice Thrown when transfer to current contract
error TransferToContract();
/// @notice Thrown when unexpected msg.value is sent
error UnexpectedMsgValue();
/// @notice Thrown when zero address is provided
error ZeroAddress();
/// @notice Thrown when amount is zero
error ZeroAmount();
/// @notice Thrown when input is zero or empty
error ZeroInput();
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
import {IQuote} from "./IQuote.sol";
/// @title Native Router Interface
interface INativeRouter is IQuote {
/// @notice Execute an RFQ trade with a signed quote
/// @param quote The RFQ quote containing trade details
/// @param actualSellerAmount The actual amount of tokens to be sold
/// @param actualMinOutputAmount The minimum amount of tokens to be received
function tradeRFQT(
RFQTQuote memory quote,
uint256 actualSellerAmount,
uint256 actualMinOutputAmount
) external payable;
/// @notice Execute an external swap through approved external sources
/// @param params The external swap parameters including signature
function externalSwap(ExternalSwap calldata params) external payable;
/// @notice Emitted when ETH is refunded
event RefundETH(address recipient, uint256 amount);
/// @notice Emitted when ERC20 tokens are refunded
event RefundERC20(address token, address recipient, uint256 amount);
// @notice Emitted when a signer's status is updated
event SignerUpdated(address signer, bool isSigner);
/// @notice Emitted when a native pool's status is updated
event NativePoolUpdated(address indexed pool, bool isActive);
/// @notice Emitted when RFQ trade widget fee is transferred
event WidgetFeeTransfer(
address widgetFeeRecipient, uint256 widgetFeeRate, uint256 widgetFeeAmount, address widgetFeeToken
);
/// @notice Emitted when WETH9 is unwrapped
event UnwrapWETH9(address indexed recipient, uint256 amount);
/// @notice Emitted when an external swap is executed
event ExternalSwapped(
address indexed source,
address indexed recipient,
address indexed sellerToken,
address buyerToken,
uint256 sellerTokenAmount,
uint256 buyerTokenAmount,
bytes16 quoteId
);
/// @notice Emitted when an external swap source's status is updated
event ExternalSwapSourceUpdated(address indexed source, bool isActive);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.28;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
library TransferHelper {
using SafeERC20 for IERC20;
/// @notice Transfers tokens from the targeted address to the given destination
/// @notice Errors with 'STF' if transfer fails
/// @param token The contract address of the token to be transferred
/// @param from The originating address from which the tokens will be transferred
/// @param to The destination address of the transfer
/// @param value The amount to be transferred
function safeTransferFrom(address token, address from, address to, uint256 value) internal {
IERC20(token).safeTransferFrom(from, to, value);
}
/// @notice Transfers tokens from msg.sender to a recipient
/// @dev Errors with ST if transfer fails
/// @param token The contract address of the token which will be transferred
/// @param to The recipient of the transfer
/// @param value The value of the transfer
function safeTransfer(address token, address to, uint256 value) internal {
IERC20(token).safeTransfer(to, value);
}
function safeIncreaseAllowance(address token, address to, uint256 value) internal {
IERC20(token).safeIncreaseAllowance(to, value);
}
function safeDecreaseAllowance(address token, address to, uint256 value) internal {
IERC20(token).safeDecreaseAllowance(to, value);
}
/// @notice Transfers ETH to the recipient address
/// @dev Fails with `STE`
/// @param to The destination of the transfer
/// @param value The value to be transferred
function safeTransferETH(address to, uint256 value) internal {
(bool success,) = to.call{value: value}(new bytes(0));
require(success, "STE");
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
import {IQuote} from "./IQuote.sol";
/// @title ICreditVault - Interface for Market Maker Credit Accounting
/// @notice Manages market maker positions and credit balances across multiple tokens
interface ICreditVault {
/// @notice Returns the credit position of a market maker for a specific token
/// @param settler The market maker's address
/// @param token The token address
/// @return amount The credit position (positive = credit, negative = debt)
function positions(address settler, address token) external view returns (int256 amount);
}
/// @title INativeBridge - Interface for Native Bridge Cross-chain Protocol
/// @notice Defines the data structures, errors, and events for the Native Bridge system
interface INativeBridge is IQuote {
/*//////////////////////////////////////////////////////////////
STRUCTS / ENUMS
//////////////////////////////////////////////////////////////*/
/// @notice Tracks the lifecycle state of a bridge order
/// @dev State transitions:
/// @dev None -> Committed (via initiate)
/// @dev Committed -> Completed (via claim) OR Refunded (via refund)
enum OrderState {
/// @dev Order does not exist or has not been initiated
None,
/// @dev Order initiated on source chain, funds locked, awaiting fill on destination chain
Committed,
/// @dev Order filled on destination chain and claimed on source chain by market maker
Completed,
/// @dev Order refunded to user after timeout period
Refunded
}
enum ExternalBridgeState {
None,
Committed,
Refunded
}
/// @notice Core order information stored on both source and destination chains
/// @dev Fields have different meanings depending on which chain:
struct Order {
/// @dev The recipient address (who will receive tokens on destination chain)
/// @dev Enables backend to verify recipient via RPC without event indexing delays, preventing recipient address forgery
address recipient;
/// @dev The token address (sellerToken on source chain, buyerToken on destination chain)
address token;
/// @dev The token amount (locked amount on source chain, delivered amount on destination chain)
uint256 amount;
/// @dev The timestamp when the order was created (initiate time on source, fill time on dest)
uint256 orderTimestamp;
/// @dev The market maker (quote.signer) responsible for filling this order
address settler;
/// @dev Address to receive refund on source chain (refund/refundFor). If not provided at initiate (passed as 0), defaults to msg.sender.
address refundTo;
/// @dev Current state of the order in its lifecycle
OrderState orderState;
}
/// @notice Data structure for batch claiming multiple orders
/// @dev Market makers use this to claim rewards for fulfilled orders
struct ClaimData {
/// @dev The signed quote from the market maker
/// @dev quote.sellerTokenAmount must equal the sum of all order amounts
/// @dev quote.buyerTokenAmount must be 0 (already paid on dest chain)
IQuote.RFQTQuote quote;
/// @dev Array of user addresses whose orders are being claimed
address[] users;
/// @dev Array of quote IDs corresponding to each user's order
bytes16[] quoteIds;
}
/// @notice Parameters for executing a fallback external bridge call
struct ExternalBridge {
/// @dev External bridge router contract (must be whitelisted)
address bridgerRouter;
/// @dev Contract that actually pulls tokens; may differ from bridgeRouter
address spender;
/// @dev Recipient address on the destination chain (for accounting / events)
address recipient;
/// @dev Token supplied on the source chain (ERC20 or wrapped native token)
address inputToken;
/// @dev Token expected to arrive on the destination chain (for reconciliation)
address outputToken;
/// @dev Amount of inputToken to send into the external bridge
uint256 inputTokenAmount;
/// @dev Quoted/expected output token amount before slippage
uint256 outputTokenAmount;
/// @dev Minimum acceptable output amount (slippage protection)
uint256 minOutputAmount;
/// @dev Destination chain ID recognized by the external bridge
uint256 destChainId;
/// @dev Deadline timestamp after which this fallback quote is invalid
uint256 deadlineTimestamp;
/// @dev Backend-generated globally unique identifier for this fallback call
bytes16 quoteId;
/// @dev Encoded calldata to execute on the bridgeRouter
bytes callData;
/// @dev EIP-712 signature authorized by backend to allow this fallback path
bytes signature;
}
/// @notice State for fallback external bridge orders
struct ExternalBridgeOrder {
address inputToken;
uint256 inputTokenAmount;
uint256 orderTimestamp;
ExternalBridgeState state;
}
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/// @notice Thrown when a deadline has passed
error DeadlineExpired();
/// @notice Thrown when attempting to refund an order that is not refundable
error NotRefundable();
/// @notice Thrown when the caller is not the refund executor
error NotRefundExecutor();
/// @notice Thrown when attempting to use an unapproved external bridge router
error InvalidBridgeRouter();
/// @notice Thrown when attempting to bridge to a disabled destination chain
error InvalidDestChain();
/// @notice Thrown when an EIP-712 signature verification fails
error InvalidSignature();
/// @notice Thrown when a quoteId is invalid or already used
error InvalidQuoteId();
/// @notice Thrown when token validation fails
error InvalidToken();
/// @notice Thrown when attempting to fill an already completed order
error OrderCompleted();
/*//////////////////////////////////////////////////////////////
FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted when an order is filled on the destination chain
/// @param recipient The address receiving the buyerToken on destination chain
/// @param quoteId The unique identifier of the order
/// @param settler The market maker who filled this order
/// @param buyerToken The token delivered to the recipient
/// @param buyerTokenAmount The actual amount of buyerToken delivered (after fees)
/// @param chainId The chain ID where the fill occurred (destination chain)
event Filled(
address indexed recipient,
bytes16 indexed quoteId,
address indexed settler,
address buyerToken,
uint256 buyerTokenAmount,
uint32 chainId
);
/// @notice Emitted when a new bridge order is created on the source chain
/// @param swapper The user who initiated the cross-chain swap
/// @param recipient The address that will receive tokens on the destination chain
/// @param quoteId The unique identifier for this order
/// @param sellerToken The token locked on the source chain
/// @param sellerTokenAmount The amount of sellerToken locked
/// @param buyerToken The token to be delivered on the destination chain
/// @param buyerTokenAmount The expected amount of buyerToken to be delivered
/// @param settler The market maker responsible for filling this order
/// @param refundTo The address that will receive refund if order is refunded
/// @param destChainId The destination chain ID where the order will be filled
event OrderCreated(
address indexed swapper,
address indexed recipient,
bytes16 indexed quoteId,
address sellerToken,
uint256 sellerTokenAmount,
address buyerToken,
uint256 buyerTokenAmount,
address settler,
address refundTo,
uint32 destChainId
);
/// @notice Emitted when a signer's authorization status is updated
/// @param signer The address of the signer being updated
/// @param isSigner True if the signer is authorized, false if revoked
event SignerUpdated(address indexed signer, bool isSigner);
/// @notice Emitted when a market maker signer's authorization status is updated
/// @param signer The address of the market maker signer being updated
/// @param isSigner True if the signer is authorized, false if revoked
event MMSignerUpdated(address indexed signer, bool isSigner);
/// @notice Emitted when the refund executor is updated
/// @param oldExecutor The previous refund executor address
/// @param newExecutor The new refund executor address
event RefundExecutorUpdated(address indexed oldExecutor, address indexed newExecutor);
/// @notice Emitted when a user receives a refund for an unfilled order
/// @param user The order owner (sourceOrder key)
/// @param refundTo The address that actually received the refund
/// @param quoteId The unique identifier of the refunded order
/// @param token The token being refunded
/// @param amount The amount of tokens refunded
event Refunded(
address indexed user, address indexed refundTo, bytes16 indexed quoteId, address token, uint256 amount
);
/// @notice Emitted when a destination chain's enabled status is updated
/// @param destChainId The chain ID being updated
/// @param enabled True if the chain is enabled, false if disabled
event DestinationStatusUpdated(uint32 indexed destChainId, bool enabled);
/// @notice Emitted when the refund buffer period is updated
/// @param oldBuffer The previous refund buffer in seconds
/// @param newBuffer The new refund buffer in seconds
event RefundBufferUpdated(uint256 oldBuffer, uint256 newBuffer);
/// @notice Emitted when the NativeRouter contract address is updated
/// @param oldRouter The previous router contract address
/// @param newRouter The new router contract address
event RouterUpdated(address indexed oldRouter, address indexed newRouter);
/// @notice Emitted when a market maker claims locked funds for filled orders
/// @param settler The market maker claiming the funds
/// @param token The token being claimed
/// @param amount The total amount of tokens claimed
/// @param users Array of user addresses whose orders are being claimed
/// @param quoteIds Array of quote IDs being claimed
event Claimed(address indexed settler, address indexed token, uint256 amount, address[] users, bytes16[] quoteIds);
/// @notice Emitted when funds are bridged via an external fallback path
/// @param bridgeRouter The external bridge router contract invoked
/// @param recipient The destination recipient encoded in the fallback request
/// @param inputToken The token sent on the source chain
/// @param outputToken The token expected on the destination chain
/// @param inputTokenAmount The amount of inputToken supplied to the bridge
/// @param outputTokenAmount The quoted/expected output token amount
/// @param minOutputAmount The minimum acceptable output amount
/// @param destChainId The destination chain id understood by the bridge
/// @param quoteId Backend-generated identifier for this fallback bridge
event ExternalBridged(
address indexed bridgeRouter,
address indexed recipient,
address inputToken,
address outputToken,
uint256 inputTokenAmount,
uint256 outputTokenAmount,
uint256 minOutputAmount,
uint256 destChainId,
bytes16 quoteId
);
/// @notice Emitted when an external bridge router whitelist status is updated
/// @param bridgeRouter The router address being updated
/// @param allowed True if router is whitelisted, false if removed
event ExternalBridgeRouterUpdated(address indexed bridgeRouter, bool allowed);
/// @notice Emitted when an external bridge order is refunded on the source chain
/// @param initiator The address that initiated the refund request
/// @param user The original recipient/user receiving the refund
/// @param quoteId The identifier of the external bridge order
/// @param token The input token being refunded
/// @param amount The input token amount refunded
event ExternalBridgeRefunded(
address indexed initiator, address indexed user, bytes16 indexed quoteId, address token, uint256 amount
);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
import {TStorage} from "./TStorage.sol";
// Refer from OpenZeppelin https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v5.1/contracts/utils/ReentrancyGuardTransient.sol
/**
* @dev Variant of {ReentrancyGuard} that uses transient storage.
*/
abstract contract ReentrancyGuardTransient {
using TStorage for bytes32;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
REENTRANCY_GUARD_STORAGE.tstore(true);
}
function _nonReentrantAfter() private {
REENTRANCY_GUARD_STORAGE.tstore(false);
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return REENTRANCY_GUARD_STORAGE.tload();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// 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/ShortStrings.sol)
pragma solidity ^0.8.8;
import "./StorageSlot.sol";
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(_FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.0;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.28;
interface IQuote {
struct WidgetFee {
address feeRecipient;
uint256 feeRate;
}
struct RFQTQuote {
/// @notice RFQ pool address
address pool;
/// @notice market maker
address signer;
/// @notice The recipient of the buyerToken at the end of the trade.
address recipient;
/// @notice The token that the trader sells.
address sellerToken;
/// @notice The token that the trader buys.
address buyerToken;
/// @notice The max amount of sellerToken sold.
uint256 sellerTokenAmount;
/// @notice The amount of buyerToken bought when sellerTokenAmount is sold.
uint256 buyerTokenAmount;
/// @notice Minimum buyerToken amount received
uint256 amountOutMinimum;
/// @notice The Unix timestamp (in seconds) when the quote expires.
uint256 deadlineTimestamp;
/// @notice Nonces are used to protect against replay.
uint256 nonce;
/// @notice confidence control factor T
uint256 confidenceExtractedValueT;
/// @notice confidence control factor N
uint256 confidenceExtractedValueN;
/// @notice confidence control factor E
uint256 confidenceExtractedValueE;
/// @notice confidence control factor M
uint256 confidenceExtractedValueM;
/// @notice Unique identifier for the quote.
/// @dev Generated off-chain via a distributed UUID generator.
bytes16 quoteId;
/// @dev false if this quote is for the 1st hop of a multi-hop or a single-hop, in which case msg.sender is the payer.
/// true if this quote is for 2nd or later hop of a multi-hop, in which case router is the payer.
bool multiHop;
/// @notice Signature provided by the market maker (EIP-191).
bytes signature;
/// @notice Widget fee information
WidgetFee widgetFee;
/// @notice Widget fee signature
bytes widgetFeeSignature;
}
struct ExternalSwap {
/// @notice The external liquidity source contract
address source;
/// @notice The contract address that needs seller token approval (may differ from source)
address spender;
/// @notice The recipient of the buyerToken at the end of the swap
address recipient;
/// @notice The token to be sold/swapped from
address sellerToken;
/// @notice The amount of sellerToken to be swapped
uint256 sellerTokenAmount;
/// @notice The token that the trader buys
address buyerToken;
/// @notice Minimum amount of buyerToken expected to receive
uint256 amountOutMinimum;
/// @notice The Unix timestamp (in seconds) when the swap expires
uint256 deadlineTimestamp;
/// @notice Unique identifier for the quote
bytes16 quoteId;
/// @notice Call data for the external swap
bytes callData;
/// @notice EIP-712 signature authorizing the swap
bytes signature;
}
}// 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: UNLICENSED
pragma solidity 0.8.28;
/// @title Transient storage utils
library TStorage {
/// @notice Loads a boolean value from transient storage at a given slot.
/// @param slot The storage slot to read from.
/// @return value The boolean value stored at the specified slot.
function tload(bytes32 slot) internal view returns (bool value) {
assembly {
value := tload(slot)
}
}
/// @notice Stores a boolean value in transient storage at a given slot.
/// @param slot The storage slot to write to.
/// @param value The boolean value to store at the specified slot.
function tstore(bytes32 slot, bool value) internal {
assembly {
tstore(slot, value)
}
}
}// 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
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// 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) (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/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);
}
}
}{
"remappings": [
"forge-std/=lib/forge-std/src/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"ds-test/=lib/solmate/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"openzeppelin/=lib/openzeppelin-contracts/contracts/",
"permit2/=lib/permit2/",
"solmate/=lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 2000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract INativeRouter","name":"_router","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"},{"internalType":"address","name":"_signer","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint256","name":"_refundBuffer","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DeadlineExpired","type":"error"},{"inputs":[],"name":"ExternalCallFailed","type":"error"},{"inputs":[],"name":"InsufficientAmount","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidBridgeRouter","type":"error"},{"inputs":[],"name":"InvalidDestChain","type":"error"},{"inputs":[],"name":"InvalidQuoteId","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"NotRefundExecutor","type":"error"},{"inputs":[],"name":"NotRefundable","type":"error"},{"inputs":[],"name":"OrderCompleted","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"UnexpectedMsgValue","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"settler","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"users","type":"address[]"},{"indexed":false,"internalType":"bytes16[]","name":"quoteIds","type":"bytes16[]"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"DestinationStatusUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExternalBridgeRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bridgeRouter","type":"address"},{"indexed":false,"internalType":"bool","name":"allowed","type":"bool"}],"name":"ExternalBridgeRouterUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"bridgeRouter","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outputTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minOutputAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destChainId","type":"uint256"},{"indexed":false,"internalType":"bytes16","name":"quoteId","type":"bytes16"}],"name":"ExternalBridged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"indexed":true,"internalType":"address","name":"settler","type":"address"},{"indexed":false,"internalType":"address","name":"buyerToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"buyerTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"chainId","type":"uint32"}],"name":"Filled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":false,"internalType":"bool","name":"isSigner","type":"bool"}],"name":"MMSignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"swapper","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"indexed":false,"internalType":"address","name":"sellerToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"sellerTokenAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"buyerToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"buyerTokenAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"settler","type":"address"},{"indexed":false,"internalType":"address","name":"refundTo","type":"address"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldBuffer","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBuffer","type":"uint256"}],"name":"RefundBufferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldExecutor","type":"address"},{"indexed":true,"internalType":"address","name":"newExecutor","type":"address"}],"name":"RefundExecutorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"refundTo","type":"address"},{"indexed":true,"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldRouter","type":"address"},{"indexed":true,"internalType":"address","name":"newRouter","type":"address"}],"name":"RouterUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":false,"internalType":"bool","name":"isSigner","type":"bool"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MIN_REFUND_BUFFER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"sellerToken","type":"address"},{"internalType":"address","name":"buyerToken","type":"address"},{"internalType":"uint256","name":"sellerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"buyerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint256","name":"deadlineTimestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueT","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueN","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueE","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueM","type":"uint256"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bool","name":"multiHop","type":"bool"},{"internalType":"bytes","name":"signature","type":"bytes"},{"components":[{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"feeRate","type":"uint256"}],"internalType":"struct IQuote.WidgetFee","name":"widgetFee","type":"tuple"},{"internalType":"bytes","name":"widgetFeeSignature","type":"bytes"}],"internalType":"struct IQuote.RFQTQuote","name":"quote","type":"tuple"},{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"bytes16[]","name":"quoteIds","type":"bytes16[]"}],"internalType":"struct INativeBridge.ClaimData[]","name":"claimData","type":"tuple[]"}],"name":"batchClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"sellerToken","type":"address"},{"internalType":"address","name":"buyerToken","type":"address"},{"internalType":"uint256","name":"sellerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"buyerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint256","name":"deadlineTimestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueT","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueN","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueE","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueM","type":"uint256"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bool","name":"multiHop","type":"bool"},{"internalType":"bytes","name":"signature","type":"bytes"},{"components":[{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"feeRate","type":"uint256"}],"internalType":"struct IQuote.WidgetFee","name":"widgetFee","type":"tuple"},{"internalType":"bytes","name":"widgetFeeSignature","type":"bytes"}],"internalType":"struct IQuote.RFQTQuote","name":"quote","type":"tuple"},{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"bytes16[]","name":"quoteIds","type":"bytes16[]"}],"internalType":"struct INativeBridge.ClaimData","name":"claimData","type":"tuple"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"destOrder","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"orderTimestamp","type":"uint256"},{"internalType":"address","name":"settler","type":"address"},{"internalType":"address","name":"refundTo","type":"address"},{"internalType":"enum INativeBridge.OrderState","name":"orderState","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"enabledDestination","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"bridgerRouter","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"outputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"},{"internalType":"uint256","name":"destChainId","type":"uint256"},{"internalType":"uint256","name":"deadlineTimestamp","type":"uint256"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct INativeBridge.ExternalBridge","name":"params","type":"tuple"}],"name":"externalBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"externalBridgeOrders","outputs":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputTokenAmount","type":"uint256"},{"internalType":"uint256","name":"orderTimestamp","type":"uint256"},{"internalType":"enum INativeBridge.ExternalBridgeState","name":"state","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"externalBridgeRouters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"sellerToken","type":"address"},{"internalType":"address","name":"buyerToken","type":"address"},{"internalType":"uint256","name":"sellerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"buyerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint256","name":"deadlineTimestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueT","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueN","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueE","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueM","type":"uint256"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bool","name":"multiHop","type":"bool"},{"internalType":"bytes","name":"signature","type":"bytes"},{"components":[{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"feeRate","type":"uint256"}],"internalType":"struct IQuote.WidgetFee","name":"widgetFee","type":"tuple"},{"internalType":"bytes","name":"widgetFeeSignature","type":"bytes"}],"internalType":"struct IQuote.RFQTQuote","name":"quote","type":"tuple"}],"name":"fill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"initDeadline","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"refundTo","type":"address"},{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"sellerToken","type":"address"},{"internalType":"address","name":"buyerToken","type":"address"},{"internalType":"uint256","name":"sellerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"buyerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint256","name":"deadlineTimestamp","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueT","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueN","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueE","type":"uint256"},{"internalType":"uint256","name":"confidenceExtractedValueM","type":"uint256"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bool","name":"multiHop","type":"bool"},{"internalType":"bytes","name":"signature","type":"bytes"},{"components":[{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"uint256","name":"feeRate","type":"uint256"}],"internalType":"struct IQuote.WidgetFee","name":"widgetFee","type":"tuple"},{"internalType":"bytes","name":"widgetFeeSignature","type":"bytes"}],"internalType":"struct IQuote.RFQTQuote","name":"quote","type":"tuple"}],"name":"initiate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"marketMakerSigners","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bytes","name":"mmSignature","type":"bytes"},{"internalType":"bytes","name":"refundSignature","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refundBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refundExecutor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bytes","name":"mmSignature","type":"bytes"},{"internalType":"bytes","name":"refundSignature","type":"bytes"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"bytes","name":"refundCallData","type":"bytes"}],"name":"refundExternalBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bytes","name":"mmSignature","type":"bytes"},{"internalType":"bytes","name":"refundSignature","type":"bytes"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"bytes","name":"refundCallData","type":"bytes"}],"name":"refundExternalBridgeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes16","name":"quoteId","type":"bytes16"},{"internalType":"bytes","name":"mmSignature","type":"bytes"},{"internalType":"bytes","name":"refundSignature","type":"bytes"}],"name":"refundFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract INativeRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"destChainIds","type":"uint32[]"},{"internalType":"bool[]","name":"statuses","type":"bool[]"}],"name":"setDestinationChains","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bridgeRouter","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setExternalBridgeRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bool","name":"isSigner","type":"bool"}],"name":"setMarketMakerSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRefundBuffer","type":"uint256"}],"name":"setRefundBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newExecutor","type":"address"}],"name":"setRefundExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRouter","type":"address"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bool","name":"isSigner","type":"bool"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"signers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes16","name":"","type":"bytes16"}],"name":"sourceOrder","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"orderTimestamp","type":"uint256"},{"internalType":"address","name":"settler","type":"address"},{"internalType":"address","name":"refundTo","type":"address"},{"internalType":"enum INativeBridge.OrderState","name":"orderState","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6101a0604052348015610010575f5ffd5b50604051615ffe380380615ffe83398101604081905261002f9161037c565b604080518082018252600d81526c4e61746976652042726964676560981b602080830191909152825180840190935260018352603160f81b9083015290610076825f61019a565b6101205261008581600161019a565b61014052815160208084019190912060e052815190820120610100524660a05261011160e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c052610123336101cc565b6003805460ff60a01b191690556107088110156101535760405163162908e360e11b815260040160405180910390fd5b600480546001600160a01b0319166001600160a01b03878116919091179091558481166101805282166101605260068190556101908360016101e8565b505050505061058d565b5f6020835110156101b5576101ae83610275565b90506101c6565b816101c0848261047b565b5060ff90505b92915050565b600380546001600160a01b03191690556101e5816102bb565b50565b6101f061030c565b6001600160a01b0382166102175760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0382165f81815260076020908152604091829020805460ff191685151590811790915591519182527ffcaa24b1276bfa7dbf77797c0a984b9df924acbeaabd48cd2f1b0eca379b78fa910160405180910390a25050565b5f5f829050601f815111156102a8578260405163305a27a960e01b815260040161029f9190610535565b60405180910390fd5b80516102b38261056a565b179392505050565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6002546001600160a01b031633146103665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161029f565b565b6001600160a01b03811681146101e5575f5ffd5b5f5f5f5f5f60a08688031215610390575f5ffd5b855161039b81610368565b60208701519095506103ac81610368565b60408701519094506103bd81610368565b60608701519093506103ce81610368565b80925050608086015190509295509295909350565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061040b57607f821691505b60208210810361042957634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561047657805f5260205f20601f840160051c810160208510156104545750805b601f840160051c820191505b81811015610473575f8155600101610460565b50505b505050565b81516001600160401b03811115610494576104946103e3565b6104a8816104a284546103f7565b8461042f565b6020601f8211600181146104da575f83156104c35750848201515b5f19600385901b1c1916600184901b178455610473565b5f84815260208120601f198516915b8281101561050957878501518255602094850194600190920191016104e9565b508482101561052657868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80516020808301519190811015610429575f1960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051610180516159e261061c5f395f81816103cc01528181611f760152611ff501525f81816108450152818161387f0152818161394501528181613a9a0152613ba401525f611b2501525f611afb01525f6143a701525f61437f01525f6142da01525f61430401525f61432e01526159e25ff3fe60806040526004361061027a575f3560e01c80638c31d1381161014b578063d8859d8c116100c6578063f2fde38b1161007c578063fbfa77cf11610062578063fbfa77cf14610834578063ff9b349f14610867578063ffad4064146108fb575f5ffd5b8063f2fde38b146107e9578063f887ea4014610808575f5ffd5b8063dd8b301a116100ac578063dd8b301a14610781578063e159a112146107a0578063e30c3978146107bf575f5ffd5b8063d8859d8c14610725578063dd19158e14610753575f5ffd5b8063aad39a1f1161011b578063c212e40211610101578063c212e402146106c7578063c21c3ca6146106f3578063d4ba0dbf14610706575f5ffd5b8063aad39a1f14610601578063c0d78655146106a8575f5ffd5b80638c31d138146105245780638da5cb5b1461059957806390238882146105c357806396158520146105e2575f5ffd5b80634aa4a4fc116101f5578063715018a6116101ab57806379ba50971161019157806379ba5097146104d55780638456cb59146104e957806384b0196e146104fd575f5ffd5b8063715018a614610493578063736c0d5b146104a7575f5ffd5b80636013a881116101db5780636013a8811461044257806360330682146104615780636cd3ca1c14610474575f5ffd5b80634aa4a4fc146103bb5780635c975abb14610413575f5ffd5b80632990c4321161024a5780633399b499116102305780633399b49914610369578063383c599f146103885780633f4ba83a146103a7575f5ffd5b80632990c4321461032b57806331cb61051461034a575f5ffd5b806305cc262e1461028557806314aac67e146102a657806316a4bfca146102e9578063283138c214610308575f5ffd5b3661028157005b5f5ffd5b348015610290575f5ffd5b506102a461029f3660046147fe565b610910565b005b3480156102b1575f5ffd5b506102d46102c03660046148e3565b60096020525f908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156102f4575f5ffd5b506102a4610303366004614903565b610995565b348015610313575f5ffd5b5061031d60065481565b6040519081526020016102e0565b348015610336575f5ffd5b506102a46103453660046149d2565b6109c8565b348015610355575f5ffd5b506102a46103643660046149d2565b610aa7565b348015610374575f5ffd5b506102a4610383366004614a03565b610b7e565b348015610393575f5ffd5b506102a46103a2366004614d26565b610c07565b3480156103b2575f5ffd5b506102a461128c565b3480156103c6575f5ffd5b506103ee7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102e0565b34801561041e575f5ffd5b5060035474010000000000000000000000000000000000000000900460ff166102d4565b34801561044d575f5ffd5b506102a461045c366004614d60565b61129e565b6102a461046f366004614de0565b6112cb565b34801561047f575f5ffd5b506102a461048e366004614e59565b6119b2565b34801561049e575f5ffd5b506102a4611a16565b3480156104b2575f5ffd5b506102d46104c1366004614e98565b60076020525f908152604090205460ff1681565b3480156104e0575f5ffd5b506102a4611a27565b3480156104f4575f5ffd5b506102a4611ade565b348015610508575f5ffd5b50610511611aee565b6040516102e09796959493929190614efd565b34801561052f575f5ffd5b5061058961053e366004614fbc565b600b60209081525f9283526040808420909152908252902080546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff90921692909160ff1684565b6040516102e09493929190615011565b3480156105a4575f5ffd5b5060025473ffffffffffffffffffffffffffffffffffffffff166103ee565b3480156105ce575f5ffd5b506102a46105dd3660046149d2565b611b90565b3480156105ed575f5ffd5b506102a46105fc366004614e98565b611c67565b34801561060c575f5ffd5b5061069561061b366004614fbc565b600c60209081525f928352604080842090915290825290208054600182015460028301546003840154600485015460059095015473ffffffffffffffffffffffffffffffffffffffff9485169593851694929391929182169181169074010000000000000000000000000000000000000000900460ff1687565b6040516102e0979695949392919061505b565b3480156106b3575f5ffd5b506102a46106c2366004614e98565b611ce5565b3480156106d2575f5ffd5b506005546103ee9073ffffffffffffffffffffffffffffffffffffffff1681565b6102a46107013660046150c0565b611db0565b348015610711575f5ffd5b506102a4610720366004615130565b61255c565b348015610730575f5ffd5b506102d461073f366004614e98565b600a6020525f908152604090205460ff1681565b34801561075e575f5ffd5b506102d461076d366004614e98565b60086020525f908152604090205460ff1681565b34801561078c575f5ffd5b506102a461079b3660046151c0565b6125db565b3480156107ab575f5ffd5b506102a46107ba3660046151f7565b6125ff565b3480156107ca575f5ffd5b5060035473ffffffffffffffffffffffffffffffffffffffff166103ee565b3480156107f4575f5ffd5b506102a4610803366004614e98565b61276d565b348015610813575f5ffd5b506004546103ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561083f575f5ffd5b506103ee7f000000000000000000000000000000000000000000000000000000000000000081565b348015610872575f5ffd5b50610695610881366004614fbc565b600d60209081525f928352604080842090915290825290208054600182015460028301546003840154600485015460059095015473ffffffffffffffffffffffffffffffffffffffff9485169593851694929391929182169181169074010000000000000000000000000000000000000000900460ff1687565b348015610906575f5ffd5b5061031d61070881565b61091861281d565b6109206128a1565b60055473ffffffffffffffffffffffffffffffffffffffff163314610971576040517f1c4a9c8300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610982898989898989898989612926565b61098a612dc1565b505050505050505050565b61099d61281d565b6109a56128a1565b6109b6338989898989898989612926565b6109be612dc1565b5050505050505050565b6109d0612deb565b73ffffffffffffffffffffffffffffffffffffffff8216610a1d576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82165f818152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f1cdec17edf903de63af98b441f02e1ba4852f1a1b079d5f173e01ca00276839091015b60405180910390a25050565b610aaf612deb565b73ffffffffffffffffffffffffffffffffffffffff8216610afc576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82165f8181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527ffcaa24b1276bfa7dbf77797c0a984b9df924acbeaabd48cd2f1b0eca379b78fa9101610a9b565b610b86612deb565b610708811015610bc2576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600680549082905560408051828152602081018490527f453d9c1835fbe1dfc18c62b581abf16bce57e9aafda476ecdf245e83a0b29e94910160405180910390a15050565b610c0f61281d565b610c176128a1565b5f60408281015173ffffffffffffffffffffffffffffffffffffffff165f908152600d60209081528282206101c08601517fffffffffffffffffffffffffffffffff000000000000000000000000000000001683529052206005015474010000000000000000000000000000000000000000900460ff166003811115610c9f57610c9f614fe4565b14610cd6576040517fc53292e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a081015115610d12576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60808101515f9073ffffffffffffffffffffffffffffffffffffffff1615610dd157608082015160408084015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529116906370a0823190602401602060405180830381865afa158015610da8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dcc9190615263565b610dee565b816040015173ffffffffffffffffffffffffffffffffffffffff16315b600480546040517f0947c2d900000000000000000000000000000000000000000000000000000000815292935073ffffffffffffffffffffffffffffffffffffffff1691630947c2d991610e489186915f9182910161527a565b5f604051808303815f87803b158015610e5f575f5ffd5b505af1158015610e71573d5f5f3e3d5ffd5b50505060808301515f915073ffffffffffffffffffffffffffffffffffffffff1615610f4257608083015160408085015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152849291909116906370a0823190602401602060405180830381865afa158015610f0f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f339190615263565b610f3d91906154a7565b610f69565b81836040015173ffffffffffffffffffffffffffffffffffffffff1631610f6991906154a7565b90506127108360c0015184610220015160200151610f8791906154ba565b610f9191906154d1565b8360c00151610fa091906154a7565b811015610fd9576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060e00160405280846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff168152602001828152602001428152602001846020015173ffffffffffffffffffffffffffffffffffffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020016002600381111561107f5761107f614fe4565b905260408085015173ffffffffffffffffffffffffffffffffffffffff9081165f908152600d60209081528382206101c08901517fffffffffffffffffffffffffffffffff00000000000000000000000000000000168352815290839020845181549084167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178255918501516001820180549185169184169190911790559284015160028401556060840151600380850191909155608085015160048501805491851691841691909117905560a0850151600585018054919094169281168317845560c086015193927fffffffffffffffffffffff0000000000000000000000000000000000000000009091161790740100000000000000000000000000000000000000009084908111156111ba576111ba614fe4565b0217905550905050826020015173ffffffffffffffffffffffffffffffffffffffff16836101c001516fffffffffffffffffffffffffffffffff1916846040015173ffffffffffffffffffffffffffffffffffffffff167f5058c2c070ee43aa7920589163f285ff95ba6c223652dcd97080437c9d3d6dba866080015185466040516112779392919073ffffffffffffffffffffffffffffffffffffffff939093168352602083019190915263ffffffff16604082015260600190565b60405180910390a45050611289612dc1565b50565b611294612deb565b61129c612e6c565b565b6112a661281d565b6112ae6128a1565b6112bc338686868686612ee9565b6112c4612dc1565b5050505050565b6112d361281d565b6112db6128a1565b80610120013542111561131a576040517f1ab7da6b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a5f61132a6020840184614e98565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040015f205460ff16611389576040517f870240b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b335f908152600b60205260408120816113aa61016085016101408601615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208101919091526040015f9081209150600382015460ff1660028111156113f8576113f8614fe4565b1461142f576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f13cd64c20705b67ed42e8bcab4a2563dfb42bb2a709ffdc8106905de262ca13561145e6020850185614e98565b61146e6040860160208701614e98565b61147e6060870160408801614e98565b61148e6080880160608901614e98565b61149e60a0890160808a01614e98565b8860a001358960c001358a60e001358b61010001358c61012001358d6101400160208101906114cd9190615509565b8e8061016001906114de9190615522565b6040516114ec929190615583565b60405190819003812061150d9d9c9b9a999897969594939291602001615592565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120905061155c81611557610180860186615522565b61324c565b5f61156d6080850160608601614e98565b73ffffffffffffffffffffffffffffffffffffffff16036115ca578260a0013534146115c5576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61167f565b3415611602576040517fbd28e88900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61163a333060a086013561161c6080880160608901614e98565b73ffffffffffffffffffffffffffffffffffffffff169291906132f5565b61167f61164d6040850160208601614e98565b60a08501356116626080870160608801614e98565b73ffffffffffffffffffffffffffffffffffffffff16919061337e565b5f61168d6020850185614e98565b73ffffffffffffffffffffffffffffffffffffffff16346116b2610160870187615522565b6040516116c0929190615583565b5f6040518083038185875af1925050503d805f81146116fa576040519150601f19603f3d011682016040523d82523d5f602084013e6116ff565b606091505b505090508061173a576040517f350c20f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405180608001604052808560600160208101906117589190614e98565b73ffffffffffffffffffffffffffffffffffffffff16815260a0860135602082015242604082015260600160019052335f908152600b60205260408120906117a861016088016101408901615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208082019290925260409081015f20835181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617815591830151600180840191909155908301516002808401919091556060840151600384018054919390927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090921691849081111561187c5761187c614fe4565b02179055506118949150506060850160408601614e98565b73ffffffffffffffffffffffffffffffffffffffff166118b76020860186614e98565b73ffffffffffffffffffffffffffffffffffffffff167fba6d2931f5936f3abce23702c8bb6462fd7185f176abcbebca603f74806314106118fe6080880160608901614e98565b61190e60a0890160808a01614e98565b60a089013560c08a013560e08b01356101008c01356119356101608e016101408f01615509565b6040805173ffffffffffffffffffffffffffffffffffffffff9889168152979096166020880152948601939093526060850191909152608084015260a08301527fffffffffffffffffffffffffffffffff000000000000000000000000000000001660c082015260e00160405180910390a3505050611289612dc1565b6119ba61281d565b6119c26128a1565b5f5b81811015611a0957611a018383838181106119e1576119e161563f565b90506020028101906119f3919061566c565b6119fc9061573c565b61338e565b6001016119c4565b50611a12612dc1565b5050565b611a1e612deb565b61129c5f613cc8565b600354339073ffffffffffffffffffffffffffffffffffffffff168114611ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61128981613cc8565b611ae6612deb565b61129c613cf9565b5f60608082808083611b207f000000000000000000000000000000000000000000000000000000000000000083613d68565b611b4b7f00000000000000000000000000000000000000000000000000000000000000006001613d68565b604080515f808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b611b98612deb565b73ffffffffffffffffffffffffffffffffffffffff8216611be5576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82165f8181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527fe57b6bfa2587fb4d95cb816404e883c653c162cf7682728a32ba94b1441398549101610a9b565b611c6f612deb565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f060744ad36c7e2695965e49629feb4962ad92e4ddd6b3f89508327b09ef8f486905f90a35050565b611ced612deb565b73ffffffffffffffffffffffffffffffffffffffff8116611d3a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6004805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f02dc5c233404867c793b749c6d644beb2277536d18a7e7974d3f238e4c6f1684905f90a35050565b611db861281d565b611dc06128a1565b63ffffffff83165f9081526009602052604090205460ff16611e0e576040517fabdef43a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b335f908152600c6020526040812081611e2f6101e085016101c08601615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208101919091526040015f206005015474010000000000000000000000000000000000000000900460ff166003811115611e9057611e90614fe4565b14611ec7576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8363ffffffff1642108015611ee657508061010001358463ffffffff16105b611f1c576040517f1ab7da6b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3415612075578060a001353414611f5f576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016611fa66080830160608401614e98565b73ffffffffffffffffffffffffffffffffffffffff1614611ff3576040517fc1ab6dc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004015f604051808303818588803b158015612059575f5ffd5b505af115801561206b573d5f5f3e3d5ffd5b5050505050612218565b5f6120866080830160608401614e98565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156120f0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121149190615263565b9050612130333060a085013561161c6080870160608801614e98565b60a0820135816121466080850160608601614e98565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156121b0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121d49190615263565b6121de91906154a7565b1015612216576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b5f73ffffffffffffffffffffffffffffffffffffffff83161561223b578261223d565b335b90506040518060e0016040528083604001602081019061225d9190614e98565b73ffffffffffffffffffffffffffffffffffffffff1681526020016122886080850160608601614e98565b73ffffffffffffffffffffffffffffffffffffffff1681526020018360a0013581526020014281526020018360200160208101906122c69190614e98565b73ffffffffffffffffffffffffffffffffffffffff90811682528316602082015260400160019052335f908152600c602052604081209061230f6101e086016101c08701615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208082019290925260409081015f20835181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff92831617835593850151600183018054861691831691909117905591840151600282015560608401516003808301919091556080850151600483018054861691851691909117905560a085015160058301805495861691909416908117845560c086015192949293927fffffffffffffffffffffff0000000000000000000000000000000000000000001617907401000000000000000000000000000000000000000090849081111561243557612435614fe4565b021790555061244f9150506101e083016101c08401615509565b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166124816060840160408501614e98565b73ffffffffffffffffffffffffffffffffffffffff16337f815eb8f31f063ad6e5dfc30e9904bf56c06c67a0cf04123a24b3707a6b5e1ce16124c96080870160608801614e98565b60a087018035906124dd9060808a01614e98565b60c08901356124f260408b0160208c01614e98565b6040805173ffffffffffffffffffffffffffffffffffffffff968716815260208101959095529285169284019290925260608301528216608082015290861660a082015263ffffffff891660c082015260e00160405180910390a450612556612dc1565b50505050565b61256461281d565b61256c6128a1565b60055473ffffffffffffffffffffffffffffffffffffffff1633146125bd576040517f1c4a9c8300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6125cb868686868686612ee9565b6125d3612dc1565b505050505050565b6125e361281d565b6125eb6128a1565b6125f76119fc8261573c565b611289612dc1565b612607612deb565b828114612640576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b838110156112c45782828281811061265c5761265c61563f565b90506020020160208101906126719190615833565b60095f8787858181106126865761268661563f565b905060200201602081019061269b91906148e3565b63ffffffff16815260208101919091526040015f2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790558484828181106126ef576126ef61563f565b905060200201602081019061270491906148e3565b63ffffffff167fa834f0101ce3509b1bc39a75a825caae7045d16d08c4759b84799e0fd875d24884848481811061273d5761273d61563f565b90506020020160208101906127529190615833565b604051901515815260200160405180910390a2600101612642565b612775612deb565b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091556127d860025473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c15612876576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61129c7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f006001613e18565b60035474010000000000000000000000000000000000000000900460ff161561129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401611acc565b73ffffffffffffffffffffffffffffffffffffffff89165f908152600b602090815260408083207fffffffffffffffffffffffffffffffff000000000000000000000000000000008c16845290915290206001600382015460ff16600281111561299257612992614fe4565b146129c9576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60065481600201546129db919061584c565b4211612a13576040517f3742d1f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080517fe91459739c65339c6f9d9d4aaf76070d6e580cec363432da7d718b215c8a0f4a602082015273ffffffffffffffffffffffffffffffffffffffff8c16918101919091527fffffffffffffffffffffffffffffffff000000000000000000000000000000008a1660608201525f90608001604051602081830303815290604052805190602001209050612aab818a8a613e1f565b5f7f2e8b423aa04051ad929f93dc9ea2cc49896ca12aa24d3dade9e5f8faeb1107135f1b8c8c888888604051612ae2929190615583565b60405180910390208e8e604051612afa929190615583565b60408051918290038220602083019790975273ffffffffffffffffffffffffffffffffffffffff958616908201527fffffffffffffffffffffffffffffffff0000000000000000000000000000000090931660608401529216608082015260a081019190915260c081019190915260e001604051602081830303815290604052805190602001209050612b8e81898961324c565b73ffffffffffffffffffffffffffffffffffffffff861615612cab5773ffffffffffffffffffffffffffffffffffffffff86165f908152600a602052604090205460ff16612c08576040517f870240b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8673ffffffffffffffffffffffffffffffffffffffff168686604051612c30929190615583565b5f604051808303815f865af19150503d805f8114612c69576040519150601f19603f3d011682016040523d82523d5f602084013e612c6e565b606091505b5050905080612ca9576040517f350c20f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6003830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166002179055825473ffffffffffffffffffffffffffffffffffffffff16612d0757612d028c8460010154613e8d565b612d32565b60018301548354612d329173ffffffffffffffffffffffffffffffffffffffff909116908e90613f6d565b825460018401546040805173ffffffffffffffffffffffffffffffffffffffff938416815260208101929092527fffffffffffffffffffffffffffffffff000000000000000000000000000000008e16928f169133917f0a86f74894e732067ed6b5772d5a1e1fa9351815214f3d71fb0a758d2021befc910160405180910390a4505050505050505050505050565b61129c7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f613e18565b60025473ffffffffffffffffffffffffffffffffffffffff16331461129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611acc565b612e74613fab565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b73ffffffffffffffffffffffffffffffffffffffff86165f908152600c602090815260408083207fffffffffffffffffffffffffffffffff000000000000000000000000000000008916845290915290206001600582015474010000000000000000000000000000000000000000900460ff166003811115612f6d57612f6d614fe4565b14612fa4576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006548160030154612fb6919061584c565b4211612fee576040517f3742d1f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080517fe91459739c65339c6f9d9d4aaf76070d6e580cec363432da7d718b215c8a0f4a602082015273ffffffffffffffffffffffffffffffffffffffff8916918101919091527fffffffffffffffffffffffffffffffff00000000000000000000000000000000871660608201525f90608001604051602081830303815290604052805190602001209050613086818787613e1f565b5f7f22a6a1ee4ce3c203e6c5050f89b76de80922c621972f1f2c715343fd02e303795f1b898989896040516130bc929190615583565b6040519081900381206131229493929160200193845273ffffffffffffffffffffffffffffffffffffffff9290921660208401527fffffffffffffffffffffffffffffffff00000000000000000000000000000000166040830152606082015260800190565b60405160208183030381529060405280519060200120905061314581868661324c565b600583018054740300000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff821617909155600284015460018501546131b79273ffffffffffffffffffffffffffffffffffffffff91821692911690613f6d565b6005830154600184015460028501546040805173ffffffffffffffffffffffffffffffffffffffff938416815260208101929092527fffffffffffffffffffffffffffffffff000000000000000000000000000000008c16938316928d16917f6424645453312a97d058f07efffabd2c739263d83d5c4d8a38a2d9e8e9e56755910160405180910390a4505050505050505050565b5f6132946132598561402f565b84848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061407692505050565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526007602052604090205490915060ff16612556576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526125569186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050614098565b613389838383614137565b505050565b805160c00151156133cb576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160608101516020909101515f91903373ffffffffffffffffffffffffffffffffffffffff82161461345a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f6e6c7920746865207365747465722063616e20636c61696d000000000000006044820152606401611acc565b5f5b846040015151811015613803575f600c5f876020015184815181106134835761348361563f565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f876040015184815181106134db576134db61563f565b6020908102919091018101517fffffffffffffffffffffffffffffffff000000000000000000000000000000001682528181019290925260409081015f20815160e081018352815473ffffffffffffffffffffffffffffffffffffffff908116825260018301548116948201949094526002820154928101929092526003808201546060840152600482015484166080840152600582015493841660a08401529192909160c084019174010000000000000000000000000000000000000000900460ff16908111156135af576135af614fe4565b60038111156135c0576135c0614fe4565b8152505090508373ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff161461362f576040517fc1ab6dc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff16816080015173ffffffffffffffffffffffffffffffffffffffff1614613698576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018160c0015160038111156136b0576136b0614fe4565b146136e7576040517fc53292e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408101516136f6908661584c565b94506002600c5f886020015185815181106137135761371361563f565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8860400151858151811061376b5761376b61563f565b6020908102919091018101517fffffffffffffffffffffffffffffffff000000000000000000000000000000001682528101919091526040015f2060050180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000008360038111156137f5576137f5614fe4565b02179055505060010161345c565b50835160a001518314613842576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301525f91908416906370a0823190602401602060405180830381865afa1580156138cf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138f39190615263565b6040517f4bd2144500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015285811660248301529192505f917f00000000000000000000000000000000000000000000000000000000000000001690634bd2144590604401602060405180830381865afa15801561398a573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906139ae9190615263565b6004549091506139d89073ffffffffffffffffffffffffffffffffffffffff86811691168761337e565b6004805487516040517f0947c2d900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921692630947c2d992613a3292915f9182910161527a565b5f604051808303815f87803b158015613a49575f5ffd5b505af1158015613a5b573d5f5f3e3d5ffd5b50506040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301528893508592508716906370a0823190602401602060405180830381865afa158015613aed573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b119190615263565b613b1b91906154a7565b1015613b53576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f4bd2144500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301528581166024830152869183917f00000000000000000000000000000000000000000000000000000000000000001690634bd2144590604401602060405180830381865afa158015613be9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c0d9190615263565b613c17919061585f565b1215613c4f576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fbd951368d43c2e1875fd02dd315c81c7561f8cdbaed467664b48a06e7101dab78789602001518a60400151604051613cb893929190615885565b60405180910390a3505050505050565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556112898161420e565b613d016128a1565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612ebf3390565b606060ff8314613d8257613d7b83614284565b9050613e0d565b818054613d8e90615945565b80601f0160208091040260200160405190810160405280929190818152602001828054613dba90615945565b8015613e055780601f10613ddc57610100808354040283529160200191613e05565b820191905f5260205f20905b815481529060010190602001808311613de857829003601f168201915b505050505090505b92915050565b905090565b80825d5050565b5f613e2c6132598561402f565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526008602052604090205490915060ff16612556576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080515f8082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051613ec39190615996565b5f6040518083038185875af1925050503d805f8114613efd576040519150601f19603f3d011682016040523d82523d5f602084013e613f02565b606091505b5050905080613389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f53544500000000000000000000000000000000000000000000000000000000006044820152606401611acc565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261338991859182169063a9059cbb90606401613337565b60035474010000000000000000000000000000000000000000900460ff1661129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401611acc565b5f613e0d61403b6142c1565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b5f5f5f61408385856143f7565b9150915061409081614439565b509392505050565b5f5f60205f8451602086015f885af1806140b7576040513d5f823e3d81fd5b50505f513d915081156140ce5780600114156140e8565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15612556576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401611acc565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790526141c384826145eb565b6125565760405173ffffffffffffffffffffffffffffffffffffffff84811660248301525f604483015261420491869182169063095ea7b390606401613337565b6125568482614098565b6002805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60605f61429083614641565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f3073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614801561432657507f000000000000000000000000000000000000000000000000000000000000000046145b1561435057507f000000000000000000000000000000000000000000000000000000000000000090565b613e13604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f5f825160410361442b576020830151604084015160608501515f1a61441f87828585614681565b94509450505050614432565b505f905060025b9250929050565b5f81600481111561444c5761444c614fe4565b036144545750565b600181600481111561446857614468614fe4565b036144cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401611acc565b60028160048111156144e3576144e3614fe4565b0361454a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611acc565b600381600481111561455e5761455e614fe4565b03611289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401611acc565b5f5f5f5f60205f8651602088015f8a5af192503d91505f5190508280156146375750811561461c5780600114614637565b5f8673ffffffffffffffffffffffffffffffffffffffff163b115b9695505050505050565b5f60ff8216601f811115613e0d576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156146b657505f90506003614760565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614707573d5f5f3e3d5ffd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661475a575f60019250925050614760565b91505f90505b94509492505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461478c575f5ffd5b919050565b80357fffffffffffffffffffffffffffffffff000000000000000000000000000000008116811461478c575f5ffd5b5f5f83601f8401126147d0575f5ffd5b50813567ffffffffffffffff8111156147e7575f5ffd5b602083019150836020828501011115614432575f5ffd5b5f5f5f5f5f5f5f5f5f60c08a8c031215614816575f5ffd5b61481f8a614769565b985061482d60208b01614791565b975060408a013567ffffffffffffffff811115614848575f5ffd5b6148548c828d016147c0565b90985096505060608a013567ffffffffffffffff811115614873575f5ffd5b61487f8c828d016147c0565b9096509450614892905060808b01614769565b925060a08a013567ffffffffffffffff8111156148ad575f5ffd5b6148b98c828d016147c0565b915080935050809150509295985092959850929598565b803563ffffffff8116811461478c575f5ffd5b5f602082840312156148f3575f5ffd5b6148fc826148d0565b9392505050565b5f5f5f5f5f5f5f5f60a0898b03121561491a575f5ffd5b61492389614791565b9750602089013567ffffffffffffffff81111561493e575f5ffd5b61494a8b828c016147c0565b909850965050604089013567ffffffffffffffff811115614969575f5ffd5b6149758b828c016147c0565b9096509450614988905060608a01614769565b9250608089013567ffffffffffffffff8111156149a3575f5ffd5b6149af8b828c016147c0565b999c989b5096995094979396929594505050565b8035801515811461478c575f5ffd5b5f5f604083850312156149e3575f5ffd5b6149ec83614769565b91506149fa602084016149c3565b90509250929050565b5f60208284031215614a13575f5ffd5b5035919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051610260810167ffffffffffffffff81118282101715614a6b57614a6b614a1a565b60405290565b6040516060810167ffffffffffffffff81118282101715614a6b57614a6b614a1a565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614adb57614adb614a1a565b604052919050565b5f82601f830112614af2575f5ffd5b813567ffffffffffffffff811115614b0c57614b0c614a1a565b614b3d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601614a94565b818152846020838601011115614b51575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f60408284031215614b7d575f5ffd5b6040805190810167ffffffffffffffff81118282101715614ba057614ba0614a1a565b604052905080614baf83614769565b8152602092830135920191909152919050565b5f6102808284031215614bd3575f5ffd5b614bdb614a47565b9050614be682614769565b8152614bf460208301614769565b6020820152614c0560408301614769565b6040820152614c1660608301614769565b6060820152614c2760808301614769565b608082015260a0828101359082015260c0808301359082015260e08083013590820152610100808301359082015261012080830135908201526101408083013590820152610160808301359082015261018080830135908201526101a08083013590820152614c996101c08301614791565b6101c0820152614cac6101e083016149c3565b6101e082015261020082013567ffffffffffffffff811115614ccc575f5ffd5b614cd884828501614ae3565b61020083015250614ced836102208401614b6d565b61022082015261026082013567ffffffffffffffff811115614d0d575f5ffd5b614d1984828501614ae3565b6102408301525092915050565b5f60208284031215614d36575f5ffd5b813567ffffffffffffffff811115614d4c575f5ffd5b614d5884828501614bc2565b949350505050565b5f5f5f5f5f60608688031215614d74575f5ffd5b614d7d86614791565b9450602086013567ffffffffffffffff811115614d98575f5ffd5b614da4888289016147c0565b909550935050604086013567ffffffffffffffff811115614dc3575f5ffd5b614dcf888289016147c0565b969995985093965092949392505050565b5f60208284031215614df0575f5ffd5b813567ffffffffffffffff811115614e06575f5ffd5b82016101a081850312156148fc575f5ffd5b5f5f83601f840112614e28575f5ffd5b50813567ffffffffffffffff811115614e3f575f5ffd5b6020830191508360208260051b8501011115614432575f5ffd5b5f5f60208385031215614e6a575f5ffd5b823567ffffffffffffffff811115614e80575f5ffd5b614e8c85828601614e18565b90969095509350505050565b5f60208284031215614ea8575f5ffd5b6148fc82614769565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e060208201525f614f3760e0830189614eb1565b8281036040840152614f498189614eb1565b6060840188905273ffffffffffffffffffffffffffffffffffffffff8716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b81811015614fab578351835260209384019390920191600101614f8d565b50909b9a5050505050505050505050565b5f5f60408385031215614fcd575f5ffd5b614fd683614769565b91506149fa60208401614791565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff851681526020810184905260408101839052608081016003831061504c5761504c614fe4565b82606083015295945050505050565b73ffffffffffffffffffffffffffffffffffffffff8881168252878116602083015260408201879052606082018690528481166080830152831660a082015260e08101600483106150ae576150ae614fe4565b8260c083015298975050505050505050565b5f5f5f5f608085870312156150d3575f5ffd5b6150dc856148d0565b93506150ea602086016148d0565b92506150f860408601614769565b9150606085013567ffffffffffffffff811115615113575f5ffd5b85016102808188031215615125575f5ffd5b939692955090935050565b5f5f5f5f5f5f60808789031215615145575f5ffd5b61514e87614769565b955061515c60208801614791565b9450604087013567ffffffffffffffff811115615177575f5ffd5b61518389828a016147c0565b909550935050606087013567ffffffffffffffff8111156151a2575f5ffd5b6151ae89828a016147c0565b979a9699509497509295939492505050565b5f602082840312156151d0575f5ffd5b813567ffffffffffffffff8111156151e6575f5ffd5b8201606081850312156148fc575f5ffd5b5f5f5f5f6040858703121561520a575f5ffd5b843567ffffffffffffffff811115615220575f5ffd5b61522c87828801614e18565b909550935050602085013567ffffffffffffffff81111561524b575f5ffd5b61525787828801614e18565b95989497509550505050565b5f60208284031215615273575f5ffd5b5051919050565b606081526152a160608201855173ffffffffffffffffffffffffffffffffffffffff169052565b5f60208501516152c9608084018273ffffffffffffffffffffffffffffffffffffffff169052565b50604085015173ffffffffffffffffffffffffffffffffffffffff811660a084015250606085015173ffffffffffffffffffffffffffffffffffffffff811660c084015250608085015173ffffffffffffffffffffffffffffffffffffffff811660e08401525060a085015161010083015260c085015161012083015260e08501516101408301526101008501516101608301526101208501516101808301526101408501516101a08301526101608501516101c08301526101808501516101e08301526101a08501516102008301526101c08501516153ce6102208401827fffffffffffffffffffffffffffffffff00000000000000000000000000000000169052565b506101e085015115156102408301526102008501516102806102608401526153fa6102e0840182614eb1565b610220870151805173ffffffffffffffffffffffffffffffffffffffff16610280860152602001516102a08501526102408701518482037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0016102c08601529091506154668282614eb1565b602085019690965250505060400152919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115613e0d57613e0d61547a565b8082028115828204841417613e0d57613e0d61547a565b5f82615504577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f60208284031215615519575f5ffd5b6148fc82614791565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112615555575f5ffd5b83018035915067ffffffffffffffff82111561556f575f5ffd5b602001915036819003821315614432575f5ffd5b818382375f9101908152919050565b8d815273ffffffffffffffffffffffffffffffffffffffff8d811660208301528c811660408301528b811660608301528a81166080830152891660a08201526101a081018860c08301528760e08301528661010083015285610120830152846101408301526156266101608301857fffffffffffffffffffffffffffffffff00000000000000000000000000000000169052565b826101808301529e9d5050505050505050505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261569e575f5ffd5b9190910192915050565b5f67ffffffffffffffff8211156156c1576156c1614a1a565b5060051b60200190565b5f82601f8301126156da575f5ffd5b81356156ed6156e8826156a8565b614a94565b8082825260208201915060208360051b86010192508583111561570e575f5ffd5b602085015b838110156157325761572481614791565b835260209283019201615713565b5095945050505050565b5f6060823603121561574c575f5ffd5b615754614a71565b823567ffffffffffffffff81111561576a575f5ffd5b61577636828601614bc2565b825250602083013567ffffffffffffffff811115615792575f5ffd5b830136601f8201126157a2575f5ffd5b80356157b06156e8826156a8565b8082825260208201915060208360051b8501019250368311156157d1575f5ffd5b6020840193505b828410156157fa576157e984614769565b8252602093840193909101906157d8565b6020850152505050604083013567ffffffffffffffff81111561581b575f5ffd5b615827368286016156cb565b60408301525092915050565b5f60208284031215615843575f5ffd5b6148fc826149c3565b80820180821115613e0d57613e0d61547a565b8181035f83128015838313168383128216171561587e5761587e61547a565b5092915050565b5f60608201858352606060208401528085518083526080850191506020870192505f5b818110156158dc57835173ffffffffffffffffffffffffffffffffffffffff168352602093840193909201916001016158a8565b50508381036040850152845180825260209182019250908501905f5b818110156159385782517fffffffffffffffffffffffffffffffff00000000000000000000000000000000168452602093840193909201916001016158f8565b5091979650505050505050565b600181811c9082168061595957607f821691505b602082108103615990577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b5f82518060208501845e5f92019182525091905056fea2646970667358221220b53202deb44c409809993cf492647f1cf83dd651ab1a49d82ee86ed26af9e03464736f6c634300081c00330000000000000000000000008a2ddc0461fcf96f81a05529bed540d4f1eb2a00000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000003f00297c1cba2d732cd8f40a1ea5b7c5d8aa865000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef0000000000000000000000000000000000000000000000000000000000000708
Deployed Bytecode
0x60806040526004361061027a575f3560e01c80638c31d1381161014b578063d8859d8c116100c6578063f2fde38b1161007c578063fbfa77cf11610062578063fbfa77cf14610834578063ff9b349f14610867578063ffad4064146108fb575f5ffd5b8063f2fde38b146107e9578063f887ea4014610808575f5ffd5b8063dd8b301a116100ac578063dd8b301a14610781578063e159a112146107a0578063e30c3978146107bf575f5ffd5b8063d8859d8c14610725578063dd19158e14610753575f5ffd5b8063aad39a1f1161011b578063c212e40211610101578063c212e402146106c7578063c21c3ca6146106f3578063d4ba0dbf14610706575f5ffd5b8063aad39a1f14610601578063c0d78655146106a8575f5ffd5b80638c31d138146105245780638da5cb5b1461059957806390238882146105c357806396158520146105e2575f5ffd5b80634aa4a4fc116101f5578063715018a6116101ab57806379ba50971161019157806379ba5097146104d55780638456cb59146104e957806384b0196e146104fd575f5ffd5b8063715018a614610493578063736c0d5b146104a7575f5ffd5b80636013a881116101db5780636013a8811461044257806360330682146104615780636cd3ca1c14610474575f5ffd5b80634aa4a4fc146103bb5780635c975abb14610413575f5ffd5b80632990c4321161024a5780633399b499116102305780633399b49914610369578063383c599f146103885780633f4ba83a146103a7575f5ffd5b80632990c4321461032b57806331cb61051461034a575f5ffd5b806305cc262e1461028557806314aac67e146102a657806316a4bfca146102e9578063283138c214610308575f5ffd5b3661028157005b5f5ffd5b348015610290575f5ffd5b506102a461029f3660046147fe565b610910565b005b3480156102b1575f5ffd5b506102d46102c03660046148e3565b60096020525f908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156102f4575f5ffd5b506102a4610303366004614903565b610995565b348015610313575f5ffd5b5061031d60065481565b6040519081526020016102e0565b348015610336575f5ffd5b506102a46103453660046149d2565b6109c8565b348015610355575f5ffd5b506102a46103643660046149d2565b610aa7565b348015610374575f5ffd5b506102a4610383366004614a03565b610b7e565b348015610393575f5ffd5b506102a46103a2366004614d26565b610c07565b3480156103b2575f5ffd5b506102a461128c565b3480156103c6575f5ffd5b506103ee7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102e0565b34801561041e575f5ffd5b5060035474010000000000000000000000000000000000000000900460ff166102d4565b34801561044d575f5ffd5b506102a461045c366004614d60565b61129e565b6102a461046f366004614de0565b6112cb565b34801561047f575f5ffd5b506102a461048e366004614e59565b6119b2565b34801561049e575f5ffd5b506102a4611a16565b3480156104b2575f5ffd5b506102d46104c1366004614e98565b60076020525f908152604090205460ff1681565b3480156104e0575f5ffd5b506102a4611a27565b3480156104f4575f5ffd5b506102a4611ade565b348015610508575f5ffd5b50610511611aee565b6040516102e09796959493929190614efd565b34801561052f575f5ffd5b5061058961053e366004614fbc565b600b60209081525f9283526040808420909152908252902080546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff90921692909160ff1684565b6040516102e09493929190615011565b3480156105a4575f5ffd5b5060025473ffffffffffffffffffffffffffffffffffffffff166103ee565b3480156105ce575f5ffd5b506102a46105dd3660046149d2565b611b90565b3480156105ed575f5ffd5b506102a46105fc366004614e98565b611c67565b34801561060c575f5ffd5b5061069561061b366004614fbc565b600c60209081525f928352604080842090915290825290208054600182015460028301546003840154600485015460059095015473ffffffffffffffffffffffffffffffffffffffff9485169593851694929391929182169181169074010000000000000000000000000000000000000000900460ff1687565b6040516102e0979695949392919061505b565b3480156106b3575f5ffd5b506102a46106c2366004614e98565b611ce5565b3480156106d2575f5ffd5b506005546103ee9073ffffffffffffffffffffffffffffffffffffffff1681565b6102a46107013660046150c0565b611db0565b348015610711575f5ffd5b506102a4610720366004615130565b61255c565b348015610730575f5ffd5b506102d461073f366004614e98565b600a6020525f908152604090205460ff1681565b34801561075e575f5ffd5b506102d461076d366004614e98565b60086020525f908152604090205460ff1681565b34801561078c575f5ffd5b506102a461079b3660046151c0565b6125db565b3480156107ab575f5ffd5b506102a46107ba3660046151f7565b6125ff565b3480156107ca575f5ffd5b5060035473ffffffffffffffffffffffffffffffffffffffff166103ee565b3480156107f4575f5ffd5b506102a4610803366004614e98565b61276d565b348015610813575f5ffd5b506004546103ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561083f575f5ffd5b506103ee7f000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef81565b348015610872575f5ffd5b50610695610881366004614fbc565b600d60209081525f928352604080842090915290825290208054600182015460028301546003840154600485015460059095015473ffffffffffffffffffffffffffffffffffffffff9485169593851694929391929182169181169074010000000000000000000000000000000000000000900460ff1687565b348015610906575f5ffd5b5061031d61070881565b61091861281d565b6109206128a1565b60055473ffffffffffffffffffffffffffffffffffffffff163314610971576040517f1c4a9c8300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610982898989898989898989612926565b61098a612dc1565b505050505050505050565b61099d61281d565b6109a56128a1565b6109b6338989898989898989612926565b6109be612dc1565b5050505050505050565b6109d0612deb565b73ffffffffffffffffffffffffffffffffffffffff8216610a1d576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82165f818152600a602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527f1cdec17edf903de63af98b441f02e1ba4852f1a1b079d5f173e01ca00276839091015b60405180910390a25050565b610aaf612deb565b73ffffffffffffffffffffffffffffffffffffffff8216610afc576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82165f8181526007602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527ffcaa24b1276bfa7dbf77797c0a984b9df924acbeaabd48cd2f1b0eca379b78fa9101610a9b565b610b86612deb565b610708811015610bc2576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600680549082905560408051828152602081018490527f453d9c1835fbe1dfc18c62b581abf16bce57e9aafda476ecdf245e83a0b29e94910160405180910390a15050565b610c0f61281d565b610c176128a1565b5f60408281015173ffffffffffffffffffffffffffffffffffffffff165f908152600d60209081528282206101c08601517fffffffffffffffffffffffffffffffff000000000000000000000000000000001683529052206005015474010000000000000000000000000000000000000000900460ff166003811115610c9f57610c9f614fe4565b14610cd6576040517fc53292e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a081015115610d12576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60808101515f9073ffffffffffffffffffffffffffffffffffffffff1615610dd157608082015160408084015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529116906370a0823190602401602060405180830381865afa158015610da8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dcc9190615263565b610dee565b816040015173ffffffffffffffffffffffffffffffffffffffff16315b600480546040517f0947c2d900000000000000000000000000000000000000000000000000000000815292935073ffffffffffffffffffffffffffffffffffffffff1691630947c2d991610e489186915f9182910161527a565b5f604051808303815f87803b158015610e5f575f5ffd5b505af1158015610e71573d5f5f3e3d5ffd5b50505060808301515f915073ffffffffffffffffffffffffffffffffffffffff1615610f4257608083015160408085015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152849291909116906370a0823190602401602060405180830381865afa158015610f0f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f339190615263565b610f3d91906154a7565b610f69565b81836040015173ffffffffffffffffffffffffffffffffffffffff1631610f6991906154a7565b90506127108360c0015184610220015160200151610f8791906154ba565b610f9191906154d1565b8360c00151610fa091906154a7565b811015610fd9576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518060e00160405280846040015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff168152602001828152602001428152602001846020015173ffffffffffffffffffffffffffffffffffffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020016002600381111561107f5761107f614fe4565b905260408085015173ffffffffffffffffffffffffffffffffffffffff9081165f908152600d60209081528382206101c08901517fffffffffffffffffffffffffffffffff00000000000000000000000000000000168352815290839020845181549084167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178255918501516001820180549185169184169190911790559284015160028401556060840151600380850191909155608085015160048501805491851691841691909117905560a0850151600585018054919094169281168317845560c086015193927fffffffffffffffffffffff0000000000000000000000000000000000000000009091161790740100000000000000000000000000000000000000009084908111156111ba576111ba614fe4565b0217905550905050826020015173ffffffffffffffffffffffffffffffffffffffff16836101c001516fffffffffffffffffffffffffffffffff1916846040015173ffffffffffffffffffffffffffffffffffffffff167f5058c2c070ee43aa7920589163f285ff95ba6c223652dcd97080437c9d3d6dba866080015185466040516112779392919073ffffffffffffffffffffffffffffffffffffffff939093168352602083019190915263ffffffff16604082015260600190565b60405180910390a45050611289612dc1565b50565b611294612deb565b61129c612e6c565b565b6112a661281d565b6112ae6128a1565b6112bc338686868686612ee9565b6112c4612dc1565b5050505050565b6112d361281d565b6112db6128a1565b80610120013542111561131a576040517f1ab7da6b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600a5f61132a6020840184614e98565b73ffffffffffffffffffffffffffffffffffffffff16815260208101919091526040015f205460ff16611389576040517f870240b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b335f908152600b60205260408120816113aa61016085016101408601615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208101919091526040015f9081209150600382015460ff1660028111156113f8576113f8614fe4565b1461142f576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f13cd64c20705b67ed42e8bcab4a2563dfb42bb2a709ffdc8106905de262ca13561145e6020850185614e98565b61146e6040860160208701614e98565b61147e6060870160408801614e98565b61148e6080880160608901614e98565b61149e60a0890160808a01614e98565b8860a001358960c001358a60e001358b61010001358c61012001358d6101400160208101906114cd9190615509565b8e8061016001906114de9190615522565b6040516114ec929190615583565b60405190819003812061150d9d9c9b9a999897969594939291602001615592565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120905061155c81611557610180860186615522565b61324c565b5f61156d6080850160608601614e98565b73ffffffffffffffffffffffffffffffffffffffff16036115ca578260a0013534146115c5576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61167f565b3415611602576040517fbd28e88900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61163a333060a086013561161c6080880160608901614e98565b73ffffffffffffffffffffffffffffffffffffffff169291906132f5565b61167f61164d6040850160208601614e98565b60a08501356116626080870160608801614e98565b73ffffffffffffffffffffffffffffffffffffffff16919061337e565b5f61168d6020850185614e98565b73ffffffffffffffffffffffffffffffffffffffff16346116b2610160870187615522565b6040516116c0929190615583565b5f6040518083038185875af1925050503d805f81146116fa576040519150601f19603f3d011682016040523d82523d5f602084013e6116ff565b606091505b505090508061173a576040517f350c20f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405180608001604052808560600160208101906117589190614e98565b73ffffffffffffffffffffffffffffffffffffffff16815260a0860135602082015242604082015260600160019052335f908152600b60205260408120906117a861016088016101408901615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208082019290925260409081015f20835181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617815591830151600180840191909155908301516002808401919091556060840151600384018054919390927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090921691849081111561187c5761187c614fe4565b02179055506118949150506060850160408601614e98565b73ffffffffffffffffffffffffffffffffffffffff166118b76020860186614e98565b73ffffffffffffffffffffffffffffffffffffffff167fba6d2931f5936f3abce23702c8bb6462fd7185f176abcbebca603f74806314106118fe6080880160608901614e98565b61190e60a0890160808a01614e98565b60a089013560c08a013560e08b01356101008c01356119356101608e016101408f01615509565b6040805173ffffffffffffffffffffffffffffffffffffffff9889168152979096166020880152948601939093526060850191909152608084015260a08301527fffffffffffffffffffffffffffffffff000000000000000000000000000000001660c082015260e00160405180910390a3505050611289612dc1565b6119ba61281d565b6119c26128a1565b5f5b81811015611a0957611a018383838181106119e1576119e161563f565b90506020028101906119f3919061566c565b6119fc9061573c565b61338e565b6001016119c4565b50611a12612dc1565b5050565b611a1e612deb565b61129c5f613cc8565b600354339073ffffffffffffffffffffffffffffffffffffffff168114611ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e6572000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61128981613cc8565b611ae6612deb565b61129c613cf9565b5f60608082808083611b207f4e6174697665204272696467650000000000000000000000000000000000000d83613d68565b611b4b7f31000000000000000000000000000000000000000000000000000000000000016001613d68565b604080515f808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b611b98612deb565b73ffffffffffffffffffffffffffffffffffffffff8216611be5576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff82165f8181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527fe57b6bfa2587fb4d95cb816404e883c653c162cf7682728a32ba94b1441398549101610a9b565b611c6f612deb565b6005805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f060744ad36c7e2695965e49629feb4962ad92e4ddd6b3f89508327b09ef8f486905f90a35050565b611ced612deb565b73ffffffffffffffffffffffffffffffffffffffff8116611d3a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6004805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f02dc5c233404867c793b749c6d644beb2277536d18a7e7974d3f238e4c6f1684905f90a35050565b611db861281d565b611dc06128a1565b63ffffffff83165f9081526009602052604090205460ff16611e0e576040517fabdef43a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b335f908152600c6020526040812081611e2f6101e085016101c08601615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208101919091526040015f206005015474010000000000000000000000000000000000000000900460ff166003811115611e9057611e90614fe4565b14611ec7576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8363ffffffff1642108015611ee657508061010001358463ffffffff16105b611f1c576040517f1ab7da6b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3415612075578060a001353414611f5f576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216611fa66080830160608401614e98565b73ffffffffffffffffffffffffffffffffffffffff1614611ff3576040517fc1ab6dc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004015f604051808303818588803b158015612059575f5ffd5b505af115801561206b573d5f5f3e3d5ffd5b5050505050612218565b5f6120866080830160608401614e98565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156120f0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121149190615263565b9050612130333060a085013561161c6080870160608801614e98565b60a0820135816121466080850160608601614e98565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa1580156121b0573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121d49190615263565b6121de91906154a7565b1015612216576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b5f73ffffffffffffffffffffffffffffffffffffffff83161561223b578261223d565b335b90506040518060e0016040528083604001602081019061225d9190614e98565b73ffffffffffffffffffffffffffffffffffffffff1681526020016122886080850160608601614e98565b73ffffffffffffffffffffffffffffffffffffffff1681526020018360a0013581526020014281526020018360200160208101906122c69190614e98565b73ffffffffffffffffffffffffffffffffffffffff90811682528316602082015260400160019052335f908152600c602052604081209061230f6101e086016101c08701615509565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016815260208082019290925260409081015f20835181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff92831617835593850151600183018054861691831691909117905591840151600282015560608401516003808301919091556080850151600483018054861691851691909117905560a085015160058301805495861691909416908117845560c086015192949293927fffffffffffffffffffffff0000000000000000000000000000000000000000001617907401000000000000000000000000000000000000000090849081111561243557612435614fe4565b021790555061244f9150506101e083016101c08401615509565b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000166124816060840160408501614e98565b73ffffffffffffffffffffffffffffffffffffffff16337f815eb8f31f063ad6e5dfc30e9904bf56c06c67a0cf04123a24b3707a6b5e1ce16124c96080870160608801614e98565b60a087018035906124dd9060808a01614e98565b60c08901356124f260408b0160208c01614e98565b6040805173ffffffffffffffffffffffffffffffffffffffff968716815260208101959095529285169284019290925260608301528216608082015290861660a082015263ffffffff891660c082015260e00160405180910390a450612556612dc1565b50505050565b61256461281d565b61256c6128a1565b60055473ffffffffffffffffffffffffffffffffffffffff1633146125bd576040517f1c4a9c8300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6125cb868686868686612ee9565b6125d3612dc1565b505050505050565b6125e361281d565b6125eb6128a1565b6125f76119fc8261573c565b611289612dc1565b612607612deb565b828114612640576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b838110156112c45782828281811061265c5761265c61563f565b90506020020160208101906126719190615833565b60095f8787858181106126865761268661563f565b905060200201602081019061269b91906148e3565b63ffffffff16815260208101919091526040015f2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790558484828181106126ef576126ef61563f565b905060200201602081019061270491906148e3565b63ffffffff167fa834f0101ce3509b1bc39a75a825caae7045d16d08c4759b84799e0fd875d24884848481811061273d5761273d61563f565b90506020020160208101906127529190615833565b604051901515815260200160405180910390a2600101612642565b612775612deb565b6003805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911681179091556127d860025473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c15612876576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61129c7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f006001613e18565b60035474010000000000000000000000000000000000000000900460ff161561129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401611acc565b73ffffffffffffffffffffffffffffffffffffffff89165f908152600b602090815260408083207fffffffffffffffffffffffffffffffff000000000000000000000000000000008c16845290915290206001600382015460ff16600281111561299257612992614fe4565b146129c9576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60065481600201546129db919061584c565b4211612a13576040517f3742d1f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080517fe91459739c65339c6f9d9d4aaf76070d6e580cec363432da7d718b215c8a0f4a602082015273ffffffffffffffffffffffffffffffffffffffff8c16918101919091527fffffffffffffffffffffffffffffffff000000000000000000000000000000008a1660608201525f90608001604051602081830303815290604052805190602001209050612aab818a8a613e1f565b5f7f2e8b423aa04051ad929f93dc9ea2cc49896ca12aa24d3dade9e5f8faeb1107135f1b8c8c888888604051612ae2929190615583565b60405180910390208e8e604051612afa929190615583565b60408051918290038220602083019790975273ffffffffffffffffffffffffffffffffffffffff958616908201527fffffffffffffffffffffffffffffffff0000000000000000000000000000000090931660608401529216608082015260a081019190915260c081019190915260e001604051602081830303815290604052805190602001209050612b8e81898961324c565b73ffffffffffffffffffffffffffffffffffffffff861615612cab5773ffffffffffffffffffffffffffffffffffffffff86165f908152600a602052604090205460ff16612c08576040517f870240b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8673ffffffffffffffffffffffffffffffffffffffff168686604051612c30929190615583565b5f604051808303815f865af19150503d805f8114612c69576040519150601f19603f3d011682016040523d82523d5f602084013e612c6e565b606091505b5050905080612ca9576040517f350c20f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6003830180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166002179055825473ffffffffffffffffffffffffffffffffffffffff16612d0757612d028c8460010154613e8d565b612d32565b60018301548354612d329173ffffffffffffffffffffffffffffffffffffffff909116908e90613f6d565b825460018401546040805173ffffffffffffffffffffffffffffffffffffffff938416815260208101929092527fffffffffffffffffffffffffffffffff000000000000000000000000000000008e16928f169133917f0a86f74894e732067ed6b5772d5a1e1fa9351815214f3d71fb0a758d2021befc910160405180910390a4505050505050505050505050565b61129c7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005f613e18565b60025473ffffffffffffffffffffffffffffffffffffffff16331461129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611acc565b612e74613fab565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b73ffffffffffffffffffffffffffffffffffffffff86165f908152600c602090815260408083207fffffffffffffffffffffffffffffffff000000000000000000000000000000008916845290915290206001600582015474010000000000000000000000000000000000000000900460ff166003811115612f6d57612f6d614fe4565b14612fa4576040517f140dcdb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006548160030154612fb6919061584c565b4211612fee576040517f3742d1f600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080517fe91459739c65339c6f9d9d4aaf76070d6e580cec363432da7d718b215c8a0f4a602082015273ffffffffffffffffffffffffffffffffffffffff8916918101919091527fffffffffffffffffffffffffffffffff00000000000000000000000000000000871660608201525f90608001604051602081830303815290604052805190602001209050613086818787613e1f565b5f7f22a6a1ee4ce3c203e6c5050f89b76de80922c621972f1f2c715343fd02e303795f1b898989896040516130bc929190615583565b6040519081900381206131229493929160200193845273ffffffffffffffffffffffffffffffffffffffff9290921660208401527fffffffffffffffffffffffffffffffff00000000000000000000000000000000166040830152606082015260800190565b60405160208183030381529060405280519060200120905061314581868661324c565b600583018054740300000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff821617909155600284015460018501546131b79273ffffffffffffffffffffffffffffffffffffffff91821692911690613f6d565b6005830154600184015460028501546040805173ffffffffffffffffffffffffffffffffffffffff938416815260208101929092527fffffffffffffffffffffffffffffffff000000000000000000000000000000008c16938316928d16917f6424645453312a97d058f07efffabd2c739263d83d5c4d8a38a2d9e8e9e56755910160405180910390a4505050505050505050565b5f6132946132598561402f565b84848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061407692505050565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526007602052604090205490915060ff16612556576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526125569186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050614098565b613389838383614137565b505050565b805160c00151156133cb576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160608101516020909101515f91903373ffffffffffffffffffffffffffffffffffffffff82161461345a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f6e6c7920746865207365747465722063616e20636c61696d000000000000006044820152606401611acc565b5f5b846040015151811015613803575f600c5f876020015184815181106134835761348361563f565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f876040015184815181106134db576134db61563f565b6020908102919091018101517fffffffffffffffffffffffffffffffff000000000000000000000000000000001682528181019290925260409081015f20815160e081018352815473ffffffffffffffffffffffffffffffffffffffff908116825260018301548116948201949094526002820154928101929092526003808201546060840152600482015484166080840152600582015493841660a08401529192909160c084019174010000000000000000000000000000000000000000900460ff16908111156135af576135af614fe4565b60038111156135c0576135c0614fe4565b8152505090508373ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff161461362f576040517fc1ab6dc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff16816080015173ffffffffffffffffffffffffffffffffffffffff1614613698576040517f815e1d6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018160c0015160038111156136b0576136b0614fe4565b146136e7576040517fc53292e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408101516136f6908661584c565b94506002600c5f886020015185815181106137135761371361563f565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8860400151858151811061376b5761376b61563f565b6020908102919091018101517fffffffffffffffffffffffffffffffff000000000000000000000000000000001682528101919091526040015f2060050180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000008360038111156137f5576137f5614fe4565b02179055505060010161345c565b50835160a001518314613842576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef811660048301525f91908416906370a0823190602401602060405180830381865afa1580156138cf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138f39190615263565b6040517f4bd2144500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015285811660248301529192505f917f000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef1690634bd2144590604401602060405180830381865afa15801561398a573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906139ae9190615263565b6004549091506139d89073ffffffffffffffffffffffffffffffffffffffff86811691168761337e565b6004805487516040517f0947c2d900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921692630947c2d992613a3292915f9182910161527a565b5f604051808303815f87803b158015613a49575f5ffd5b505af1158015613a5b573d5f5f3e3d5ffd5b50506040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef811660048301528893508592508716906370a0823190602401602060405180830381865afa158015613aed573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b119190615263565b613b1b91906154a7565b1015613b53576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f4bd2144500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301528581166024830152869183917f000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef1690634bd2144590604401602060405180830381865afa158015613be9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c0d9190615263565b613c17919061585f565b1215613c4f576040517f5945ea5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fbd951368d43c2e1875fd02dd315c81c7561f8cdbaed467664b48a06e7101dab78789602001518a60400151604051613cb893929190615885565b60405180910390a3505050505050565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556112898161420e565b613d016128a1565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612ebf3390565b606060ff8314613d8257613d7b83614284565b9050613e0d565b818054613d8e90615945565b80601f0160208091040260200160405190810160405280929190818152602001828054613dba90615945565b8015613e055780601f10613ddc57610100808354040283529160200191613e05565b820191905f5260205f20905b815481529060010190602001808311613de857829003601f168201915b505050505090505b92915050565b905090565b80825d5050565b5f613e2c6132598561402f565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526008602052604090205490915060ff16612556576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080515f8082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051613ec39190615996565b5f6040518083038185875af1925050503d805f8114613efd576040519150601f19603f3d011682016040523d82523d5f602084013e613f02565b606091505b5050905080613389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f53544500000000000000000000000000000000000000000000000000000000006044820152606401611acc565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261338991859182169063a9059cbb90606401613337565b60035474010000000000000000000000000000000000000000900460ff1661129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401611acc565b5f613e0d61403b6142c1565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b5f5f5f61408385856143f7565b9150915061409081614439565b509392505050565b5f5f60205f8451602086015f885af1806140b7576040513d5f823e3d81fd5b50505f513d915081156140ce5780600114156140e8565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15612556576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401611acc565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790526141c384826145eb565b6125565760405173ffffffffffffffffffffffffffffffffffffffff84811660248301525f604483015261420491869182169063095ea7b390606401613337565b6125568482614098565b6002805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60605f61429083614641565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f3073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000cebfc5dfbd5ce21694fe2acefa63ad6f828831d21614801561432657507f000000000000000000000000000000000000000000000000000000000000000146145b1561435057507f22d166cf1c8c8d9783e4529a79af6856483e448d765a2dd1b3727f26994f651390565b613e13604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f481cc9b62c42bdbdfb23cf8936b37b71e57e1473c13644dc72ff9cea664d4a58918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f5f825160410361442b576020830151604084015160608501515f1a61441f87828585614681565b94509450505050614432565b505f905060025b9250929050565b5f81600481111561444c5761444c614fe4565b036144545750565b600181600481111561446857614468614fe4565b036144cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401611acc565b60028160048111156144e3576144e3614fe4565b0361454a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611acc565b600381600481111561455e5761455e614fe4565b03611289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401611acc565b5f5f5f5f60205f8651602088015f8a5af192503d91505f5190508280156146375750811561461c5780600114614637565b5f8673ffffffffffffffffffffffffffffffffffffffff163b115b9695505050505050565b5f60ff8216601f811115613e0d576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156146b657505f90506003614760565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614707573d5f5f3e3d5ffd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661475a575f60019250925050614760565b91505f90505b94509492505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461478c575f5ffd5b919050565b80357fffffffffffffffffffffffffffffffff000000000000000000000000000000008116811461478c575f5ffd5b5f5f83601f8401126147d0575f5ffd5b50813567ffffffffffffffff8111156147e7575f5ffd5b602083019150836020828501011115614432575f5ffd5b5f5f5f5f5f5f5f5f5f60c08a8c031215614816575f5ffd5b61481f8a614769565b985061482d60208b01614791565b975060408a013567ffffffffffffffff811115614848575f5ffd5b6148548c828d016147c0565b90985096505060608a013567ffffffffffffffff811115614873575f5ffd5b61487f8c828d016147c0565b9096509450614892905060808b01614769565b925060a08a013567ffffffffffffffff8111156148ad575f5ffd5b6148b98c828d016147c0565b915080935050809150509295985092959850929598565b803563ffffffff8116811461478c575f5ffd5b5f602082840312156148f3575f5ffd5b6148fc826148d0565b9392505050565b5f5f5f5f5f5f5f5f60a0898b03121561491a575f5ffd5b61492389614791565b9750602089013567ffffffffffffffff81111561493e575f5ffd5b61494a8b828c016147c0565b909850965050604089013567ffffffffffffffff811115614969575f5ffd5b6149758b828c016147c0565b9096509450614988905060608a01614769565b9250608089013567ffffffffffffffff8111156149a3575f5ffd5b6149af8b828c016147c0565b999c989b5096995094979396929594505050565b8035801515811461478c575f5ffd5b5f5f604083850312156149e3575f5ffd5b6149ec83614769565b91506149fa602084016149c3565b90509250929050565b5f60208284031215614a13575f5ffd5b5035919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051610260810167ffffffffffffffff81118282101715614a6b57614a6b614a1a565b60405290565b6040516060810167ffffffffffffffff81118282101715614a6b57614a6b614a1a565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614adb57614adb614a1a565b604052919050565b5f82601f830112614af2575f5ffd5b813567ffffffffffffffff811115614b0c57614b0c614a1a565b614b3d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601614a94565b818152846020838601011115614b51575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f60408284031215614b7d575f5ffd5b6040805190810167ffffffffffffffff81118282101715614ba057614ba0614a1a565b604052905080614baf83614769565b8152602092830135920191909152919050565b5f6102808284031215614bd3575f5ffd5b614bdb614a47565b9050614be682614769565b8152614bf460208301614769565b6020820152614c0560408301614769565b6040820152614c1660608301614769565b6060820152614c2760808301614769565b608082015260a0828101359082015260c0808301359082015260e08083013590820152610100808301359082015261012080830135908201526101408083013590820152610160808301359082015261018080830135908201526101a08083013590820152614c996101c08301614791565b6101c0820152614cac6101e083016149c3565b6101e082015261020082013567ffffffffffffffff811115614ccc575f5ffd5b614cd884828501614ae3565b61020083015250614ced836102208401614b6d565b61022082015261026082013567ffffffffffffffff811115614d0d575f5ffd5b614d1984828501614ae3565b6102408301525092915050565b5f60208284031215614d36575f5ffd5b813567ffffffffffffffff811115614d4c575f5ffd5b614d5884828501614bc2565b949350505050565b5f5f5f5f5f60608688031215614d74575f5ffd5b614d7d86614791565b9450602086013567ffffffffffffffff811115614d98575f5ffd5b614da4888289016147c0565b909550935050604086013567ffffffffffffffff811115614dc3575f5ffd5b614dcf888289016147c0565b969995985093965092949392505050565b5f60208284031215614df0575f5ffd5b813567ffffffffffffffff811115614e06575f5ffd5b82016101a081850312156148fc575f5ffd5b5f5f83601f840112614e28575f5ffd5b50813567ffffffffffffffff811115614e3f575f5ffd5b6020830191508360208260051b8501011115614432575f5ffd5b5f5f60208385031215614e6a575f5ffd5b823567ffffffffffffffff811115614e80575f5ffd5b614e8c85828601614e18565b90969095509350505050565b5f60208284031215614ea8575f5ffd5b6148fc82614769565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b7fff000000000000000000000000000000000000000000000000000000000000008816815260e060208201525f614f3760e0830189614eb1565b8281036040840152614f498189614eb1565b6060840188905273ffffffffffffffffffffffffffffffffffffffff8716608085015260a0840186905283810360c0850152845180825260208087019350909101905f5b81811015614fab578351835260209384019390920191600101614f8d565b50909b9a5050505050505050505050565b5f5f60408385031215614fcd575f5ffd5b614fd683614769565b91506149fa60208401614791565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff851681526020810184905260408101839052608081016003831061504c5761504c614fe4565b82606083015295945050505050565b73ffffffffffffffffffffffffffffffffffffffff8881168252878116602083015260408201879052606082018690528481166080830152831660a082015260e08101600483106150ae576150ae614fe4565b8260c083015298975050505050505050565b5f5f5f5f608085870312156150d3575f5ffd5b6150dc856148d0565b93506150ea602086016148d0565b92506150f860408601614769565b9150606085013567ffffffffffffffff811115615113575f5ffd5b85016102808188031215615125575f5ffd5b939692955090935050565b5f5f5f5f5f5f60808789031215615145575f5ffd5b61514e87614769565b955061515c60208801614791565b9450604087013567ffffffffffffffff811115615177575f5ffd5b61518389828a016147c0565b909550935050606087013567ffffffffffffffff8111156151a2575f5ffd5b6151ae89828a016147c0565b979a9699509497509295939492505050565b5f602082840312156151d0575f5ffd5b813567ffffffffffffffff8111156151e6575f5ffd5b8201606081850312156148fc575f5ffd5b5f5f5f5f6040858703121561520a575f5ffd5b843567ffffffffffffffff811115615220575f5ffd5b61522c87828801614e18565b909550935050602085013567ffffffffffffffff81111561524b575f5ffd5b61525787828801614e18565b95989497509550505050565b5f60208284031215615273575f5ffd5b5051919050565b606081526152a160608201855173ffffffffffffffffffffffffffffffffffffffff169052565b5f60208501516152c9608084018273ffffffffffffffffffffffffffffffffffffffff169052565b50604085015173ffffffffffffffffffffffffffffffffffffffff811660a084015250606085015173ffffffffffffffffffffffffffffffffffffffff811660c084015250608085015173ffffffffffffffffffffffffffffffffffffffff811660e08401525060a085015161010083015260c085015161012083015260e08501516101408301526101008501516101608301526101208501516101808301526101408501516101a08301526101608501516101c08301526101808501516101e08301526101a08501516102008301526101c08501516153ce6102208401827fffffffffffffffffffffffffffffffff00000000000000000000000000000000169052565b506101e085015115156102408301526102008501516102806102608401526153fa6102e0840182614eb1565b610220870151805173ffffffffffffffffffffffffffffffffffffffff16610280860152602001516102a08501526102408701518482037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0016102c08601529091506154668282614eb1565b602085019690965250505060400152919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b81810381811115613e0d57613e0d61547a565b8082028115828204841417613e0d57613e0d61547a565b5f82615504577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f60208284031215615519575f5ffd5b6148fc82614791565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112615555575f5ffd5b83018035915067ffffffffffffffff82111561556f575f5ffd5b602001915036819003821315614432575f5ffd5b818382375f9101908152919050565b8d815273ffffffffffffffffffffffffffffffffffffffff8d811660208301528c811660408301528b811660608301528a81166080830152891660a08201526101a081018860c08301528760e08301528661010083015285610120830152846101408301526156266101608301857fffffffffffffffffffffffffffffffff00000000000000000000000000000000169052565b826101808301529e9d5050505050505050505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261569e575f5ffd5b9190910192915050565b5f67ffffffffffffffff8211156156c1576156c1614a1a565b5060051b60200190565b5f82601f8301126156da575f5ffd5b81356156ed6156e8826156a8565b614a94565b8082825260208201915060208360051b86010192508583111561570e575f5ffd5b602085015b838110156157325761572481614791565b835260209283019201615713565b5095945050505050565b5f6060823603121561574c575f5ffd5b615754614a71565b823567ffffffffffffffff81111561576a575f5ffd5b61577636828601614bc2565b825250602083013567ffffffffffffffff811115615792575f5ffd5b830136601f8201126157a2575f5ffd5b80356157b06156e8826156a8565b8082825260208201915060208360051b8501019250368311156157d1575f5ffd5b6020840193505b828410156157fa576157e984614769565b8252602093840193909101906157d8565b6020850152505050604083013567ffffffffffffffff81111561581b575f5ffd5b615827368286016156cb565b60408301525092915050565b5f60208284031215615843575f5ffd5b6148fc826149c3565b80820180821115613e0d57613e0d61547a565b8181035f83128015838313168383128216171561587e5761587e61547a565b5092915050565b5f60608201858352606060208401528085518083526080850191506020870192505f5b818110156158dc57835173ffffffffffffffffffffffffffffffffffffffff168352602093840193909201916001016158a8565b50508381036040850152845180825260209182019250908501905f5b818110156159385782517fffffffffffffffffffffffffffffffff00000000000000000000000000000000168452602093840193909201916001016158f8565b5091979650505050505050565b600181811c9082168061595957607f821691505b602082108103615990577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b5f82518060208501845e5f92019182525091905056fea2646970667358221220b53202deb44c409809993cf492647f1cf83dd651ab1a49d82ee86ed26af9e03464736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000008a2ddc0461fcf96f81a05529bed540d4f1eb2a00000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000003f00297c1cba2d732cd8f40a1ea5b7c5d8aa865000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef0000000000000000000000000000000000000000000000000000000000000708
-----Decoded View---------------
Arg [0] : _router (address): 0x8a2ddc0461Fcf96F81a05529Bed540d4f1eb2a00
Arg [1] : _WETH9 (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _signer (address): 0x03f00297C1cba2D732Cd8f40a1eA5B7C5D8aA865
Arg [3] : _vault (address): 0xe3D41d19564922C9952f692C5Dd0563030f5f2EF
Arg [4] : _refundBuffer (uint256): 1800
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000008a2ddc0461fcf96f81a05529bed540d4f1eb2a00
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 00000000000000000000000003f00297c1cba2d732cd8f40a1ea5b7c5d8aa865
Arg [3] : 000000000000000000000000e3d41d19564922c9952f692c5dd0563030f5f2ef
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000708
Loading...
Loading
Loading...
Loading
Net Worth in USD
$32.40
Net Worth in ETH
0.015439
Token Allocations
USDC
100.00%
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $0.999905 | 32.4 | $32.4 |
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.