ETH Price: $3,987.56 (+0.75%)

Contract

0xb41Ec6e014e2AD12Ae8514216EAb2592b74F19e7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MultiPath

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 14 : MultiPath.sol
/*solhint-disable avoid-low-level-calls*/
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "./IRouter.sol";
import "../IAugustusSwapperV5.sol";
import "../adapters/IAdapter.sol";
import "../adapters/IBuyAdapter.sol";
import "../fee/FeeModel.sol";
import "../fee/IFeeClaimer.sol";

contract MultiPath is FeeModel, IRouter {
    using SafeMath for uint256;

    /*solhint-disable no-empty-blocks*/
    constructor(
        uint256 _partnerSharePercent,
        uint256 _maxFeePercent,
        IFeeClaimer _feeClaimer
    ) public FeeModel(_partnerSharePercent, _maxFeePercent, _feeClaimer) {}

    /*solhint-enable no-empty-blocks*/

    function initialize(bytes calldata) external override {
        revert("METHOD NOT IMPLEMENTED");
    }

    function getKey() external pure override returns (bytes32) {
        return keccak256(abi.encodePacked("MULTIPATH_ROUTER", "1.0.0"));
    }

    /**
     * @dev The function which performs the multi path swap.
     * @param data Data required to perform swap.
     */
    function multiSwap(Utils.SellData memory data) public payable returns (uint256) {
        require(data.deadline >= block.timestamp, "Deadline breached");

        address fromToken = data.fromToken;
        uint256 fromAmount = data.fromAmount;
        require(msg.value == (fromToken == Utils.ethAddress() ? fromAmount : 0), "Incorrect msg.value");
        uint256 toAmount = data.toAmount;
        uint256 expectedAmount = data.expectedAmount;
        address payable beneficiary = data.beneficiary == address(0) ? msg.sender : data.beneficiary;
        Utils.Path[] memory path = data.path;
        address toToken = path[path.length - 1].to;

        require(toAmount > 0, "To amount can not be 0");

        //If source token is not ETH than transfer required amount of tokens
        //from sender to this contract
        transferTokensFromProxy(fromToken, fromAmount, data.permit);
        if (_isTakeFeeFromSrcToken(data.feePercent)) {
            // take fee from source token
            fromAmount = takeFromTokenFee(fromToken, fromAmount, data.partner, data.feePercent);
        }

        performSwap(fromToken, fromAmount, path);

        uint256 receivedAmount = Utils.tokenBalance(toToken, address(this));

        require(receivedAmount >= toAmount, "Received amount of tokens are less then expected");

        if (!_isTakeFeeFromSrcToken(data.feePercent)) {
            // take fee from dest token
            takeToTokenFeeSlippageAndTransfer(
                toToken,
                expectedAmount,
                receivedAmount,
                beneficiary,
                data.partner,
                data.feePercent
            );
        } else {
            // Fee is already taken from fromToken
            // Transfer toToken to beneficiary
            Utils.transferTokens(toToken, beneficiary, receivedAmount);
        }

        emit SwappedV3(
            data.uuid,
            data.partner,
            data.feePercent,
            msg.sender,
            beneficiary,
            fromToken,
            toToken,
            fromAmount,
            receivedAmount,
            expectedAmount
        );

        return receivedAmount;
    }

    /**
     * @dev The function which performs the single path buy.
     * @param data Data required to perform swap.
     */
    function buy(Utils.BuyData memory data) public payable returns (uint256) {
        require(data.deadline >= block.timestamp, "Deadline breached");

        address fromToken = data.fromToken;
        uint256 fromAmount = data.fromAmount;
        require(msg.value == (fromToken == Utils.ethAddress() ? fromAmount : 0), "Incorrect msg.value");
        uint256 toAmount = data.toAmount;
        address payable beneficiary = data.beneficiary == address(0) ? msg.sender : data.beneficiary;
        address toToken = data.toToken;
        uint256 expectedAmount = data.expectedAmount;

        require(toAmount > 0, "To amount can not be 0");

        //If source token is not ETH than transfer required amount of tokens
        //from sender to this contract
        transferTokensFromProxy(fromToken, fromAmount, data.permit);

        uint256 receivedAmount = performBuy(data.adapter, fromToken, toToken, fromAmount, toAmount, data.route);

        uint256 remainingAmount;

        if (!_isTakeFeeFromSrcToken(data.feePercent)) {
            // take fee from dest token
            takeToTokenFeeAndTransfer(toToken, receivedAmount, beneficiary, data.partner, data.feePercent);

            // Transfer fromToken back to sender
            remainingAmount = Utils.tokenBalance(fromToken, address(this));
            Utils.transferTokens(fromToken, msg.sender, remainingAmount);
        } else {
            // Transfer toToken to beneficiary
            Utils.transferTokens(toToken, beneficiary, receivedAmount);

            // take slippage from src token
            remainingAmount = Utils.tokenBalance(fromToken, address(this));
            takeFromTokenFeeSlippageAndTransfer(
                fromToken,
                fromAmount,
                expectedAmount,
                remainingAmount,
                data.partner,
                data.feePercent
            );
        }

        fromAmount = fromAmount.sub(remainingAmount);
        emit BoughtV3(
            data.uuid,
            data.partner,
            data.feePercent,
            msg.sender,
            beneficiary,
            fromToken,
            toToken,
            fromAmount,
            receivedAmount,
            expectedAmount
        );

        return receivedAmount;
    }

    /**
     * @dev The function which performs the mega path swap.
     * @param data Data required to perform swap.
     */
    function megaSwap(Utils.MegaSwapSellData memory data) public payable returns (uint256) {
        require(data.deadline >= block.timestamp, "Deadline breached");
        address fromToken = data.fromToken;
        uint256 fromAmount = data.fromAmount;
        require(msg.value == (fromToken == Utils.ethAddress() ? fromAmount : 0), "Incorrect msg.value");
        uint256 toAmount = data.toAmount;
        uint256 expectedAmount = data.expectedAmount;
        address payable beneficiary = data.beneficiary == address(0) ? msg.sender : data.beneficiary;
        Utils.MegaSwapPath[] memory path = data.path;
        address toToken = path[0].path[path[0].path.length - 1].to;

        require(toAmount > 0, "To amount can not be 0");

        //if fromToken is not ETH then transfer tokens from user to this contract
        transferTokensFromProxy(fromToken, fromAmount, data.permit);
        if (_isTakeFeeFromSrcToken(data.feePercent)) {
            // take fee from source token
            fromAmount = takeFromTokenFee(fromToken, fromAmount, data.partner, data.feePercent);
        }

        for (uint8 i = 0; i < uint8(path.length); i++) {
            uint256 _fromAmount = fromAmount.mul(path[i].fromAmountPercent).div(10000);
            if (i == path.length - 1) {
                _fromAmount = Utils.tokenBalance(address(fromToken), address(this));
            }
            performSwap(fromToken, _fromAmount, path[i].path);
        }

        uint256 receivedAmount = Utils.tokenBalance(toToken, address(this));

        require(receivedAmount >= toAmount, "Received amount of tokens are less then expected");

        if (!_isTakeFeeFromSrcToken(data.feePercent)) {
            // take fee from dest token
            takeToTokenFeeSlippageAndTransfer(
                toToken,
                expectedAmount,
                receivedAmount,
                beneficiary,
                data.partner,
                data.feePercent
            );
        } else {
            // Fee is already taken from fromToken
            // Transfer toToken to beneficiary
            Utils.transferTokens(toToken, beneficiary, receivedAmount);
        }

        emit SwappedV3(
            data.uuid,
            data.partner,
            data.feePercent,
            msg.sender,
            beneficiary,
            fromToken,
            toToken,
            fromAmount,
            receivedAmount,
            expectedAmount
        );

        return receivedAmount;
    }

    //Helper function to perform swap
    function performSwap(
        address fromToken,
        uint256 fromAmount,
        Utils.Path[] memory path
    ) private {
        require(path.length > 0, "Path not provided for swap");

        //Assuming path will not be too long to reach out of gas exception
        for (uint256 i = 0; i < path.length; i++) {
            //_fromToken will be either fromToken or toToken of the previous path
            address _fromToken = i > 0 ? path[i - 1].to : fromToken;
            address _toToken = path[i].to;

            uint256 _fromAmount = i > 0 ? Utils.tokenBalance(_fromToken, address(this)) : fromAmount;

            for (uint256 j = 0; j < path[i].adapters.length; j++) {
                Utils.Adapter memory adapter = path[i].adapters[j];

                //Check if exchange is supported
                require(
                    IAugustusSwapperV5(address(this)).hasRole(WHITELISTED_ROLE, adapter.adapter),
                    "Exchange not whitelisted"
                );

                //Calculating tokens to be passed to the relevant exchange
                //percentage should be 200 for 2%
                uint256 fromAmountSlice = i > 0 && j == path[i].adapters.length.sub(1)
                    ? Utils.tokenBalance(address(_fromToken), address(this))
                    : _fromAmount.mul(adapter.percent).div(10000);

                //DELEGATING CALL TO THE ADAPTER
                (bool success, ) = adapter.adapter.delegatecall(
                    abi.encodeWithSelector(
                        IAdapter.swap.selector,
                        _fromToken,
                        _toToken,
                        fromAmountSlice,
                        uint256(0), //adapter.networkFee,
                        adapter.route
                    )
                );

                require(success, "Call to adapter failed");
            }
        }
    }

    //Helper function to perform swap
    function performBuy(
        address adapter,
        address fromToken,
        address toToken,
        uint256 fromAmount,
        uint256 toAmount,
        Utils.Route[] memory routes
    ) private returns (uint256) {
        //Check if exchange is supported
        require(IAugustusSwapperV5(address(this)).hasRole(WHITELISTED_ROLE, adapter), "Exchange not whitelisted");

        for (uint256 j = 0; j < routes.length; j++) {
            Utils.Route memory route = routes[j];

            uint256 fromAmountSlice;
            uint256 toAmountSlice;

            //last route
            if (j == routes.length.sub(1)) {
                toAmountSlice = toAmount.sub(Utils.tokenBalance(address(toToken), address(this)));

                fromAmountSlice = Utils.tokenBalance(address(fromToken), address(this));
            } else {
                fromAmountSlice = fromAmount.mul(route.percent).div(10000);
                toAmountSlice = toAmount.mul(route.percent).div(10000);
            }

            //delegate Call to the exchange
            (bool success, ) = adapter.delegatecall(
                abi.encodeWithSelector(
                    IBuyAdapter.buy.selector,
                    route.index,
                    fromToken,
                    toToken,
                    fromAmountSlice,
                    toAmountSlice,
                    route.targetExchange,
                    route.payload
                )
            );
            require(success, "Call to adapter failed");
        }

        uint256 receivedAmount = Utils.tokenBalance(toToken, address(this));
        require(receivedAmount >= toAmount, "Received amount of tokens are less then expected tokens");

        return receivedAmount;
    }

    function transferTokensFromProxy(
        address token,
        uint256 amount,
        bytes memory permit
    ) private {
        if (token != Utils.ethAddress()) {
            Utils.permit(token, permit);
            tokenTransferProxy.transferFrom(token, msg.sender, address(this), amount);
        }
    }
}

