ETH Price: $3,105.00 (+1.18%)
Gas: 6 Gwei

Contract

0xeaD3dd83Ed1e107e02E1d0A307D4f1Ba8a2af12d
 

Overview

ETH Balance

0.001629337899543385 ETH

Eth Value

$5.06 (@ $3,105.00/ETH)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Execute Option186914662023-12-01 12:08:47222 days ago1701432527IN
0xeaD3dd83...a8a2af12d
0.34 ETH0.0112368633.1952658
Execute Option186831982023-11-30 8:21:23223 days ago1701332483IN
0xeaD3dd83...a8a2af12d
2.98108692 ETH0.0345573330.73016712
Execute Option186465672023-11-25 5:16:35228 days ago1700889395IN
0xeaD3dd83...a8a2af12d
0.34 ETH0.0058846117.99202585
Execute Option W...186465292023-11-25 5:08:59228 days ago1700888939IN
0xeaD3dd83...a8a2af12d
0 ETH0.0113502717.84295308
Execute Option186008212023-11-18 19:32:47235 days ago1700335967IN
0xeaD3dd83...a8a2af12d
0.34 ETH0.0062014518.49506975
Execute Option185972912023-11-18 7:37:11235 days ago1700293031IN
0xeaD3dd83...a8a2af12d
0.34 ETH0.0061864618.45037783
Execute Option185972802023-11-18 7:34:59235 days ago1700292899IN
0xeaD3dd83...a8a2af12d
0.34 ETH0.006349618.93692409
Execute Option185961702023-11-18 3:49:47235 days ago1700279387IN
0xeaD3dd83...a8a2af12d
0.35575342 ETH0.0077718621.40909554
Execute Option185895992023-11-17 5:44:11236 days ago1700199851IN
0xeaD3dd83...a8a2af12d
0.2959589 ETH0.0057424617.12618878
Execute Option185888242023-11-17 3:09:11236 days ago1700190551IN
0xeaD3dd83...a8a2af12d
0.34 ETH0.00792322.70311962
Execute Option185806002023-11-15 23:34:47237 days ago1700091287IN
0xeaD3dd83...a8a2af12d
0.32 ETH0.0130228537.31659334
Execute Option185649082023-11-13 18:56:47240 days ago1699901807IN
0xeaD3dd83...a8a2af12d
0.2095178 ETH0.0132529841.73341425
Execute Option185241912023-11-08 2:14:23245 days ago1699409663IN
0xeaD3dd83...a8a2af12d
0.30986301 ETH0.0060198517.95346434
Execute Option185241852023-11-08 2:13:11245 days ago1699409591IN
0xeaD3dd83...a8a2af12d
0.313315 ETH0.0054327117.87766294
Execute Option184927562023-11-03 16:33:59250 days ago1699029239IN
0xeaD3dd83...a8a2af12d
0.30986301 ETH0.007609722.69502106
Execute Option184908162023-11-03 10:04:11250 days ago1699005851IN
0xeaD3dd83...a8a2af12d
0.30986301 ETH0.0074487421.34415377
Execute Option184882862023-11-03 1:33:23250 days ago1698975203IN
0xeaD3dd83...a8a2af12d
0.32 ETH0.0006308718.56610253
Execute Option184882862023-11-03 1:33:23250 days ago1698975203IN
0xeaD3dd83...a8a2af12d
0.32 ETH0.0006308718.56610253
Execute Option184882862023-11-03 1:33:23250 days ago1698975203IN
0xeaD3dd83...a8a2af12d
0.32 ETH0.006208518.51610253
Execute Option184881872023-11-03 1:13:23250 days ago1698974003IN
0xeaD3dd83...a8a2af12d
0.32 ETH0.0062212518.55414334
Execute Option184881622023-11-03 1:08:23250 days ago1698973703IN
0xeaD3dd83...a8a2af12d
0.30986301 ETH0.0068017220.42174312
Execute Option184881402023-11-03 1:03:59250 days ago1698973439IN
0xeaD3dd83...a8a2af12d
0.258014 ETH0.0059389119.54342659
Execute Option184880612023-11-03 0:48:11250 days ago1698972491IN
0xeaD3dd83...a8a2af12d
0.2189461 ETH0.0061264120.16042517
Execute Option184880042023-11-03 0:36:23250 days ago1698971783IN
0xeaD3dd83...a8a2af12d
0.258014 ETH0.006072319.98238985
Execute Option184879722023-11-03 0:29:59250 days ago1698971399IN
0xeaD3dd83...a8a2af12d
0.258014 ETH0.0066520321.89011327
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
186914662023-12-01 12:08:47222 days ago1701432527
0xeaD3dd83...a8a2af12d
0.34 ETH
186831982023-11-30 8:21:23223 days ago1701332483
0xeaD3dd83...a8a2af12d
2.98108692 ETH
186465672023-11-25 5:16:35228 days ago1700889395
0xeaD3dd83...a8a2af12d
0.34 ETH
186465292023-11-25 5:08:59228 days ago1700888939
0xeaD3dd83...a8a2af12d
1.43254382 ETH
186465292023-11-25 5:08:59228 days ago1700888939
0xeaD3dd83...a8a2af12d
4.47225 ETH
186465292023-11-25 5:08:59228 days ago1700888939
0xeaD3dd83...a8a2af12d
5.90479382 ETH
186465292023-11-25 5:08:59228 days ago1700888939
0xeaD3dd83...a8a2af12d
4.45 ETH
186465292023-11-25 5:08:59228 days ago1700888939
0xeaD3dd83...a8a2af12d
4.45 ETH
186420192023-11-24 13:59:59229 days ago1700834399
0xeaD3dd83...a8a2af12d
0.34 ETH
186420192023-11-24 13:59:59229 days ago1700834399
0xeaD3dd83...a8a2af12d
0.34 ETH
186008212023-11-18 19:32:47235 days ago1700335967
0xeaD3dd83...a8a2af12d
0.34 ETH
185972912023-11-18 7:37:11235 days ago1700293031
0xeaD3dd83...a8a2af12d
0.34 ETH
185972802023-11-18 7:34:59235 days ago1700292899
0xeaD3dd83...a8a2af12d
0.34 ETH
185961702023-11-18 3:49:47235 days ago1700279387
0xeaD3dd83...a8a2af12d
0.35412408 ETH
185895992023-11-17 5:44:11236 days ago1700199851
0xeaD3dd83...a8a2af12d
0.2959589 ETH
185888242023-11-17 3:09:11236 days ago1700190551
0xeaD3dd83...a8a2af12d
0.34 ETH
185806002023-11-15 23:34:47237 days ago1700091287
0xeaD3dd83...a8a2af12d
0.32 ETH
185649082023-11-13 18:56:47240 days ago1699901807
0xeaD3dd83...a8a2af12d
0.2095178 ETH
185391062023-11-10 4:17:59243 days ago1699589879
0xeaD3dd83...a8a2af12d
0.2869041 ETH
185391062023-11-10 4:17:59243 days ago1699589879
0xeaD3dd83...a8a2af12d
0.2869041 ETH
185323352023-11-09 5:34:23244 days ago1699508063
0xeaD3dd83...a8a2af12d
0.2869041 ETH
185323352023-11-09 5:34:23244 days ago1699508063
0xeaD3dd83...a8a2af12d
0.2869041 ETH
185323282023-11-09 5:32:59244 days ago1699507979
0xeaD3dd83...a8a2af12d
0.28517808 ETH
185323282023-11-09 5:32:59244 days ago1699507979
0xeaD3dd83...a8a2af12d
0.28517808 ETH
185317862023-11-09 3:43:47244 days ago1699501427
0xeaD3dd83...a8a2af12d
0.28517808 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WasabiBNPL

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1500 runs

