Address Details
contract

0x9961aFBF63e73E48E4bc30E2658625F14A3dBf15

Contract Name
SwapWithFee
Creator
0xe59f13–f1e2b8 at 0x9e7808–c33414
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
13509752
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
SwapWithFee




Optimization enabled
true
Compiler version
v0.8.13+commit.abaa5c0e




Optimization runs
999999
EVM Version
london




Verified at
2022-06-13T14:22:23.371363Z

contracts/swap/SwapWithFee.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/ISwappaRouter.sol";

contract SwapWithFee is Ownable {
    uint256 public constant MAX_FEE_NUMERATOR = 6_000; // max 60 bps.
    uint256 public constant FEE_DENOMINATOR = 1_000_000;

    uint256 feeNumerator;
    address beneficiary;
    ISwappaRouterV1 private swappaRouter;

    event Swap(
        address indexed userAddress,
        address indexed sellToken,
        address indexed buyToken,
        uint256 sellAmount,
        uint256 outputAmount,
        uint256 fee
    );
    event BeneficiarySet(address newBeneficiary);
    event FeeNumeratorSet(uint256 feeNumerator);

    constructor(
        ISwappaRouterV1 _swappaRouter,
        address _beneficiary,
        uint256 initialFee
    ) {
        swappaRouter = _swappaRouter;
        setBeneficiary(_beneficiary);
        setFeeNumerator(initialFee);
    }

    function setBeneficiary(address _beneficiary) public onlyOwner {
        beneficiary = _beneficiary;
        emit BeneficiarySet(_beneficiary);
    }

    function setFeeNumerator(uint256 _feeNumerator) public onlyOwner {
        feeNumerator = _feeNumerator;
        emit FeeNumeratorSet(_feeNumerator);
    }

    function swap(
        address userAddress,
        address sellToken,
        address buyToken,
        uint256 sellAmount,
        address[] calldata path,
        address[] calldata pairs,
        bytes[] calldata extras,
        uint256 minOutputAmount,
        uint256 deadline
    ) external {
        uint256 fee = (sellAmount * feeNumerator) / FEE_DENOMINATOR;
        require(
            ERC20(sellToken).transferFrom(userAddress, beneficiary, fee),
            "Fee payment failed"
        );
        uint256 swapAmount = sellAmount - fee;
        require(
            ERC20(sellToken).transferFrom(
                userAddress,
                address(swappaRouter),
                swapAmount
            ),
            "Swap initial transfer failed. Did you approve the funds?"
        );

        uint256 outputAmount = swappaRouter.swapExactInputForOutput(
            path,
            pairs,
            extras,
            0,
            minOutputAmount,
            userAddress,
            deadline
        );

        // Sanity check, already checked by Swappa. Can be removed to save gas if needed.
        require(outputAmount >= minOutputAmount, "Insufficient output amount!");

        emit Swap(
            userAddress,
            sellToken,
            buyToken,
            sellAmount,
            outputAmount,
            fee
        );
    }
}
        

/_openzeppelin/contracts/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

/_openzeppelin/contracts/token/ERC20/ERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}
          

/_openzeppelin/contracts/token/ERC20/IERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

/_openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
          

/_openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol

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

pragma solidity ^0.8.0;

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

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

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

/_openzeppelin/contracts/utils/Context.sol

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

pragma solidity ^0.8.0;

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

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

/contracts/interfaces/ISwappaRouter.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.2;

interface ISwappaRouterV1 {
    function getOutputAmount(
        address[] calldata path,
        address[] calldata pairs,
        bytes[] calldata extras,
        uint256 inputAmount
    ) external view returns (uint256 outputAmount);

    function swapExactInputForOutput(
        address[] calldata path,
        address[] calldata pairs,
        bytes[] calldata extras,
        uint256 inputAmount,
        uint256 minOutputAmount,
        address to,
        uint256 deadline
    ) external returns (uint256 outputAmount);