File 2 of 14 : IRouter.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface IRouter {
    /**
     * @dev Certain routers/exchanges needs to be initialized.
     * This method will be called from Augustus
     */
    function initialize(bytes calldata data) external;

    /**
     * @dev Returns unique identifier for the router
     */
    function getKey() external pure returns (bytes32);

    event SwappedV3(
        bytes16 uuid,
        address partner,
        uint256 feePercent,
        address initiator,
        address indexed beneficiary,
        address indexed srcToken,
        address indexed destToken,
        uint256 srcAmount,
        uint256 receivedAmount,
        uint256 expectedAmount
    );

    event BoughtV3(
        bytes16 uuid,
        address partner,
        uint256 feePercent,
        address initiator,
        address indexed beneficiary,
        address indexed srcToken,
        address indexed destToken,
        uint256 srcAmount,
        uint256 receivedAmount,
        uint256 expectedAmount
    );
}

File 3 of 14 : IAugustusSwapperV5.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface IAugustusSwapperV5 {
    function hasRole(bytes32 role, address account) external view returns (bool);
}

File 4 of 14 : IAdapter.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma abicoder v2;

import "../lib/Utils.sol";

interface IAdapter {
    /**
     * @dev Certain adapters needs to be initialized.
     * This method will be called from Augustus
     */
    function initialize(bytes calldata data) external;

    /**
     * @dev The function which performs the swap on an exchange.
     * @param fromToken Address of the source token
     * @param toToken Address of the destination token
     * @param fromAmount Amount of source tokens to be swapped
     * @param networkFee NOT USED - Network fee to be used in this router
     * @param route Route to be followed
     */
    function swap(
        IERC20 fromToken,
        IERC20 toToken,
        uint256 fromAmount,
        uint256 networkFee,
        Utils.Route[] calldata route
    ) external payable;
}

File 5 of 14 : IBuyAdapter.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

import "../lib/Utils.sol";

interface IBuyAdapter {
    /**
     * @dev Certain adapters needs to be initialized.
     * This method will be called from Augustus
     */
    function initialize(bytes calldata data) external;

    /**
     * @dev The function which performs the swap on an exchange.
     * @param index Index of the router in the adapter
     * @param fromToken Address of the source token
     * @param toToken Address of the destination token
     * @param maxFromAmount Max amount of source tokens to be swapped
     * @param toAmount Amount of destination tokens to be received
     * @param targetExchange Target exchange address to be called
     * @param payload extra data which needs to be passed to this router
     */
    function buy(
        uint256 index,
        IERC20 fromToken,
        IERC20 toToken,
        uint256 maxFromAmount,
        uint256 toAmount,
        address targetExchange,
        bytes calldata payload
    ) external payable;
}