Other Settings:
default evmVersion
File 1 of 19 : WasabiBNPL.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";

import "../lib/Signing.sol";
import {IWETH} from "../IWETH.sol";
import "./interfaces/IWasabiBNPL.sol";
import "./interfaces/IWasabiOption.sol";
import "./interfaces/IFlashloan.sol";
import "./interfaces/ILendingAddressProvider.sol";
import "./interfaces/INFTLending.sol";

contract WasabiBNPL is IWasabiBNPL, Ownable, IERC721Receiver, ReentrancyGuard {
    using SafeERC20 for IERC20;
    using Address for address;

    /// @notice Wasabi Option
    IWasabiOption public wasabiOption;

    /// @notice Wasabi Flashloan
    IFlashloan public flashloan;

    /// @notice Wasabi Address Provider
    ILendingAddressProvider public addressProvider;

    /// @notice Wasabi Pool Factory
    address public factory;

    /// @notice Option ID to LoanInfo mapping
    mapping(uint256 => LoanInfo) public optionToLoan;

    /// @notice
    address public wethAddress;

    /// @notice WasabiBNPL Constructor
    /// @param _wasabiOption Wasabi Option address
    /// @param _flashloan Wasabi Flashloan address
    /// @param _addressProvider Wasabi Address Provider address
    /// @param _wethAddress Wrapped ETH address
    /// @param _factory Wasabi Pool Factory address
    constructor(
        IWasabiOption _wasabiOption,
        IFlashloan _flashloan,
        ILendingAddressProvider _addressProvider,
        address _wethAddress,
        address _factory
    ) {
        wasabiOption = _wasabiOption;
        flashloan = _flashloan;
        addressProvider = _addressProvider;
        wethAddress = _wethAddress;
        factory = _factory;
    }

    /// @dev Returns the option data for the given option id
    function getOptionData(
        uint256 _optionId
    ) external view returns (WasabiStructs.OptionData memory optionData) {
        LoanInfo memory loanInfo = optionToLoan[_optionId];
        INFTLending.LoanDetails memory loanDetails = INFTLending(
            loanInfo.nftLending
        ).getLoanDetails(loanInfo.loanId);
        bool active = wasabiOption.ownerOf(_optionId) != address(0) &&
            loanDetails.loanExpiration > block.timestamp;

        optionData = WasabiStructs.OptionData(
            active,
            WasabiStructs.OptionType.CALL,
            loanDetails.repayAmount,
            loanDetails.loanExpiration,
            loanDetails.tokenId
        );
    }

    /// @notice Executes BNPL flow
    /// @dev BNLP flow
    ///      1. take flashloan
    ///      2. buy nft from marketplace
    ///      3. get loan from nft lending protocol
    /// @param _nftLending NFTLending contract address
    /// @param _borrowData Borrow data
    /// @param _flashLoanAmount Call value
    /// @param _marketplaceCallData List of marketplace calldata
    /// @param _signatures Signatures
    function bnpl(
        address _nftLending,
        bytes calldata _borrowData,
        uint256 _flashLoanAmount,
        FunctionCallData[] calldata _marketplaceCallData,
        bytes[] calldata _signatures
    ) external payable nonReentrant returns (uint256) {
        validate(_marketplaceCallData, _signatures);

        if (!addressProvider.isLending(_nftLending)) {
            revert InvalidParam();
        }

        // 1. Get flash loan
        uint256 flashLoanRepayAmount = flashloan.borrow(_flashLoanAmount);

        // 2. Buy NFT
        bool marketSuccess = executeFunctions(_marketplaceCallData);
        if (!marketSuccess) {
            revert FunctionCallFailed();
        }

        // 3. Get loan
        bytes memory result = _nftLending.functionDelegateCall(
            abi.encodeWithSelector(INFTLending.borrow.selector, _borrowData)
        );
        uint256 loanId = abi.decode(result, (uint256));

        uint256 optionId = wasabiOption.mint(_msgSender(), factory);
        optionToLoan[optionId] = LoanInfo({
            nftLending: _nftLending,
            loanId: loanId
        });

        // 4. Repay flashloan
        if (address(this).balance < flashLoanRepayAmount) {
            revert LoanNotPaid();
        }
        uint256 payout = address(this).balance - flashLoanRepayAmount;

        (bool sent, ) = payable(address(flashloan)).call{
            value: flashLoanRepayAmount
        }("");
        if (!sent) {
            revert EthTransferFailed();
        }
        if (payout > 0) {
            (sent, ) = payable(_msgSender()).call{value: payout}("");
            if (!sent) {
                revert EthTransferFailed();
            }
        }

        return optionId;
    }

    /// @notice Executes a given list of functions
    /// @param _marketplaceCallData List of marketplace calldata
    function executeFunctions(
        FunctionCallData[] memory _marketplaceCallData
    ) internal returns (bool) {
        uint256 length = _marketplaceCallData.length;
        for (uint256 i; i != length; ++i) {
            FunctionCallData memory functionCallData = _marketplaceCallData[i];
            (bool success, ) = functionCallData.to.call{
                value: functionCallData.value
            }(functionCallData.data);
            if (success == false) {
                return false;
            }
        }
        return true;
    }

    /// @notice Validates if the FunctionCallData list has been approved
    /// @param _marketplaceCallData List of marketplace calldata
    /// @param _signatures Signatures
    function validate(
        FunctionCallData[] calldata _marketplaceCallData,
        bytes[] calldata _signatures
    ) internal view {
        uint256 calldataLength = _marketplaceCallData.length;
        require(calldataLength > 0, "Need marketplace calls");
        require(calldataLength == _signatures.length, "Length is invalid");
        for (uint256 i; i != calldataLength; ++i) {
            bytes32 ethSignedMessageHash = Signing.getEthSignedMessageHash(
                getMessageHash(_marketplaceCallData[i])
            );
            require(
                Signing.recoverSigner(ethSignedMessageHash, _signatures[i]) ==
                    owner(),
                "Owner is not signer"
            );
        }
    }

    /// @notice Returns the message hash for the given _data
    function getMessageHash(
        FunctionCallData calldata _data
    ) public pure returns (bytes32) {
        return keccak256(abi.encode(_data.to, _data.value, _data.data));
    }

    /// @dev Withdraws any stuck ETH in this contract
    function withdrawETH(uint256 _amount) external payable onlyOwner {
        if (_amount > address(this).balance) {
            _amount = address(this).balance;
        }
        (bool sent, ) = payable(owner()).call{value: _amount}("");
        if (!sent) {
            revert EthTransferFailed();
        }
    }

    /// @dev Withdraws any stuck ERC20 in this contract
    function withdrawERC20(IERC20 _token, uint256 _amount) external onlyOwner {
        _token.safeTransfer(_msgSender(), _amount);
    }

    /// @dev Withdraws any stuck ERC721 in this contract
    function withdrawERC721(
        IERC721 _token,
        uint256 _tokenId
    ) external onlyOwner {
        _token.safeTransferFrom(address(this), owner(), _tokenId);
    }

    function onERC721Received(
        address /* operator */,
        address /* from */,
        uint256 /* tokenId */,
        bytes memory /* data */
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    receive() external payable {}

    /**
     * @dev Executes the given option id
     * @param _optionId The option id
     */
    function executeOption(uint256 _optionId) external payable nonReentrant {
        require(
            wasabiOption.ownerOf(_optionId) == _msgSender(),
            "Only owner can exercise option"
        );

        LoanInfo storage loanInfo = optionToLoan[_optionId];
        require(loanInfo.nftLending != address(0), "Invalid Option");

        INFTLending.LoanDetails memory loanDetails = INFTLending(
            loanInfo.nftLending
        ).getLoanDetails(loanInfo.loanId);
        require(
            loanDetails.loanExpiration > block.timestamp,
            "Loan has expired"
        );
        require(
            msg.value >= loanDetails.repayAmount,
            "Insufficient repay amount supplied"
        );

        loanInfo.nftLending.functionDelegateCall(
            abi.encodeWithSelector(
                INFTLending.repay.selector,
                loanInfo.loanId,
                _msgSender()
            )
        );

        wasabiOption.burn(_optionId);
        emit OptionExecuted(_optionId);
    }

    /**
     * @dev Executes the given option id and sells the NFT to the market
     * @param _optionId The option id
     * @param _marketplaceCallData List of marketplace calldata
     * @param _signatures List of signatures of the marketplace call data
     */
    function executeOptionWithArbitrage(
        uint256 _optionId,
        FunctionCallData[] calldata _marketplaceCallData,
        bytes[] calldata _signatures
    ) external payable nonReentrant {
        validate(_marketplaceCallData, _signatures);
        require(
            wasabiOption.ownerOf(_optionId) == _msgSender(),
            "Only owner can exercise option"
        );

        LoanInfo storage loanInfo = optionToLoan[_optionId];
        require(loanInfo.nftLending != address(0), "Invalid Option");

        INFTLending.LoanDetails memory loanDetails = INFTLending(
            loanInfo.nftLending
        ).getLoanDetails(loanInfo.loanId);
        require(
            loanDetails.loanExpiration > block.timestamp,
            "Loan has expired"
        );

        uint256 initialBalance = address(this).balance;

        // 1. Get flash loan
        uint256 flashLoanRepayAmount = flashloan.borrow(
            loanDetails.repayAmount
        );

        // 2. Repay loan
        loanInfo.nftLending.functionDelegateCall(
            abi.encodeWithSelector(
                INFTLending.repay.selector,
                loanInfo.loanId,
                address(this)
            )
        );
        wasabiOption.burn(_optionId);

        // 3. Sell NFT
        bool marketSuccess = executeFunctions(_marketplaceCallData);
        if (!marketSuccess) {
            revert FunctionCallFailed();
        }

        // Withdraw any WETH received
        IWETH weth = IWETH(wethAddress);
        uint256 wethBalance = weth.balanceOf(address(this));
        if (wethBalance > 0) {
            weth.withdraw(wethBalance);
        }

        uint256 balanceChange = address(this).balance - initialBalance;

        // 4. Repay flashloan
        if (balanceChange < flashLoanRepayAmount) {
            revert LoanNotPaid();
        }
        (bool sent, ) = payable(address(flashloan)).call{
            value: flashLoanRepayAmount
        }("");
        if (!sent) {
            revert EthTransferFailed();
        }

        // 5. Give payout
        uint256 payout = balanceChange - flashLoanRepayAmount;
        if (payout > 0) {
            (sent, ) = payable(_msgSender()).call{value: payout}("");
            if (!sent) {
                revert EthTransferFailed();
            }
        }

        emit OptionExecutedWithArbitrage(_optionId, payout);
    }
}

File 2 of 19 : WasabiStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

library WasabiStructs {
    enum OptionType {
        CALL,
        PUT
    }

    struct OptionData {
        bool active;
        OptionType optionType;
        uint256 strikePrice;
        uint256 expiry;
        uint256 tokenId; // Locked token for CALL options
    }

    struct PoolAsk {
        uint256 id;
        address poolAddress;
        OptionType optionType;
        uint256 strikePrice;
        uint256 premium;
        uint256 expiry;
        uint256 tokenId; // Token to lock for CALL options
        uint256 orderExpiry;
    }

    struct PoolBid {
        uint256 id;
        uint256 price;
        address tokenAddress;
        uint256 orderExpiry;
        uint256 optionId;
    }

    struct Bid {
        uint256 id;
        uint256 price;
        address tokenAddress;
        address collection;
        uint256 orderExpiry;
        address buyer;
        OptionType optionType;
        uint256 strikePrice;
        uint256 expiry;
        uint256 expiryAllowance;
        address optionTokenAddress;
    }

    struct Ask {
        uint256 id;
        uint256 price;
        address tokenAddress;
        uint256 orderExpiry;
        address seller;
        uint256 optionId;
    }

    struct EIP712Domain {
        string name;
        string version;
        uint256 chainId;
        address verifyingContract;
    }
}

File 3 of 19 : Signing.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {WasabiStructs} from "./WasabiStructs.sol";

/**
 * @dev Signature Verification
 */
library Signing {

    /**
     * @dev Returns the message hash for the given request
     */
    function getMessageHash(WasabiStructs.PoolAsk calldata _request) internal pure returns (bytes32) {
        return keccak256(
            abi.encode(
                _request.id,
                _request.poolAddress,
                _request.optionType,
                _request.strikePrice,
                _request.premium,
                _request.expiry,
                _request.tokenId,
                _request.orderExpiry));
    }

    /**
     * @dev Returns the message hash for the given request
     */
    function getAskHash(WasabiStructs.Ask calldata _ask) internal pure returns (bytes32) {
        return keccak256(
            abi.encode(
                _ask.id,
                _ask.price,
                _ask.tokenAddress,
                _ask.orderExpiry,
                _ask.seller,
                _ask.optionId));
    }

    function getBidHash(WasabiStructs.Bid calldata _bid) internal pure returns (bytes32) {
        return keccak256(
            abi.encode(
                _bid.id,
                _bid.price,
                _bid.tokenAddress,
                _bid.collection,
                _bid.orderExpiry,
                _bid.buyer,
                _bid.optionType,
                _bid.strikePrice,
                _bid.expiry,
                _bid.expiryAllowance));
    }

    /**
     * @dev creates an ETH signed message hash
     */
    function getEthSignedMessageHash(bytes32 _messageHash) internal pure returns (bytes32) {
        /*
        Signature is produced by signing a keccak256 hash with the following format:
        "\x19Ethereum Signed Message\n" + len(msg) + msg
        */
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
    }

    function getSigner(
        WasabiStructs.PoolAsk calldata _request,
        bytes memory signature
    ) internal pure returns (address) {
        bytes32 messageHash = getMessageHash(_request);
        bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);

        return recoverSigner(ethSignedMessageHash, signature);
    }

    function getAskSigner(
        WasabiStructs.Ask calldata _ask,
        bytes memory signature
    ) internal pure returns (address) {
        bytes32 messageHash = getAskHash(_ask);
        bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);

        return recoverSigner(ethSignedMessageHash, signature);
    }

    function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature)
        internal
        pure
        returns (address)
    {
        (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);

        return ecrecover(_ethSignedMessageHash, v, r, s);
    }

    function splitSignature(bytes memory sig)
        internal
        pure
        returns (
            bytes32 r,
            bytes32 s,
            uint8 v
        )
    {
        require(sig.length == 65, "invalid signature length");

        assembly {
            /*
            First 32 bytes stores the length of the signature

            add(sig, 32) = pointer of sig + 32
            effectively, skips first 32 bytes of signature

            mload(p) loads next 32 bytes starting at the memory address p into memory
            */

            // first 32 bytes, after the length prefix
            r := mload(add(sig, 32))
            // second 32 bytes
            s := mload(add(sig, 64))
            // final byte (first byte of the next 32 bytes)
            v := byte(0, mload(add(sig, 96)))
        }

        // implicitly return (r, s, v)
    }
}

