Source Code
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x9659edf3ea91df14f2d5f3b01f9783169e61ab2f5fdd8b809ff2c4ace05aa87b | Send | (pending) | 1 min ago | IN | 0 ETH | (Pending) | |||
Send | 23531570 | 14 secs ago | IN | 0 ETH | 0.0002554 | ||||
Send | 23531565 | 1 min ago | IN | 1.4 ETH | 0.0001916 | ||||
Send | 23531562 | 1 min ago | IN | 0 ETH | 0.00037821 | ||||
Send | 23531529 | 8 mins ago | IN | 0.00404796 ETH | 0.00025512 | ||||
Send | 23531525 | 9 mins ago | IN | 0.000315 ETH | 0.0000195 | ||||
Send | 23531523 | 9 mins ago | IN | 0.009 ETH | 0.00014573 | ||||
Send | 23531510 | 12 mins ago | IN | 0.11283194 ETH | 0.00001861 | ||||
Send | 23531507 | 13 mins ago | IN | 0.0475 ETH | 0.00019413 | ||||
Send | 23531502 | 14 mins ago | IN | 0 ETH | 0.00025626 | ||||
Send | 23531499 | 14 mins ago | IN | 0 ETH | 0.00039572 | ||||
Send | 23531495 | 15 mins ago | IN | 0 ETH | 0.0000581 | ||||
Send | 23531490 | 16 mins ago | IN | 0 ETH | 0.00038737 | ||||
Send | 23531477 | 19 mins ago | IN | 0 ETH | 0.00039092 | ||||
Send | 23531475 | 19 mins ago | IN | 0 ETH | 0.00022184 | ||||
Send | 23531473 | 19 mins ago | IN | 0.04882533 ETH | 0.00027274 | ||||
Send | 23531456 | 23 mins ago | IN | 0.008 ETH | 0.0002587 | ||||
Send | 23531450 | 24 mins ago | IN | 0.2 ETH | 0.00021066 | ||||
Send | 23531448 | 24 mins ago | IN | 1.11 ETH | 0.00022475 | ||||
Send | 23531444 | 25 mins ago | IN | 0 ETH | 0.00018553 | ||||
Send | 23531430 | 28 mins ago | IN | 0.002 ETH | 0.00026071 | ||||
Send | 23531403 | 34 mins ago | IN | 0.01153057 ETH | 0.00027875 | ||||
Send | 23531371 | 40 mins ago | IN | 0.0165 ETH | 0.00025402 | ||||
Send | 23531369 | 40 mins ago | IN | 0.00981902 ETH | 0.00017669 | ||||
Send | 23531365 | 41 mins ago | IN | 0.89 ETH | 0.00017871 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
Bridge | 23531565 | 1 min ago | 1.4 ETH | ||||
Bridge | 23531529 | 8 mins ago | 0.00404796 ETH | ||||
Bridge | 23531525 | 9 mins ago | 0.000315 ETH | ||||
Bridge | 23531523 | 9 mins ago | 0.009 ETH | ||||
Bridge | 23531510 | 12 mins ago | 0.11283194 ETH | ||||
Bridge | 23531507 | 13 mins ago | 0.0475 ETH | ||||
Bridge | 23531473 | 19 mins ago | 0.04882533 ETH | ||||
Bridge | 23531456 | 23 mins ago | 0.008 ETH | ||||
Bridge | 23531450 | 24 mins ago | 0.2 ETH | ||||
Bridge | 23531448 | 24 mins ago | 1.11 ETH | ||||
Bridge | 23531430 | 28 mins ago | 0.002 ETH | ||||
Bridge | 23531403 | 34 mins ago | 0.01153057 ETH | ||||
Bridge | 23531371 | 40 mins ago | 0.0165 ETH | ||||
Bridge | 23531369 | 40 mins ago | 0.00981902 ETH | ||||
Bridge | 23531365 | 41 mins ago | 0.89 ETH | ||||
Bridge | 23531357 | 43 mins ago | 0.03861448 ETH | ||||
Bridge | 23531349 | 44 mins ago | 0.0007 ETH | ||||
Bridge | 23531306 | 53 mins ago | 0.005 ETH | ||||
Bridge | 23531295 | 55 mins ago | 0.02844496 ETH | ||||
Bridge | 23531242 | 1 hr ago | 0.01 ETH | ||||
Bridge | 23531241 | 1 hr ago | 0.005 ETH | ||||
Bridge | 23531235 | 1 hr ago | 0.043 ETH | ||||
Bridge | 23531233 | 1 hr ago | 0.7 ETH | ||||
Bridge | 23531226 | 1 hr ago | 5.61769562 ETH | ||||
Bridge | 23531225 | 1 hr ago | 0.01 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
XChainSender
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import {ERC20} from "solmate/src/tokens/ERC20.sol"; import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol"; import {SafeTransferLib} from "solmate/src/utils/SafeTransferLib.sol"; import {ReentrancyGuardTransient} from "./base/ReentrancyGuardTransient.sol"; import {PCSOrderData, PCSCommand, Permit2Data} from "./libraries/PCSOrder.sol"; import {LibAddress} from "./libraries/LibAddress.sol"; import {Commands} from "./libraries/Commands.sol"; import {Dispatcher} from "./Dispatcher.sol"; import {Constants} from "./libraries/Constants.sol"; import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol"; import {SafeCastLib} from "solmate/src/utils/SafeCastLib.sol"; contract XChainSender is Dispatcher, ReentrancyGuardTransient, Pausable { using SafeTransferLib for ERC20; using LibAddress for address; using LibAddress for bytes32; using SafeCastLib for uint256; /// @notice thrown when msg.value is not equal to order amount error InsufficientSendBalance(); /// @notice thrown when more than 1 bridge command is found error MoreThanOneBridgeCommand(); /// @notice thrown when swap command is found after bridge command error NoSwapAfterBridgeCommand(); event Send(bytes32 indexed orderId, bytes order); uint256 public numberOfOrders; address public immutable PERMIT2; constructor(address owner, address weth, address permit2) Dispatcher(owner, weth) { PERMIT2 = permit2; } /// @notice Entry point to begin a cross-chain swap /// @param order Order data containing the input token, amount, commands to execute and permit2 data function send(PCSOrderData calldata order) external payable nonReentrant whenNotPaused { if (order.inputToken.toAddress() == Constants.ETH) { if (msg.value != order.inputAmount) { revert InsufficientSendBalance(); } } else { if (order.permit2Data.length > 0) { // use permit2 Permit2Data memory permit2Data = abi.decode(order.permit2Data, (Permit2Data)); /// @dev even if permit2.permit fails (in case frontrun), continue to proceed PERMIT2.call( abi.encodeWithSignature( "permit(address,((address,uint160,uint48,uint48),address,uint256),bytes)", msg.sender, permit2Data.permitSingle, permit2Data.signature ) ); IAllowanceTransfer(PERMIT2).transferFrom( msg.sender, address(this), order.inputAmount.safeCastTo160(), order.inputToken.toAddress() ); } else { ERC20(order.inputToken.toAddress()).safeTransferFrom(msg.sender, address(this), order.inputAmount); } } bytes32 orderId = getNextOrderId(); dispatch(orderId, order.commands); emit Send(orderId, abi.encode(order)); numberOfOrders += 1; } /// @notice return the next generated orderId function getNextOrderId() public view returns (bytes32) { return keccak256(abi.encode(address(this), numberOfOrders, block.chainid)); } /** * @dev called by the owner to pause, triggers stopped state */ function pause() external onlyOwner whenNotPaused { _pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() external onlyOwner whenPaused { _unpause(); } /// @dev validate the commands before executing: max only 1 bridge command function _validateCommands(PCSCommand[] memory pcsCommands) internal pure override { uint256 totalBridgeCommand; for (uint256 i = 0; i < pcsCommands.length; i++) { uint256 command = pcsCommands[i].command; if (command == Commands.BRIDGE) totalBridgeCommand++; // only 1 bridge command expected if (totalBridgeCommand > 1) revert MoreThanOneBridgeCommand(); // no swap on source chain after bridge command if (totalBridgeCommand == 1 && command == Commands.SWAP) revert NoSwapAfterBridgeCommand(); } } /// @notice Receive native asset directly. receive() external payable {} }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../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 { bool private _paused; /** * @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); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @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 { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @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: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; /// @solidity memory-safe-assembly assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument. mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. success := call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data and token has code. if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) { success := iszero(or(iszero(extcodesize(token)), returndatasize())) } } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data and token has code. if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) { success := iszero(or(iszero(extcodesize(token)), returndatasize())) } } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; /// @solidity memory-safe-assembly assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type. // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data and token has code. if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) { success := iszero(or(iszero(extcodesize(token)), returndatasize())) } } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; /// @notice Using transient storage slot for the lock status /// @dev credit to https://github.com/Vectorized/solady/blob/main/src/utils/ReentrancyGuardTransient.sol abstract contract ReentrancyGuardTransient { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Unauthorized reentrant call. error Reentrancy(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to: `uint32(bytes4(keccak256("Reentrancy()"))) | 1 << 71`. /// 9 bytes is large enough to avoid collisions in practice, /// but not too large to result in excessive bytecode bloat. uint256 private constant _REENTRANCY_GUARD_SLOT = 0x8000000000ab143c06; modifier nonReentrant() { /// @solidity memory-safe-assembly assembly { if tload(_REENTRANCY_GUARD_SLOT) { mstore(0x00, 0xab143c06) // `Reentrancy()`. revert(0x1c, 0x04) } tstore(_REENTRANCY_GUARD_SLOT, address()) } _; /// @solidity memory-safe-assembly assembly { tstore(_REENTRANCY_GUARD_SLOT, 0) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IAllowanceTransfer} from "permit2/src/interfaces/IAllowanceTransfer.sol"; struct PCSCommand { /// @notice command type uint256 command; /// @notice command data, abi encoded data for the command bytes commandData; } struct PCSOrderData { /// @notice input token address. set as Constant.ETH for native token bytes32 inputToken; /// @notice input amount uint256 inputAmount; /// @notice list of PCS commands to execute PCSCommand[] commands; /// @notice permit2 data abi.encode(Permit2Data) /// @dev if permit2Data length=0, input token will be transfer via token.safeTransferFrom /// @dev if permit2Data is set, input token will be transfer via permit2.transferFrom bytes permit2Data; } struct Permit2Data { /// @notice permit2 permitSingle IAllowanceTransfer.PermitSingle permitSingle; /// @notice permit2 signature bytes signature; }
/// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; /// @title LibAddress /// @notice Utility method for address library LibAddress { error InvalidBytes32Address(); function toAddress(bytes32 _bytes32) internal pure returns (address) { if (uint256(_bytes32) >> 160 != 0) { revert InvalidBytes32Address(); } return address(uint160(uint256(_bytes32))); } function toBytes32(address _address) internal pure returns (bytes32) { return bytes32(uint256(uint160(_address))); } function isNative(address _address) internal pure returns (bool) { return _address == address(0); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Commands { /// @notice for swapping tokens uint256 constant SWAP = 0x00; /// @notice for bridging token to another chain uint256 constant BRIDGE = 0x01; /// @notice for sweeping token from contract uint256 constant SWEEP = 0x02; /// @notice for transferring token (or native eth) from contract uint256 constant TRANSFER = 0x03; /// @notice for wrapping WETH->ETH uint256 constant WRAP_ETH = 0x04; /// @notice for ybwrapping ETH->WETH uint256 constant UNWRAP_WETH = 0x05; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import {PCSCommand} from "./libraries/PCSOrder.sol"; import {Commands} from "./libraries/Commands.sol"; import {ERC20} from "solmate/src/tokens/ERC20.sol"; import {SafeTransferLib} from "solmate/src/utils/SafeTransferLib.sol"; import {LibAddress} from "./libraries/LibAddress.sol"; import {IBridgeAdapter, BridgeData} from "./interfaces/IBridgeAdapter.sol"; import {IDispatcher} from "./interfaces/IDispatcher.sol"; import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol"; import {SwapData} from "./interfaces/ISwapAdapter.sol"; import {Payments} from "./libraries/Payments.sol"; import {Constants} from "./libraries/Constants.sol"; abstract contract Dispatcher is IDispatcher, Ownable2Step, Payments { using SafeTransferLib for ERC20; using LibAddress for bytes32; error DisallowCombination(); // keccak256(abi.encode(address target, bytes4 selector)) => bool mapping(bytes32 => bool) swapFunctionWhitelisted; mapping(address => bool) public isBridgeAdapterWhitelisted; constructor(address owner, address weth) Ownable(owner) Payments(weth) {} function dispatch(bytes32 orderId, PCSCommand[] memory pcsCommands) internal { _validateCommands(pcsCommands); for (uint8 i = 0; i < pcsCommands.length; i++) { PCSCommand memory pcsCommand = pcsCommands[i]; // 0x00 to 0x02 if (pcsCommand.command < Commands.TRANSFER) { if (pcsCommand.command == Commands.SWAP) { // swap related logic SwapData memory swapData = abi.decode(pcsCommand.commandData, (SwapData)); if (!isSwapFunctionWhitelisted(swapData.target, swapData.input)) { revert SwapFunctionNotWhitelisted(); } uint256 inputAmount = swapData.inputAmount; address inputToken = swapData.inputToken; bool success; if (inputToken != Constants.ETH) { // this check prevent approve from failing or using only a portion of the funds // since we cannot update the amount in swapData.input if (inputAmount == Constants.CONTRACT_BALANCE && !swapData.shouldTransferTokensBeforeSwap) { revert DisallowCombination(); } if (inputAmount == Constants.CONTRACT_BALANCE) { inputAmount = ERC20(inputToken).balanceOf(address(this)); } // if inputToken is native, it will be sent with the transaction if (swapData.shouldTransferTokensBeforeSwap) { ERC20(inputToken).safeTransfer(swapData.target, inputAmount); } else { ERC20(inputToken).safeApprove(swapData.target, inputAmount); } (success,) = swapData.target.call(swapData.input); if ( !swapData.shouldTransferTokensBeforeSwap && ERC20(inputToken).allowance(address(this), swapData.target) > 0 ) { // safe practice: reset approval to 0 after swap // the return value of the call is not checked, because it can be a non-standard ERC20 token like BNB on ETH inputToken.call(abi.encodeWithSignature("approve(address,uint256)", swapData.target, 0)); } } else { // no need to check disallow combination since we always transfer native token to target if (inputAmount == Constants.CONTRACT_BALANCE) { inputAmount = address(this).balance; } (success,) = swapData.target.call{value: inputAmount}(swapData.input); } if (!success) revert FailSwapCall(orderId, swapData.target); } else if (pcsCommand.command == Commands.BRIDGE) { // bridge related logic (BridgeData memory bridgeData) = abi.decode(pcsCommand.commandData, (BridgeData)); address bridgeAdapter = bridgeData.target; if (!isBridgeAdapterWhitelisted[bridgeAdapter]) { revert BridgeAdapterNotWhitelisted(); } address inputToken = bridgeData.inputToken.toAddress(); if (inputToken == Constants.ETH) { uint256 inputBalance = address(this).balance; if (inputBalance < bridgeData.inputAmount) { revert InsufficientBridgeInputBalance(); } // set the output amount in proportion to the actual input amount if (inputBalance != bridgeData.inputAmount) { bridgeData.outputAmount = (bridgeData.outputAmount * inputBalance) / bridgeData.inputAmount; } // set input amount to the balance in contract, this can happen when user swap->bridge // and it can result in more token balance in contract, so bridge as much as possible bridgeData.inputAmount = inputBalance; IBridgeAdapter(bridgeAdapter).bridge{value: bridgeData.inputAmount}(orderId, bridgeData); } else { uint256 inputBalance = ERC20(inputToken).balanceOf(address(this)); if (inputBalance < bridgeData.inputAmount) { revert InsufficientBridgeInputBalance(); } // set the output amount in proportion to the actual input amount if (inputBalance != bridgeData.inputAmount) { bridgeData.outputAmount = (bridgeData.outputAmount * inputBalance) / bridgeData.inputAmount; } // set input amount to the balance in contract, this can happen when user swap->bridge // and it can result in more token balance in contract, so bridge as much as possible bridgeData.inputAmount = inputBalance; // bridgeAdapter expect token to be transferred over first ERC20(inputToken).safeTransfer(bridgeAdapter, bridgeData.inputAmount); IBridgeAdapter(bridgeAdapter).bridge(orderId, bridgeData); } } else if (pcsCommand.command == Commands.SWEEP) { (address token, address recipient, uint256 amountMinimum) = abi.decode(pcsCommand.commandData, (address, address, uint256)); Payments.sweep(token, map(recipient), amountMinimum); } else { revert CommandNotSupported(pcsCommand.command); } } else { // 0x03 to 0x05 if (pcsCommand.command == Commands.UNWRAP_WETH) { (address recipient, uint256 amountMinimum) = abi.decode(pcsCommand.commandData, (address, uint256)); Payments.unwrapWETH(map(recipient), amountMinimum); } else if (pcsCommand.command == Commands.WRAP_ETH) { (address recipient, uint256 amount) = abi.decode(pcsCommand.commandData, (address, uint256)); Payments.wrapETH(map(recipient), amount); } else if (pcsCommand.command == Commands.TRANSFER) { (address token, address recipient, uint256 amount) = abi.decode(pcsCommand.commandData, (address, address, uint256)); Payments.pay(token, map(recipient), amount); } else { revert CommandNotSupported(pcsCommand.command); } } } } /// @notice Checks if a swap target address and function selector are whitelisted. /// @param target The target address /// @param input The input data to call, will extract the first 4 bytes to get the selector /// @return bool Returns true if the target address and function selector are whitelisted, false otherwise. function isSwapFunctionWhitelisted(address target, bytes memory input) public view returns (bool) { bytes4 selector; assembly { selector := mload(add(input, 32)) // Load 4 bytes from memory } return swapFunctionWhitelisted[keccak256(abi.encode(target, selector))]; } /// @notice Checks if a swap target address and function selector are whitelisted. /// @param target The target address /// @param selector The function selector /// @return bool Returns true if the target address and function selector are whitelisted, false otherwise. function isSwapFunctionWhitelisted(address target, bytes4 selector) public view returns (bool) { return swapFunctionWhitelisted[keccak256(abi.encode(target, selector))]; } /// @notice Sets the whitelist status for a swap target address and function selector. function setSwapFunctionWhitelist(address target, bytes4 selector, bool status) external onlyOwner { if (target == address(0)) revert AddressZero(); // blacklist 4 selector: 0x23b872dd: IERC20.transferFrom, 0x095ea7b3: IERC20.approve, 0x39509351 IERC20.increaseAllowance, 0x2da334b5 IBridgeAdapter.bridge if (selector == 0x23b872dd || selector == 0x095ea7b3 || selector == 0x39509351 || selector == 0x2da334b5) { revert InvalidWhitelistSelector(); } swapFunctionWhitelisted[keccak256(abi.encode(target, selector))] = status; emit SetSwapFunctionWhitelist(target, selector, status); } function setBridgeAdapterWhitelist(address target, bool status) external onlyOwner { if (target == address(0)) revert AddressZero(); isBridgeAdapterWhitelisted[target] = status; emit SetBridgeAdapterWhitelist(target, status); } /// @notice Calculates the recipient address for a command /// @param recipient The recipient or recipient-flag for the command /// @return output The resultant recipient for the command function map(address recipient) internal view returns (address) { if (recipient == Constants.MSG_SENDER) { return msg.sender; } else if (recipient == Constants.ADDRESS_THIS) { return address(this); } else { return recipient; } } /// @dev override this function to add custom validation logic for commands function _validateCommands(PCSCommand[] memory pcsCommands) internal virtual {} }
/// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; /// @title Constant state library Constants { /// @dev Used as a flag for identifying the transfer of ETH instead of a token address internal constant ETH = address(0); /// @notice used to signal that the recipient of an action should be the msgSender address internal constant MSG_SENDER = address(1); /// @notice used to signal that the recipient of an action should be the address(this) address internal constant ADDRESS_THIS = address(2); /// @notice used to signal that an action should use the contract's entire balance of a currency /// This value is equivalent to 1<<255, i.e. a singular 1 in the most significant bit. uint256 internal constant CONTRACT_BALANCE = 0x8000000000000000000000000000000000000000000000000000000000000000; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {IEIP712} from "./IEIP712.sol"; /// @title AllowanceTransfer /// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts /// @dev Requires user's token approval on the Permit2 contract interface IAllowanceTransfer is IEIP712 { /// @notice Thrown when an allowance on a token has expired. /// @param deadline The timestamp at which the allowed amount is no longer valid error AllowanceExpired(uint256 deadline); /// @notice Thrown when an allowance on a token has been depleted. /// @param amount The maximum amount allowed error InsufficientAllowance(uint256 amount); /// @notice Thrown when too many nonces are invalidated. error ExcessiveInvalidation(); /// @notice Emits an event when the owner successfully invalidates an ordered nonce. event NonceInvalidation( address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce ); /// @notice Emits an event when the owner successfully sets permissions on a token for the spender. event Approval( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration ); /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender. event Permit( address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration, uint48 nonce ); /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function. event Lockdown(address indexed owner, address token, address spender); /// @notice The permit data for a token struct PermitDetails { // ERC20 token address address token; // the maximum amount allowed to spend uint160 amount; // timestamp at which a spender's token allowances become invalid uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice The permit message signed for a single token allownce struct PermitSingle { // the permit data for a single token alownce PermitDetails details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The permit message signed for multiple token allowances struct PermitBatch { // the permit data for multiple token allowances PermitDetails[] details; // address permissioned on the allowed tokens address spender; // deadline on the permit signature uint256 sigDeadline; } /// @notice The saved permissions /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message /// @dev Setting amount to type(uint160).max sets an unlimited approval struct PackedAllowance { // amount allowed uint160 amount; // permission expiry uint48 expiration; // an incrementing value indexed per owner,token,and spender for each signature uint48 nonce; } /// @notice A token spender pair. struct TokenSpenderPair { // the token the spender is approved address token; // the spender address address spender; } /// @notice Details for a token transfer. struct AllowanceTransferDetails { // the owner of the token address from; // the recipient of the token address to; // the amount of the token uint160 amount; // the token to be transferred address token; } /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval. /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress] /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals. function allowance(address user, address token, address spender) external view returns (uint160 amount, uint48 expiration, uint48 nonce); /// @notice Approves the spender to use up to amount of the specified token up until the expiration /// @param token The token to approve /// @param spender The spender address to approve /// @param amount The approved amount of the token /// @param expiration The timestamp at which the approval is no longer valid /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve /// @dev Setting amount to type(uint160).max sets an unlimited approval function approve(address token, address spender, uint160 amount, uint48 expiration) external; /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitSingle Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external; /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce /// @param owner The owner of the tokens being approved /// @param permitBatch Data signed over by the owner specifying the terms of approval /// @param signature The owner's signature over the permit data function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external; /// @notice Transfer approved tokens from one address to another /// @param from The address to transfer from /// @param to The address of the recipient /// @param amount The amount of the token to transfer /// @param token The token address to transfer /// @dev Requires the from address to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(address from, address to, uint160 amount, address token) external; /// @notice Transfer approved tokens in a batch /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers /// @dev Requires the from addresses to have approved at least the desired amount /// of tokens to msg.sender. function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external; /// @notice Enables performing a "lockdown" of the sender's Permit2 identity /// by batch revoking approvals /// @param approvals Array of approvals to revoke. function lockdown(TokenSpenderPair[] calldata approvals) external; /// @notice Invalidate nonces for a given (token, spender) pair /// @param token The token to invalidate nonces for /// @param spender The spender to invalidate nonces for /// @param newNonce The new nonce to set. Invalidates all nonces less than it. /// @dev Can't invalidate more than 2**16 nonces per transaction. function invalidateNonces(address token, address spender, uint48 newNonce) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Safe unsigned integer casting library that reverts on overflow. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeCastLib.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol) library SafeCastLib { function safeCastTo248(uint256 x) internal pure returns (uint248 y) { require(x < 1 << 248); y = uint248(x); } function safeCastTo240(uint256 x) internal pure returns (uint240 y) { require(x < 1 << 240); y = uint240(x); } function safeCastTo232(uint256 x) internal pure returns (uint232 y) { require(x < 1 << 232); y = uint232(x); } function safeCastTo224(uint256 x) internal pure returns (uint224 y) { require(x < 1 << 224); y = uint224(x); } function safeCastTo216(uint256 x) internal pure returns (uint216 y) { require(x < 1 << 216); y = uint216(x); } function safeCastTo208(uint256 x) internal pure returns (uint208 y) { require(x < 1 << 208); y = uint208(x); } function safeCastTo200(uint256 x) internal pure returns (uint200 y) { require(x < 1 << 200); y = uint200(x); } function safeCastTo192(uint256 x) internal pure returns (uint192 y) { require(x < 1 << 192); y = uint192(x); } function safeCastTo184(uint256 x) internal pure returns (uint184 y) { require(x < 1 << 184); y = uint184(x); } function safeCastTo176(uint256 x) internal pure returns (uint176 y) { require(x < 1 << 176); y = uint176(x); } function safeCastTo168(uint256 x) internal pure returns (uint168 y) { require(x < 1 << 168); y = uint168(x); } function safeCastTo160(uint256 x) internal pure returns (uint160 y) { require(x < 1 << 160); y = uint160(x); } function safeCastTo152(uint256 x) internal pure returns (uint152 y) { require(x < 1 << 152); y = uint152(x); } function safeCastTo144(uint256 x) internal pure returns (uint144 y) { require(x < 1 << 144); y = uint144(x); } function safeCastTo136(uint256 x) internal pure returns (uint136 y) { require(x < 1 << 136); y = uint136(x); } function safeCastTo128(uint256 x) internal pure returns (uint128 y) { require(x < 1 << 128); y = uint128(x); } function safeCastTo120(uint256 x) internal pure returns (uint120 y) { require(x < 1 << 120); y = uint120(x); } function safeCastTo112(uint256 x) internal pure returns (uint112 y) { require(x < 1 << 112); y = uint112(x); } function safeCastTo104(uint256 x) internal pure returns (uint104 y) { require(x < 1 << 104); y = uint104(x); } function safeCastTo96(uint256 x) internal pure returns (uint96 y) { require(x < 1 << 96); y = uint96(x); } function safeCastTo88(uint256 x) internal pure returns (uint88 y) { require(x < 1 << 88); y = uint88(x); } function safeCastTo80(uint256 x) internal pure returns (uint80 y) { require(x < 1 << 80); y = uint80(x); } function safeCastTo72(uint256 x) internal pure returns (uint72 y) { require(x < 1 << 72); y = uint72(x); } function safeCastTo64(uint256 x) internal pure returns (uint64 y) { require(x < 1 << 64); y = uint64(x); } function safeCastTo56(uint256 x) internal pure returns (uint56 y) { require(x < 1 << 56); y = uint56(x); } function safeCastTo48(uint256 x) internal pure returns (uint48 y) { require(x < 1 << 48); y = uint48(x); } function safeCastTo40(uint256 x) internal pure returns (uint40 y) { require(x < 1 << 40); y = uint40(x); } function safeCastTo32(uint256 x) internal pure returns (uint32 y) { require(x < 1 << 32); y = uint32(x); } function safeCastTo24(uint256 x) internal pure returns (uint24 y) { require(x < 1 << 24); y = uint24(x); } function safeCastTo16(uint256 x) internal pure returns (uint16 y) { require(x < 1 << 16); y = uint16(x); } function safeCastTo8(uint256 x) internal pure returns (uint8 y) { require(x < 1 << 8); y = uint8(x); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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 pragma solidity ^0.8.0; struct BridgeData { /// @notice the token to be bridged from source chain. Specify address(0) for native token. /// @dev bytes32 for supporting non-evm chain in the future bytes32 inputToken; /// @notice the token to receive on destination chain bytes32 outputToken; /// @notice the amount of input token to be bridged uint256 inputAmount; /// @notice the amount of output token to be received /// @dev the amount will change base on the actual amount of input token /// actualOutputAmount = outputAmount * actualInputAmount / inputAmount /// please take reference on the Dispatcher.sol line 100 and 114 uint256 outputAmount; /// @notice if bridge fails (or not executed), refund to this address on source chain address refundRecipient; /// @notice target bridge adapter to call address target; /// @notice custom data for each bridge adapter to decode. relayerFeePct for across bytes data; /// @notice destination chain id uint256 destinationChainId; /// @notice recipient address on destination chain bytes32 recipient; /// @notice message to recipient. eg. for across, will be passed as part of message param in handleV3AcrossMessage /// @dev for across, it will be abi.encode(PCSCommand[], address fallbackReceiver) bytes recipientMessage; } /// @title IBridgeAdapter /// @notice Interface for calling bridge interface IBridgeAdapter { /// @notice Thrown when caller is not xChainSender error NotXChainSender(); /// @notice Thrown when caller is not contract itself error NotSelf(); /// @notice Emitted whenever bridge happen, the event does not have a lot of data as bridge provider will likely emit one too. eg. /// for across, it will emit FundDeposit with all the parameters event BridgeStarted( bytes32 orderId, bytes32 inputToken, bytes32 outputToken, uint256 inputAmt, uint256 outputAmt, uint256 destinationChainId ); /// @notice Emitted on the destination chain when executing event BridgeSuccess(bytes32 orderId); /// @notice Emitted on the destination chain when executing commands fails (eg. swap fail) event BridgeFallBackExecuted(bytes32 orderId, address token, uint256 tokenAmount, address receiver); /// @notice bridge token from source chain to destination chain /// @dev payable for the case of native token bridging function bridge(bytes32 orderId, BridgeData memory data) external payable; }
/// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IDispatcher { /// @notice thrown when command not supported error CommandNotSupported(uint256 command); /// @notice thrown when swap target function is not whitelisted error SwapFunctionNotWhitelisted(); /// @notice thrown when there's insuffcient input token to bridge error InsufficientBridgeInputBalance(); /// @notice thrown when swap command fails error FailSwapCall(bytes32 orderId, address target); /// @notice thrown when bridge adapter is not whitelisted error BridgeAdapterNotWhitelisted(); /// @notice thrown when address(0) was used when it should not be error AddressZero(); /// @notice thrown when invalid selector was used in setTargetFunctionWhitelist error InvalidWhitelistSelector(); /// @notice emitted whenever swap's function selector whitelisted status is updated event SetSwapFunctionWhitelist(address indexed target, bytes4 selector, bool whitelisted); /// @notice emitted whenever bridge adapter whitelist status is updated event SetBridgeAdapterWhitelist(address indexed adapter, bool whitelisted); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol) pragma solidity ^0.8.20; import {Ownable} from "./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. * * This extension of the {Ownable} contract includes a two-step mechanism to transfer * ownership, where the new owner must call {acceptOwnership} in order to replace the * old one. This can help prevent common mistakes, such as transfers of ownership to * incorrect accounts, or to contracts that are unable to interact with the * permission system. * * The initial owner is specified at deployment time in the constructor for `Ownable`. 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. * * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer. */ 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(); if (pendingOwner() != sender) { revert OwnableUnauthorizedAccount(sender); } _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; struct SwapData { /// @notice inputToken for swap address inputToken; /// @notice input amount required for swap uint256 inputAmount; /// @notice If true, will transfer erc20 token to target before swap instead of inputToken.approve(target, inputAmount) /// @dev if target is universal router and inputToken is erc20 token, set as true bool shouldTransferTokensBeforeSwap; /// @notice target address for swap. eg. smart router / universal router address target; /// @notice input data when calling target bytes input; }
/// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import {ERC20} from "solmate/src/tokens/ERC20.sol"; import {SafeTransferLib} from "solmate/src/utils/SafeTransferLib.sol"; import {IWETH} from "../interfaces/external/IWETH.sol"; import {Constants} from "./Constants.sol"; /// @title Payments contract /// @notice Performs various operations around the payment of ETH and tokens abstract contract Payments { using SafeTransferLib for ERC20; using SafeTransferLib for address; error InsufficientToken(); error InsufficientETH(); IWETH public immutable WETH; constructor(address _weth) { WETH = IWETH(_weth); } /// @notice Sweeps all of the contract's ERC20 or ETH to an address /// @param token The token to sweep (can be ETH using Constants.ETH) /// @param recipient The address that will receive payment /// @param amountMinimum The minimum desired amount function sweep(address token, address recipient, uint256 amountMinimum) internal { uint256 balance; if (token == Constants.ETH) { balance = address(this).balance; if (balance < amountMinimum) revert InsufficientETH(); if (balance > 0) recipient.safeTransferETH(balance); } else { balance = ERC20(token).balanceOf(address(this)); if (balance < amountMinimum) revert InsufficientToken(); if (balance > 0) ERC20(token).safeTransfer(recipient, balance); } } /// @notice Pays an amount of ETH or ERC20 to a recipient /// @param token The token to pay (can be ETH using Constants.ETH) /// @param recipient The address that will receive the payment /// @param value The amount to pay function pay(address token, address recipient, uint256 value) internal { if (token == Constants.ETH) { if (value == Constants.CONTRACT_BALANCE) { value = address(this).balance; } recipient.safeTransferETH(value); } else { if (value == Constants.CONTRACT_BALANCE) { value = ERC20(token).balanceOf(address(this)); } ERC20(token).safeTransfer(recipient, value); } } /// @notice Wraps an amount of ETH into WETH /// @param recipient The recipient of the WETH /// @param amount The amount to wrap (can be CONTRACT_BALANCE) function wrapETH(address recipient, uint256 amount) internal { if (amount == Constants.CONTRACT_BALANCE) { amount = address(this).balance; } else if (amount > address(this).balance) { revert InsufficientETH(); } if (amount > 0) { WETH.deposit{value: amount}(); if (recipient != address(this)) { ERC20(address(WETH)).safeTransfer(recipient, amount); } } } /// @notice Unwraps all of the contract's WETH into ETH /// @param recipient The recipient of the ETH /// @param amountMinimum The minimum amount of ETH desired function unwrapWETH(address recipient, uint256 amountMinimum) internal { uint256 value = WETH.balanceOf(address(this)); if (value < amountMinimum) { revert InsufficientETH(); } if (value > 0) { WETH.withdraw(value); if (recipient != address(this)) { recipient.safeTransferETH(value); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; interface IEIP712 { function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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 { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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: GPL-3.0-or-later pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title Interface for WETH interface IWETH is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; /// @notice Withdraw wrapped ether to get ether function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
{ "remappings": [ "solmate/=lib/solmate/", "solady/=lib/solady/", "@openzeppelin/=lib/openzeppelin-contracts/", "forge-std/=lib/forge-std/src/", "infinity-universal-router/=lib/infinity-universal-router/", "infinity-periphery/=lib/infinity-universal-router/lib/infinity-periphery/", "infinity-core/=lib/infinity-universal-router/lib/infinity-periphery/lib/infinity-core/", "permit2/=lib/infinity-universal-router/lib/infinity-periphery/lib/permit2/", "ds-test/=lib/solmate/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-gas-snapshot/=lib/pancake-create3-factory/lib/forge-gas-snapshot/src/", "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "pancake-create3-factory/=lib/pancake-create3-factory/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"weth","type":"address"},{"internalType":"address","name":"permit2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"BridgeAdapterNotWhitelisted","type":"error"},{"inputs":[{"internalType":"uint256","name":"command","type":"uint256"}],"name":"CommandNotSupported","type":"error"},{"inputs":[],"name":"DisallowCombination","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"bytes32","name":"orderId","type":"bytes32"},{"internalType":"address","name":"target","type":"address"}],"name":"FailSwapCall","type":"error"},{"inputs":[],"name":"InsufficientBridgeInputBalance","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientSendBalance","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBytes32Address","type":"error"},{"inputs":[],"name":"InvalidWhitelistSelector","type":"error"},{"inputs":[],"name":"MoreThanOneBridgeCommand","type":"error"},{"inputs":[],"name":"NoSwapAfterBridgeCommand","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"Reentrancy","type":"error"},{"inputs":[],"name":"SwapFunctionNotWhitelisted","type":"error"},{"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":true,"internalType":"bytes32","name":"orderId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"order","type":"bytes"}],"name":"Send","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"adapter","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"SetBridgeAdapterWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"SetSwapFunctionWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"PERMIT2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getNextOrderId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBridgeAdapterWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"input","type":"bytes"}],"name":"isSwapFunctionWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"isSwapFunctionWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfOrders","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"inputToken","type":"bytes32"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"components":[{"internalType":"uint256","name":"command","type":"uint256"},{"internalType":"bytes","name":"commandData","type":"bytes"}],"internalType":"struct PCSCommand[]","name":"commands","type":"tuple[]"},{"internalType":"bytes","name":"permit2Data","type":"bytes"}],"internalType":"struct PCSOrderData","name":"order","type":"tuple"}],"name":"send","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setBridgeAdapterWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setSwapFunctionWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60c03461012057601f612f9738819003918201601f19168301916001600160401b03831184841017610124578084926060946040528339810103126101205761004781610138565b61005f604061005860208501610138565b9301610138565b6001600160a01b0390911691821561010d57600180546001600160a01b03199081169091555f80549182168517815560405194916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a36001600160a01b03166080526004805460ff1916905560a052612e4a908161014d82396080518181816110770152818161290f0152612a27015260a05181818161069d01526109960152f35b631e4fbdf760e01b5f525f60045260245ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101205756fe6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c806305df27a114610139578063080ca2431461013457806327ad57d51461012f5780633f4ba83a1461012a5780635c975abb146101255780636afdd85014610120578063715018a61461011b57806379ba50971461011657806379e41c7a146101115780637a54d7751461010c5780638158900b146101075780638456cb59146101025780638da5cb5b146100fd578063aaaeaf5e146100f8578063ad5c4648146100f3578063b451794e146100ee578063e30c3978146100e95763f2fde38b0361000e57611127565b6110d6565b61109b565b61102d565b610f70565b610f20565b610e83565b610e43565b610d68565b610cf7565b610a7c565b6109ba565b61094c565b61090c565b610872565b6104de565b610212565b61016d565b73ffffffffffffffffffffffffffffffffffffffff81160361015c57565b5f80fd5b359061016b8261013e565b565b3461015c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5773ffffffffffffffffffffffffffffffffffffffff6004356101bd8161013e565b165f526003602052602060ff60405f2054166040519015158152f35b602435907fffffffff000000000000000000000000000000000000000000000000000000008216820361015c57565b8015150361015c57565b3461015c5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5760043561024d8161013e565b6102556101d9565b9060443561026281610208565b61026a61185d565b73ffffffffffffffffffffffffffffffffffffffff82169283156104b6577fffffffff0000000000000000000000000000000000000000000000000000000081167f23b872dd00000000000000000000000000000000000000000000000000000000811490811561048c575b8115610462575b8115610438575b50610410576103da826103aa7fff1a2ed9c559be7343626a32f36160299954e9f425c6ebe3655d8f27be900f89956040516103998161036d886020830195869092917fffffffff0000000000000000000000000000000000000000000000000000000060209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610c26565b5190205f52600260205260405f2090565b9060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b604080517fffffffff000000000000000000000000000000000000000000000000000000009290921682529115156020820152a2005b7f8efeb66e000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f2da334b5000000000000000000000000000000000000000000000000000000009150145f6102e4565b7f3950935100000000000000000000000000000000000000000000000000000000811491506102dd565b7f095ea7b300000000000000000000000000000000000000000000000000000000811491506102d6565b7f9fabe1c1000000000000000000000000000000000000000000000000000000005f5260045ffd5b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5760043567ffffffffffffffff811161015c578060040160807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc833603011261015c57688000000000ab143c065c61085b5730688000000000ab143c065d61056d61187d565b803573ffffffffffffffffffffffffffffffffffffffff61058d826118b1565b166106595750602482013534036106315761060d61036d6106017fafbe1df72b07bfe5bfeaf8d0502bbeb554fd24f80e2f6dfaef57f9c81ca4a271935b6105f26105ec6105e560446105dd61182f565b990184611461565b36916114b5565b87611da4565b604051928391602083016116aa565b6040519182918261176c565b0390a261062361061e6005546117aa565b600555565b5f688000000000ab143c065d005b7f1b34520b000000000000000000000000000000000000000000000000000000005f5260045ffd5b906064830161066881836111e8565b1590506107f35761069961069173ffffffffffffffffffffffffffffffffffffffff92846111e8565b81019061124c565b5f807f00000000000000000000000000000000000000000000000000000000000000009261036d6107026020835193015160405192839160208301957f2b67b5700000000000000000000000000000000000000000000000000000000087523360248501611374565b519082855af150610711611427565b50169161072a61072460248601356119db565b916118b1565b833b1561015c576040517f36c7851600000000000000000000000000000000000000000000000000000000815233600482015230602482015273ffffffffffffffffffffffffffffffffffffffff928316604482015291166064820152915f908390608490829084905af19182156107ee5761060161060d9261036d927fafbe1df72b07bfe5bfeaf8d0502bbeb554fd24f80e2f6dfaef57f9c81ca4a271956107d4575b506105ca565b806107e25f6107e893610c26565b80610868565b5f6107ce565b611456565b5061036d61060161060d9261085661084761082e7fafbe1df72b07bfe5bfeaf8d0502bbeb554fd24f80e2f6dfaef57f9c81ca4a271976118b1565b73ffffffffffffffffffffffffffffffffffffffff1690565b602488013590309033906118fa565b6105ca565b63ab143c065f526004601cfd5b5f91031261015c57565b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576108a861185d565b6108b0612696565b6108b8612696565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600454166004557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602060ff600454166040519015158152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576109f061185d565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000600154166001555f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c573373ffffffffffffffffffffffffffffffffffffffff6001541603610b58577fffffffffffffffffffffffff0000000000000000000000000000000000000000600154166001555f54337fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f5573ffffffffffffffffffffffffffffffffffffffff3391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b7f118cdaa7000000000000000000000000000000000000000000000000000000005f523360045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff821117610bcd57604052565b610b84565b6060810190811067ffffffffffffffff821117610bcd57604052565b6080810190811067ffffffffffffffff821117610bcd57604052565b60a0810190811067ffffffffffffffff821117610bcd57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610bcd57604052565b6040519061016b61014083610c26565b67ffffffffffffffff8111610bcd57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561015c57803590610cc882610c77565b92610cd66040519485610c26565b8284526020838301011161015c57815f926020809301838601378301015290565b3461015c5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57600435610d328161013e565b60243567ffffffffffffffff811161015c57602091610d58610d5e923690600401610cb1565b906117bd565b6040519015158152f35b3461015c5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57600435610da38161013e565b73ffffffffffffffffffffffffffffffffffffffff60243591610dc583610208565b610dcd61185d565b169081156104b65760207faa1e61e4b2bdff2663672064c648aa1fd5e95092f24b94e83c374a3a47e6ffae91835f5260038252610e388160405f209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6040519015158152a2005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576020610e7b61182f565b604051908152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57610eb961185d565b610ec161187d565b610ec961187d565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060045416176004557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b3461015c5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57600435610fab8161013e565b61036d61100f610fb96101d9565b6040519283916020830195869092917fffffffff0000000000000000000000000000000000000000000000000000000060209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b5190205f526002602052602060ff60405f2054166040519015158152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576020600554604051908152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b3461015c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5773ffffffffffffffffffffffffffffffffffffffff6004356111778161013e565b61117f61185d565b16807fffffffffffffffffffffffff0000000000000000000000000000000000000000600154161760015573ffffffffffffffffffffffffffffffffffffffff5f54167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227005f80a3005b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561015c570180359067ffffffffffffffff821161015c5760200191813603831361015c57565b359065ffffffffffff8216820361015c57565b60208183031261015c5780359067ffffffffffffffff821161015c57018082039160e0831261015c576040519261128284610bb1565b60c0811261015c5760806040519161129983610bd2565b1261015c576040516112aa81610bee565b83356112b58161013e565b815260208401356112c58161013e565b60208201526112d660408501611239565b60408201526112e760608501611239565b606082015281526112fa60808401610160565b602082015260a08301356040820152835260c082013567ffffffffffffffff811161015c576113299201610cb1565b602082015290565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b6040611424949373ffffffffffffffffffffffffffffffffffffffff6101009416835265ffffffffffff6060825173ffffffffffffffffffffffffffffffffffffffff815116602087015273ffffffffffffffffffffffffffffffffffffffff6020820151168587015282858201511682870152015116608084015273ffffffffffffffffffffffffffffffffffffffff60208201511660a0840152015160c08201528160e08201520190611331565b90565b3d15611451573d9061143882610c77565b916114466040519384610c26565b82523d5f602084013e565b606090565b6040513d5f823e3d90fd5b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561015c570180359067ffffffffffffffff821161015c57602001918160051b3603831361015c57565b9291909267ffffffffffffffff8411610bcd578360051b60206040516114dd82840182610c26565b80968152019082019183831161015c5780915b8383106114fe575050505050565b823567ffffffffffffffff811161015c57820160408187031261015c576040519161152883610bb1565b8135835260208201359267ffffffffffffffff841161015c5761155088602095869501610cb1565b838201528152019201916114f0565b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561015c57016020813591019167ffffffffffffffff821161015c57813603831361015c57565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093818652868601375f8582860101520116010190565b90602083828152019060208160051b85010193835f915b8383106116145750505050505090565b9091929394957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820301865286357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18436030181121561015c57602061169c600193604061168d88859601803584528581019061155f565b919092818682015201916115af565b980196019493019190611604565b9060208252803560208301526020810135604083015260408101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561015c5781019160208335930167ffffffffffffffff841161015c578360051b3603811361015c5761173161173c91611424956080606086015260a08501916115ed565b92606081019061155f565b9160807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828603019101526115af565b906020611424928181520190611331565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90600182018092116117b857565b61177d565b6020918201516040805173ffffffffffffffffffffffffffffffffffffffff9093169383019384527fffffffff000000000000000000000000000000000000000000000000000000009091169082015261181a816060810161036d565b5190205f52600260205260ff60405f20541690565b6005546040516020810191308352604082015246606082015260608152611857608082610c26565b51902090565b73ffffffffffffffffffffffffffffffffffffffff5f54163303610b5857565b60ff6004541661188957565b7fd93c0665000000000000000000000000000000000000000000000000000000005f5260045ffd5b8060a01c6118d25773ffffffffffffffffffffffffffffffffffffffff1690565b7ff7d2b34a000000000000000000000000000000000000000000000000000000005f5260045ffd5b925f9160649173ffffffffffffffffffffffffffffffffffffffff60209581604051947f23b872dd000000000000000000000000000000000000000000000000000000008652166004850152166024830152604482015282855af19081601f3d1160015f51141615166119ce575b501561197057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152fd5b3b153d171590505f611968565b7401000000000000000000000000000000000000000081101561015c5773ffffffffffffffffffffffffffffffffffffffff1690565b60ff1660ff81146117b85760010190565b8051821015611a365760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9081606091031261015c578051611a798161013e565b9160406020830151611a8a8161013e565b92015190565b919082604091031261015c5760208251611a8a8161013e565b519061016b8261013e565b81601f8201121561015c57805190611acb82610c77565b92611ad96040519485610c26565b8284526020838301011161015c57815f9260208093018386015e8301015290565b60208183031261015c5780519067ffffffffffffffff821161015c57016101408183031261015c57611b2a610c67565b9181518352602082015160208401526040820151604084015260608201516060840152611b5960808301611aa9565b6080840152611b6a60a08301611aa9565b60a084015260c082015167ffffffffffffffff811161015c5781611b8f918401611ab4565b60c084015260e082015160e084015261010082015161010084015261012082015167ffffffffffffffff811161015c57611bc99201611ab4565b61012082015290565b9081602091031261015c575190565b818102929181159184041417156117b857565b8115611bfe570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b6114249291815260406020820152815160408201526020820151606082015260408201516080820152606082015160a0820152611c85608083015160c083019073ffffffffffffffffffffffffffffffffffffffff169052565b60a082015173ffffffffffffffffffffffffffffffffffffffff1660e0820152610120611cc460c0840151610140610100850152610180840190611331565b9260e0810151828401526101008101516101408401520151906101607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc082850301910152611331565b60208183031261015c5780519067ffffffffffffffff821161015c570160a08183031261015c5760405191611d4183610c0a565b8151611d4c8161013e565b8352602082015160208401526040820151611d6681610208565b60408401526060820151611d798161013e565b6060840152608082015167ffffffffffffffff811161015c57611d9c9201611ab4565b608082015290565b9091611daf836126cb565b5f5b835160ff82169081101561268f57611dc99085611a22565b51805160038110156125b9575080518061228a57506020611df591015160208082518301019101611d0d565b6060810190611e18825173ffffffffffffffffffffffffffffffffffffffff1690565b611e2f611e2b60808401928351906117bd565b1590565b61226257602082015191611e57815173ffffffffffffffffffffffffffffffffffffffff1690565b9173ffffffffffffffffffffffffffffffffffffffff83169182156121f8577f8000000000000000000000000000000000000000000000000000000000000000851480806121e2575b6121ba5761213a575b5f80611f24936040611e2b940197611ec18951151590565b831461210d57611eef90611ee98b5173ffffffffffffffffffffffffffffffffffffffff1690565b88612bf5565b885173ffffffffffffffffffffffffffffffffffffffff1690519082602083519301915af1611f1c611427565b509451151590565b9081612046575b50611fb4575b505b15611f485750611f43905b611a11565b611db1565b83611f6a611fb1925173ffffffffffffffffffffffffffffffffffffffff1690565b7fd3e223fa000000000000000000000000000000000000000000000000000000005f5260049190915273ffffffffffffffffffffffffffffffffffffffff16602452604490565b5ffd5b5f8091611fd5855173ffffffffffffffffffffffffffffffffffffffff1690565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000006020820190815273ffffffffffffffffffffffffffffffffffffffff90921660248201525f60448201528390612032816064810161036d565b51925af15061203f611427565b505f611f31565b6120c4915060209061206c865173ffffffffffffffffffffffffffffffffffffffff1690565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116602482015292839190829081906044820190565b03915afa9081156107ee575f916120df575b5015155f611f2b565b612100915060203d8111612106575b6120f88183610c26565b810190611bd2565b5f6120d6565b503d6120ee565b6121359061212f8b5173ffffffffffffffffffffffffffffffffffffffff1690565b88612cce565b611eef565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290945090602082602481865afa9182156107ee575f611e2b926040611f24958394849161219c575b509894505093505050611ea9565b6121b4915060203d8111612106576120f88183610c26565b5f61218e565b7f48c12934000000000000000000000000000000000000000000000000000000005f5260045ffd5b506121f3611e2b6040840151151590565b611ea0565b505f9391508392507f8000000000000000000000000000000000000000000000000000000000000000821461225a575b845173ffffffffffffffffffffffffffffffffffffffff16905191602083519301915af1612254611427565b50611f33565b479150612228565b7f4cc29419000000000000000000000000000000000000000000000000000000005f5260045ffd5b6001810361253e575060206122aa91015160208082518301019101611afa565b906122cc60a083015173ffffffffffffffffffffffffffffffffffffffff1690565b91612302611e2b6122fb8573ffffffffffffffffffffffffffffffffffffffff165f52600360205260405f2090565b5460ff1690565b6125165773ffffffffffffffffffffffffffffffffffffffff61232582516118b1565b1680612418575047926040820190815185106123f057848273ffffffffffffffffffffffffffffffffffffffff935182036123cf575b521690813b1561015c575f916123a1916040519586809481937f2da334b50000000000000000000000000000000000000000000000000000000083528b60048401611c2b565b03925af19182156107ee57611f43926123bb575b50611a11565b806107e25f6123c993610c26565b5f6123b5565b606085016123e96123e1848351611be1565b835190611bf4565b905261235b565b7f21f55fa8000000000000000000000000000000000000000000000000000000005f5260045ffd5b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152919390602083602481845afa9283156107ee575f936124f6575b506040850192835181106123f0578261249792828673ffffffffffffffffffffffffffffffffffffffff975182036124dd575b52612bf5565b16803b1561015c576123a15f939184926040519586809481937f2da334b50000000000000000000000000000000000000000000000000000000083528b60048401611c2b565b60608a016124ef6123e1848351611be1565b9052612491565b61250f91935060203d8111612106576120f88183610c26565b915f61245e565b7f40c01d00000000000000000000000000000000000000000000000000000000005f5260045ffd5b6002810361258e575090611f3e61258773ffffffffffffffffffffffffffffffffffffffff8061257e6020611f4397015160208082518301019101611a63565b9491931661279c565b9116612b24565b7fa00a107f000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b60058103612604575090611f3e73ffffffffffffffffffffffffffffffffffffffff6125ff6125f86020611f4396015160208082518301019101611a90565b921661279c565b6129e2565b60048103612648575090611f3e73ffffffffffffffffffffffffffffffffffffffff6126436125f86020611f4396015160208082518301019101611a90565b6128c4565b6003810361258e575090611f3e61268873ffffffffffffffffffffffffffffffffffffffff8061257e6020611f4397015160208082518301019101611a63565b91166127cd565b5050915050565b60ff60045416156126a357565b7f8dfc202b000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f905f5b8151811015612797576126e28183611a22565b515160018114612766575b6001841161273e57600184149081612735575b5061270d576001016126cf565b7fa8245c83000000000000000000000000000000000000000000000000000000005f5260045ffd5b9050155f612700565b7f73bbfa81000000000000000000000000000000000000000000000000000000005f5260045ffd5b927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146117b857600101926126ed565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116600181036127c15750503390565b60020361142457503090565b90919073ffffffffffffffffffffffffffffffffffffffff168061281f575061016b917f80000000000000000000000000000000000000000000000000000000000000008203612da757479150612da7565b7f80000000000000000000000000000000000000000000000000000000000000008214612851575b9161016b92612bf5565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015292909150602083602481855afa80156107ee5761016b935f916128a5575b5091909250612847565b6128be915060203d602011612106576120f88183610c26565b5f61289b565b907f800000000000000000000000000000000000000000000000000000000000000081036129b15750475b806128f8575050565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691823b1561015c576040517fd0e30db00000000000000000000000000000000000000000000000000000000081525f8160048186885af180156107ee5761299d575b503073ffffffffffffffffffffffffffffffffffffffff82160361299457505050565b61016b92612bf5565b806107e25f6129ab93610c26565b5f612971565b478111156128ef575b7f6a12f104000000000000000000000000000000000000000000000000000000005f5260045ffd5b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152909173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690602083602481855afa9283156107ee575f93612b03575b5082106129ba5781612a7057505050565b803b1561015c575f60405180927f2e1a7d4d000000000000000000000000000000000000000000000000000000008252818381612ab588600483019190602083019252565b03925af180156107ee57612aef575b503073ffffffffffffffffffffffffffffffffffffffff831603612ae6575050565b61016b91612da7565b806107e25f612afd93610c26565b5f612ac4565b612b1d91935060203d602011612106576120f88183610c26565b915f612a5f565b90919073ffffffffffffffffffffffffffffffffffffffff1680612b545750479081106129ba5780612ae6575050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290929091602083602481875afa9283156107ee575f93612bd4575b508210612bac578161299457505050565b7f675cae38000000000000000000000000000000000000000000000000000000005f5260045ffd5b612bee91935060203d602011612106576120f88183610c26565b915f612b9b565b9160446020925f9273ffffffffffffffffffffffffffffffffffffffff604051927fa9059cbb000000000000000000000000000000000000000000000000000000008452166004830152602482015282855af19081601f3d1160015f5114161516612cc1575b5015612c6357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152fd5b3b153d171590505f612c5b565b9160446020925f9273ffffffffffffffffffffffffffffffffffffffff604051927f095ea7b3000000000000000000000000000000000000000000000000000000008452166004830152602482015282855af19081601f3d1160015f5114161516612d9a575b5015612d3c57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f415050524f56455f4641494c45440000000000000000000000000000000000006044820152fd5b3b153d171590505f612d34565b5f80809381935af115612db657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152fdfea2646970667358221220240aeb8be63faef01239b68705aa4f2d4ff6810aa02bd85c23c387b8e87a81c064736f6c634300081a0033000000000000000000000000702099e284f23da733c03b461c7571a742782fc2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768
Deployed Bytecode
0x6080604052600436101561001a575b3615610018575f80fd5b005b5f3560e01c806305df27a114610139578063080ca2431461013457806327ad57d51461012f5780633f4ba83a1461012a5780635c975abb146101255780636afdd85014610120578063715018a61461011b57806379ba50971461011657806379e41c7a146101115780637a54d7751461010c5780638158900b146101075780638456cb59146101025780638da5cb5b146100fd578063aaaeaf5e146100f8578063ad5c4648146100f3578063b451794e146100ee578063e30c3978146100e95763f2fde38b0361000e57611127565b6110d6565b61109b565b61102d565b610f70565b610f20565b610e83565b610e43565b610d68565b610cf7565b610a7c565b6109ba565b61094c565b61090c565b610872565b6104de565b610212565b61016d565b73ffffffffffffffffffffffffffffffffffffffff81160361015c57565b5f80fd5b359061016b8261013e565b565b3461015c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5773ffffffffffffffffffffffffffffffffffffffff6004356101bd8161013e565b165f526003602052602060ff60405f2054166040519015158152f35b602435907fffffffff000000000000000000000000000000000000000000000000000000008216820361015c57565b8015150361015c57565b3461015c5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5760043561024d8161013e565b6102556101d9565b9060443561026281610208565b61026a61185d565b73ffffffffffffffffffffffffffffffffffffffff82169283156104b6577fffffffff0000000000000000000000000000000000000000000000000000000081167f23b872dd00000000000000000000000000000000000000000000000000000000811490811561048c575b8115610462575b8115610438575b50610410576103da826103aa7fff1a2ed9c559be7343626a32f36160299954e9f425c6ebe3655d8f27be900f89956040516103998161036d886020830195869092917fffffffff0000000000000000000000000000000000000000000000000000000060209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282610c26565b5190205f52600260205260405f2090565b9060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b604080517fffffffff000000000000000000000000000000000000000000000000000000009290921682529115156020820152a2005b7f8efeb66e000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f2da334b5000000000000000000000000000000000000000000000000000000009150145f6102e4565b7f3950935100000000000000000000000000000000000000000000000000000000811491506102dd565b7f095ea7b300000000000000000000000000000000000000000000000000000000811491506102d6565b7f9fabe1c1000000000000000000000000000000000000000000000000000000005f5260045ffd5b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5760043567ffffffffffffffff811161015c578060040160807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc833603011261015c57688000000000ab143c065c61085b5730688000000000ab143c065d61056d61187d565b803573ffffffffffffffffffffffffffffffffffffffff61058d826118b1565b166106595750602482013534036106315761060d61036d6106017fafbe1df72b07bfe5bfeaf8d0502bbeb554fd24f80e2f6dfaef57f9c81ca4a271935b6105f26105ec6105e560446105dd61182f565b990184611461565b36916114b5565b87611da4565b604051928391602083016116aa565b6040519182918261176c565b0390a261062361061e6005546117aa565b600555565b5f688000000000ab143c065d005b7f1b34520b000000000000000000000000000000000000000000000000000000005f5260045ffd5b906064830161066881836111e8565b1590506107f35761069961069173ffffffffffffffffffffffffffffffffffffffff92846111e8565b81019061124c565b5f807f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c7689261036d6107026020835193015160405192839160208301957f2b67b5700000000000000000000000000000000000000000000000000000000087523360248501611374565b519082855af150610711611427565b50169161072a61072460248601356119db565b916118b1565b833b1561015c576040517f36c7851600000000000000000000000000000000000000000000000000000000815233600482015230602482015273ffffffffffffffffffffffffffffffffffffffff928316604482015291166064820152915f908390608490829084905af19182156107ee5761060161060d9261036d927fafbe1df72b07bfe5bfeaf8d0502bbeb554fd24f80e2f6dfaef57f9c81ca4a271956107d4575b506105ca565b806107e25f6107e893610c26565b80610868565b5f6107ce565b611456565b5061036d61060161060d9261085661084761082e7fafbe1df72b07bfe5bfeaf8d0502bbeb554fd24f80e2f6dfaef57f9c81ca4a271976118b1565b73ffffffffffffffffffffffffffffffffffffffff1690565b602488013590309033906118fa565b6105ca565b63ab143c065f526004601cfd5b5f91031261015c57565b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576108a861185d565b6108b0612696565b6108b8612696565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00600454166004557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602060ff600454166040519015158152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602060405173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768168152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576109f061185d565b7fffffffffffffffffffffffff0000000000000000000000000000000000000000600154166001555f73ffffffffffffffffffffffffffffffffffffffff81547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c573373ffffffffffffffffffffffffffffffffffffffff6001541603610b58577fffffffffffffffffffffffff0000000000000000000000000000000000000000600154166001555f54337fffffffffffffffffffffffff00000000000000000000000000000000000000008216175f5573ffffffffffffffffffffffffffffffffffffffff3391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3005b7f118cdaa7000000000000000000000000000000000000000000000000000000005f523360045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040810190811067ffffffffffffffff821117610bcd57604052565b610b84565b6060810190811067ffffffffffffffff821117610bcd57604052565b6080810190811067ffffffffffffffff821117610bcd57604052565b60a0810190811067ffffffffffffffff821117610bcd57604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff821117610bcd57604052565b6040519061016b61014083610c26565b67ffffffffffffffff8111610bcd57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b81601f8201121561015c57803590610cc882610c77565b92610cd66040519485610c26565b8284526020838301011161015c57815f926020809301838601378301015290565b3461015c5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57600435610d328161013e565b60243567ffffffffffffffff811161015c57602091610d58610d5e923690600401610cb1565b906117bd565b6040519015158152f35b3461015c5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57600435610da38161013e565b73ffffffffffffffffffffffffffffffffffffffff60243591610dc583610208565b610dcd61185d565b169081156104b65760207faa1e61e4b2bdff2663672064c648aa1fd5e95092f24b94e83c374a3a47e6ffae91835f5260038252610e388160405f209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6040519015158152a2005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576020610e7b61182f565b604051908152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57610eb961185d565b610ec161187d565b610ec961187d565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060045416176004557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602073ffffffffffffffffffffffffffffffffffffffff5f5416604051908152f35b3461015c5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57600435610fab8161013e565b61036d61100f610fb96101d9565b6040519283916020830195869092917fffffffff0000000000000000000000000000000000000000000000000000000060209173ffffffffffffffffffffffffffffffffffffffff604085019616845216910152565b5190205f526002602052602060ff60405f2054166040519015158152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2168152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c576020600554604051908152f35b3461015c575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b3461015c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015c5773ffffffffffffffffffffffffffffffffffffffff6004356111778161013e565b61117f61185d565b16807fffffffffffffffffffffffff0000000000000000000000000000000000000000600154161760015573ffffffffffffffffffffffffffffffffffffffff5f54167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227005f80a3005b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561015c570180359067ffffffffffffffff821161015c5760200191813603831361015c57565b359065ffffffffffff8216820361015c57565b60208183031261015c5780359067ffffffffffffffff821161015c57018082039160e0831261015c576040519261128284610bb1565b60c0811261015c5760806040519161129983610bd2565b1261015c576040516112aa81610bee565b83356112b58161013e565b815260208401356112c58161013e565b60208201526112d660408501611239565b60408201526112e760608501611239565b606082015281526112fa60808401610160565b602082015260a08301356040820152835260c082013567ffffffffffffffff811161015c576113299201610cb1565b602082015290565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b6040611424949373ffffffffffffffffffffffffffffffffffffffff6101009416835265ffffffffffff6060825173ffffffffffffffffffffffffffffffffffffffff815116602087015273ffffffffffffffffffffffffffffffffffffffff6020820151168587015282858201511682870152015116608084015273ffffffffffffffffffffffffffffffffffffffff60208201511660a0840152015160c08201528160e08201520190611331565b90565b3d15611451573d9061143882610c77565b916114466040519384610c26565b82523d5f602084013e565b606090565b6040513d5f823e3d90fd5b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18136030182121561015c570180359067ffffffffffffffff821161015c57602001918160051b3603831361015c57565b9291909267ffffffffffffffff8411610bcd578360051b60206040516114dd82840182610c26565b80968152019082019183831161015c5780915b8383106114fe575050505050565b823567ffffffffffffffff811161015c57820160408187031261015c576040519161152883610bb1565b8135835260208201359267ffffffffffffffff841161015c5761155088602095869501610cb1565b838201528152019201916114f0565b90357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561015c57016020813591019167ffffffffffffffff821161015c57813603831361015c57565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093818652868601375f8582860101520116010190565b90602083828152019060208160051b85010193835f915b8383106116145750505050505090565b9091929394957fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820301865286357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18436030181121561015c57602061169c600193604061168d88859601803584528581019061155f565b919092818682015201916115af565b980196019493019190611604565b9060208252803560208301526020810135604083015260408101357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18236030181121561015c5781019160208335930167ffffffffffffffff841161015c578360051b3603811361015c5761173161173c91611424956080606086015260a08501916115ed565b92606081019061155f565b9160807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828603019101526115af565b906020611424928181520190611331565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90600182018092116117b857565b61177d565b6020918201516040805173ffffffffffffffffffffffffffffffffffffffff9093169383019384527fffffffff000000000000000000000000000000000000000000000000000000009091169082015261181a816060810161036d565b5190205f52600260205260ff60405f20541690565b6005546040516020810191308352604082015246606082015260608152611857608082610c26565b51902090565b73ffffffffffffffffffffffffffffffffffffffff5f54163303610b5857565b60ff6004541661188957565b7fd93c0665000000000000000000000000000000000000000000000000000000005f5260045ffd5b8060a01c6118d25773ffffffffffffffffffffffffffffffffffffffff1690565b7ff7d2b34a000000000000000000000000000000000000000000000000000000005f5260045ffd5b925f9160649173ffffffffffffffffffffffffffffffffffffffff60209581604051947f23b872dd000000000000000000000000000000000000000000000000000000008652166004850152166024830152604482015282855af19081601f3d1160015f51141615166119ce575b501561197057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152fd5b3b153d171590505f611968565b7401000000000000000000000000000000000000000081101561015c5773ffffffffffffffffffffffffffffffffffffffff1690565b60ff1660ff81146117b85760010190565b8051821015611a365760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9081606091031261015c578051611a798161013e565b9160406020830151611a8a8161013e565b92015190565b919082604091031261015c5760208251611a8a8161013e565b519061016b8261013e565b81601f8201121561015c57805190611acb82610c77565b92611ad96040519485610c26565b8284526020838301011161015c57815f9260208093018386015e8301015290565b60208183031261015c5780519067ffffffffffffffff821161015c57016101408183031261015c57611b2a610c67565b9181518352602082015160208401526040820151604084015260608201516060840152611b5960808301611aa9565b6080840152611b6a60a08301611aa9565b60a084015260c082015167ffffffffffffffff811161015c5781611b8f918401611ab4565b60c084015260e082015160e084015261010082015161010084015261012082015167ffffffffffffffff811161015c57611bc99201611ab4565b61012082015290565b9081602091031261015c575190565b818102929181159184041417156117b857565b8115611bfe570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b6114249291815260406020820152815160408201526020820151606082015260408201516080820152606082015160a0820152611c85608083015160c083019073ffffffffffffffffffffffffffffffffffffffff169052565b60a082015173ffffffffffffffffffffffffffffffffffffffff1660e0820152610120611cc460c0840151610140610100850152610180840190611331565b9260e0810151828401526101008101516101408401520151906101607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc082850301910152611331565b60208183031261015c5780519067ffffffffffffffff821161015c570160a08183031261015c5760405191611d4183610c0a565b8151611d4c8161013e565b8352602082015160208401526040820151611d6681610208565b60408401526060820151611d798161013e565b6060840152608082015167ffffffffffffffff811161015c57611d9c9201611ab4565b608082015290565b9091611daf836126cb565b5f5b835160ff82169081101561268f57611dc99085611a22565b51805160038110156125b9575080518061228a57506020611df591015160208082518301019101611d0d565b6060810190611e18825173ffffffffffffffffffffffffffffffffffffffff1690565b611e2f611e2b60808401928351906117bd565b1590565b61226257602082015191611e57815173ffffffffffffffffffffffffffffffffffffffff1690565b9173ffffffffffffffffffffffffffffffffffffffff83169182156121f8577f8000000000000000000000000000000000000000000000000000000000000000851480806121e2575b6121ba5761213a575b5f80611f24936040611e2b940197611ec18951151590565b831461210d57611eef90611ee98b5173ffffffffffffffffffffffffffffffffffffffff1690565b88612bf5565b885173ffffffffffffffffffffffffffffffffffffffff1690519082602083519301915af1611f1c611427565b509451151590565b9081612046575b50611fb4575b505b15611f485750611f43905b611a11565b611db1565b83611f6a611fb1925173ffffffffffffffffffffffffffffffffffffffff1690565b7fd3e223fa000000000000000000000000000000000000000000000000000000005f5260049190915273ffffffffffffffffffffffffffffffffffffffff16602452604490565b5ffd5b5f8091611fd5855173ffffffffffffffffffffffffffffffffffffffff1690565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000006020820190815273ffffffffffffffffffffffffffffffffffffffff90921660248201525f60448201528390612032816064810161036d565b51925af15061203f611427565b505f611f31565b6120c4915060209061206c865173ffffffffffffffffffffffffffffffffffffffff1690565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116602482015292839190829081906044820190565b03915afa9081156107ee575f916120df575b5015155f611f2b565b612100915060203d8111612106575b6120f88183610c26565b810190611bd2565b5f6120d6565b503d6120ee565b6121359061212f8b5173ffffffffffffffffffffffffffffffffffffffff1690565b88612cce565b611eef565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290945090602082602481865afa9182156107ee575f611e2b926040611f24958394849161219c575b509894505093505050611ea9565b6121b4915060203d8111612106576120f88183610c26565b5f61218e565b7f48c12934000000000000000000000000000000000000000000000000000000005f5260045ffd5b506121f3611e2b6040840151151590565b611ea0565b505f9391508392507f8000000000000000000000000000000000000000000000000000000000000000821461225a575b845173ffffffffffffffffffffffffffffffffffffffff16905191602083519301915af1612254611427565b50611f33565b479150612228565b7f4cc29419000000000000000000000000000000000000000000000000000000005f5260045ffd5b6001810361253e575060206122aa91015160208082518301019101611afa565b906122cc60a083015173ffffffffffffffffffffffffffffffffffffffff1690565b91612302611e2b6122fb8573ffffffffffffffffffffffffffffffffffffffff165f52600360205260405f2090565b5460ff1690565b6125165773ffffffffffffffffffffffffffffffffffffffff61232582516118b1565b1680612418575047926040820190815185106123f057848273ffffffffffffffffffffffffffffffffffffffff935182036123cf575b521690813b1561015c575f916123a1916040519586809481937f2da334b50000000000000000000000000000000000000000000000000000000083528b60048401611c2b565b03925af19182156107ee57611f43926123bb575b50611a11565b806107e25f6123c993610c26565b5f6123b5565b606085016123e96123e1848351611be1565b835190611bf4565b905261235b565b7f21f55fa8000000000000000000000000000000000000000000000000000000005f5260045ffd5b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152919390602083602481845afa9283156107ee575f936124f6575b506040850192835181106123f0578261249792828673ffffffffffffffffffffffffffffffffffffffff975182036124dd575b52612bf5565b16803b1561015c576123a15f939184926040519586809481937f2da334b50000000000000000000000000000000000000000000000000000000083528b60048401611c2b565b60608a016124ef6123e1848351611be1565b9052612491565b61250f91935060203d8111612106576120f88183610c26565b915f61245e565b7f40c01d00000000000000000000000000000000000000000000000000000000005f5260045ffd5b6002810361258e575090611f3e61258773ffffffffffffffffffffffffffffffffffffffff8061257e6020611f4397015160208082518301019101611a63565b9491931661279c565b9116612b24565b7fa00a107f000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b60058103612604575090611f3e73ffffffffffffffffffffffffffffffffffffffff6125ff6125f86020611f4396015160208082518301019101611a90565b921661279c565b6129e2565b60048103612648575090611f3e73ffffffffffffffffffffffffffffffffffffffff6126436125f86020611f4396015160208082518301019101611a90565b6128c4565b6003810361258e575090611f3e61268873ffffffffffffffffffffffffffffffffffffffff8061257e6020611f4397015160208082518301019101611a63565b91166127cd565b5050915050565b60ff60045416156126a357565b7f8dfc202b000000000000000000000000000000000000000000000000000000005f5260045ffd5b5f905f5b8151811015612797576126e28183611a22565b515160018114612766575b6001841161273e57600184149081612735575b5061270d576001016126cf565b7fa8245c83000000000000000000000000000000000000000000000000000000005f5260045ffd5b9050155f612700565b7f73bbfa81000000000000000000000000000000000000000000000000000000005f5260045ffd5b927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146117b857600101926126ed565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116600181036127c15750503390565b60020361142457503090565b90919073ffffffffffffffffffffffffffffffffffffffff168061281f575061016b917f80000000000000000000000000000000000000000000000000000000000000008203612da757479150612da7565b7f80000000000000000000000000000000000000000000000000000000000000008214612851575b9161016b92612bf5565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015292909150602083602481855afa80156107ee5761016b935f916128a5575b5091909250612847565b6128be915060203d602011612106576120f88183610c26565b5f61289b565b907f800000000000000000000000000000000000000000000000000000000000000081036129b15750475b806128f8575050565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21691823b1561015c576040517fd0e30db00000000000000000000000000000000000000000000000000000000081525f8160048186885af180156107ee5761299d575b503073ffffffffffffffffffffffffffffffffffffffff82160361299457505050565b61016b92612bf5565b806107e25f6129ab93610c26565b5f612971565b478111156128ef575b7f6a12f104000000000000000000000000000000000000000000000000000000005f5260045ffd5b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152909173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21690602083602481855afa9283156107ee575f93612b03575b5082106129ba5781612a7057505050565b803b1561015c575f60405180927f2e1a7d4d000000000000000000000000000000000000000000000000000000008252818381612ab588600483019190602083019252565b03925af180156107ee57612aef575b503073ffffffffffffffffffffffffffffffffffffffff831603612ae6575050565b61016b91612da7565b806107e25f612afd93610c26565b5f612ac4565b612b1d91935060203d602011612106576120f88183610c26565b915f612a5f565b90919073ffffffffffffffffffffffffffffffffffffffff1680612b545750479081106129ba5780612ae6575050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290929091602083602481875afa9283156107ee575f93612bd4575b508210612bac578161299457505050565b7f675cae38000000000000000000000000000000000000000000000000000000005f5260045ffd5b612bee91935060203d602011612106576120f88183610c26565b915f612b9b565b9160446020925f9273ffffffffffffffffffffffffffffffffffffffff604051927fa9059cbb000000000000000000000000000000000000000000000000000000008452166004830152602482015282855af19081601f3d1160015f5114161516612cc1575b5015612c6357565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152fd5b3b153d171590505f612c5b565b9160446020925f9273ffffffffffffffffffffffffffffffffffffffff604051927f095ea7b3000000000000000000000000000000000000000000000000000000008452166004830152602482015282855af19081601f3d1160015f5114161516612d9a575b5015612d3c57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f415050524f56455f4641494c45440000000000000000000000000000000000006044820152fd5b3b153d171590505f612d34565b5f80809381935af115612db657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c4544000000000000000000000000006044820152fdfea2646970667358221220240aeb8be63faef01239b68705aa4f2d4ff6810aa02bd85c23c387b8e87a81c064736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000702099e284f23da733c03b461c7571a742782fc2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768
-----Decoded View---------------
Arg [0] : owner (address): 0x702099e284f23Da733C03B461C7571a742782FC2
Arg [1] : weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : permit2 (address): 0x31c2F6fcFf4F8759b3Bd5Bf0e1084A055615c768
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000702099e284f23da733c03b461c7571a742782fc2
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768
Loading...
Loading
Loading...
Loading

Loading...
Loading
[ Download: CSV Export ]
[ 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.