File 6 of 14 : FeeModel.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "../AugustusStorage.sol";
import "../lib/Utils.sol";
import "./IFeeClaimer.sol";
// helpers
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract FeeModel is AugustusStorage {
    using SafeMath for uint256;

    uint256 public immutable partnerSharePercent;
    uint256 public immutable maxFeePercent;
    IFeeClaimer public immutable feeClaimer;

    constructor(
        uint256 _partnerSharePercent,
        uint256 _maxFeePercent,
        IFeeClaimer _feeClaimer
    ) public {
        partnerSharePercent = _partnerSharePercent;
        maxFeePercent = _maxFeePercent;
        feeClaimer = _feeClaimer;
    }

    // feePercent is a packed structure.
    // Bits 255-248 = 8-bit version field
    //
    // Version 0
    // =========
    // Entire structure is interpreted as the fee percent in basis points.
    // If set to 0 then partner will not receive any fees.
    //
    // Version 1
    // =========
    // Bits 13-0 = Fee percent in basis points
    // Bit 14 = positiveSlippageToUser (positive slippage to partner if not set)
    // Bit 15 = if set, take fee from fromToken, toToken otherwise
    // Bit 16 = if set, do fee distribution as per referral program

    // Used only for SELL (where needs to be done before swap or at the end if not transferring)
    function takeFromTokenFee(
        address fromToken,
        uint256 fromAmount,
        address payable partner,
        uint256 feePercent
    ) internal returns (uint256 newFromAmount) {
        uint256 fixedFeeBps = _getFixedFeeBps(partner, feePercent);
        if (fixedFeeBps == 0) return fromAmount;
        (uint256 partnerShare, uint256 paraswapShare) = _calcFixedFees(fromAmount, fixedFeeBps);
        return _distributeFees(fromAmount, fromToken, partner, partnerShare, paraswapShare);
    }

    // Used only for SELL (where can be done after swap and need to transfer)
    function takeFromTokenFeeAndTransfer(
        address fromToken,
        uint256 fromAmount,
        uint256 remainingAmount,
        address payable partner,
        uint256 feePercent
    ) internal {
        uint256 fixedFeeBps = _getFixedFeeBps(partner, feePercent);
        if (fixedFeeBps != 0) {
            (uint256 partnerShare, uint256 paraswapShare) = _calcFixedFees(fromAmount, fixedFeeBps);
            remainingAmount = _distributeFees(remainingAmount, fromToken, partner, partnerShare, paraswapShare);
        }
        Utils.transferTokens(fromToken, msg.sender, remainingAmount);
    }

    // Used only for BUY
    function takeFromTokenFeeSlippageAndTransfer(
        address fromToken,
        uint256 fromAmount,
        uint256 expectedAmount,
        uint256 remainingAmount,
        address payable partner,
        uint256 feePercent
    ) internal {
        uint256 fixedFeeBps = _getFixedFeeBps(partner, feePercent);
        uint256 slippage = _calcSlippage(fixedFeeBps, expectedAmount, fromAmount.sub(remainingAmount));
        uint256 partnerShare;
        uint256 paraswapShare;
        if (fixedFeeBps != 0) {
            (partnerShare, paraswapShare) = _calcFixedFees(expectedAmount, fixedFeeBps);
        }
        if (slippage != 0) {
            (uint256 partnerShare2, uint256 paraswapShare2) = _calcSlippageFees(slippage, partner, feePercent);
            partnerShare = partnerShare.add(partnerShare2);
            paraswapShare = paraswapShare.add(paraswapShare2);
        }
        Utils.transferTokens(
            fromToken,
            msg.sender,
            _distributeFees(remainingAmount, fromToken, partner, partnerShare, paraswapShare)
        );
    }

    // Used only for SELL
    function takeToTokenFeeSlippageAndTransfer(
        address toToken,
        uint256 expectedAmount,
        uint256 receivedAmount,
        address payable beneficiary,
        address payable partner,
        uint256 feePercent
    ) internal {
        uint256 fixedFeeBps = _getFixedFeeBps(partner, feePercent);
        uint256 slippage = _calcSlippage(fixedFeeBps, receivedAmount, expectedAmount);
        uint256 partnerShare;
        uint256 paraswapShare;
        if (fixedFeeBps != 0) {
            (partnerShare, paraswapShare) = _calcFixedFees(
                slippage != 0 ? expectedAmount : receivedAmount,
                fixedFeeBps
            );
        }
        if (slippage != 0) {
            (uint256 partnerShare2, uint256 paraswapShare2) = _calcSlippageFees(slippage, partner, feePercent);
            partnerShare = partnerShare.add(partnerShare2);
            paraswapShare = paraswapShare.add(paraswapShare2);
        }
        Utils.transferTokens(
            toToken,
            beneficiary,
            _distributeFees(receivedAmount, toToken, partner, partnerShare, paraswapShare)
        );
    }

    // Used only for BUY
    function takeToTokenFeeAndTransfer(
        address toToken,
        uint256 receivedAmount,
        address payable beneficiary,
        address payable partner,
        uint256 feePercent
    ) internal {
        uint256 fixedFeeBps = _getFixedFeeBps(partner, feePercent);
        if (fixedFeeBps != 0) {
            (uint256 partnerShare, uint256 paraswapShare) = _calcFixedFees(receivedAmount, fixedFeeBps);
            receivedAmount = _distributeFees(receivedAmount, toToken, partner, partnerShare, paraswapShare);
        }
        Utils.transferTokens(toToken, beneficiary, receivedAmount);
    }

    function _getFixedFeeBps(address partner, uint256 feePercent) private view returns (uint256 fixedFeeBps) {
        if (partner == address(0)) return 0;
        uint256 version = feePercent >> 248;
        if (version == 0) {
            fixedFeeBps = feePercent;
        } else if ((feePercent & (1 << 16)) != 0) {
            // Referrer program only has slippage fees
            return 0;
        } else {
            fixedFeeBps = feePercent & 0x3FFF;
        }
        return fixedFeeBps > maxFeePercent ? maxFeePercent : fixedFeeBps;
    }

    function _calcSlippage(
        uint256 fixedFeeBps,
        uint256 positiveAmount,
        uint256 negativeAmount
    ) private pure returns (uint256 slippage) {
        return (fixedFeeBps <= 50 && positiveAmount > negativeAmount) ? positiveAmount.sub(negativeAmount) : 0;
    }

    function _calcFixedFees(uint256 amount, uint256 fixedFeeBps)
        private
        view
        returns (uint256 partnerShare, uint256 paraswapShare)
    {
        uint256 fee = amount.mul(fixedFeeBps).div(10000);
        partnerShare = fee.mul(partnerSharePercent).div(10000);
        paraswapShare = fee.sub(partnerShare);
    }

    function _calcSlippageFees(
        uint256 slippage,
        address partner,
        uint256 feePercent
    ) private pure returns (uint256 partnerShare, uint256 paraswapShare) {
        paraswapShare = slippage.div(2);
        if (partner != address(0)) {
            uint256 version = feePercent >> 248;
            if (version != 0) {
                if ((feePercent & (1 << 16)) != 0) {
                    uint256 feeBps = feePercent & 0x3FFF;
                    partnerShare = paraswapShare.mul(feeBps > 10000 ? 10000 : feeBps).div(10000);
                } else if ((feePercent & (1 << 14)) == 0) {
                    partnerShare = paraswapShare;
                }
            }
        }
    }

    function _distributeFees(
        uint256 currentBalance,
        address token,
        address payable partner,
        uint256 partnerShare,
        uint256 paraswapShare
    ) private returns (uint256 newBalance) {
        uint256 totalFees = partnerShare.add(paraswapShare);
        if (totalFees == 0) return currentBalance;

        require(totalFees <= currentBalance, "Insufficient balance to pay for fees");

        Utils.transferTokens(token, payable(address(feeClaimer)), totalFees);
        if (partnerShare != 0) {
            feeClaimer.registerFee(partner, IERC20(token), partnerShare);
        }
        if (paraswapShare != 0) {
            feeClaimer.registerFee(feeWallet, IERC20(token), paraswapShare);
        }

        return currentBalance.sub(totalFees);
    }

    function _isTakeFeeFromSrcToken(uint256 feePercent) internal pure returns (bool) {
        return feePercent >> 248 != 0 && (feePercent & (1 << 15)) != 0;
    }
}

File 7 of 14 : IFeeClaimer.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

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

interface IFeeClaimer {
    /**
     * @notice register partner's, affiliate's and PP's fee
     * @dev only callable by AugustusSwapper contract
     * @param _account account address used to withdraw fees
     * @param _token token address
     * @param _fee fee amount in token
     */
    function registerFee(
        address _account,
        IERC20 _token,
        uint256 _fee
    ) external;

    /**
     * @notice claim partner share fee in ERC20 token
     * @dev transfers ERC20 token balance to the caller's account
     *      the call will fail if withdrawer have zero balance in the contract
     * @param _token address of the ERC20 token
     * @param _recipient address
     * @return true if the withdraw was successfull
     */
    function withdrawAllERC20(IERC20 _token, address _recipient) external returns (bool);

    /**
     * @notice batch claim whole balance of fee share amount
     * @dev transfers ERC20 token balance to the caller's account
     *      the call will fail if withdrawer have zero balance in the contract
     * @param _tokens list of addresses of the ERC20 token
     * @param _recipient address of recipient
     * @return true if the withdraw was successfull
     */
    function batchWithdrawAllERC20(IERC20[] calldata _tokens, address _recipient) external returns (bool);

    /**
     * @notice claim some partner share fee in ERC20 token
     * @dev transfers ERC20 token amount to the caller's account
     *      the call will fail if withdrawer have zero balance in the contract
     * @param _token address of the ERC20 token
     * @param _recipient address
     * @return true if the withdraw was successfull
     */
    function withdrawSomeERC20(
        IERC20 _token,
        uint256 _tokenAmount,
        address _recipient
    ) external returns (bool);

    /**
     * @notice batch claim some amount of fee share in ERC20 token
     * @dev transfers ERC20 token balance to the caller's account
     *      the call will fail if withdrawer have zero balance in the contract
     * @param _tokens address of the ERC20 tokens
     * @param _tokenAmounts array of amounts
     * @param _recipient destination account addresses
     * @return true if the withdraw was successfull
     */
    function batchWithdrawSomeERC20(
        IERC20[] calldata _tokens,
        uint256[] calldata _tokenAmounts,
        address _recipient
    ) external returns (bool);

    /**
     * @notice compute unallocated fee in token
     * @param _token address of the ERC20 token
     * @return amount of unallocated token in fees
     */
    function getUnallocatedFees(IERC20 _token) external view returns (uint256);

    /**
     * @notice returns unclaimed fee amount given the token
     * @dev retrieves the balance of ERC20 token fee amount for a partner
     * @param _token address of the ERC20 token
     * @param _partner account address of the partner
     * @return amount of balance
     */
    function getBalance(IERC20 _token, address _partner) external view returns (uint256);

    /**
     * @notice returns unclaimed fee amount given the token in batch
     * @dev retrieves the balance of ERC20 token fee amount for a partner in batch
     * @param _tokens list of ERC20 token addresses
     * @param _partner account address of the partner
     * @return _fees array of the token amount
     */
    function batchGetBalance(IERC20[] calldata _tokens, address _partner)
        external
        view
        returns (uint256[] memory _fees);
}

File 8 of 14 : Utils.sol
/*solhint-disable avoid-low-level-calls */
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../ITokenTransferProxy.sol";