File 4 of 19 : IWasabiOption.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IWasabiOption {
    function mint(address, address) external returns (uint256);

    function burn(uint256) external;

    function ownerOf(uint256 tokenId) external view returns (address owner);
}

File 5 of 19 : IWasabiBNPL.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/// @title WasabiBNPL Interface
interface IWasabiBNPL {
    /// @notice Function Calldata Struct
    /// @param to to address
    /// @param value call value
    /// @param data call data
    struct FunctionCallData {
        address to;
        uint256 value;
        bytes data;
    }

    /// @notice Loan Info Struct
    /// @param nftLending INFTLending address
    /// @param loanId loan id
    struct LoanInfo {
        address nftLending;
        uint256 loanId;
    }

    /// @notice Function Call Failed
    error FunctionCallFailed();

    /// @notice Loan Not Paid
    error LoanNotPaid();

    /// @notice ETH Transfer Failed
    error EthTransferFailed();

    /// @notice Invalid Param
    error InvalidParam();

    /// @dev Emitted when an option is executed
    event OptionExecuted(uint256 optionId);

    /// @dev Emitted when an option is executed and the NFT is sold to the market
    event OptionExecutedWithArbitrage(uint256 optionId, uint256 payout);
}

File 6 of 19 : INFTLending.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/// @notice NFTLending Interface
interface INFTLending {
    /// @notice Loan Details struct
    /// @param borrowAmount Borrow amount
    /// @param repayAmount Repay amount
    /// @param loanExpiration Loan expiration
    struct LoanDetails {
        uint256 borrowAmount;
        uint256 repayAmount;
        uint256 loanExpiration;
        address nftAddress;
        uint256 tokenId;
    }

