POL Price: $0.652333 (+11.03%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
QuickswapSwapBridge

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 5 : QuickswapSwapBridge.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity ^0.8.6;

import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IERC20.sol";
import "../../interfaces/IUniswapV2Swap.sol";

/**
 * @title QuickswapSwapBridge
 * @author DeFi Basket
 *
 * @notice Swaps using the Quickswap contract in Polygon.
 *
 * @dev This contract swaps ERC20 tokens to ERC20 tokens. Please notice that there are no payable functions.
 *
 */

contract QuickswapSwapBridge is IUniswapV2Swap {
    address constant routerAddress = 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff;
    /**
      * @notice Swaps from ERC20 token to ERC20 token.
      *
      * @dev Wraps the swap and generate the necessary events to communicate with DeFi Basket's UI and back-end.
      *
      * @param amountInPercentage Percentage of the balance of the input ERC20 token that will be swapped
      * @param amountOutMin Minimum amount of the output token required to execute swap
      * @param path The swap route determined by the path. The first element of path is the input token, the last is
      * the output token, and any intermediate elements represent intermediate pairs to trade through (if, for example,
      * a direct pair does not exist)
      */
    function swapTokenToToken(
        uint256 amountInPercentage,
        uint256 amountOutMin,
        address[] calldata path
    ) external override {
        IUniswapV2Router02 router = IUniswapV2Router02(routerAddress);

        uint256 amountIn = IERC20(path[0]).balanceOf(address(this)) * amountInPercentage / 100000;

        // Approve 0 first as a few ERC20 tokens are requiring this pattern.
        IERC20(path[0]).approve(routerAddress, 0);
        IERC20(path[0]).approve(routerAddress, amountIn);

        uint[] memory amounts = router.swapExactTokensForTokens(
            amountIn,
            amountOutMin,
            path,
            address(this),
            block.timestamp + 100000
        );

        emit DEFIBASKET_UNISWAPV2_SWAP(amounts);
    }
}

File 2 of 5 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 3 of 5 : IERC20.sol
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
}

File 4 of 5 : IUniswapV2Swap.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity ^0.8.6;

interface IUniswapV2Swap {
    event DEFIBASKET_UNISWAPV2_SWAP(
        uint256[] amounts
    );

    function swapTokenToToken(
        uint256 amountInPercentage,
        uint256 amountOutMin,
        address[] calldata path
    ) external;
}