interface IERC20Permit {
    function permit(
        address owner,
        address spender,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

interface IERC20PermitLegacy {
    function permit(
        address holder,
        address spender,
        uint256 nonce,
        uint256 expiry,
        bool allowed,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

library Utils {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);

    uint256 private constant MAX_UINT = type(uint256).max;

    /**
   * @param fromToken Address of the source token
   * @param fromAmount Amount of source tokens to be swapped
   * @param toAmount Minimum destination token amount expected out of this swap
   * @param expectedAmount Expected amount of destination tokens without slippage
   * @param beneficiary Beneficiary address
   * 0 then 100% will be transferred to beneficiary. Pass 10000 for 100%
   * @param path Route to be taken for this swap to take place

   */
    struct SellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.Path[] path;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct BuyData {
        address adapter;
        address fromToken;
        address toToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.Route[] route;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct MegaSwapSellData {
        address fromToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address payable beneficiary;
        Utils.MegaSwapPath[] path;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct SimpleData {
        address fromToken;
        address toToken;
        uint256 fromAmount;
        uint256 toAmount;
        uint256 expectedAmount;
        address[] callees;
        bytes exchangeData;
        uint256[] startIndexes;
        uint256[] values;
        address payable beneficiary;
        address payable partner;
        uint256 feePercent;
        bytes permit;
        uint256 deadline;
        bytes16 uuid;
    }

    struct Adapter {
        address payable adapter;
        uint256 percent;
        uint256 networkFee; //NOT USED
        Route[] route;
    }

    struct Route {
        uint256 index; //Adapter at which index needs to be used
        address targetExchange;
        uint256 percent;
        bytes payload;
        uint256 networkFee; //NOT USED - Network fee is associated with 0xv3 trades
    }

    struct MegaSwapPath {
        uint256 fromAmountPercent;
        Path[] path;
    }

    struct Path {
        address to;
        uint256 totalNetworkFee; //NOT USED - Network fee is associated with 0xv3 trades
        Adapter[] adapters;
    }

    function ethAddress() internal pure returns (address) {
        return ETH_ADDRESS;
    }

    function maxUint() internal pure returns (uint256) {
        return MAX_UINT;
    }

    function approve(
        address addressToApprove,
        address token,
        uint256 amount
    ) internal {
        if (token != ETH_ADDRESS) {
            IERC20 _token = IERC20(token);

            uint256 allowance = _token.allowance(address(this), addressToApprove);

            if (allowance < amount) {
                _token.safeApprove(addressToApprove, 0);
                _token.safeIncreaseAllowance(addressToApprove, MAX_UINT);
            }
        }
    }

    function transferTokens(
        address token,
        address payable destination,
        uint256 amount
    ) internal {
        if (amount > 0) {
            if (token == ETH_ADDRESS) {
                (bool result, ) = destination.call{ value: amount, gas: 10000 }("");
                require(result, "Failed to transfer Ether");
            } else {
                IERC20(token).safeTransfer(destination, amount);
            }
        }
    }

    function tokenBalance(address token, address account) internal view returns (uint256) {
        if (token == ETH_ADDRESS) {
            return account.balance;
        } else {
            return IERC20(token).balanceOf(account);
        }
    }

    function permit(address token, bytes memory permit) internal {
        if (permit.length == 32 * 7) {
            (bool success, ) = token.call(abi.encodePacked(IERC20Permit.permit.selector, permit));
            require(success, "Permit failed");
        }

        if (permit.length == 32 * 8) {
            (bool success, ) = token.call(abi.encodePacked(IERC20PermitLegacy.permit.selector, permit));
            require(success, "Permit failed");
        }
    }

    function transferETH(address payable destination, uint256 amount) internal {
        if (amount > 0) {
            (bool result, ) = destination.call{ value: amount, gas: 10000 }("");
            require(result, "Transfer ETH failed");
        }
    }
}

File 9 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @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);
}

File 10 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

    /**
     * @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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 11 of 14 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 12 of 14 : ITokenTransferProxy.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

interface ITokenTransferProxy {
    function transferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    ) external;
}

File 13 of 14 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 14 : AugustusStorage.sol
// SPDX-License-Identifier: ISC

pragma solidity 0.7.5;

import "./ITokenTransferProxy.sol";

contract AugustusStorage {
    struct FeeStructure {
        uint256 partnerShare;
        bool noPositiveSlippage;
        bool positiveSlippageToUser;
        uint16 feePercent;
        string partnerId;
        bytes data;
    }

    ITokenTransferProxy internal tokenTransferProxy;
    address payable internal feeWallet;

    mapping(address => FeeStructure) internal registeredPartners;

    mapping(bytes4 => address) internal selectorVsRouter;
    mapping(bytes32 => bool) internal adapterInitialized;
    mapping(bytes32 => bytes) internal adapterVsData;

    mapping(bytes32 => bytes) internal routerData;
    mapping(bytes32 => bool) internal routerInitialized;

    bytes32 public constant WHITELISTED_ROLE = keccak256("WHITELISTED_ROLE");

    bytes32 public constant ROUTER_ROLE = keccak256("ROUTER_ROLE");
}

Settings
{
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_partnerSharePercent","type":"uint256"},{"internalType":"uint256","name":"_maxFeePercent","type":"uint256"},{"internalType":"contract IFeeClaimer","name":"_feeClaimer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes16","name":"uuid","type":"bytes16"},{"indexed":false,"internalType":"address","name":"partner","type":"address"},{"indexed":false,"internalType":"uint256","name":"feePercent","type":"uint256"},{"indexed":false,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":true,"internalType":"address","name":"srcToken","type":"address"},{"indexed":true,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"receivedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expectedAmount","type":"uint256"}],"name":"BoughtV3","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes16","name":"uuid","type":"bytes16"},{"indexed":false,"internalType":"address","name":"partner","type":"address"},{"indexed":false,"internalType":"uint256","name":"feePercent","type":"uint256"},{"indexed":false,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":true,"internalType":"address","name":"srcToken","type":"address"},{"indexed":true,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"receivedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expectedAmount","type":"uint256"}],"name":"SwappedV3","type":"event"},{"inputs":[],"name":"ROUTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WHITELISTED_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"adapter","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"uint256","name":"expectedAmount","type":"uint256"},{"internalType":"address payable","name":"beneficiary","type":"address"},{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"targetExchange","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"networkFee","type":"uint256"}],"internalType":"struct Utils.Route[]","name":"route","type":"tuple[]"},{"internalType":"address payable","name":"partner","type":"address"},{"internalType":"uint256","name":"feePercent","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes16","name":"uuid","type":"bytes16"}],"internalType":"struct Utils.BuyData","name":"data","type":"tuple"}],"name":"buy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeClaimer","outputs":[{"internalType":"contract IFeeClaimer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"uint256","name":"expectedAmount","type":"uint256"},{"internalType":"address payable","name":"beneficiary","type":"address"},{"components":[{"internalType":"uint256","name":"fromAmountPercent","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"totalNetworkFee","type":"uint256"},{"components":[{"internalType":"address payable","name":"adapter","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"uint256","name":"networkFee","type":"uint256"},{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"targetExchange","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"networkFee","type":"uint256"}],"internalType":"struct Utils.Route[]","name":"route","type":"tuple[]"}],"internalType":"struct Utils.Adapter[]","name":"adapters","type":"tuple[]"}],"internalType":"struct Utils.Path[]","name":"path","type":"tuple[]"}],"internalType":"struct Utils.MegaSwapPath[]","name":"path","type":"tuple[]"},{"internalType":"address payable","name":"partner","type":"address"},{"internalType":"uint256","name":"feePercent","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes16","name":"uuid","type":"bytes16"}],"internalType":"struct Utils.MegaSwapSellData","name":"data","type":"tuple"}],"name":"megaSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"uint256","name":"expectedAmount","type":"uint256"},{"internalType":"address payable","name":"beneficiary","type":"address"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"totalNetworkFee","type":"uint256"},{"components":[{"internalType":"address payable","name":"adapter","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"uint256","name":"networkFee","type":"uint256"},{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"targetExchange","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"networkFee","type":"uint256"}],"internalType":"struct Utils.Route[]","name":"route","type":"tuple[]"}],"internalType":"struct Utils.Adapter[]","name":"adapters","type":"tuple[]"}],"internalType":"struct Utils.Path[]","name":"path","type":"tuple[]"},{"internalType":"address payable","name":"partner","type":"address"},{"internalType":"uint256","name":"feePercent","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes16","name":"uuid","type":"bytes16"}],"internalType":"struct Utils.SellData","name":"data","type":"tuple"}],"name":"multiSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"partnerSharePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60e06040523480156200001157600080fd5b506040516200322438038062003224833981016040819052620000349162000053565b60809290925260a05260601b6001600160601b03191660c05262000099565b60008060006060848603121562000068578283fd5b83516020850151604086015191945092506001600160a01b03811681146200008e578182fd5b809150509250925092565b60805160a05160c05160601c61313d620000e7600039806108715280611b365280611b635280611c89525080610a725280611a0a5280611a375250806101b45280611a80525061313d6000f3fe6080604052600436106100b15760003560e01c80637a3226ec1161006957806382678dd61161004e57806382678dd614610175578063a94e78ef1461018a578063d830a05b1461019d576100b1565b80637a3226ec1461013e57806381cbd3ea14610153576100b1565b8063353269101161009a57806335326910146100f6578063439fab911461010957806346c67b6d1461012b576100b1565b806312070a41146100b657806330d643b5146100e1575b600080fd5b3480156100c257600080fd5b506100cb6101b2565b6040516100d89190612cf8565b60405180910390f35b3480156100ed57600080fd5b506100cb6101d6565b6100cb610104366004612754565b6101fa565b34801561011557600080fd5b506101296101243660046126e7565b610494565b005b6100cb61013936600461288a565b6104c6565b34801561014a57600080fd5b506100cb61084b565b34801561015f57600080fd5b5061016861086f565b6040516100d89190612b45565b34801561018157600080fd5b506100cb610893565b6100cb61019836600461298d565b6108bf565b3480156101a957600080fd5b506100cb610a70565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f7a05a596cb0ce7fdea8a1e1ec73be300bdb35097c944ce1897202f7a13122eb281565b6000428261016001511015610244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f60565b60405180910390fd5b60208201516060830151610256610a94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461028f576000610291565b805b34146102c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612ecc565b608084015160c085015160009073ffffffffffffffffffffffffffffffffffffffff16156102fb578560c001516102fd565b335b604087015160a08801519192509083610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f97565b61035286868a6101400151610aac565b600061036a8960000151888589898e60e00151610b84565b9050600061037c8a6101200151610ecc565b6103b3576103978483878d61010001518e6101200151610eea565b6103a18830610f34565b90506103ae88338361102f565b6103e2565b6103be84868461102f565b6103c88830610f34565b90506103e2888885848e61010001518f6101200151611136565b6103ec87826111cc565b96508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f4cc7e95e48af62690313a0733e93308ac9a73326bc3c29f1788b1191c376d5b68d61018001518e61010001518f6101200151338e8a8c60405161047d9796959493929190612c88565b60405180910390a45096505050505050505b919050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e5e565b6000428261012001511015610507576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f60565b81516020830151610516610a94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461054f576000610551565b805b3414610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612ecc565b60408401516060850151608086015160009073ffffffffffffffffffffffffffffffffffffffff16156105c05786608001516105c2565b335b905060608760a0015190506000816000815181106105dc57fe5b6020026020010151602001516001836000815181106105f757fe5b60200260200101516020015151038151811061060f57fe5b602002602001015160000151905060008511610657576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f97565b61066787878b6101000151610aac565b6106748960e00151610ecc565b156106905761068d87878b60c001518c60e00151611243565b95505b60005b825160ff168160ff1610156107295760006106dd6127106106d7868560ff16815181106106bc57fe5b6020026020010151600001518b61128c90919063ffffffff16565b906112ff565b905060018451038260ff1614156106fb576106f88930610f34565b90505b6107208982868560ff168151811061070f57fe5b602002602001015160200151611380565b50600101610693565b5060006107368230610f34565b905085811015610772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f03565b61077f8a60e00151610ecc565b61079e57610799828683878e60c001518f60e00151611741565b6107a9565b6107a982858361102f565b8173ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb08d61014001518e60c001518f60e00151338e898e6040516108369796959493929190612c88565b60405180910390a49998505050505050505050565b7f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b4981565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006040516020016108a490612af3565b60405160208183030381529060405280519060200120905090565b6000428261012001511015610900576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f60565b8151602083015161090f610a94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461094857600061094a565b805b3414610982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612ecc565b60408401516060850151608086015160009073ffffffffffffffffffffffffffffffffffffffff16156109b95786608001516109bb565b335b905060608760a0015190506000816001835103815181106109d857fe5b602002602001015160000151905060008511610a20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f97565b610a3087878b6101000151610aac565b610a3d8960e00151610ecc565b15610a5957610a5687878b60c001518c60e00151611243565b95505b610a64878784611380565b60006107368230610f34565b7f000000000000000000000000000000000000000000000000000000000000000081565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b610ab4610a94565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b7f57610af083826117c9565b6000546040517f15dacbea00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906315dacbea90610b4c908690339030908890600401612b66565b600060405180830381600087803b158015610b6657600080fd5b505af1158015610b7a573d6000803e3d6000fd5b505050505b505050565b6040517f91d1485400000000000000000000000000000000000000000000000000000000815260009030906391d1485490610be5907f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b49908b90600401612d01565b60206040518083038186803b158015610bfd57600080fd5b505afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3591906126c7565b610c6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e27565b60005b8251811015610e7857610c7f6121ae565b838281518110610c8b57fe5b60200260200101519050600080610cad600187516111cc90919063ffffffff16565b841415610cdb57610cc8610cc18a30610f34565b88906111cc565b9050610cd48a30610f34565b9150610d1a565b610cf86127106106d785604001518b61128c90919063ffffffff16565b9150610d176127106106d785604001518a61128c90919063ffffffff16565b90505b60008b73ffffffffffffffffffffffffffffffffffffffff166325deee1e60e01b85600001518d8d87878a602001518b60600151604051602401610d649796959493929190612fce565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610ded9190612ad7565b600060405180830381855af49150503d8060008114610e28576040519150601f19603f3d011682016040523d82523d6000602084013e610e2d565b606091505b5050905080610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e95565b505060019092019150610c6e9050565b506000610e858630610f34565b905083811015610ec1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612d5c565b979650505050505050565b600060f882901c15801590610ee45750618000821615155b92915050565b6000610ef683836119b4565b90508015610f2157600080610f0b8784611a5e565b91509150610f1c8789878585611aba565b965050505b610f2c86858761102f565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610f86575073ffffffffffffffffffffffffffffffffffffffff811631610ee4565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610fd8908590600401612b45565b60206040518083038186803b158015610ff057600080fd5b505afa158015611004573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110289190612a2d565b9392505050565b8015610b7f5773ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156111155760008273ffffffffffffffffffffffffffffffffffffffff16826127109060405161109190612b42565b600060405180830381858888f193505050503d80600081146110cf576040519150601f19603f3d011682016040523d82523d6000602084013e6110d4565b606091505b505090508061110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612d25565b50610b7f565b610b7f73ffffffffffffffffffffffffffffffffffffffff84168383611d03565b600061114283836119b4565b9050600061115a82876111558a896111cc565b611d90565b905060008083156111755761116f8885611a5e565b90925090505b82156111a957600080611189858989611db7565b90925090506111988483611e3e565b93506111a48382611e3e565b925050505b6111c08a336111bb8a8e8b8888611aba565b61102f565b50505050505050505050565b60008282111561123d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008061125084846119b4565b9050806112605784915050611284565b60008061126d8784611a5e565b9150915061127e8789888585611aba565b93505050505b949350505050565b60008261129b57506000610ee4565b828202828482816112a857fe5b0414611028576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130c26021913960400191505060405180910390fd5b600080821161136f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161137857fe5b049392505050565b60008151116113bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612df0565b60005b815181101561173b5760008082116113d657846113f2565b8260018303815181106113e557fe5b6020026020010151600001515b9050600083838151811061140257fe5b6020026020010151600001519050600080841161141f5785611429565b6114298330610f34565b905060005b85858151811061143a57fe5b6020026020010151604001515181101561172b576114566121f3565b86868151811061146257fe5b602002602001015160400151828151811061147957fe5b602090810291909101015180516040517f91d1485400000000000000000000000000000000000000000000000000000000815291925030916391d14854916114e6917f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b499190600401612d01565b60206040518083038186803b1580156114fe57600080fd5b505afa158015611512573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153691906126c7565b61156c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e27565b600080871180156115a757506115a4600189898151811061158957fe5b602002602001015160400151516111cc90919063ffffffff16565b83145b6115cd576115c86127106106d784602001518761128c90919063ffffffff16565b6115d7565b6115d78630610f34565b90506000826000015173ffffffffffffffffffffffffffffffffffffffff1663e76b146c60e01b8888856000886060015160405160240161161c959493929190612b9d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516116a59190612ad7565b600060405180830381855af49150503d80600081146116e0576040519150601f19603f3d011682016040523d82523d6000602084013e6116e5565b606091505b5050905080611720576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e95565b50505060010161142e565b5050600190920191506113be9050565b50505050565b600061174d83836119b4565b9050600061175c828789611d90565b905060008083156117835761177d836117755788611777565b895b85611a5e565b90925090505b82156117b757600080611797858989611db7565b90925090506117a68483611e3e565b93506117b28382611e3e565b925050505b6111c08a886111bb8b8e8b8888611aba565b805160e014156118bd5760008273ffffffffffffffffffffffffffffffffffffffff1663d505accf60e01b83604051602001611806929190612a8f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261183e91612ad7565b6000604051808303816000865af19150503d806000811461187b576040519150601f19603f3d011682016040523d82523d6000602084013e611880565b606091505b50509050806118bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612db9565b505b805161010014156119b05760008273ffffffffffffffffffffffffffffffffffffffff16638fcbaf0c60e01b836040516020016118fb929190612a8f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261193391612ad7565b6000604051808303816000865af19150503d8060008114611970576040519150601f19603f3d011682016040523d82523d6000602084013e611975565b606091505b5050905080610b7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612db9565b5050565b600073ffffffffffffffffffffffffffffffffffffffff83166119d957506000610ee4565b60f882901c806119eb57829150611a08565b62010000831615611a00576000915050610ee4565b82613fff1691505b7f00000000000000000000000000000000000000000000000000000000000000008211611a355781611284565b7f0000000000000000000000000000000000000000000000000000000000000000949350505050565b60008080611a726127106106d7878761128c565b9050611aa46127106106d7837f000000000000000000000000000000000000000000000000000000000000000061128c565b9250611ab081846111cc565b9150509250929050565b600080611ac78484611e3e565b905080611ad75786915050611cfa565b86811115611b30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806130e36024913960400191505060405180910390fd5b611b5b867f00000000000000000000000000000000000000000000000000000000000000008361102f565b8315611c29577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d1f4354b8688876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015611c1057600080fd5b505af1158015611c24573d6000803e3d6000fd5b505050505b8215611cec57600154604080517fd1f4354b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316600482015288831660248201526044810186905290517f00000000000000000000000000000000000000000000000000000000000000009092169163d1f4354b9160648082019260009290919082900301818387803b158015611cd357600080fd5b505af1158015611ce7573d6000803e3d6000fd5b505050505b611cf687826111cc565b9150505b95945050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610b7f908490611eb2565b600060328411158015611da257508183115b611dad576000611284565b61128483836111cc565b600080611dc58560026112ff565b905073ffffffffffffffffffffffffffffffffffffffff841615611e365760f883901c8015611e345762010000841615611e2757613fff8416611e1f6127106106d7818411611e145783611e18565b6127105b869061128c565b935050611e34565b6140008416611e34578192505b505b935093915050565b60008282018381101561102857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6060611f14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f8a9092919063ffffffff16565b805190915015610b7f57808060200190516020811015611f3357600080fd5b5051610b7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613107602a913960400191505060405180910390fd5b6060611284848460008585611f9e856120ea565b61200957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061207357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612036565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146120d5576040519150601f19603f3d011682016040523d82523d6000602084013e6120da565b606091505b5091509150610ec18282866120f0565b3b151590565b606083156120ff575081611028565b82511561210f5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561217357818101518382015260200161215b565b50505050905090810190601f1680156121a05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001600081525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001606081525090565b803561048f8161309c565b600082601f83011261224c578081fd5b813561225f61225a82613052565b61302e565b818152915060208083019084810160005b8481101561230e57813587016040807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c030112156122af57600080fd5b805181810167ffffffffffffffff82821081831117156122cb57fe5b8184528488013583529284013592808411156122e657600080fd5b50506122f68b8784860101612319565b81870152865250509282019290820190600101612270565b505050505092915050565b600082601f830112612329578081fd5b61233661225a8335613052565b823581529050602080820190830160005b8435811015612512578135850160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082890301121561238657600080fd5b60405180606082011067ffffffffffffffff606083011117156123a557fe5b606081016040526123b9602083013561309c565b602082013581526040820135602082015267ffffffffffffffff606083013511156123e357600080fd5b60608201358201915087603f8301126123fb57600080fd5b61240b61225a6020840135613052565b60208381013582528101906040840160005b60208601358110156124f4578135860160807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0828f0301121561245f57600080fd5b60405180608082011067ffffffffffffffff6080830111171561247e57fe5b60808101604052612492604083013561309c565b60408201358152606082013560208201526080820135604082015267ffffffffffffffff60a083013511156124c657600080fd5b6124d98e604060a085013585010161251b565b6060820152855250602093840193919091019060010161241d565b50506040830152508452506020928301929190910190600101612347565b50505092915050565b600082601f83011261252b578081fd5b813561253961225a82613052565b818152915060208083019084810160005b8481101561230e578135870160a0807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c0301121561258957600080fd5b6040805182810167ffffffffffffffff82821081831117156125a757fe5b8184528886013583526125bb848701612231565b898401526060915081860135848401526080935083860135818111156125e057600080fd5b6125ee8f8b838a0101612642565b9284019290925250509290910135908201528452928201929082019060010161254a565b80357fffffffffffffffffffffffffffffffff000000000000000000000000000000008116811461048f57600080fd5b600082601f830112612652578081fd5b813567ffffffffffffffff81111561266657fe5b61269760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161302e565b91508082528360208285010111156126ae57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126d8578081fd5b81518015158114611028578182fd5b600080602083850312156126f9578081fd5b823567ffffffffffffffff80821115612710578283fd5b818501915085601f830112612723578283fd5b813581811115612731578384fd5b866020828501011115612742578384fd5b60209290920196919550909350505050565b600060208284031215612765578081fd5b813567ffffffffffffffff8082111561277c578283fd5b81840191506101a0808387031215612792578384fd5b61279b8161302e565b90506127a683612231565b81526127b460208401612231565b60208201526127c560408401612231565b6040820152606083013560608201526080830135608082015260a083013560a08201526127f460c08401612231565b60c082015260e08301358281111561280a578485fd5b6128168782860161251b565b60e08301525061010061282a818501612231565b908201526101208381013590820152610140808401358381111561284c578586fd5b61285888828701612642565b82840152505061016091508183013582820152610180915061287b828401612612565b91810191909152949350505050565b60006020828403121561289b578081fd5b813567ffffffffffffffff808211156128b2578283fd5b81840191506101608083870312156128c8578384fd5b6128d18161302e565b90506128dc83612231565b815260208301356020820152604083013560408201526060830135606082015261290860808401612231565b608082015260a08301358281111561291e578485fd5b61292a8782860161223c565b60a08301525061293c60c08401612231565b60c082015260e083013560e0820152610100808401358381111561295e578586fd5b61296a88828701612642565b82840152505061012091508183013582820152610140915061287b828401612612565b60006020828403121561299e578081fd5b813567ffffffffffffffff808211156129b5578283fd5b81840191506101608083870312156129cb578384fd5b6129d48161302e565b90506129df83612231565b8152602083013560208201526040830135604082015260608301356060820152612a0b60808401612231565b608082015260a083013582811115612a21578485fd5b61292a87828601612319565b600060208284031215612a3e578081fd5b5051919050565b60008151808452612a5d816020860160208601613070565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60007fffffffff00000000000000000000000000000000000000000000000000000000841682528251612ac9816004850160208701613070565b919091016004019392505050565b60008251612ae9818460208701613070565b9190910192915050565b7f4d554c5449504154485f524f555445520000000000000000000000000000000081527f312e302e30000000000000000000000000000000000000000000000000000000601082015260150190565b90565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9485168152928416602084015292166040820152606081019190915260800190565b600060a080830173ffffffffffffffffffffffffffffffffffffffff808a1685526020818a16818701526040898188015260608981890152608086818a0152858a5180885260c08b01915060c08682028c01019750858c018a5b82811015612c70577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff408d8b03018452815180518b52898982015116898c015287810151888c0152868101518c888d0152612c538d8d0182612a45565b918701519b87019b909b5299509287019290870190600101612bf7565b50505050505050505080925050509695505050505050565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000097909716875273ffffffffffffffffffffffffffffffffffffffff95861660208801526040870194909452919093166060850152608084019290925260a083019190915260c082015260e00190565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60208082526018908201527f4661696c656420746f207472616e736665722045746865720000000000000000604082015260600190565b60208082526037908201527f526563656976656420616d6f756e74206f6620746f6b656e7320617265206c6560408201527f7373207468656e20657870656374656420746f6b656e73000000000000000000606082015260800190565b6020808252600d908201527f5065726d6974206661696c656400000000000000000000000000000000000000604082015260600190565b6020808252601a908201527f50617468206e6f742070726f766964656420666f722073776170000000000000604082015260600190565b60208082526018908201527f45786368616e6765206e6f742077686974656c69737465640000000000000000604082015260600190565b60208082526016908201527f4d4554484f44204e4f5420494d504c454d454e54454400000000000000000000604082015260600190565b60208082526016908201527f43616c6c20746f2061646170746572206661696c656400000000000000000000604082015260600190565b60208082526013908201527f496e636f7272656374206d73672e76616c756500000000000000000000000000604082015260600190565b60208082526030908201527f526563656976656420616d6f756e74206f6620746f6b656e7320617265206c6560408201527f7373207468656e20657870656374656400000000000000000000000000000000606082015260800190565b60208082526011908201527f446561646c696e65206272656163686564000000000000000000000000000000604082015260600190565b60208082526016908201527f546f20616d6f756e742063616e206e6f74206265203000000000000000000000604082015260600190565b600088825273ffffffffffffffffffffffffffffffffffffffff8089166020840152808816604084015286606084015285608084015280851660a08401525060e060c083015261302160e0830184612a45565b9998505050505050505050565b60405181810167ffffffffffffffff8111828210171561304a57fe5b604052919050565b600067ffffffffffffffff82111561306657fe5b5060209081020190565b60005b8381101561308b578181015183820152602001613073565b8381111561173b5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff811681146130be57600080fd5b5056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77496e73756666696369656e742062616c616e636520746f2070617920666f7220666565735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a164736f6c6343000705000a000000000000000000000000000000000000000000000000000000000000213400000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f7

Deployed Bytecode

0x6080604052600436106100b15760003560e01c80637a3226ec1161006957806382678dd61161004e57806382678dd614610175578063a94e78ef1461018a578063d830a05b1461019d576100b1565b80637a3226ec1461013e57806381cbd3ea14610153576100b1565b8063353269101161009a57806335326910146100f6578063439fab911461010957806346c67b6d1461012b576100b1565b806312070a41146100b657806330d643b5146100e1575b600080fd5b3480156100c257600080fd5b506100cb6101b2565b6040516100d89190612cf8565b60405180910390f35b3480156100ed57600080fd5b506100cb6101d6565b6100cb610104366004612754565b6101fa565b34801561011557600080fd5b506101296101243660046126e7565b610494565b005b6100cb61013936600461288a565b6104c6565b34801561014a57600080fd5b506100cb61084b565b34801561015f57600080fd5b5061016861086f565b6040516100d89190612b45565b34801561018157600080fd5b506100cb610893565b6100cb61019836600461298d565b6108bf565b3480156101a957600080fd5b506100cb610a70565b7f000000000000000000000000000000000000000000000000000000000000213481565b7f7a05a596cb0ce7fdea8a1e1ec73be300bdb35097c944ce1897202f7a13122eb281565b6000428261016001511015610244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f60565b60405180910390fd5b60208201516060830151610256610a94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461028f576000610291565b805b34146102c9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612ecc565b608084015160c085015160009073ffffffffffffffffffffffffffffffffffffffff16156102fb578560c001516102fd565b335b604087015160a08801519192509083610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f97565b61035286868a6101400151610aac565b600061036a8960000151888589898e60e00151610b84565b9050600061037c8a6101200151610ecc565b6103b3576103978483878d61010001518e6101200151610eea565b6103a18830610f34565b90506103ae88338361102f565b6103e2565b6103be84868461102f565b6103c88830610f34565b90506103e2888885848e61010001518f6101200151611136565b6103ec87826111cc565b96508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f4cc7e95e48af62690313a0733e93308ac9a73326bc3c29f1788b1191c376d5b68d61018001518e61010001518f6101200151338e8a8c60405161047d9796959493929190612c88565b60405180910390a45096505050505050505b919050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e5e565b6000428261012001511015610507576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f60565b81516020830151610516610a94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461054f576000610551565b805b3414610589576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612ecc565b60408401516060850151608086015160009073ffffffffffffffffffffffffffffffffffffffff16156105c05786608001516105c2565b335b905060608760a0015190506000816000815181106105dc57fe5b6020026020010151602001516001836000815181106105f757fe5b60200260200101516020015151038151811061060f57fe5b602002602001015160000151905060008511610657576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f97565b61066787878b6101000151610aac565b6106748960e00151610ecc565b156106905761068d87878b60c001518c60e00151611243565b95505b60005b825160ff168160ff1610156107295760006106dd6127106106d7868560ff16815181106106bc57fe5b6020026020010151600001518b61128c90919063ffffffff16565b906112ff565b905060018451038260ff1614156106fb576106f88930610f34565b90505b6107208982868560ff168151811061070f57fe5b602002602001015160200151611380565b50600101610693565b5060006107368230610f34565b905085811015610772576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f03565b61077f8a60e00151610ecc565b61079e57610799828683878e60c001518f60e00151611741565b6107a9565b6107a982858361102f565b8173ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fe00361d207b252a464323eb23d45d42583e391f2031acdd2e9fa36efddd43cb08d61014001518e60c001518f60e00151338e898e6040516108369796959493929190612c88565b60405180910390a49998505050505050505050565b7f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b4981565b7f000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f781565b60006040516020016108a490612af3565b60405160208183030381529060405280519060200120905090565b6000428261012001511015610900576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f60565b8151602083015161090f610a94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461094857600061094a565b805b3414610982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612ecc565b60408401516060850151608086015160009073ffffffffffffffffffffffffffffffffffffffff16156109b95786608001516109bb565b335b905060608760a0015190506000816001835103815181106109d857fe5b602002602001015160000151905060008511610a20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612f97565b610a3087878b6101000151610aac565b610a3d8960e00151610ecc565b15610a5957610a5687878b60c001518c60e00151611243565b95505b610a64878784611380565b60006107368230610f34565b7f00000000000000000000000000000000000000000000000000000000000001f481565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b610ab4610a94565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b7f57610af083826117c9565b6000546040517f15dacbea00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906315dacbea90610b4c908690339030908890600401612b66565b600060405180830381600087803b158015610b6657600080fd5b505af1158015610b7a573d6000803e3d6000fd5b505050505b505050565b6040517f91d1485400000000000000000000000000000000000000000000000000000000815260009030906391d1485490610be5907f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b49908b90600401612d01565b60206040518083038186803b158015610bfd57600080fd5b505afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3591906126c7565b610c6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e27565b60005b8251811015610e7857610c7f6121ae565b838281518110610c8b57fe5b60200260200101519050600080610cad600187516111cc90919063ffffffff16565b841415610cdb57610cc8610cc18a30610f34565b88906111cc565b9050610cd48a30610f34565b9150610d1a565b610cf86127106106d785604001518b61128c90919063ffffffff16565b9150610d176127106106d785604001518a61128c90919063ffffffff16565b90505b60008b73ffffffffffffffffffffffffffffffffffffffff166325deee1e60e01b85600001518d8d87878a602001518b60600151604051602401610d649796959493929190612fce565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610ded9190612ad7565b600060405180830381855af49150503d8060008114610e28576040519150601f19603f3d011682016040523d82523d6000602084013e610e2d565b606091505b5050905080610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e95565b505060019092019150610c6e9050565b506000610e858630610f34565b905083811015610ec1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612d5c565b979650505050505050565b600060f882901c15801590610ee45750618000821615155b92915050565b6000610ef683836119b4565b90508015610f2157600080610f0b8784611a5e565b91509150610f1c8789878585611aba565b965050505b610f2c86858761102f565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610f86575073ffffffffffffffffffffffffffffffffffffffff811631610ee4565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190610fd8908590600401612b45565b60206040518083038186803b158015610ff057600080fd5b505afa158015611004573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110289190612a2d565b9392505050565b8015610b7f5773ffffffffffffffffffffffffffffffffffffffff831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156111155760008273ffffffffffffffffffffffffffffffffffffffff16826127109060405161109190612b42565b600060405180830381858888f193505050503d80600081146110cf576040519150601f19603f3d011682016040523d82523d6000602084013e6110d4565b606091505b505090508061110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612d25565b50610b7f565b610b7f73ffffffffffffffffffffffffffffffffffffffff84168383611d03565b600061114283836119b4565b9050600061115a82876111558a896111cc565b611d90565b905060008083156111755761116f8885611a5e565b90925090505b82156111a957600080611189858989611db7565b90925090506111988483611e3e565b93506111a48382611e3e565b925050505b6111c08a336111bb8a8e8b8888611aba565b61102f565b50505050505050505050565b60008282111561123d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008061125084846119b4565b9050806112605784915050611284565b60008061126d8784611a5e565b9150915061127e8789888585611aba565b93505050505b949350505050565b60008261129b57506000610ee4565b828202828482816112a857fe5b0414611028576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130c26021913960400191505060405180910390fd5b600080821161136f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161137857fe5b049392505050565b60008151116113bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612df0565b60005b815181101561173b5760008082116113d657846113f2565b8260018303815181106113e557fe5b6020026020010151600001515b9050600083838151811061140257fe5b6020026020010151600001519050600080841161141f5785611429565b6114298330610f34565b905060005b85858151811061143a57fe5b6020026020010151604001515181101561172b576114566121f3565b86868151811061146257fe5b602002602001015160400151828151811061147957fe5b602090810291909101015180516040517f91d1485400000000000000000000000000000000000000000000000000000000815291925030916391d14854916114e6917f8429d542926e6695b59ac6fbdcd9b37e8b1aeb757afab06ab60b1bb5878c3b499190600401612d01565b60206040518083038186803b1580156114fe57600080fd5b505afa158015611512573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153691906126c7565b61156c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e27565b600080871180156115a757506115a4600189898151811061158957fe5b602002602001015160400151516111cc90919063ffffffff16565b83145b6115cd576115c86127106106d784602001518761128c90919063ffffffff16565b6115d7565b6115d78630610f34565b90506000826000015173ffffffffffffffffffffffffffffffffffffffff1663e76b146c60e01b8888856000886060015160405160240161161c959493929190612b9d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516116a59190612ad7565b600060405180830381855af49150503d80600081146116e0576040519150601f19603f3d011682016040523d82523d6000602084013e6116e5565b606091505b5050905080611720576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612e95565b50505060010161142e565b5050600190920191506113be9050565b50505050565b600061174d83836119b4565b9050600061175c828789611d90565b905060008083156117835761177d836117755788611777565b895b85611a5e565b90925090505b82156117b757600080611797858989611db7565b90925090506117a68483611e3e565b93506117b28382611e3e565b925050505b6111c08a886111bb8b8e8b8888611aba565b805160e014156118bd5760008273ffffffffffffffffffffffffffffffffffffffff1663d505accf60e01b83604051602001611806929190612a8f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261183e91612ad7565b6000604051808303816000865af19150503d806000811461187b576040519150601f19603f3d011682016040523d82523d6000602084013e611880565b606091505b50509050806118bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612db9565b505b805161010014156119b05760008273ffffffffffffffffffffffffffffffffffffffff16638fcbaf0c60e01b836040516020016118fb929190612a8f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261193391612ad7565b6000604051808303816000865af19150503d8060008114611970576040519150601f19603f3d011682016040523d82523d6000602084013e611975565b606091505b5050905080610b7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161023b90612db9565b5050565b600073ffffffffffffffffffffffffffffffffffffffff83166119d957506000610ee4565b60f882901c806119eb57829150611a08565b62010000831615611a00576000915050610ee4565b82613fff1691505b7f00000000000000000000000000000000000000000000000000000000000001f48211611a355781611284565b7f00000000000000000000000000000000000000000000000000000000000001f4949350505050565b60008080611a726127106106d7878761128c565b9050611aa46127106106d7837f000000000000000000000000000000000000000000000000000000000000213461128c565b9250611ab081846111cc565b9150509250929050565b600080611ac78484611e3e565b905080611ad75786915050611cfa565b86811115611b30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806130e36024913960400191505060405180910390fd5b611b5b867f000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f78361102f565b8315611c29577f000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f773ffffffffffffffffffffffffffffffffffffffff1663d1f4354b8688876040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015611c1057600080fd5b505af1158015611c24573d6000803e3d6000fd5b505050505b8215611cec57600154604080517fd1f4354b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316600482015288831660248201526044810186905290517f000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f79092169163d1f4354b9160648082019260009290919082900301818387803b158015611cd357600080fd5b505af1158015611ce7573d6000803e3d6000fd5b505050505b611cf687826111cc565b9150505b95945050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610b7f908490611eb2565b600060328411158015611da257508183115b611dad576000611284565b61128483836111cc565b600080611dc58560026112ff565b905073ffffffffffffffffffffffffffffffffffffffff841615611e365760f883901c8015611e345762010000841615611e2757613fff8416611e1f6127106106d7818411611e145783611e18565b6127105b869061128c565b935050611e34565b6140008416611e34578192505b505b935093915050565b60008282018381101561102857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6060611f14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f8a9092919063ffffffff16565b805190915015610b7f57808060200190516020811015611f3357600080fd5b5051610b7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613107602a913960400191505060405180910390fd5b6060611284848460008585611f9e856120ea565b61200957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061207357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612036565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146120d5576040519150601f19603f3d011682016040523d82523d6000602084013e6120da565b606091505b5091509150610ec18282866120f0565b3b151590565b606083156120ff575081611028565b82511561210f5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561217357818101518382015260200161215b565b50505050905090810190601f1680156121a05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001600081525090565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001606081525090565b803561048f8161309c565b600082601f83011261224c578081fd5b813561225f61225a82613052565b61302e565b818152915060208083019084810160005b8481101561230e57813587016040807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c030112156122af57600080fd5b805181810167ffffffffffffffff82821081831117156122cb57fe5b8184528488013583529284013592808411156122e657600080fd5b50506122f68b8784860101612319565b81870152865250509282019290820190600101612270565b505050505092915050565b600082601f830112612329578081fd5b61233661225a8335613052565b823581529050602080820190830160005b8435811015612512578135850160607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082890301121561238657600080fd5b60405180606082011067ffffffffffffffff606083011117156123a557fe5b606081016040526123b9602083013561309c565b602082013581526040820135602082015267ffffffffffffffff606083013511156123e357600080fd5b60608201358201915087603f8301126123fb57600080fd5b61240b61225a6020840135613052565b60208381013582528101906040840160005b60208601358110156124f4578135860160807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0828f0301121561245f57600080fd5b60405180608082011067ffffffffffffffff6080830111171561247e57fe5b60808101604052612492604083013561309c565b60408201358152606082013560208201526080820135604082015267ffffffffffffffff60a083013511156124c657600080fd5b6124d98e604060a085013585010161251b565b6060820152855250602093840193919091019060010161241d565b50506040830152508452506020928301929190910190600101612347565b50505092915050565b600082601f83011261252b578081fd5b813561253961225a82613052565b818152915060208083019084810160005b8481101561230e578135870160a0807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c0301121561258957600080fd5b6040805182810167ffffffffffffffff82821081831117156125a757fe5b8184528886013583526125bb848701612231565b898401526060915081860135848401526080935083860135818111156125e057600080fd5b6125ee8f8b838a0101612642565b9284019290925250509290910135908201528452928201929082019060010161254a565b80357fffffffffffffffffffffffffffffffff000000000000000000000000000000008116811461048f57600080fd5b600082601f830112612652578081fd5b813567ffffffffffffffff81111561266657fe5b61269760207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161302e565b91508082528360208285010111156126ae57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156126d8578081fd5b81518015158114611028578182fd5b600080602083850312156126f9578081fd5b823567ffffffffffffffff80821115612710578283fd5b818501915085601f830112612723578283fd5b813581811115612731578384fd5b866020828501011115612742578384fd5b60209290920196919550909350505050565b600060208284031215612765578081fd5b813567ffffffffffffffff8082111561277c578283fd5b81840191506101a0808387031215612792578384fd5b61279b8161302e565b90506127a683612231565b81526127b460208401612231565b60208201526127c560408401612231565b6040820152606083013560608201526080830135608082015260a083013560a08201526127f460c08401612231565b60c082015260e08301358281111561280a578485fd5b6128168782860161251b565b60e08301525061010061282a818501612231565b908201526101208381013590820152610140808401358381111561284c578586fd5b61285888828701612642565b82840152505061016091508183013582820152610180915061287b828401612612565b91810191909152949350505050565b60006020828403121561289b578081fd5b813567ffffffffffffffff808211156128b2578283fd5b81840191506101608083870312156128c8578384fd5b6128d18161302e565b90506128dc83612231565b815260208301356020820152604083013560408201526060830135606082015261290860808401612231565b608082015260a08301358281111561291e578485fd5b61292a8782860161223c565b60a08301525061293c60c08401612231565b60c082015260e083013560e0820152610100808401358381111561295e578586fd5b61296a88828701612642565b82840152505061012091508183013582820152610140915061287b828401612612565b60006020828403121561299e578081fd5b813567ffffffffffffffff808211156129b5578283fd5b81840191506101608083870312156129cb578384fd5b6129d48161302e565b90506129df83612231565b8152602083013560208201526040830135604082015260608301356060820152612a0b60808401612231565b608082015260a083013582811115612a21578485fd5b61292a87828601612319565b600060208284031215612a3e578081fd5b5051919050565b60008151808452612a5d816020860160208601613070565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60007fffffffff00000000000000000000000000000000000000000000000000000000841682528251612ac9816004850160208701613070565b919091016004019392505050565b60008251612ae9818460208701613070565b9190910192915050565b7f4d554c5449504154485f524f555445520000000000000000000000000000000081527f312e302e30000000000000000000000000000000000000000000000000000000601082015260150190565b90565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9485168152928416602084015292166040820152606081019190915260800190565b600060a080830173ffffffffffffffffffffffffffffffffffffffff808a1685526020818a16818701526040898188015260608981890152608086818a0152858a5180885260c08b01915060c08682028c01019750858c018a5b82811015612c70577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff408d8b03018452815180518b52898982015116898c015287810151888c0152868101518c888d0152612c538d8d0182612a45565b918701519b87019b909b5299509287019290870190600101612bf7565b50505050505050505080925050509695505050505050565b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000097909716875273ffffffffffffffffffffffffffffffffffffffff95861660208801526040870194909452919093166060850152608084019290925260a083019190915260c082015260e00190565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60208082526018908201527f4661696c656420746f207472616e736665722045746865720000000000000000604082015260600190565b60208082526037908201527f526563656976656420616d6f756e74206f6620746f6b656e7320617265206c6560408201527f7373207468656e20657870656374656420746f6b656e73000000000000000000606082015260800190565b6020808252600d908201527f5065726d6974206661696c656400000000000000000000000000000000000000604082015260600190565b6020808252601a908201527f50617468206e6f742070726f766964656420666f722073776170000000000000604082015260600190565b60208082526018908201527f45786368616e6765206e6f742077686974656c69737465640000000000000000604082015260600190565b60208082526016908201527f4d4554484f44204e4f5420494d504c454d454e54454400000000000000000000604082015260600190565b60208082526016908201527f43616c6c20746f2061646170746572206661696c656400000000000000000000604082015260600190565b60208082526013908201527f496e636f7272656374206d73672e76616c756500000000000000000000000000604082015260600190565b60208082526030908201527f526563656976656420616d6f756e74206f6620746f6b656e7320617265206c6560408201527f7373207468656e20657870656374656400000000000000000000000000000000606082015260800190565b60208082526011908201527f446561646c696e65206272656163686564000000000000000000000000000000604082015260600190565b60208082526016908201527f546f20616d6f756e742063616e206e6f74206265203000000000000000000000604082015260600190565b600088825273ffffffffffffffffffffffffffffffffffffffff8089166020840152808816604084015286606084015285608084015280851660a08401525060e060c083015261302160e0830184612a45565b9998505050505050505050565b60405181810167ffffffffffffffff8111828210171561304a57fe5b604052919050565b600067ffffffffffffffff82111561306657fe5b5060209081020190565b60005b8381101561308b578181015183820152602001613073565b8381111561173b5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff811681146130be57600080fd5b5056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77496e73756666696369656e742062616c616e636520746f2070617920666f7220666565735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a164736f6c6343000705000a

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

000000000000000000000000000000000000000000000000000000000000213400000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f7

-----Decoded View---------------
Arg [0] : _partnerSharePercent (uint256): 8500
Arg [1] : _maxFeePercent (uint256): 500
Arg [2] : _feeClaimer (address): 0xeF13101C5bbD737cFb2bF00Bbd38c626AD6952F7

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000002134
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [2] : 000000000000000000000000ef13101c5bbd737cfb2bf00bbd38c626ad6952f7


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

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.