    /// @notice Get loan details for given loan id
    /// @param _loanId The loan id
    function getLoanDetails(
        uint256 _loanId
    ) external view returns (LoanDetails memory);

    /// @notice Borrow WETH from the protocol
    /// @param _inputData Encoded input parameters
    /// @return _loanId The loan id
    function borrow(
        bytes calldata _inputData
    ) external payable returns (uint256 _loanId);

    /// @notice Repay the loan
    /// @param _loanId The loan id to repay
    /// @param _receiver The user address to receive collateral NFT
    function repay(uint256 _loanId, address _receiver) external payable;
}

File 7 of 19 : ILendingAddressProvider.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface ILendingAddressProvider {
    event LendingAdded(address indexed lending);

    event LendingRemoved(address indexed lending);

    function isLending(address) external view returns (bool);

    function addLending(address _lending) external;
}

File 8 of 19 : IFlashloan.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/// @title Flashloan Interface
interface IFlashloan {
    /// @notice Flashloan Info Struct
    /// @param enabled Enabled flag
    /// @param flashloanPremiumValue;
    struct FlashLoanInfo {
        bool enabled;
        uint256 flashloanPremiumValue;
    }

    /// @notice ETH Transfer Failed
    error EthTransferFailed();

    /// @notice Borrow ETH
    /// @param amount Flashloan amount
    /// @return flashLoanRepayAmount Flashloan repayment amount
    function borrow(uint256 amount) external returns (uint256 flashLoanRepayAmount);
}

File 9 of 19 : IWETH.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IWETH is IERC20 {
    function deposit() external payable;
    function withdraw(uint) external;
}