    function swapExactInputForOutputWithPrecheck(
        address[] calldata path,
        address[] calldata pairs,
        bytes[] calldata extras,
        uint256 inputAmount,
        uint256 minOutputAmount,
        address to,
        uint256 deadline
    ) external returns (uint256 outputAmount);
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_swappaRouter","internalType":"contract ISwappaRouterV1"},{"type":"address","name":"_beneficiary","internalType":"address"},{"type":"uint256","name":"initialFee","internalType":"uint256"}]},{"type":"event","name":"BeneficiarySet","inputs":[{"type":"address","name":"newBeneficiary","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"FeeNumeratorSet","inputs":[{"type":"uint256","name":"feeNumerator","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Swap","inputs":[{"type":"address","name":"userAddress","internalType":"address","indexed":true},{"type":"address","name":"sellToken","internalType":"address","indexed":true},{"type":"address","name":"buyToken","internalType":"address","indexed":true},{"type":"uint256","name":"sellAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"outputAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"fee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"FEE_DENOMINATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_FEE_NUMERATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBeneficiary","inputs":[{"type":"address","name":"_beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeNumerator","inputs":[{"type":"uint256","name":"_feeNumerator","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"swap","inputs":[{"type":"address","name":"userAddress","internalType":"address"},{"type":"address","name":"sellToken","internalType":"address"},{"type":"address","name":"buyToken","internalType":"address"},{"type":"uint256","name":"sellAmount","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"},{"type":"address[]","name":"pairs","internalType":"address[]"},{"type":"bytes[]","name":"extras","internalType":"bytes[]"},{"type":"uint256","name":"minOutputAmount","internalType":"uint256"},{"type":"uint256","name":"deadline","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x60803461007557601f610fae38819003918201601f19168301916001600160401b0383118484101761007a578084926060946040528339810103126100755780516100669161004d82610090565b604060208201519161005e83610090565b0151916100a1565b604051610e4e90816101608239f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381160361007557565b60008054336001600160a01b0319808316821784556040517fc1bcceddd77fdc95a8da9bec5802d2e0bb564dd02c0730222d8e12030bd910439760209790967f04d55a8be181fb8d75b76f2d48aa0b2ee40f47e53d6e61763eeeec46feea8a2496899693956001600160a01b0394859392908416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09089a31683600354161760035516809160025416176002558152a180600155604051908152a156fe6101006040526004361015610014575b600080fd5b6000803560e01c9081631c31f710146100b757508063715018a6146100ae5780638da5cb5b146100a5578063a45db9111461009c578063caddaceb14610093578063d73792a91461008a578063f2fde38b146100815763fd9b56871461007957600080fd5b61000f61056f565b5061000f61047f565b5061000f610442565b5061000f610387565b5061000f6102d0565b5061000f61027d565b5061000f6101d8565b3461016c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261016c577f04d55a8be181fb8d75b76f2d48aa0b2ee40f47e53d6e61763eeeec46feea8a24602061011161016f565b73ffffffffffffffffffffffffffffffffffffffff906101358286541633146105ab565b16807fffffffffffffffffffffffff00000000000000000000000000000000000000006002541617600255604051908152a1604051f35b80fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361000f57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361000f57565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361000f57565b503461000f576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261016c5780547fffffffffffffffffffffffff000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff82169161024f3384146105ab565b16825581604051917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08284a3f35b503461000f5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f57602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b503461000f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f577fc1bcceddd77fdc95a8da9bec5802d2e0bb564dd02c0730222d8e12030bd91043602060043561034973ffffffffffffffffffffffffffffffffffffffff6000541633146105ab565b80600155604051908152a1005b9181601f8401121561000f5782359167ffffffffffffffff831161000f576020808501948460051b01011161000f57565b503461000f576101207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f576103c061016f565b6103c8610192565b6103d06101b5565b906084359267ffffffffffffffff9384811161000f576103f4903690600401610356565b60a49291923586811161000f5761040f903690600401610356565b9160c43597881161000f5761042b610440983690600401610356565b959094610104359860e4359860643592610ac4565b005b503461000f5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f576020604051620f42408152f35b503461000f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f576104b761016f565b73ffffffffffffffffffffffffffffffffffffffff6104db816000541633146105ab565b8116156104eb5761044090610610565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b503461000f5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f5760206040516117708152f35b156105b257565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06000604051a3565b507f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211811515166106e0570290565b6106e861067f565b0290565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761072d57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b9081602091031261000f5751801515810361000f5790565b506040513d6000823e3d90fd5b1561078857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f466565207061796d656e74206661696c656400000000000000000000000000006044820152fd5b8181106107f1570390565b6107f961067f565b0390565b1561080457565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f5377617020696e697469616c207472616e73666572206661696c65642e20446960448201527f6420796f7520617070726f7665207468652066756e64733f00000000000000006064820152fd5b9081602091031261000f575190565b9190808252602080920192916000805b8382106108b657505050505090565b9091929394853573ffffffffffffffffffffffffffffffffffffffff81168091036108ee5781528301948301939291600101906108a7565b8280fd5b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b969998979592939061094f9061095f9360e08a5260e08a0191610897565b90602094888303868a0152610897565b91858303604087015281835280830192818360051b8201019480946000925b8584106109c4575050505050505060c092916109c0919660006060850152608084015260a083019073ffffffffffffffffffffffffffffffffffffffff169052565b0152565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820301835287357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18536030181121561000f57840190813567ffffffffffffffff811161000f57803603861361000f57610a4e8892839283600196016108f2565b99019301940192919594939061097e565b15610a6657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e73756666696369656e74206f757470757420616d6f756e742100000000006044820152fd5b9a97929891909a99949693959960c05260805260e052600154610ae790886106af565b620f424090049485928873ffffffffffffffffffffffffffffffffffffffff809c169a8b998a600254610b2d9073ffffffffffffffffffffffffffffffffffffffff1690565b60405160a08181527f23b872dd00000000000000000000000000000000000000000000000000000000909152805160c05173ffffffffffffffffffffffffffffffffffffffff90811660048301529290921660248301526044909101899052516064815a602094600091f1908115610c8c60207fd6d34547c69c5ee3d2667625c188acf1006abb93e0ee7cf03925c67cf77604139e610bec829c600099610d0798610ca597610e0b575b8b90610dd4575b610be790610781565b6107e6565b90610c28610c0f60035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b896040518096819582947f23b872dd00000000000000000000000000000000000000000000000000000000845260c0516004850160409194939294606082019573ffffffffffffffffffffffffffffffffffffffff80921683521660208201520152565b03925af1908115610dc7575b8691610d9a575b506107fd565b610cc7610c0f60035473ffffffffffffffffffffffffffffffffffffffff1690565b95896040519b8c998a9889977f0862d12f00000000000000000000000000000000000000000000000000000000895260c0519560e0519460048b01610931565b03925af1918215610d8d575b600092610d58575b50610d2890821015610a5f565b610d5360405192839288608051169860c0511696846040919493926060820195825260208201520152565b0390a4565b610d28919250610d7f9060203d602011610d86575b610d7781836106ec565b810190610888565b9190610d1b565b503d610d6d565b610d95610774565b610d13565b610dba91508a3d8c11610dc0575b610db281836106ec565b81019061075c565b38610c9f565b503d610da8565b610dcf610774565b610c98565b50843d8611610e04575b610dfd81610df1610be79360a0516106ec565b60a0519081019061075c565b9050610bde565b503d610dde565b610e13610774565b610bd756fea26469706673582212200f1eb2b0b182c239141748154f189ec4fe9f118a3be8cd78e3ac757e576ff08a64736f6c634300080d0033000000000000000000000000f35ed7156babf2541e032b3bb8625210316e2832000000000000000000000000e0c8c2a53eebadcd6a3b2c7564e428bdf276909b00000000000000000000000000000000000000000000000000000000000005dc

Deployed ByteCode

0x6101006040526004361015610014575b600080fd5b6000803560e01c9081631c31f710146100b757508063715018a6146100ae5780638da5cb5b146100a5578063a45db9111461009c578063caddaceb14610093578063d73792a91461008a578063f2fde38b146100815763fd9b56871461007957600080fd5b61000f61056f565b5061000f61047f565b5061000f610442565b5061000f610387565b5061000f6102d0565b5061000f61027d565b5061000f6101d8565b3461016c5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261016c577f04d55a8be181fb8d75b76f2d48aa0b2ee40f47e53d6e61763eeeec46feea8a24602061011161016f565b73ffffffffffffffffffffffffffffffffffffffff906101358286541633146105ab565b16807fffffffffffffffffffffffff00000000000000000000000000000000000000006002541617600255604051908152a1604051f35b80fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361000f57565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361000f57565b6044359073ffffffffffffffffffffffffffffffffffffffff8216820361000f57565b503461000f576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261016c5780547fffffffffffffffffffffffff000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff82169161024f3384146105ab565b16825581604051917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08284a3f35b503461000f5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f57602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b503461000f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f577fc1bcceddd77fdc95a8da9bec5802d2e0bb564dd02c0730222d8e12030bd91043602060043561034973ffffffffffffffffffffffffffffffffffffffff6000541633146105ab565b80600155604051908152a1005b9181601f8401121561000f5782359167ffffffffffffffff831161000f576020808501948460051b01011161000f57565b503461000f576101207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f576103c061016f565b6103c8610192565b6103d06101b5565b906084359267ffffffffffffffff9384811161000f576103f4903690600401610356565b60a49291923586811161000f5761040f903690600401610356565b9160c43597881161000f5761042b610440983690600401610356565b959094610104359860e4359860643592610ac4565b005b503461000f5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f576020604051620f42408152f35b503461000f5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f576104b761016f565b73ffffffffffffffffffffffffffffffffffffffff6104db816000541633146105ab565b8116156104eb5761044090610610565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b503461000f5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000f5760206040516117708152f35b156105b257565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06000604051a3565b507f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211811515166106e0570290565b6106e861067f565b0290565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761072d57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b9081602091031261000f5751801515810361000f5790565b506040513d6000823e3d90fd5b1561078857565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f466565207061796d656e74206661696c656400000000000000000000000000006044820152fd5b8181106107f1570390565b6107f961067f565b0390565b1561080457565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f5377617020696e697469616c207472616e73666572206661696c65642e20446960448201527f6420796f7520617070726f7665207468652066756e64733f00000000000000006064820152fd5b9081602091031261000f575190565b9190808252602080920192916000805b8382106108b657505050505090565b9091929394853573ffffffffffffffffffffffffffffffffffffffff81168091036108ee5781528301948301939291600101906108a7565b8280fd5b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b969998979592939061094f9061095f9360e08a5260e08a0191610897565b90602094888303868a0152610897565b91858303604087015281835280830192818360051b8201019480946000925b8584106109c4575050505050505060c092916109c0919660006060850152608084015260a083019073ffffffffffffffffffffffffffffffffffffffff169052565b0152565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820301835287357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18536030181121561000f57840190813567ffffffffffffffff811161000f57803603861361000f57610a4e8892839283600196016108f2565b99019301940192919594939061097e565b15610a6657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e73756666696369656e74206f757470757420616d6f756e742100000000006044820152fd5b9a97929891909a99949693959960c05260805260e052600154610ae790886106af565b620f424090049485928873ffffffffffffffffffffffffffffffffffffffff809c169a8b998a600254610b2d9073ffffffffffffffffffffffffffffffffffffffff1690565b60405160a08181527f23b872dd00000000000000000000000000000000000000000000000000000000909152805160c05173ffffffffffffffffffffffffffffffffffffffff90811660048301529290921660248301526044909101899052516064815a602094600091f1908115610c8c60207fd6d34547c69c5ee3d2667625c188acf1006abb93e0ee7cf03925c67cf77604139e610bec829c600099610d0798610ca597610e0b575b8b90610dd4575b610be790610781565b6107e6565b90610c28610c0f60035473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b896040518096819582947f23b872dd00000000000000000000000000000000000000000000000000000000845260c0516004850160409194939294606082019573ffffffffffffffffffffffffffffffffffffffff80921683521660208201520152565b03925af1908115610dc7575b8691610d9a575b506107fd565b610cc7610c0f60035473ffffffffffffffffffffffffffffffffffffffff1690565b95896040519b8c998a9889977f0862d12f00000000000000000000000000000000000000000000000000000000895260c0519560e0519460048b01610931565b03925af1918215610d8d575b600092610d58575b50610d2890821015610a5f565b610d5360405192839288608051169860c0511696846040919493926060820195825260208201520152565b0390a4565b610d28919250610d7f9060203d602011610d86575b610d7781836106ec565b810190610888565b9190610d1b565b503d610d6d565b610d95610774565b610d13565b610dba91508a3d8c11610dc0575b610db281836106ec565b81019061075c565b38610c9f565b503d610da8565b610dcf610774565b610c98565b50843d8611610e04575b610dfd81610df1610be79360a0516106ec565b60a0519081019061075c565b9050610bde565b503d610dde565b610e13610774565b610bd756fea26469706673582212200f1eb2b0b182c239141748154f189ec4fe9f118a3be8cd78e3ac757e576ff08a64736f6c634300080d0033