Address Details
contract

0xFBDa43491810F532DA406F4A59d88816378bcd6e

Contract Name
SwapSlippageAware
Creator
0xe59f13–f1e2b8 at 0x850d23–e894d8
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
20 Transactions
Transfers
76 Transfers
Gas Used
11,645,609
Last Balance Update
13640122
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
SwapSlippageAware




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




Optimization runs
999999
EVM Version
london




Verified at
2022-06-18T22:10:21.178699Z

contracts/swap/SwapSlippageAware.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 SwapSlippageAware is Ownable {
    address public beneficiary;
    ISwappaRouterV1 private swappaRouter;

    event Swap(
        address indexed userAddress,
        address indexed inputToken,
        address indexed outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 fee
    );
    event BeneficiarySet(address newBeneficiary);

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

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

    function emergencyWithdrawal(address token) external onlyOwner {
        ERC20(token).transfer(
            beneficiary,
            ERC20(token).balanceOf(address(this))
        );
    }

    function swap(
        address[] calldata path,
        address[] calldata pairs,
        bytes[] calldata extras,
        uint256 inputAmount,
        uint256 quotedOutputAmount,
        uint256 minOutputAmount,
        uint256 deadline
    ) external {
        ERC20 inputToken = ERC20(path[0]);

        require(
            inputToken.transferFrom(msg.sender, address(this), inputAmount),
            "Swap initial transfer failed. Did you approve the funds?"
        );

        inputToken.approve(address(swappaRouter), inputAmount);
        uint256 outputAmount = swappaRouter.swapExactInputForOutput(
            path,
            pairs,
            extras,
            inputAmount,
            minOutputAmount,
            address(this),
            deadline
        );

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

        // We charge positive slippage as a fee.
        uint256 fee = outputAmount <= quotedOutputAmount
            ? 0
            : outputAmount - quotedOutputAmount;

        ERC20 outputToken = ERC20(path[path.length - 1]);
        if (fee > 0) {
            require(
                outputToken.transfer(beneficiary, fee),
                "Fee payment failed"
            );
        }
        require(
            outputToken.transfer(msg.sender, outputAmount - fee),
            "Output payment failed"
        );

        emit Swap(
            msg.sender,
            path[0],
            path[path.length - 1],
            inputAmount,
            outputAmount - fee,
            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":"event","name":"BeneficiarySet","inputs":[{"type":"address","name":"newBeneficiary","internalType":"address","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":"inputToken","internalType":"address","indexed":true},{"type":"address","name":"outputToken","internalType":"address","indexed":true},{"type":"uint256","name":"inputAmount","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":"address","name":"","internalType":"address"}],"name":"beneficiary","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdrawal","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"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":"swap","inputs":[{"type":"address[]","name":"path","internalType":"address[]"},{"type":"address[]","name":"pairs","internalType":"address[]"},{"type":"bytes[]","name":"extras","internalType":"bytes[]"},{"type":"uint256","name":"inputAmount","internalType":"uint256"},{"type":"uint256","name":"quotedOutputAmount","internalType":"uint256"},{"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

0x60803461006f57601f61120638819003918201601f19168301916001600160401b0383118484101761007457808492604094855283398101031261006f5780602061006092519161004f8361008a565b01519061005b8261008a565b61009b565b6040516110d9908161012d8239f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381160361006f57565b60008054336001600160a01b0319808316821784556040517f04d55a8be181fb8d75b76f2d48aa0b2ee40f47e53d6e61763eeeec46feea8a2496602096919592946001600160a01b03949193859392918416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09089a31683600254161760025516809160015416176001558152a156fe60806040526004361015610013575b600080fd5b6000803560e01c9081631c31f710146100a25750806338af3eed146100995780636e353a1d14610090578063715018a6146100875780638da5cb5b1461007e578063f2fde38b146100755763f84a164d1461006d57600080fd5b61000e610594565b5061000e61046f565b5061000e61041c565b5061000e610377565b5061000e6101cf565b5061000e61017c565b3461015b5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015b577f04d55a8be181fb8d75b76f2d48aa0b2ee40f47e53d6e61763eeeec46feea8a2460206004356101008161015e565b73ffffffffffffffffffffffffffffffffffffffff90610124828654163314610632565b16807fffffffffffffffffffffffff00000000000000000000000000000000000000006001541617600155604051908152a1604051f35b80fd5b73ffffffffffffffffffffffffffffffffffffffff81160361000e57565b503461000e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461000e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e576102f6816004356102108161015e565b73ffffffffffffffffffffffffffffffffffffffff9061023582600054163314610632565b1661025560015473ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015291908383602481855afa92831561036a575b60009361033b575b5060006040518096819582947fa9059cbb000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561032e575b610308575b005b8161030692903d10610327575b61031f8183610706565b810190610792565b503d610315565b610336610785565b610301565b61035c919350843d8611610363575b6103548183610706565b810190610776565b913861029b565b503d61034a565b610372610785565b610293565b503461000e576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015b5780547fffffffffffffffffffffffff000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff8216916103ee338414610632565b16825581604051917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08284a3f35b503461000e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e57602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b503461000e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e576004356104ab8161015e565b73ffffffffffffffffffffffffffffffffffffffff6104cf81600054163314610632565b8116156104df5761030690610697565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9181601f8401121561000e5782359167ffffffffffffffff831161000e576020808501948460051b01011161000e57565b503461000e5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e5767ffffffffffffffff60043581811161000e576105e5903690600401610563565b9060243583811161000e576105fe903690600401610563565b92909160443594851161000e5761061c610306953690600401610563565b9060c4359560a435956084359560643595610be3565b1561063957565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06000604051a3565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761074757604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b9081602091031261000e575190565b506040513d6000823e3d90fd5b9081602091031261000e5751801515810361000e5790565b90156107b35790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b91908110156107b35760051b0190565b356107fc8161015e565b90565b1561080657565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f5377617020696e697469616c207472616e73666572206661696c65642e20446960448201527f6420796f7520617070726f7665207468652066756e64733f00000000000000006064820152fd5b91908082526020809201929160005b8281106108a7575050505090565b90919293828060019273ffffffffffffffffffffffffffffffffffffffff88356108d08161015e565b16815201950193929101610899565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b979592939061093e9061094e939c9b9a989c60e08b5260e08b019161088a565b90602094898303868b015261088a565b91868303604088015281835280830192818360051b8201019480946000925b8584106109b25750505050505050916109ae9160c09493976060850152608084015260a083019073ffffffffffffffffffffffffffffffffffffffff169052565b0152565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820301835287357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18536030181121561000e57840190813567ffffffffffffffff811161000e57803603861361000e57610a3c8892839283600196016108df565b99019301940192919594939061096d565b15610a5457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e73756666696369656e74206f757470757420616d6f756e742100000000006044820152fd5b60018110610adf577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818110610adf570390565b15610b2057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f466565207061796d656e74206661696c656400000000000000000000000000006044820152fd5b15610b8557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4f7574707574207061796d656e74206661696c656400000000000000000000006044820152fd5b8199610cfc602089610c23610c0a610c0a610c059b9e9b889d9b9a99896107aa565b6107f2565b73ffffffffffffffffffffffffffffffffffffffff1690565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052610c809084816064816000875af1908115611096575b600091611079575b506107ff565b610ca2610c0a60025473ffffffffffffffffffffffffffffffffffffffff1690565b60006040518096819582947f095ea7b3000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561106c575b61104d575b508a8a89600254610d309073ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16976040519c8d9889987f0862d12f000000000000000000000000000000000000000000000000000000008a52309660048b0199610d829a61091e565b03815a602094600091f1938415611040575b600094610ff9575b50610dcc84957fd6d34547c69c5ee3d2667625c188acf1006abb93e0ee7cf03925c67cf776041394951015610a4d565b808511610fe957506000935b610ed4610eaf86610ea9610c05610dff610c0a610c058d610df881610ab2565b908b6107e2565b9683610f05575b610e8c610e586020610e18878b610b0e565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481019190915291829081906044820190565b0381600073ffffffffffffffffffffffffffffffffffffffff9e8f165af1908115610ef8575b600091610ed9575b50610b7e565b610e99610c058d836107aa565b9b610ea381610ab2565b916107e2565b93610b0e565b9583604051948594169816963396846040919493926060820195825260208201520152565b0390a4565b610ef2915060203d6020116103275761031f8183610706565b38610e86565b610f00610785565b610e7e565b610fb8610f9d6020868b610f2e60015473ffffffffffffffffffffffffffffffffffffffff1690565b600073ffffffffffffffffffffffffffffffffffffffff6040518097819682957fa9059cbb000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b0393165af1908115610fdc575b600091610fbd575b50610b19565b610e06565b610fd6915060203d6020116103275761031f8183610706565b38610fb2565b610fe4610785565b610faa565b610ff39085610b0e565b93610dd8565b7fd6d34547c69c5ee3d2667625c188acf1006abb93e0ee7cf03925c67cf7760413939450611038610dcc9160203d602011610363576103548183610706565b949350610d9c565b611048610785565b610d94565b6110659060203d6020116103275761031f8183610706565b5038610d0c565b611074610785565b610d07565b6110909150853d87116103275761031f8183610706565b38610c7a565b61109e610785565b610c7256fea26469706673582212202080be729ca3a9ef2bc9b55a24128cac455009aef7ddb87be93e8a16575ae66264736f6c634300080d0033000000000000000000000000f35ed7156babf2541e032b3bb8625210316e2832000000000000000000000000e0c8c2a53eebadcd6a3b2c7564e428bdf276909b

Deployed ByteCode

0x60806040526004361015610013575b600080fd5b6000803560e01c9081631c31f710146100a25750806338af3eed146100995780636e353a1d14610090578063715018a6146100875780638da5cb5b1461007e578063f2fde38b146100755763f84a164d1461006d57600080fd5b61000e610594565b5061000e61046f565b5061000e61041c565b5061000e610377565b5061000e6101cf565b5061000e61017c565b3461015b5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015b577f04d55a8be181fb8d75b76f2d48aa0b2ee40f47e53d6e61763eeeec46feea8a2460206004356101008161015e565b73ffffffffffffffffffffffffffffffffffffffff90610124828654163314610632565b16807fffffffffffffffffffffffff00000000000000000000000000000000000000006001541617600155604051908152a1604051f35b80fd5b73ffffffffffffffffffffffffffffffffffffffff81160361000e57565b503461000e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461000e576020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e576102f6816004356102108161015e565b73ffffffffffffffffffffffffffffffffffffffff9061023582600054163314610632565b1661025560015473ffffffffffffffffffffffffffffffffffffffff1690565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015291908383602481855afa92831561036a575b60009361033b575b5060006040518096819582947fa9059cbb000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561032e575b610308575b005b8161030692903d10610327575b61031f8183610706565b810190610792565b503d610315565b610336610785565b610301565b61035c919350843d8611610363575b6103548183610706565b810190610776565b913861029b565b503d61034a565b610372610785565b610293565b503461000e576000807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261015b5780547fffffffffffffffffffffffff000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff8216916103ee338414610632565b16825581604051917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08284a3f35b503461000e5760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e57602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b503461000e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e576004356104ab8161015e565b73ffffffffffffffffffffffffffffffffffffffff6104cf81600054163314610632565b8116156104df5761030690610697565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b9181601f8401121561000e5782359167ffffffffffffffff831161000e576020808501948460051b01011161000e57565b503461000e5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e5767ffffffffffffffff60043581811161000e576105e5903690600401610563565b9060243583811161000e576105fe903690600401610563565b92909160443594851161000e5761061c610306953690600401610563565b9060c4359560a435956084359560643595610be3565b1561063957565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6000549073ffffffffffffffffffffffffffffffffffffffff80911691827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06000604051a3565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761074757604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b9081602091031261000e575190565b506040513d6000823e3d90fd5b9081602091031261000e5751801515810361000e5790565b90156107b35790565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b91908110156107b35760051b0190565b356107fc8161015e565b90565b1561080657565b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f5377617020696e697469616c207472616e73666572206661696c65642e20446960448201527f6420796f7520617070726f7665207468652066756e64733f00000000000000006064820152fd5b91908082526020809201929160005b8281106108a7575050505090565b90919293828060019273ffffffffffffffffffffffffffffffffffffffff88356108d08161015e565b16815201950193929101610899565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0938186528686013760008582860101520116010190565b979592939061093e9061094e939c9b9a989c60e08b5260e08b019161088a565b90602094898303868b015261088a565b91868303604088015281835280830192818360051b8201019480946000925b8584106109b25750505050505050916109ae9160c09493976060850152608084015260a083019073ffffffffffffffffffffffffffffffffffffffff169052565b0152565b909192939495967fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820301835287357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18536030181121561000e57840190813567ffffffffffffffff811161000e57803603861361000e57610a3c8892839283600196016108df565b99019301940192919594939061096d565b15610a5457565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f496e73756666696369656e74206f757470757420616d6f756e742100000000006044820152fd5b60018110610adf577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818110610adf570390565b15610b2057565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f466565207061796d656e74206661696c656400000000000000000000000000006044820152fd5b15610b8557565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4f7574707574207061796d656e74206661696c656400000000000000000000006044820152fd5b8199610cfc602089610c23610c0a610c0a610c059b9e9b889d9b9a99896107aa565b6107f2565b73ffffffffffffffffffffffffffffffffffffffff1690565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052610c809084816064816000875af1908115611096575b600091611079575b506107ff565b610ca2610c0a60025473ffffffffffffffffffffffffffffffffffffffff1690565b60006040518096819582947f095ea7b3000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561106c575b61104d575b508a8a89600254610d309073ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16976040519c8d9889987f0862d12f000000000000000000000000000000000000000000000000000000008a52309660048b0199610d829a61091e565b03815a602094600091f1938415611040575b600094610ff9575b50610dcc84957fd6d34547c69c5ee3d2667625c188acf1006abb93e0ee7cf03925c67cf776041394951015610a4d565b808511610fe957506000935b610ed4610eaf86610ea9610c05610dff610c0a610c058d610df881610ab2565b908b6107e2565b9683610f05575b610e8c610e586020610e18878b610b0e565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481019190915291829081906044820190565b0381600073ffffffffffffffffffffffffffffffffffffffff9e8f165af1908115610ef8575b600091610ed9575b50610b7e565b610e99610c058d836107aa565b9b610ea381610ab2565b916107e2565b93610b0e565b9583604051948594169816963396846040919493926060820195825260208201520152565b0390a4565b610ef2915060203d6020116103275761031f8183610706565b38610e86565b610f00610785565b610e7e565b610fb8610f9d6020868b610f2e60015473ffffffffffffffffffffffffffffffffffffffff1690565b600073ffffffffffffffffffffffffffffffffffffffff6040518097819682957fa9059cbb000000000000000000000000000000000000000000000000000000008452600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b0393165af1908115610fdc575b600091610fbd575b50610b19565b610e06565b610fd6915060203d6020116103275761031f8183610706565b38610fb2565b610fe4610785565b610faa565b610ff39085610b0e565b93610dd8565b7fd6d34547c69c5ee3d2667625c188acf1006abb93e0ee7cf03925c67cf7760413939450611038610dcc9160203d602011610363576103548183610706565b949350610d9c565b611048610785565b610d94565b6110659060203d6020116103275761031f8183610706565b5038610d0c565b611074610785565b610d07565b6110909150853d87116103275761031f8183610706565b38610c7a565b61109e610785565b610c7256fea26469706673582212202080be729ca3a9ef2bc9b55a24128cac455009aef7ddb87be93e8a16575ae66264736f6c634300080d0033