File 5 of 5 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"DEFIBASKET_UNISWAPV2_SWAP","type":"event"},{"inputs":[{"internalType":"uint256","name":"amountInPercentage","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"swapTokenToToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506106b6806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806399bb7e6414610030575b600080fd5b61004361003e3660046104ad565b610045565b005b73a5e0829caced8ffdd4de3c43696c57f7d7a678ff6000620186a0868585848161007157610071610654565b9050602002016020810190610086919061038b565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b1580156100c757600080fd5b505afa1580156100db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ff9190610494565b610109919061061f565b61011391906105fd565b90508383600081811061012857610128610654565b905060200201602081019061013d919061038b565b60405163095ea7b360e01b815273a5e0829caced8ffdd4de3c43696c57f7d7a678ff6004820152600060248201526001600160a01b03919091169063095ea7b390604401602060405180830381600087803b15801561019b57600080fd5b505af11580156101af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d39190610472565b50838360008181106101e7576101e7610654565b90506020020160208101906101fc919061038b565b60405163095ea7b360e01b815273a5e0829caced8ffdd4de3c43696c57f7d7a678ff6004820152602481018390526001600160a01b03919091169063095ea7b390604401602060405180830381600087803b15801561025a57600080fd5b505af115801561026e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102929190610472565b5060006001600160a01b0383166338ed173983888888306102b642620186a06105e5565b6040518763ffffffff1660e01b81526004016102d796959493929190610574565b600060405180830381600087803b1580156102f157600080fd5b505af1158015610305573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261032d91908101906103ad565b90507f15c473d9cfeb89fcaaa61973b922feb64052ea08b16f3a6c1e857c8d2c1bcd008160405161035e9190610530565b60405180910390a150505050505050565b80356001600160a01b038116811461038657600080fd5b919050565b60006020828403121561039d57600080fd5b6103a68261036f565b9392505050565b600060208083850312156103c057600080fd5b825167ffffffffffffffff808211156103d857600080fd5b818501915085601f8301126103ec57600080fd5b8151818111156103fe576103fe61066a565b8060051b604051601f19603f830116810181811085821117156104235761042361066a565b604052828152858101935084860182860187018a101561044257600080fd5b600095505b83861015610465578051855260019590950194938601938601610447565b5098975050505050505050565b60006020828403121561048457600080fd5b815180151581146103a657600080fd5b6000602082840312156104a657600080fd5b5051919050565b600080600080606085870312156104c357600080fd5b8435935060208501359250604085013567ffffffffffffffff808211156104e957600080fd5b818701915087601f8301126104fd57600080fd5b81358181111561050c57600080fd5b8860208260051b850101111561052157600080fd5b95989497505060200194505050565b6020808252825182820181905260009190848201906040850190845b818110156105685783518352928401929184019160010161054c565b50909695505050505050565b868152602080820187905260a0604083018190528201859052600090869060c08401835b888110156105c4576001600160a01b036105b18561036f565b1682529282019290820190600101610598565b506001600160a01b0396909616606085015250505060800152949350505050565b600082198211156105f8576105f861063e565b500190565b60008261061a57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156106395761063961063e565b500290565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220587a83edbbf3ed1e95585b5eac39a174c3e633d5a708f646266c6f6473589d1564736f6c63430008060033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806399bb7e6414610030575b600080fd5b61004361003e3660046104ad565b610045565b005b73a5e0829caced8ffdd4de3c43696c57f7d7a678ff6000620186a0868585848161007157610071610654565b9050602002016020810190610086919061038b565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b1580156100c757600080fd5b505afa1580156100db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ff9190610494565b610109919061061f565b61011391906105fd565b90508383600081811061012857610128610654565b905060200201602081019061013d919061038b565b60405163095ea7b360e01b815273a5e0829caced8ffdd4de3c43696c57f7d7a678ff6004820152600060248201526001600160a01b03919091169063095ea7b390604401602060405180830381600087803b15801561019b57600080fd5b505af11580156101af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d39190610472565b50838360008181106101e7576101e7610654565b90506020020160208101906101fc919061038b565b60405163095ea7b360e01b815273a5e0829caced8ffdd4de3c43696c57f7d7a678ff6004820152602481018390526001600160a01b03919091169063095ea7b390604401602060405180830381600087803b15801561025a57600080fd5b505af115801561026e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102929190610472565b5060006001600160a01b0383166338ed173983888888306102b642620186a06105e5565b6040518763ffffffff1660e01b81526004016102d796959493929190610574565b600060405180830381600087803b1580156102f157600080fd5b505af1158015610305573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261032d91908101906103ad565b90507f15c473d9cfeb89fcaaa61973b922feb64052ea08b16f3a6c1e857c8d2c1bcd008160405161035e9190610530565b60405180910390a150505050505050565b80356001600160a01b038116811461038657600080fd5b919050565b60006020828403121561039d57600080fd5b6103a68261036f565b9392505050565b600060208083850312156103c057600080fd5b825167ffffffffffffffff808211156103d857600080fd5b818501915085601f8301126103ec57600080fd5b8151818111156103fe576103fe61066a565b8060051b604051601f19603f830116810181811085821117156104235761042361066a565b604052828152858101935084860182860187018a101561044257600080fd5b600095505b83861015610465578051855260019590950194938601938601610447565b5098975050505050505050565b60006020828403121561048457600080fd5b815180151581146103a657600080fd5b6000602082840312156104a657600080fd5b5051919050565b600080600080606085870312156104c357600080fd5b8435935060208501359250604085013567ffffffffffffffff808211156104e957600080fd5b818701915087601f8301126104fd57600080fd5b81358181111561050c57600080fd5b8860208260051b850101111561052157600080fd5b95989497505060200194505050565b6020808252825182820181905260009190848201906040850190845b818110156105685783518352928401929184019160010161054c565b50909695505050505050565b868152602080820187905260a0604083018190528201859052600090869060c08401835b888110156105c4576001600160a01b036105b18561036f565b1682529282019290820190600101610598565b506001600160a01b0396909616606085015250505060800152949350505050565b600082198211156105f8576105f861063e565b500190565b60008261061a57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156106395761063961063e565b500290565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220587a83edbbf3ed1e95585b5eac39a174c3e633d5a708f646266c6f6473589d1564736f6c63430008060033

Block Transaction Gas Used Reward
view all blocks produced

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

OVERVIEW

DeFi Basket's auxiliar contract for communication with Quickswap.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.