File 10 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 11 of 19 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 12 of 19 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 13 of 19 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 14 of 19 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 15 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 16 of 19 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 17 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 18 of 19 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 19 of 19 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 1500
  },
  "evmVersion": "paris",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IWasabiOption","name":"_wasabiOption","type":"address"},{"internalType":"contract IFlashloan","name":"_flashloan","type":"address"},{"internalType":"contract ILendingAddressProvider","name":"_addressProvider","type":"address"},{"internalType":"address","name":"_wethAddress","type":"address"},{"internalType":"address","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[],"name":"FunctionCallFailed","type":"error"},{"inputs":[],"name":"InvalidParam","type":"error"},{"inputs":[],"name":"LoanNotPaid","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"optionId","type":"uint256"}],"name":"OptionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"payout","type":"uint256"}],"name":"OptionExecutedWithArbitrage","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"},{"inputs":[],"name":"addressProvider","outputs":[{"internalType":"contract ILendingAddressProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftLending","type":"address"},{"internalType":"bytes","name":"_borrowData","type":"bytes"},{"internalType":"uint256","name":"_flashLoanAmount","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IWasabiBNPL.FunctionCallData[]","name":"_marketplaceCallData","type":"tuple[]"},{"internalType":"bytes[]","name":"_signatures","type":"bytes[]"}],"name":"bnpl","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"executeOption","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IWasabiBNPL.FunctionCallData[]","name":"_marketplaceCallData","type":"tuple[]"},{"internalType":"bytes[]","name":"_signatures","type":"bytes[]"}],"name":"executeOptionWithArbitrage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flashloan","outputs":[{"internalType":"contract IFlashloan","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IWasabiBNPL.FunctionCallData","name":"_data","type":"tuple"}],"name":"getMessageHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"getOptionData","outputs":[{"components":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"enum WasabiStructs.OptionType","name":"optionType","type":"uint8"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct WasabiStructs.OptionData","name":"optionData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"optionToLoan","outputs":[{"internalType":"address","name":"nftLending","type":"address"},{"internalType":"uint256","name":"loanId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wasabiOption","outputs":[{"internalType":"contract IWasabiOption","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wethAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b506040516200289c3803806200289c83398101604081905262000034916200010f565b6200003f33620000a6565b60018055600280546001600160a01b03199081166001600160a01b039788161790915560038054821695871695909517909455600480548516938616939093179092556007805484169185169190911790556005805490921692169190911790556200018f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200010c57600080fd5b50565b600080600080600060a086880312156200012857600080fd5b85516200013581620000f6565b60208701519095506200014881620000f6565b60408701519094506200015b81620000f6565b60608701519093506200016e81620000f6565b60808701519092506200018181620000f6565b809150509295509295909350565b6126fd806200019f6000396000f3fe60806040526004361061012d5760003560e01c80638da5cb5b116100a5578063c45a015511610074578063f14210a611610059578063f14210a6146103b3578063f2fde38b146103c6578063f3e414f8146103e657600080fd5b8063c45a015514610366578063e2213a4b1461038657600080fd5b80638da5cb5b146102e85780639ccc757b146103065780639ff0a4e014610326578063a1db97821461034657600080fd5b806337fb409c116100fc57806365b78c15116100e157806365b78c15146102615780636a4d376714610274578063715018a6146102d357600080fd5b806337fb409c1461022c5780634f0e0ef31461024157600080fd5b806314f9604414610139578063150b7a021461015f5780631b89b61a146101d45780632954018c1461020c57600080fd5b3661013457005b600080fd5b61014c610147366004611fc7565b610406565b6040519081526020015b60405180910390f35b34801561016b57600080fd5b506101a361017a36600461218b565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610156565b3480156101e057600080fd5b506003546101f4906001600160a01b031681565b6040516001600160a01b039091168152602001610156565b34801561021857600080fd5b506004546101f4906001600160a01b031681565b61023f61023a3660046121f7565b6108b9565b005b34801561024d57600080fd5b506007546101f4906001600160a01b031681565b61023f61026f366004612210565b610c93565b34801561028057600080fd5b506102b461028f3660046121f7565b600660205260009081526040902080546001909101546001600160a01b039091169082565b604080516001600160a01b039093168352602083019190915201610156565b3480156102df57600080fd5b5061023f6112eb565b3480156102f457600080fd5b506000546001600160a01b03166101f4565b34801561031257600080fd5b5061014c61032136600461228a565b6112ff565b34801561033257600080fd5b506002546101f4906001600160a01b031681565b34801561035257600080fd5b5061023f6103613660046122c5565b611350565b34801561037257600080fd5b506005546101f4906001600160a01b031681565b34801561039257600080fd5b506103a66103a13660046121f7565b611370565b60405161015691906122f1565b61023f6103c13660046121f7565b611501565b3480156103d257600080fd5b5061023f6103e136600461234a565b611588565b3480156103f257600080fd5b5061023f6104013660046122c5565b611618565b600060026001540361045f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600155610470858585856116c5565b600480546040517f8833efd60000000000000000000000000000000000000000000000000000000081526001600160a01b038c811693820193909352911690638833efd690602401602060405180830381865afa1580156104d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f99190612367565b61052f576040517fd252903400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035460405163317afabb60e21b8152600481018890526000916001600160a01b03169063c5ebeaec906024016020604051808303816000875af115801561057b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059f9190612389565b905060006105b56105b087896123a2565b611883565b9050806105d5576040516325d75db760e11b815260040160405180910390fd5b6000610664639f1b472060e01b8c8c6040516024016105f592919061249c565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001600160a01b038e1690611950565b905060008180602001905181019061067c9190612389565b6002549091506000906001600160a01b031663ee1fe2ad3360055460405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156106fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107209190612389565b905060405180604001604052808f6001600160a01b03168152602001838152506006600083815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010155905050844710156107ae576040516375c6af1160e01b815260040160405180910390fd5b60006107ba86476124c6565b6003546040519192506000916001600160a01b039091169088908381818185875af1925050503d806000811461080c576040519150601f19603f3d011682016040523d82523d6000602084013e610811565b606091505b505090508061083357604051630db2c7f160e31b815260040160405180910390fd5b81156108a25760405133908390600081818185875af1925050503d8060008114610879576040519150601f19603f3d011682016040523d82523d6000602084013e61087e565b606091505b505080915050806108a257604051630db2c7f160e31b815260040160405180910390fd5b5050600180559d9c50505050505050505050505050565b60026001540361090b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610456565b6002600155336002546040516331a9108f60e11b8152600481018490526001600160a01b039283169290911690636352211e90602401602060405180830381865afa15801561095e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098291906124d9565b6001600160a01b0316146109d85760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206f776e65722063616e206578657263697365206f7074696f6e00006044820152606401610456565b600081815260066020526040902080546001600160a01b0316610a3d5760405162461bcd60e51b815260206004820152600e60248201527f496e76616c6964204f7074696f6e0000000000000000000000000000000000006044820152606401610456565b805460018201546040516366877b8d60e01b815260048101919091526000916001600160a01b0316906366877b8d9060240160a060405180830381865afa158015610a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab091906124f6565b905042816040015111610b055760405162461bcd60e51b815260206004820152601060248201527f4c6f616e206861732065787069726564000000000000000000000000000000006044820152606401610456565b8060200151341015610b7f5760405162461bcd60e51b815260206004820152602260248201527f496e73756666696369656e7420726570617920616d6f756e7420737570706c6960448201527f65640000000000000000000000000000000000000000000000000000000000006064820152608401610456565b60018201546040805160248101929092523360448084019190915281518084039091018152606490920190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663acb7081560e01b1790528254610bf2916001600160a01b039190911690611950565b50600254604051630852cd8d60e31b8152600481018590526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610c3957600080fd5b505af1158015610c4d573d6000803e3d6000fd5b505050507f71bef4a8469a3b83c64a11128d95ac7253a399544da7d5f50e8ef4a32f3fac3283604051610c8291815260200190565b60405180910390a150506001805550565b600260015403610ce55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610456565b6002600155610cf6848484846116c5565b336002546040516331a9108f60e11b8152600481018890526001600160a01b039283169290911690636352211e90602401602060405180830381865afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906124d9565b6001600160a01b031614610dbe5760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206f776e65722063616e206578657263697365206f7074696f6e00006044820152606401610456565b600085815260066020526040902080546001600160a01b0316610e235760405162461bcd60e51b815260206004820152600e60248201527f496e76616c6964204f7074696f6e0000000000000000000000000000000000006044820152606401610456565b805460018201546040516366877b8d60e01b815260048101919091526000916001600160a01b0316906366877b8d9060240160a060405180830381865afa158015610e72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9691906124f6565b905042816040015111610eeb5760405162461bcd60e51b815260206004820152601060248201527f4c6f616e206861732065787069726564000000000000000000000000000000006044820152606401610456565b600354602082015160405163317afabb60e21b815247926000926001600160a01b039091169163c5ebeaec91610f279160040190815260200190565b6020604051808303816000875af1158015610f46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6a9190612389565b60018501546040805160248101929092523060448084019190915281518084039091018152606490920190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663acb7081560e01b1790528554919250610fdd916001600160a01b031690611950565b50600254604051630852cd8d60e31b8152600481018b90526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561102457600080fd5b505af1158015611038573d6000803e3d6000fd5b50505050600061104e8989906105b091906123a2565b90508061106e576040516325d75db760e11b815260040160405180910390fd5b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa1580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f89190612389565b90508015611174576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b15801561115b57600080fd5b505af115801561116f573d6000803e3d6000fd5b505050505b600061118086476124c6565b9050848110156111a3576040516375c6af1160e01b815260040160405180910390fd5b6003546040516000916001600160a01b03169087908381818185875af1925050503d80600081146111f0576040519150601f19603f3d011682016040523d82523d6000602084013e6111f5565b606091505b505090508061121757604051630db2c7f160e31b815260040160405180910390fd5b600061122387846124c6565b905080156112945760405133908290600081818185875af1925050503d806000811461126b576040519150601f19603f3d011682016040523d82523d6000602084013e611270565b606091505b5050809250508161129457604051630db2c7f160e31b815260040160405180910390fd5b7fb972e9960753a43b3e3737730e806e14e1e1e5b0f8fb88df62d0c6f4791655ed8f826040516112ce929190918252602082015260400190565b60405180910390a150506001805550505050505050505050505050565b6112f361197e565b6112fd60006119d8565b565b600061130e602083018361234a565b6020830135611320604085018561256e565b60405160200161133394939291906125b5565b604051602081830303815290604052805190602001209050919050565b61135861197e565b61136c6001600160a01b0383163383611a40565b5050565b6113a36040805160a081019091526000808252602082019081526020016000815260200160008152602001600081525090565b60008281526006602090815260408083208151808301835281546001600160a01b031680825260019092015493810184905291516366877b8d60e01b815260048101939093529092916366877b8d9060240160a060405180830381865afa158015611412573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143691906124f6565b6002546040516331a9108f60e11b81526004810187905291925060009182916001600160a01b031690636352211e90602401602060405180830381865afa158015611485573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a991906124d9565b6001600160a01b0316141580156114c35750428260400151115b6040805160a0810182529115158252600060208084019190915284015182820152830151606082015260809283015192810192909252509392505050565b61150961197e565b478111156115145750475b600080546040516001600160a01b039091169083908381818185875af1925050503d8060008114611561576040519150601f19603f3d011682016040523d82523d6000602084013e611566565b606091505b505090508061136c57604051630db2c7f160e31b815260040160405180910390fd5b61159061197e565b6001600160a01b03811661160c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610456565b611615816119d8565b50565b61162061197e565b816001600160a01b03166342842e0e306116426000546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b1580156116a957600080fd5b505af11580156116bd573d6000803e3d6000fd5b505050505050565b82806117135760405162461bcd60e51b815260206004820152601660248201527f4e656564206d61726b6574706c6163652063616c6c73000000000000000000006044820152606401610456565b8082146117625760405162461bcd60e51b815260206004820152601160248201527f4c656e67746820697320696e76616c69640000000000000000000000000000006044820152606401610456565b60005b8181146116bd57600061179d611798888885818110611786576117866125e8565b905060200281019061032191906125fe565b611ac5565b90506117b16000546001600160a01b031690565b6001600160a01b031661181c828787868181106117d0576117d06125e8565b90506020028101906117e2919061256e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b0092505050565b6001600160a01b0316146118725760405162461bcd60e51b815260206004820152601360248201527f4f776e6572206973206e6f74207369676e6572000000000000000000000000006044820152606401610456565b5061187c8161261e565b9050611765565b8051600090815b8181146119465760008482815181106118a5576118a56125e8565b60200260200101519050600081600001516001600160a01b0316826020015183604001516040516118d6919061265b565b60006040518083038185875af1925050503d8060008114611913576040519150601f19603f3d011682016040523d82523d6000602084013e611918565b606091505b50909150508015156000036119335750600095945050505050565b50508061193f9061261e565b905061188a565b5060019392505050565b606061197583836040518060600160405280602781526020016126a160279139611b7f565b90505b92915050565b6000546001600160a01b031633146112fd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610456565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611ac0908490611c75565b505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611333565b600080600080611b0f85611d5a565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015611b6a573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b60606001600160a01b0384163b611bfe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610456565b600080856001600160a01b031685604051611c19919061265b565b600060405180830381855af49150503d8060008114611c54576040519150601f19603f3d011682016040523d82523d6000602084013e611c59565b606091505b5091509150611c69828286611dce565b925050505b9392505050565b6000611cca826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611e079092919063ffffffff16565b805190915015611ac05780806020019051810190611ce89190612367565b611ac05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610456565b60008060008351604114611db05760405162461bcd60e51b815260206004820152601860248201527f696e76616c6964207369676e6174757265206c656e67746800000000000000006044820152606401610456565b50505060208101516040820151606090920151909260009190911a90565b60608315611ddd575081611c6e565b825115611ded5782518084602001fd5b8160405162461bcd60e51b8152600401610456919061266d565b6060611e168484600085611e1e565b949350505050565b606082471015611e965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610456565b6001600160a01b0385163b611eed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610456565b600080866001600160a01b03168587604051611f09919061265b565b60006040518083038185875af1925050503d8060008114611f46576040519150601f19603f3d011682016040523d82523d6000602084013e611f4b565b606091505b5091509150611f5b828286611dce565b979650505050505050565b6001600160a01b038116811461161557600080fd5b60008083601f840112611f8d57600080fd5b50813567ffffffffffffffff811115611fa557600080fd5b6020830191508360208260051b8501011115611fc057600080fd5b9250929050565b60008060008060008060008060a0898b031215611fe357600080fd5b8835611fee81611f66565b9750602089013567ffffffffffffffff8082111561200b57600080fd5b818b0191508b601f83011261201f57600080fd5b81358181111561202e57600080fd5b8c602082850101111561204057600080fd5b6020830199508098505060408b0135965060608b013591508082111561206557600080fd5b6120718c838d01611f7b565b909650945060808b013591508082111561208a57600080fd5b506120978b828c01611f7b565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156120e4576120e46120ab565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612113576121136120ab565b604052919050565b600082601f83011261212c57600080fd5b813567ffffffffffffffff811115612146576121466120ab565b612159601f8201601f19166020016120ea565b81815284602083860101111561216e57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156121a157600080fd5b84356121ac81611f66565b935060208501356121bc81611f66565b925060408501359150606085013567ffffffffffffffff8111156121df57600080fd5b6121eb8782880161211b565b91505092959194509250565b60006020828403121561220957600080fd5b5035919050565b60008060008060006060868803121561222857600080fd5b85359450602086013567ffffffffffffffff8082111561224757600080fd5b61225389838a01611f7b565b9096509450604088013591508082111561226c57600080fd5b5061227988828901611f7b565b969995985093965092949392505050565b60006020828403121561229c57600080fd5b813567ffffffffffffffff8111156122b357600080fd5b820160608185031215611c6e57600080fd5b600080604083850312156122d857600080fd5b82356122e381611f66565b946020939093013593505050565b815115158152602082015160a08201906002811061231f57634e487b7160e01b600052602160045260246000fd5b8060208401525060408301516040830152606083015160608301526080830151608083015292915050565b60006020828403121561235c57600080fd5b8135611c6e81611f66565b60006020828403121561237957600080fd5b81518015158114611c6e57600080fd5b60006020828403121561239b57600080fd5b5051919050565b600067ffffffffffffffff808411156123bd576123bd6120ab565b8360051b60206123ce8183016120ea565b8681529185019181810190368411156123e657600080fd5b865b84811015612467578035868111156124005760008081fd5b880160603682900312156124145760008081fd5b61241c6120c1565b813561242781611f66565b81528186013586820152604080830135898111156124455760008081fd5b6124513682860161211b565b91830191909152508452509183019183016123e8565b50979650505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000611e16602083018486612473565b634e487b7160e01b600052601160045260246000fd5b81810381811115611978576119786124b0565b6000602082840312156124eb57600080fd5b8151611c6e81611f66565b600060a0828403121561250857600080fd5b60405160a0810181811067ffffffffffffffff8211171561252b5761252b6120ab565b8060405250825181526020830151602082015260408301516040820152606083015161255681611f66565b60608201526080928301519281019290925250919050565b6000808335601e1984360301811261258557600080fd5b83018035915067ffffffffffffffff8211156125a057600080fd5b602001915036819003821315611fc057600080fd5b6001600160a01b03851681528360208201526060604082015260006125de606083018486612473565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b60008235605e1983360301811261261457600080fd5b9190910192915050565b600060018201612630576126306124b0565b5060010190565b60005b8381101561265257818101518382015260200161263a565b50506000910152565b60008251612614818460208701612637565b602081526000825180602084015261268c816040850160208701612637565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220706236a4dbccbd961f23194efdc611c38e5d93cf57ca852eae623987f2c215b864736f6c63430008130033000000000000000000000000fc68f2130e094c95b6c4f5494158cbeb172e18a0000000000000000000000000001a05856e823efdb78ddcf0cf209f69dd6e6f3d000000000000000000000000c399616937ebace9e45159a60cd77663c4a30e79000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000008e2b50413a53f50e2a059142a9be060294961e40

Deployed Bytecode

0x60806040526004361061012d5760003560e01c80638da5cb5b116100a5578063c45a015511610074578063f14210a611610059578063f14210a6146103b3578063f2fde38b146103c6578063f3e414f8146103e657600080fd5b8063c45a015514610366578063e2213a4b1461038657600080fd5b80638da5cb5b146102e85780639ccc757b146103065780639ff0a4e014610326578063a1db97821461034657600080fd5b806337fb409c116100fc57806365b78c15116100e157806365b78c15146102615780636a4d376714610274578063715018a6146102d357600080fd5b806337fb409c1461022c5780634f0e0ef31461024157600080fd5b806314f9604414610139578063150b7a021461015f5780631b89b61a146101d45780632954018c1461020c57600080fd5b3661013457005b600080fd5b61014c610147366004611fc7565b610406565b6040519081526020015b60405180910390f35b34801561016b57600080fd5b506101a361017a36600461218b565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610156565b3480156101e057600080fd5b506003546101f4906001600160a01b031681565b6040516001600160a01b039091168152602001610156565b34801561021857600080fd5b506004546101f4906001600160a01b031681565b61023f61023a3660046121f7565b6108b9565b005b34801561024d57600080fd5b506007546101f4906001600160a01b031681565b61023f61026f366004612210565b610c93565b34801561028057600080fd5b506102b461028f3660046121f7565b600660205260009081526040902080546001909101546001600160a01b039091169082565b604080516001600160a01b039093168352602083019190915201610156565b3480156102df57600080fd5b5061023f6112eb565b3480156102f457600080fd5b506000546001600160a01b03166101f4565b34801561031257600080fd5b5061014c61032136600461228a565b6112ff565b34801561033257600080fd5b506002546101f4906001600160a01b031681565b34801561035257600080fd5b5061023f6103613660046122c5565b611350565b34801561037257600080fd5b506005546101f4906001600160a01b031681565b34801561039257600080fd5b506103a66103a13660046121f7565b611370565b60405161015691906122f1565b61023f6103c13660046121f7565b611501565b3480156103d257600080fd5b5061023f6103e136600461234a565b611588565b3480156103f257600080fd5b5061023f6104013660046122c5565b611618565b600060026001540361045f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600155610470858585856116c5565b600480546040517f8833efd60000000000000000000000000000000000000000000000000000000081526001600160a01b038c811693820193909352911690638833efd690602401602060405180830381865afa1580156104d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f99190612367565b61052f576040517fd252903400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035460405163317afabb60e21b8152600481018890526000916001600160a01b03169063c5ebeaec906024016020604051808303816000875af115801561057b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059f9190612389565b905060006105b56105b087896123a2565b611883565b9050806105d5576040516325d75db760e11b815260040160405180910390fd5b6000610664639f1b472060e01b8c8c6040516024016105f592919061249c565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001600160a01b038e1690611950565b905060008180602001905181019061067c9190612389565b6002549091506000906001600160a01b031663ee1fe2ad3360055460405160e084901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156106fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107209190612389565b905060405180604001604052808f6001600160a01b03168152602001838152506006600083815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010155905050844710156107ae576040516375c6af1160e01b815260040160405180910390fd5b60006107ba86476124c6565b6003546040519192506000916001600160a01b039091169088908381818185875af1925050503d806000811461080c576040519150601f19603f3d011682016040523d82523d6000602084013e610811565b606091505b505090508061083357604051630db2c7f160e31b815260040160405180910390fd5b81156108a25760405133908390600081818185875af1925050503d8060008114610879576040519150601f19603f3d011682016040523d82523d6000602084013e61087e565b606091505b505080915050806108a257604051630db2c7f160e31b815260040160405180910390fd5b5050600180559d9c50505050505050505050505050565b60026001540361090b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610456565b6002600155336002546040516331a9108f60e11b8152600481018490526001600160a01b039283169290911690636352211e90602401602060405180830381865afa15801561095e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098291906124d9565b6001600160a01b0316146109d85760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206f776e65722063616e206578657263697365206f7074696f6e00006044820152606401610456565b600081815260066020526040902080546001600160a01b0316610a3d5760405162461bcd60e51b815260206004820152600e60248201527f496e76616c6964204f7074696f6e0000000000000000000000000000000000006044820152606401610456565b805460018201546040516366877b8d60e01b815260048101919091526000916001600160a01b0316906366877b8d9060240160a060405180830381865afa158015610a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab091906124f6565b905042816040015111610b055760405162461bcd60e51b815260206004820152601060248201527f4c6f616e206861732065787069726564000000000000000000000000000000006044820152606401610456565b8060200151341015610b7f5760405162461bcd60e51b815260206004820152602260248201527f496e73756666696369656e7420726570617920616d6f756e7420737570706c6960448201527f65640000000000000000000000000000000000000000000000000000000000006064820152608401610456565b60018201546040805160248101929092523360448084019190915281518084039091018152606490920190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663acb7081560e01b1790528254610bf2916001600160a01b039190911690611950565b50600254604051630852cd8d60e31b8152600481018590526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610c3957600080fd5b505af1158015610c4d573d6000803e3d6000fd5b505050507f71bef4a8469a3b83c64a11128d95ac7253a399544da7d5f50e8ef4a32f3fac3283604051610c8291815260200190565b60405180910390a150506001805550565b600260015403610ce55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610456565b6002600155610cf6848484846116c5565b336002546040516331a9108f60e11b8152600481018890526001600160a01b039283169290911690636352211e90602401602060405180830381865afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906124d9565b6001600160a01b031614610dbe5760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206f776e65722063616e206578657263697365206f7074696f6e00006044820152606401610456565b600085815260066020526040902080546001600160a01b0316610e235760405162461bcd60e51b815260206004820152600e60248201527f496e76616c6964204f7074696f6e0000000000000000000000000000000000006044820152606401610456565b805460018201546040516366877b8d60e01b815260048101919091526000916001600160a01b0316906366877b8d9060240160a060405180830381865afa158015610e72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9691906124f6565b905042816040015111610eeb5760405162461bcd60e51b815260206004820152601060248201527f4c6f616e206861732065787069726564000000000000000000000000000000006044820152606401610456565b600354602082015160405163317afabb60e21b815247926000926001600160a01b039091169163c5ebeaec91610f279160040190815260200190565b6020604051808303816000875af1158015610f46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6a9190612389565b60018501546040805160248101929092523060448084019190915281518084039091018152606490920190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663acb7081560e01b1790528554919250610fdd916001600160a01b031690611950565b50600254604051630852cd8d60e31b8152600481018b90526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561102457600080fd5b505af1158015611038573d6000803e3d6000fd5b50505050600061104e8989906105b091906123a2565b90508061106e576040516325d75db760e11b815260040160405180910390fd5b6007546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa1580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f89190612389565b90508015611174576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690632e1a7d4d90602401600060405180830381600087803b15801561115b57600080fd5b505af115801561116f573d6000803e3d6000fd5b505050505b600061118086476124c6565b9050848110156111a3576040516375c6af1160e01b815260040160405180910390fd5b6003546040516000916001600160a01b03169087908381818185875af1925050503d80600081146111f0576040519150601f19603f3d011682016040523d82523d6000602084013e6111f5565b606091505b505090508061121757604051630db2c7f160e31b815260040160405180910390fd5b600061122387846124c6565b905080156112945760405133908290600081818185875af1925050503d806000811461126b576040519150601f19603f3d011682016040523d82523d6000602084013e611270565b606091505b5050809250508161129457604051630db2c7f160e31b815260040160405180910390fd5b7fb972e9960753a43b3e3737730e806e14e1e1e5b0f8fb88df62d0c6f4791655ed8f826040516112ce929190918252602082015260400190565b60405180910390a150506001805550505050505050505050505050565b6112f361197e565b6112fd60006119d8565b565b600061130e602083018361234a565b6020830135611320604085018561256e565b60405160200161133394939291906125b5565b604051602081830303815290604052805190602001209050919050565b61135861197e565b61136c6001600160a01b0383163383611a40565b5050565b6113a36040805160a081019091526000808252602082019081526020016000815260200160008152602001600081525090565b60008281526006602090815260408083208151808301835281546001600160a01b031680825260019092015493810184905291516366877b8d60e01b815260048101939093529092916366877b8d9060240160a060405180830381865afa158015611412573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143691906124f6565b6002546040516331a9108f60e11b81526004810187905291925060009182916001600160a01b031690636352211e90602401602060405180830381865afa158015611485573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a991906124d9565b6001600160a01b0316141580156114c35750428260400151115b6040805160a0810182529115158252600060208084019190915284015182820152830151606082015260809283015192810192909252509392505050565b61150961197e565b478111156115145750475b600080546040516001600160a01b039091169083908381818185875af1925050503d8060008114611561576040519150601f19603f3d011682016040523d82523d6000602084013e611566565b606091505b505090508061136c57604051630db2c7f160e31b815260040160405180910390fd5b61159061197e565b6001600160a01b03811661160c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610456565b611615816119d8565b50565b61162061197e565b816001600160a01b03166342842e0e306116426000546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b1580156116a957600080fd5b505af11580156116bd573d6000803e3d6000fd5b505050505050565b82806117135760405162461bcd60e51b815260206004820152601660248201527f4e656564206d61726b6574706c6163652063616c6c73000000000000000000006044820152606401610456565b8082146117625760405162461bcd60e51b815260206004820152601160248201527f4c656e67746820697320696e76616c69640000000000000000000000000000006044820152606401610456565b60005b8181146116bd57600061179d611798888885818110611786576117866125e8565b905060200281019061032191906125fe565b611ac5565b90506117b16000546001600160a01b031690565b6001600160a01b031661181c828787868181106117d0576117d06125e8565b90506020028101906117e2919061256e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b0092505050565b6001600160a01b0316146118725760405162461bcd60e51b815260206004820152601360248201527f4f776e6572206973206e6f74207369676e6572000000000000000000000000006044820152606401610456565b5061187c8161261e565b9050611765565b8051600090815b8181146119465760008482815181106118a5576118a56125e8565b60200260200101519050600081600001516001600160a01b0316826020015183604001516040516118d6919061265b565b60006040518083038185875af1925050503d8060008114611913576040519150601f19603f3d011682016040523d82523d6000602084013e611918565b606091505b50909150508015156000036119335750600095945050505050565b50508061193f9061261e565b905061188a565b5060019392505050565b606061197583836040518060600160405280602781526020016126a160279139611b7f565b90505b92915050565b6000546001600160a01b031633146112fd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610456565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611ac0908490611c75565b505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01611333565b600080600080611b0f85611d5a565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015611b6a573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b60606001600160a01b0384163b611bfe5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e747261637400000000000000000000000000000000000000000000000000006064820152608401610456565b600080856001600160a01b031685604051611c19919061265b565b600060405180830381855af49150503d8060008114611c54576040519150601f19603f3d011682016040523d82523d6000602084013e611c59565b606091505b5091509150611c69828286611dce565b925050505b9392505050565b6000611cca826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611e079092919063ffffffff16565b805190915015611ac05780806020019051810190611ce89190612367565b611ac05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610456565b60008060008351604114611db05760405162461bcd60e51b815260206004820152601860248201527f696e76616c6964207369676e6174757265206c656e67746800000000000000006044820152606401610456565b50505060208101516040820151606090920151909260009190911a90565b60608315611ddd575081611c6e565b825115611ded5782518084602001fd5b8160405162461bcd60e51b8152600401610456919061266d565b6060611e168484600085611e1e565b949350505050565b606082471015611e965760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610456565b6001600160a01b0385163b611eed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610456565b600080866001600160a01b03168587604051611f09919061265b565b60006040518083038185875af1925050503d8060008114611f46576040519150601f19603f3d011682016040523d82523d6000602084013e611f4b565b606091505b5091509150611f5b828286611dce565b979650505050505050565b6001600160a01b038116811461161557600080fd5b60008083601f840112611f8d57600080fd5b50813567ffffffffffffffff811115611fa557600080fd5b6020830191508360208260051b8501011115611fc057600080fd5b9250929050565b60008060008060008060008060a0898b031215611fe357600080fd5b8835611fee81611f66565b9750602089013567ffffffffffffffff8082111561200b57600080fd5b818b0191508b601f83011261201f57600080fd5b81358181111561202e57600080fd5b8c602082850101111561204057600080fd5b6020830199508098505060408b0135965060608b013591508082111561206557600080fd5b6120718c838d01611f7b565b909650945060808b013591508082111561208a57600080fd5b506120978b828c01611f7b565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156120e4576120e46120ab565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715612113576121136120ab565b604052919050565b600082601f83011261212c57600080fd5b813567ffffffffffffffff811115612146576121466120ab565b612159601f8201601f19166020016120ea565b81815284602083860101111561216e57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156121a157600080fd5b84356121ac81611f66565b935060208501356121bc81611f66565b925060408501359150606085013567ffffffffffffffff8111156121df57600080fd5b6121eb8782880161211b565b91505092959194509250565b60006020828403121561220957600080fd5b5035919050565b60008060008060006060868803121561222857600080fd5b85359450602086013567ffffffffffffffff8082111561224757600080fd5b61225389838a01611f7b565b9096509450604088013591508082111561226c57600080fd5b5061227988828901611f7b565b969995985093965092949392505050565b60006020828403121561229c57600080fd5b813567ffffffffffffffff8111156122b357600080fd5b820160608185031215611c6e57600080fd5b600080604083850312156122d857600080fd5b82356122e381611f66565b946020939093013593505050565b815115158152602082015160a08201906002811061231f57634e487b7160e01b600052602160045260246000fd5b8060208401525060408301516040830152606083015160608301526080830151608083015292915050565b60006020828403121561235c57600080fd5b8135611c6e81611f66565b60006020828403121561237957600080fd5b81518015158114611c6e57600080fd5b60006020828403121561239b57600080fd5b5051919050565b600067ffffffffffffffff808411156123bd576123bd6120ab565b8360051b60206123ce8183016120ea565b8681529185019181810190368411156123e657600080fd5b865b84811015612467578035868111156124005760008081fd5b880160603682900312156124145760008081fd5b61241c6120c1565b813561242781611f66565b81528186013586820152604080830135898111156124455760008081fd5b6124513682860161211b565b91830191909152508452509183019183016123e8565b50979650505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000611e16602083018486612473565b634e487b7160e01b600052601160045260246000fd5b81810381811115611978576119786124b0565b6000602082840312156124eb57600080fd5b8151611c6e81611f66565b600060a0828403121561250857600080fd5b60405160a0810181811067ffffffffffffffff8211171561252b5761252b6120ab565b8060405250825181526020830151602082015260408301516040820152606083015161255681611f66565b60608201526080928301519281019290925250919050565b6000808335601e1984360301811261258557600080fd5b83018035915067ffffffffffffffff8211156125a057600080fd5b602001915036819003821315611fc057600080fd5b6001600160a01b03851681528360208201526060604082015260006125de606083018486612473565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b60008235605e1983360301811261261457600080fd5b9190910192915050565b600060018201612630576126306124b0565b5060010190565b60005b8381101561265257818101518382015260200161263a565b50506000910152565b60008251612614818460208701612637565b602081526000825180602084015261268c816040850160208701612637565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220706236a4dbccbd961f23194efdc611c38e5d93cf57ca852eae623987f2c215b864736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000fc68f2130e094c95b6c4f5494158cbeb172e18a0000000000000000000000000001a05856e823efdb78ddcf0cf209f69dd6e6f3d000000000000000000000000c399616937ebace9e45159a60cd77663c4a30e79000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000008e2b50413a53f50e2a059142a9be060294961e40

-----Decoded View---------------
Arg [0] : _wasabiOption (address): 0xFc68f2130e094C95B6C4F5494158cbeB172e18a0
Arg [1] : _flashloan (address): 0x001A05856e823eFdb78dDcF0CF209F69dd6E6f3d
Arg [2] : _addressProvider (address): 0xC399616937EBacE9E45159a60cD77663c4A30E79
Arg [3] : _wethAddress (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [4] : _factory (address): 0x8E2b50413a53F50E2a059142a9be060294961e40

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000fc68f2130e094c95b6c4f5494158cbeb172e18a0
Arg [1] : 000000000000000000000000001a05856e823efdb78ddcf0cf209f69dd6e6f3d
Arg [2] : 000000000000000000000000c399616937ebace9e45159a60cd77663c4a30e79
Arg [3] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [4] : 0000000000000000000000008e2b50413a53f50e2a059142a9be060294961e40


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.