ETH Price: $2,517.71 (-0.29%)
Gas: 1.04 Gwei

Contract

0xD43487DBEd7658Ef1b1aa7d5B5497C2C0De51B38
 

Overview

ETH Balance

0.022048763626557797 ETH

Eth Value

$55.51 (@ $2,517.71/ETH)
Transaction Hash
Method
Block
From
To
Withdraw188493402023-12-23 15:15:35251 days ago1703344535IN
0xD43487DB...C0De51B38
0 ETH0.0030580726.53562155
Approve188490992023-12-23 14:26:35251 days ago1703341595IN
0xD43487DB...C0De51B38
0 ETH0.0007997127.15319176
Swap185377302023-11-09 23:40:47295 days ago1699573247IN
0xD43487DB...C0De51B38
0 ETH0.0049957344.39940465
Withdraw185375872023-11-09 23:11:59295 days ago1699571519IN
0xD43487DB...C0De51B38
0 ETH0.0055942642.40683972
Approve185375732023-11-09 23:09:11295 days ago1699571351IN
0xD43487DB...C0De51B38
0 ETH0.0020264943.78011392
Withdraw178840112023-08-10 10:53:11387 days ago1691664791IN
0xD43487DB...C0De51B38
0 ETH0.002055917.84146524
Approve178840062023-08-10 10:52:11387 days ago1691664731IN
0xD43487DB...C0De51B38
0 ETH0.0008583218.43804704
Withdraw178689812023-08-08 8:22:23389 days ago1691482943IN
0xD43487DB...C0De51B38
0 ETH0.0018433315.99837637
Approve178689792023-08-08 8:21:59389 days ago1691482919IN
0xD43487DB...C0De51B38
0 ETH0.000792117.01538277
Approve175771282023-06-28 10:09:59430 days ago1687946999IN
0xD43487DB...C0De51B38
0 ETH0.0015750854.00774543
Withdraw175317882023-06-22 1:05:47436 days ago1687395947IN
0xD43487DB...C0De51B38
0 ETH0.0018015415.63079089
Approve174267502023-06-07 6:33:35451 days ago1686119615IN
0xD43487DB...C0De51B38
0 ETH0.0006772825.66656206
Approve174267432023-06-07 6:32:11451 days ago1686119531IN
0xD43487DB...C0De51B38
0 ETH0.0011540124.93126974
Approve174267282023-06-07 6:28:59451 days ago1686119339IN
0xD43487DB...C0De51B38
0 ETH0.0005372920.45435396
Approve174267262023-06-07 6:28:35451 days ago1686119315IN
0xD43487DB...C0De51B38
0 ETH0.0004949320.3945925
Approve174267012023-06-07 6:23:35451 days ago1686119015IN
0xD43487DB...C0De51B38
0 ETH0.000893919.31186265
Withdraw160992872022-12-02 19:43:11637 days ago1670010191IN
0xD43487DB...C0De51B38
0 ETH0.0015273913.2522329
Withdraw159364162022-11-10 1:43:59660 days ago1668044639IN
0xD43487DB...C0De51B38
0 ETH0.0038252133.19231367
Approve159364132022-11-10 1:43:23660 days ago1668044603IN
0xD43487DB...C0De51B38
0 ETH0.0014947432.10918001
Withdraw158689082022-10-31 15:22:35669 days ago1667229755IN
0xD43487DB...C0De51B38
0 ETH0.0027638623.98524558
Approve158689052022-10-31 15:21:59669 days ago1667229719IN
0xD43487DB...C0De51B38
0 ETH0.001071323.0131764
Deposit158319422022-10-26 11:27:11675 days ago1666783631IN
0xD43487DB...C0De51B38
0.03482629 ETH0.0015765411.05159484
Deposit157187962022-10-10 16:08:47690 days ago1665418127IN
0xD43487DB...C0De51B38
0.25468617 ETH0.0045911632.17872495
Deposit152573462022-08-01 14:54:30760 days ago1659365670IN
0xD43487DB...C0De51B38
0.25039882 ETH0.0016812411.23430386
Withdraw147718632022-05-14 5:41:11840 days ago1652506871IN
0xD43487DB...C0De51B38
0 ETH0.0040129834.81803371
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
188493402023-12-23 15:15:35251 days ago1703344535
0xD43487DB...C0De51B38
0.05198155 ETH
185377302023-11-09 23:40:47295 days ago1699573247
0xD43487DB...C0De51B38
0.08242652 ETH
185375872023-11-09 23:11:59295 days ago1699571519
0xD43487DB...C0De51B38
1.08083064 ETH
183702932023-10-17 13:08:47319 days ago1697548127
0xD43487DB...C0De51B38
0.07103215 ETH
178840112023-08-10 10:53:11387 days ago1691664791
0xD43487DB...C0De51B38
0.07550763 ETH
178689922023-08-08 8:24:35389 days ago1691483075
0xD43487DB...C0De51B38
0.11061385 ETH
178689812023-08-08 8:22:23389 days ago1691482943
0xD43487DB...C0De51B38
0.00815432 ETH
176932472023-07-14 17:41:47413 days ago1689356507
0xD43487DB...C0De51B38
0.03727948 ETH
175318332023-06-22 1:14:59436 days ago1687396499
0xD43487DB...C0De51B38
0.13697393 ETH
175317882023-06-22 1:05:47436 days ago1687395947
0xD43487DB...C0De51B38
0.4688393 ETH
174268212023-06-07 6:47:59451 days ago1686120479
0xD43487DB...C0De51B38
0.41816144 ETH
164520022023-01-21 1:49:47588 days ago1674265787
0xD43487DB...C0De51B38
0.20158219 ETH
162888582022-12-29 7:14:59611 days ago1672298099
0xD43487DB...C0De51B38
0.15 ETH
162789252022-12-27 21:59:47612 days ago1672178387
0xD43487DB...C0De51B38
0.52496182 ETH
161248802022-12-06 9:33:11634 days ago1670319191
0xD43487DB...C0De51B38
0.09 ETH
161248682022-12-06 9:30:47634 days ago1670319047
0xD43487DB...C0De51B38
0.1 ETH
161248682022-12-06 9:30:47634 days ago1670319047
0xD43487DB...C0De51B38
0.1 ETH
161248682022-12-06 9:30:47634 days ago1670319047
0xD43487DB...C0De51B38
0.1 ETH
160992922022-12-02 19:44:11637 days ago1670010251
0xD43487DB...C0De51B38
0.48656768 ETH
160992872022-12-02 19:43:11637 days ago1670010191
0xD43487DB...C0De51B38
0.61955654 ETH
160990062022-12-02 18:46:47637 days ago1670006807
0xD43487DB...C0De51B38
0.19962535 ETH
159364252022-11-10 1:45:47660 days ago1668044747
0xD43487DB...C0De51B38
0.08630263 ETH
159364162022-11-10 1:43:59660 days ago1668044639
0xD43487DB...C0De51B38
0.08916062 ETH
158689202022-10-31 15:24:59669 days ago1667229899
0xD43487DB...C0De51B38
0.10829212 ETH
158689082022-10-31 15:22:35669 days ago1667229755
0xD43487DB...C0De51B38
0.04141784 ETH
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xeC1AD81B...C1821FB88
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Helioswap

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 17 : Helioswap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./libraries/UniERC20.sol";
import "./libraries/Sqrt.sol";
import "./libraries/VirtualBalance.sol";
import "./base/BaseHelioswap.sol";

contract Helioswap is BaseHelioswap {
    using Sqrt for uint256;
    using SafeMath for uint256;
    using UniERC20 for IERC20;
    using VirtualBalance for VirtualBalance.Data;

    struct Balances {
        uint256 src;
        uint256 dst;
    }

    struct HelioswapVolumes {
        uint128 confirmed;
        uint128 results;
    }

    struct Fees {
        uint256 fee;
        uint256 slippageFee;
    }

    event HelioswapDeposited(
        address indexed sender,
        address indexed receiver,
        uint256 share,
        uint256 token0Amount,
        uint256 token1Amount
    );
    event HelioswapWithdrawn(
        address indexed sender,
        address indexed receiver,
        uint256 share,
        uint256 token0Amount,
        uint256 token1Amount
    );
    event HelioswapSwapped(
        address indexed sender,
        address indexed receiver,
        address indexed srcToken,
        address dstToken,
        uint256 amount,
        uint256 result,
        uint256 srcAdditionBalance,
        uint256 dstRemovalBalance
    );
    event HelioswapSync(
        uint256 srcBalance,
        uint256 dstBalance,
        uint256 fee,
        uint256 slippageFee
    );

    uint256 private constant _BASE_SUPPLY = 1000; // Total supply on first deposit

    IERC20 public token0;
    IERC20 public token1;
    mapping(IERC20 => HelioswapVolumes) public volumes;
    mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForAddition;
    mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForRemoval;

    modifier whenNotShutdown {
        require(baseHelioswapFactory.isActive(), "Helioswap: factory shutdown");
        _;
    }

    constructor(
        IERC20 _token0,
        IERC20 _token1,
        string memory name,
        string memory symbol,
        IBaseHelioswapFactory _baseHelioswapFactory
    ) public ERC20(name, symbol) BaseHelioswap(_baseHelioswapFactory) {
        require(bytes(name).length > 0, "Helioswap: name is empty");
        require(bytes(symbol).length > 0, "Helioswap: symbol is empty");
        require(_token0 != _token1, "Helioswap: duplicate tokens");
        token0 = _token0;
        token1 = _token1;
    }

    function tokens(uint256 i) external view returns (IERC20) {
        if (i == 0) {
            return token0;
        } else if (i == 1) {
            return token1;
        } else {
            revert("Pool has two tokens");
        }
    }

    function getReserves() public view returns (uint256 _reserve0, uint256 _reserve1) {
        _reserve0 = token0.uniBalanceOf(address(this));
        _reserve1 = token1.uniBalanceOf(address(this));
    }

    function estimateBalanceForAddition(IERC20 token) public view returns (uint256) {
        uint256 balance = token.uniBalanceOf(address(this));
        return
            Math.max(
                virtualBalancesForAddition[token].current(
                    decayPeriod(),
                    balance
                ),
                balance
            );
    }

    function estimateBalanceForRemoval(IERC20 token) public view returns (uint256) {
        uint256 balance = token.uniBalanceOf(address(this));
        return
            Math.min(
                virtualBalancesForRemoval[token].current(
                    decayPeriod(),
                    balance
                ),
                balance
            );
    }

    function deposit(uint256[2] calldata maxAmounts, uint256[2] calldata minAmounts)
        external
        payable
        returns (uint256 failSupply, uint256[2] memory receivedAmounts)
    {
        return depositFor(maxAmounts, minAmounts, msg.sender);
    }

    function depositFor(
        uint256[2] memory maxAmounts,
        uint256[2] memory minAmounts,
        address target
    )
        public
        payable
        nonReentrant
        returns (uint256 fairSupply, uint256[2] memory receivedAmounts)
    {
        IERC20[2] memory _tokens = [token0, token1];
        require(
            msg.value ==
                (
                    _tokens[0].isETH()
                        ? maxAmounts[0]
                        : (_tokens[1].isETH() ? maxAmounts[1] : 0)
                ),
            "Helioswap: wrong value usage"
        );

        uint256 totalSupply = totalSupply();

        if (totalSupply == 0) {
            fairSupply = _BASE_SUPPLY.mul(99);
            _mint(address(this), _BASE_SUPPLY); // Donate up to 1%

            for (uint256 i = 0; i < maxAmounts.length; i++) {
                fairSupply = Math.max(fairSupply, maxAmounts[i]);

                require(maxAmounts[i] > 0, "Helioswap: amount is zero");
                require(
                    maxAmounts[i] >= minAmounts[i],
                    "Helioswap: minAmount not reached"
                );

                _tokens[i].uniTransferFrom(
                    msg.sender,
                    address(this),
                    maxAmounts[i]
                );
                receivedAmounts[i] = maxAmounts[i];
            }
        } else {
            uint256[2] memory realBalances;
            for (uint256 i = 0; i < realBalances.length; i++) {
                realBalances[i] = _tokens[i].uniBalanceOf(address(this)).sub(
                    _tokens[i].isETH() ? msg.value : 0
                );
            }

            // Pre-compute fair supply
            fairSupply = uint256(-1);
            for (uint256 i = 0; i < maxAmounts.length; i++) {
                fairSupply = Math.min(
                    fairSupply,
                    totalSupply.mul(maxAmounts[i]).div(realBalances[i])
                );
            }

            uint256 fairSupplyCached = fairSupply;

            for (uint256 i = 0; i < maxAmounts.length; i++) {
                require(maxAmounts[i] > 0, "Helioswap: amount is zero");
                uint256 amount = realBalances[i]
                .mul(fairSupplyCached)
                .add(totalSupply - 1)
                .div(totalSupply);
                require(amount >= minAmounts[i], "Helioswap: minAmount not reached");

                _tokens[i].uniTransferFrom(msg.sender, address(this), amount);
                receivedAmounts[i] = _tokens[i].uniBalanceOf(address(this)).sub(
                    realBalances[i]
                );
                fairSupply = Math.min(
                    fairSupply,
                    totalSupply.mul(receivedAmounts[i]).div(realBalances[i])
                );
            }

            uint256 _decayPeriod = decayPeriod(); // gas savings
            for (uint256 i = 0; i < maxAmounts.length; i++) {
                virtualBalancesForRemoval[_tokens[i]].scale(
                    _decayPeriod,
                    realBalances[i],
                    totalSupply.add(fairSupply),
                    totalSupply
                );
                virtualBalancesForAddition[_tokens[i]].scale(
                    _decayPeriod,
                    realBalances[i],
                    totalSupply.add(fairSupply),
                    totalSupply
                );
            }
        }

        require(fairSupply > 0, "Helioswap: result is not enough");
        _mint(target, fairSupply);

        emit HelioswapDeposited(
            msg.sender,
            target,
            fairSupply,
            receivedAmounts[0],
            receivedAmounts[1]
        );
    }

    function withdraw(uint256 amount, uint256[] calldata minReturns) external returns(uint256[2] memory withdrawnAmounts) {
        return withdrawFor(amount, minReturns, msg.sender);
    }

    function withdrawFor(uint256 amount, uint256[] memory minReturns, address payable target) public nonReentrant returns(uint256[2] memory withdrawnAmounts) {
        IERC20[2] memory _tokens = [token0, token1];

        uint256 totalSupply = totalSupply();
        uint256 _decayPeriod = decayPeriod(); // gas savings
        _burn(msg.sender, amount);

        for (uint i = 0; i < _tokens.length; i++) {
            IERC20 token = _tokens[i];

            uint256 preBalance = token.uniBalanceOf(address(this));
            uint256 value = preBalance.mul(amount).div(totalSupply);
            token.uniTransfer(target, value);
            withdrawnAmounts[i] = value;
            require(i >= minReturns.length || value >= minReturns[i], "Helioswap: result is not enough");

            virtualBalancesForAddition[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply);
            virtualBalancesForRemoval[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply);
        }

        emit HelioswapWithdrawn(msg.sender, target, amount, withdrawnAmounts[0], withdrawnAmounts[1]);
    }

    function swap(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn) external payable returns(uint256 result) {
        return swapFor(src, dst, amount, minReturn, msg.sender);
    }

    function swapFor(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address payable receiver) public payable nonReentrant whenNotShutdown returns (uint256 result) {
        require(msg.value == (src.isETH() ? amount : 0), "Helioswap: wrong value usage");

        Balances memory balances = Balances({
            src: src.uniBalanceOf(address(this)).sub(src.isETH() ? msg.value : 0),
            dst: dst.uniBalanceOf(address(this))
        });
        uint256 confirmed;
        Balances memory virtualBalances;
        Fees memory fees = Fees({
            fee: fee(),
            slippageFee: slippageFee()
        });
        (confirmed, result, virtualBalances) = _doTransfers(src, dst, amount, minReturn, receiver, balances, fees);
        emit HelioswapSwapped(msg.sender, receiver, address(src), address(dst), confirmed, result, virtualBalances.src, virtualBalances.dst);

        // Overflow of uint128 is desired
        volumes[src].confirmed += uint128(confirmed);
        volumes[src].results += uint128(result);

        emit HelioswapSync(balances.src, balances.dst, fees.fee, fees.slippageFee);
    }

    function _doTransfers(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address payable receiver, Balances memory balances, Fees memory fees)
        private returns(uint256 confirmed, uint256 result, Balances memory virtualBalances)
    {
        uint256 _decayPeriod = decayPeriod();
        virtualBalances.src = virtualBalancesForAddition[src].current(_decayPeriod, balances.src);
        virtualBalances.src = Math.max(virtualBalances.src, balances.src);
        virtualBalances.dst = virtualBalancesForRemoval
        [dst].current(_decayPeriod, balances.dst);
        virtualBalances.dst = Math.min(virtualBalances.dst, balances.dst);
        src.uniTransferFrom(msg.sender, address(this), amount);
        confirmed = src.uniBalanceOf(address(this)).sub(balances.src);
        result = _getReturn(src, dst, confirmed, virtualBalances.src, virtualBalances.dst, fees.fee, fees.slippageFee);
        require(result > 0 && result >= minReturn, "Helioswap: return is not enough");
        dst.uniTransfer(receiver, result);

        // Update virtual balances to the same direction only at imbalanced state
        if (virtualBalances.src != balances.src) {
            virtualBalancesForAddition[src].set(virtualBalances.src.add(confirmed));
        }
        if (virtualBalances.dst != balances.dst) {
            virtualBalancesForRemoval[dst].set(virtualBalances.dst.sub(result));
        }
        // Update virtual balances to the opposite direction
        virtualBalancesForRemoval[src].update(_decayPeriod, balances.src);
        virtualBalancesForAddition[dst].update(_decayPeriod, balances.dst);
    }

    /*
        spot_ret = dx * y / x
        uni_ret = dx * y / (x + dx)
        slippage = (spot_ret - uni_ret) / spot_ret
        slippage = dx * dx * y / (x * (x + dx)) / (dx * y / x)
        slippage = dx / (x + dx)
        ret = uni_ret * (1 - slip_fee * slippage)
        ret = dx * y / (x + dx) * (1 - slip_fee * dx / (x + dx))
        ret = dx * y / (x + dx) * (x + dx - slip_fee * dx) / (x + dx)

        x = amount * denominator
        dx = amount * (denominator - fee)
    */
    function _getReturn(IERC20 src, IERC20 dst, uint256 amount, uint256 srcBalance, uint256 dstBalance, uint256 fee, uint256 slippageFee) internal view returns(uint256) {
        if (src > dst) {
            (src, dst) = (dst, src);
        }
        if (amount > 0 && src == token0 && dst == token1) {
            uint256 taxedAmount = amount.sub(amount.mul(fee).div(HelioswapConstants._FEE_DENOMINATOR));
            uint256 srcBalancePlusTaxedAmount = srcBalance.add(taxedAmount);
            uint256 ret = taxedAmount.mul(dstBalance).div(srcBalancePlusTaxedAmount);
            uint256 feeNumerator = HelioswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount).sub(slippageFee.mul(taxedAmount));
            uint256 feeDenominator = HelioswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount);
            return ret.mul(feeNumerator).div(feeDenominator);
        }
    }

    function rescueFunds(IERC20 token, uint256 amount) external nonReentrant onlyOwner {
        uint256 balance0 = token0.uniBalanceOf(address(this));
        uint256 balance1 = token1.uniBalanceOf(address(this));

        token.uniTransfer(msg.sender, amount);

        require(token0.uniBalanceOf(address(this)) >= balance0, "Helioswap: access denied");
        require(token1.uniBalanceOf(address(this)) >= balance1, "Helioswap: access denied");
        require(balanceOf(address(this)) >= _BASE_SUPPLY, "Helioswap: access denied");
    }

    // FE function
    function getReturn(IERC20 src, IERC20 dst, uint256 amount) public view returns(uint256 result) {
        if (src.uniBalanceOf(address(this)) == 0 || dst.uniBalanceOf(address(this)) == 0) {
            return 0;
        }
        Balances memory balances = Balances({
            src: src.uniBalanceOf(address(this)),
            dst: dst.uniBalanceOf(address(this))
        });
        Balances memory virtualBalances;
        Fees memory fees = Fees({
            fee: fee(),
            slippageFee: slippageFee()
        });

        uint256 _decayPeriod = decayPeriod();
        virtualBalances.src = virtualBalancesForAddition[src].current(_decayPeriod, balances.src);
        virtualBalances.src = Math.max(virtualBalances.src, balances.src);
        virtualBalances.dst = virtualBalancesForRemoval
        [dst].current(_decayPeriod, balances.dst);
        virtualBalances.dst = Math.min(virtualBalances.dst, balances.dst);
        return _getReturn(src, dst, amount, virtualBalances.src, virtualBalances.dst, fees.fee, fees.slippageFee);
    }
}

File 2 of 17 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 3 of 17 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.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 guidelines: functions revert instead
 * of 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 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual 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 {_setupDecimals} is
     * called.
     *
     * 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 returns (uint8) {
        return _decimals;
    }

    /**
     * @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:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, 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}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), 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}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        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) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(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) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is 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:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, 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:
     *
     * - `to` 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 = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(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);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(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 Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

    /**
     * @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 to 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 { }
}

File 4 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 5 of 17 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

File 6 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 17 : UniERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

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


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

    function isETH(IERC20 token) internal pure returns(bool) {
        return (address(token) == address(0));
    }

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

    function uniTransfer(IERC20 token, address payable to, uint256 amount) internal {
        if (amount > 0) {
            if (isETH(token)) {
                to.transfer(amount);
            } else {
                token.safeTransfer(to, amount);
            }
        }
    }

    function uniTransferFrom(IERC20 token, address payable from, address to, uint256 amount) internal {
        if (amount > 0) {
            if (isETH(token)) {
                require(msg.value >= amount, "UniERC20: not enough value");
                require(from == msg.sender, "from is not msg.sender");
                require(to == address(this), "to is not this");
                if (msg.value > amount) {
                    // Return remainder if exist
                    from.transfer(msg.value.sub(amount));
                }
            } else {
                token.safeTransferFrom(from, to, amount);
            }
        }
    }

    function uniSymbol(IERC20 token) internal view returns(string memory) {
        if (isETH(token)) {
            return "ETH";
        }

        (bool success, bytes memory data) = address(token).staticcall{ gas: 20000 }(
            abi.encodeWithSignature("symbol()")
        );
        if (!success) {
            (success, data) = address(token).staticcall{ gas: 20000 }(
                abi.encodeWithSignature("SYMBOL()")
            );
        }

        if (success && data.length >= 96) {
            (uint256 offset, uint256 len) = abi.decode(data, (uint256, uint256));
            if (offset == 0x20 && len > 0 && len <= 256) {
                return string(abi.decode(data, (bytes)));
            }
        }

        if (success && data.length == 32) {
            uint len = 0;
            while (len < data.length && data[len] >= 0x20 && data[len] <= 0x7E) {
                len++;
            }

            if (len > 0) {
                bytes memory result = new bytes(len);
                for (uint i = 0; i < len; i++) {
                    result[i] = data[i];
                }
                return string(result);
            }
        }

        return _toHex(address(token));
    }

    function _toHex(address account) private pure returns(string memory) {
        return _toHex(abi.encodePacked(account));
    }

    function _toHex(bytes memory data) private pure returns(string memory) {
        bytes memory str = new bytes(2 + data.length * 2);
        str[0] = "0";
        str[1] = "x";
        uint j = 2;
        for (uint i = 0; i < data.length; i++) {
            uint a = uint8(data[i]) >> 4;
            uint b = uint8(data[i]) & 0x0f;
            str[j++] = byte(uint8(a + 48 + (a/10)*39));
            str[j++] = byte(uint8(b + 48 + (b/10)*39));
        }

        return string(str);
    }
}

File 8 of 17 : Sqrt.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

library Sqrt {
    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint256 y) internal pure returns (uint256) {
        if (y > 3) {
            uint256 z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
            return z;
        } else if (y != 0) {
            return 1;
        } else {
            return 0;
        }
    }
}

File 9 of 17 : VirtualBalance.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "./SafeCast.sol";

library VirtualBalance {
    using SafeMath for uint256;
    using SafeCast for uint256;

    struct Data {
        uint256 balance;
        uint40 time;
    }

    function set(VirtualBalance.Data storage self, uint256 balance) internal {
        (self.balance, self.time) = (
            balance.toUint216(),
            block.timestamp.toUint40()
        );
    }

    function update(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance) internal {
        set(self, current(self, decayPeriod, realBalance));
    }

    function scale(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance, uint256 num, uint256 demon) internal {
        set(self, current(self, decayPeriod, realBalance).mul(num).add(demon.sub(1)).div(demon));
    }

    function current(VirtualBalance.Data memory self, uint256 decayPeriod, uint256 realBalance) internal view returns (uint256) {
        uint256 timePassed = Math.min(decayPeriod, block.timestamp.sub(self.time));
        uint256 timeRemain = decayPeriod.sub(timePassed);
        return uint256(self.balance).mul(timeRemain).add(
            realBalance.mul(timePassed)
        ).div(decayPeriod);
    }
}

File 10 of 17 : BaseHelioswap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../interfaces/IBaseHelioswapFactory.sol";
import "../libraries/HelioswapConstants.sol";
import "../libraries/SafeCast.sol";

abstract contract BaseHelioswap is ERC20, Ownable, ReentrancyGuard {
    using SafeCast for uint256;

    event SlippageFeeUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount);
    event DecayPeriodUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount);

    IBaseHelioswapFactory public baseHelioswapFactory;
    uint256 private _fee;
    uint256 private _slippageFee;
    uint256 private _decayPeriod;

    constructor(IBaseHelioswapFactory _baseHelioswapFactory) internal {
        baseHelioswapFactory = _baseHelioswapFactory;
        _fee = baseHelioswapFactory.defaultFee().toUint104();
        _slippageFee = baseHelioswapFactory.defaultSlippageFee().toUint104();
        _decayPeriod = baseHelioswapFactory.defaultDecayPeriod().toUint104();
    }

    function setBaseHelioswapFactory(IBaseHelioswapFactory newBaseHelioswapFactory) external onlyOwner {
        baseHelioswapFactory = newBaseHelioswapFactory;
    }

    function fee() public view returns(uint256) {
        return _fee;
    }

    function slippageFee() public view returns(uint256) {
        return _slippageFee;
    }

    function decayPeriod() public view returns(uint256) {
        return _decayPeriod;
    }
}

File 11 of 17 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 12 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 13 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

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

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

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

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

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

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

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 15 of 17 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

library SafeCast {
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value < 2**216, "value does not fit in 216 bits");
        return uint216(value);
    }

    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value < 2**104, "value does not fit in 104 bits");
        return uint104(value);
    }

    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value < 2**48, "value does not fit in 48 bits");
        return uint48(value);
    }

    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value < 2**40, "value does not fit in 40 bits");
        return uint40(value);
    }
}

File 16 of 17 : IBaseHelioswapFactory.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

interface IBaseHelioswapFactory {
    function defaults() external view returns(uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod);

    function defaultFee() external view returns(uint256);
    function defaultSlippageFee() external view returns(uint256);
    function defaultDecayPeriod() external view returns(uint256);

    function setDefaultFee(uint256) external returns(uint256);
    function setDefaultSlippageFee(uint256) external returns(uint256);
    function setDefaultDecayPeriod(uint256) external returns(uint256);

    function isActive() external view returns (bool);
}

File 17 of 17 : HelioswapConstants.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

library HelioswapConstants {
    uint256 internal constant _FEE_DENOMINATOR = 1e18;

    uint256 internal constant _MIN_DECAY_PERIOD = 1 minutes;

    uint256 internal constant _MAX_FEE = 0.01e18; // 1%
    uint256 internal constant _MAX_SLIPPAGE_FEE = 1e18;  // 100%
    uint256 internal constant _MAX_DECAY_PERIOD = 5 minutes;

    uint256 internal constant _DEFAULT_FEE = 3e15; // 0.3%
    uint256 internal constant _DEFAULT_SLIPPAGE_FEE = 466e15;  // 46.6%
    uint256 internal constant _DEFAULT_DECAY_PERIOD = 1 minutes;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_token0","type":"address"},{"internalType":"contract IERC20","name":"_token1","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract IBaseHelioswapFactory","name":"_baseHelioswapFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"decayPeriod","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDefault","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DecayPeriodUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token0Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Amount","type":"uint256"}],"name":"HelioswapDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"srcToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"result","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcAdditionBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstRemovalBalance","type":"uint256"}],"name":"HelioswapSwapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"srcBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"slippageFee","type":"uint256"}],"name":"HelioswapSync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token0Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Amount","type":"uint256"}],"name":"HelioswapWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"slippageFee","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDefault","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SlippageFeeUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseHelioswapFactory","outputs":[{"internalType":"contract IBaseHelioswapFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decayPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[2]","name":"maxAmounts","type":"uint256[2]"},{"internalType":"uint256[2]","name":"minAmounts","type":"uint256[2]"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"failSupply","type":"uint256"},{"internalType":"uint256[2]","name":"receivedAmounts","type":"uint256[2]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[2]","name":"maxAmounts","type":"uint256[2]"},{"internalType":"uint256[2]","name":"minAmounts","type":"uint256[2]"},{"internalType":"address","name":"target","type":"address"}],"name":"depositFor","outputs":[{"internalType":"uint256","name":"fairSupply","type":"uint256"},{"internalType":"uint256[2]","name":"receivedAmounts","type":"uint256[2]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"estimateBalanceForAddition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"estimateBalanceForRemoval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"_reserve0","type":"uint256"},{"internalType":"uint256","name":"_reserve1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"src","type":"address"},{"internalType":"contract IERC20","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getReturn","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IBaseHelioswapFactory","name":"newBaseHelioswapFactory","type":"address"}],"name":"setBaseHelioswapFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippageFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"src","type":"address"},{"internalType":"contract IERC20","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"src","type":"address"},{"internalType":"contract IERC20","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"swapFor","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"virtualBalancesForAddition","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint40","name":"time","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"virtualBalancesForRemoval","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint40","name":"time","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"volumes","outputs":[{"internalType":"uint128","name":"confirmed","type":"uint128"},{"internalType":"uint128","name":"results","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"minReturns","type":"uint256[]"}],"name":"withdraw","outputs":[{"internalType":"uint256[2]","name":"withdrawnAmounts","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"minReturns","type":"uint256[]"},{"internalType":"address payable","name":"target","type":"address"}],"name":"withdrawFor","outputs":[{"internalType":"uint256[2]","name":"withdrawnAmounts","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x60806040526004361061024f5760003560e01c806370a0823111610138578063a9059cbb116100b0578063d21220a71161007f578063ddca3f4311610064578063ddca3f4314610aa9578063f2fde38b14610abe578063fe02915614610af15761024f565b8063d21220a714610a59578063dd62ed3e14610a6e5761024f565b8063a9059cbb14610935578063b1ec4c401461096e578063c5b5c9fc146109e2578063c9e47a0014610a265761024f565b80638b30da731161010757806395d89b41116100ec57806395d89b411461086a5780639ea5ce0a1461087f578063a457c2d7146108fc5761024f565b80638b30da73146108405780638da5cb5b146108555761024f565b806370a082311461078a578063715018a6146107bd57806378e3214f146107d45780637fe03d9f1461080d5761024f565b80633732b394116101cb57806348d67e1b1161019a5780635915d8061161017f5780635915d806146106815780635ed9156d146107055780636edc2c09146107575761024f565b806348d67e1b146106425780634f64b2be146106575761024f565b80633732b394146104c457806339509351146104d95780633c6216a6146105125780634850fb991461060f5761024f565b806318160ddd1161022257806323b872dd1161020757806323b872dd146103f45780633049105d14610437578063313ce567146104995761024f565b806318160ddd1461038a5780631e1401f8146103b15761024f565b806306fdde03146102545780630902f1ac146102de578063095ea7b31461030c5780630dfe168114610359575b600080fd5b34801561026057600080fd5b50610269610b2d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a357818101518382015260200161028b565b50505050905090810190601f1680156102d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ea57600080fd5b506102f3610bc3565b6040805192835260208301919091528051918290030190f35b34801561031857600080fd5b506103456004803603604081101561032f57600080fd5b506001600160a01b038135169060200135610bfd565b604080519115158252519081900360200190f35b34801561036557600080fd5b5061036e610c1b565b604080516001600160a01b039092168252519081900360200190f35b34801561039657600080fd5b5061039f610c2a565b60408051918252519081900360200190f35b3480156103bd57600080fd5b5061039f600480360360608110156103d457600080fd5b506001600160a01b03813581169160208101359091169060400135610c30565b34801561040057600080fd5b506103456004803603606081101561041757600080fd5b506001600160a01b03813581169160208101359091169060400135610dd6565b6104576004803603608081101561044d57600080fd5b5060408101610e5d565b6040518083815260200182600260200280838360005b8381101561048557818101518382015260200161046d565b505050509050019250505060405180910390f35b3480156104a557600080fd5b506104ae610ec1565b6040805160ff9092168252519081900360200190f35b3480156104d057600080fd5b5061039f610eca565b3480156104e557600080fd5b50610345600480360360408110156104fc57600080fd5b506001600160a01b038135169060200135610ed0565b34801561051e57600080fd5b506105d46004803603606081101561053557600080fd5b8135919081019060408101602082013564010000000081111561055757600080fd5b82018360208201111561056957600080fd5b8035906020019184602083028401116401000000008311171561058b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b03169150610f1e9050565b6040518082600260200280838360005b838110156105fc5781810151838201526020016105e4565b5050505090500191505060405180910390f35b34801561061b57600080fd5b5061039f6004803603602081101561063257600080fd5b50356001600160a01b0316611189565b34801561064e57600080fd5b5061039f6111fc565b34801561066357600080fd5b5061036e6004803603602081101561067a57600080fd5b5035611202565b34801561068d57600080fd5b506105d4600480360360408110156106a457600080fd5b813591908101906040810160208201356401000000008111156106c657600080fd5b8201836020820111156106d857600080fd5b803590602001918460208302840111640100000000831117156106fa57600080fd5b509092509050611283565b34801561071157600080fd5b506107386004803603602081101561072857600080fd5b50356001600160a01b03166112d2565b6040805192835264ffffffffff90911660208301528051918290030190f35b34801561076357600080fd5b506107386004803603602081101561077a57600080fd5b50356001600160a01b03166112f2565b34801561079657600080fd5b5061039f600480360360208110156107ad57600080fd5b50356001600160a01b0316611312565b3480156107c957600080fd5b506107d261132d565b005b3480156107e057600080fd5b506107d2600480360360408110156107f757600080fd5b506001600160a01b0381351690602001356113fe565b34801561081957600080fd5b506107d26004803603602081101561083057600080fd5b50356001600160a01b031661165a565b34801561084c57600080fd5b5061036e611708565b34801561086157600080fd5b5061036e611717565b34801561087657600080fd5b5061026961172b565b610457600480360360a081101561089557600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194505050356001600160a01b0316905061178c565b34801561090857600080fd5b506103456004803603604081101561091f57600080fd5b506001600160a01b038135169060200135611e20565b34801561094157600080fd5b506103456004803603604081101561095857600080fd5b506001600160a01b038135169060200135611e88565b34801561097a57600080fd5b506109a16004803603602081101561099157600080fd5b50356001600160a01b0316611e9c565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b61039f600480360360a08110156109f857600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160809091013516611ed8565b348015610a3257600080fd5b5061039f60048036036020811015610a4957600080fd5b50356001600160a01b03166122a1565b348015610a6557600080fd5b5061036e61230b565b348015610a7a57600080fd5b5061039f60048036036040811015610a9157600080fd5b506001600160a01b038135811691602001351661231a565b348015610ab557600080fd5b5061039f612345565b348015610aca57600080fd5b506107d260048036036020811015610ae157600080fd5b50356001600160a01b031661234b565b61039f60048036036080811015610b0757600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135612478565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bb95780601f10610b8e57610100808354040283529160200191610bb9565b820191906000526020600020905b815481529060010190602001808311610b9c57829003601f168201915b5050505050905090565b600b546000908190610bde906001600160a01b0316306124f8565b600c54909250610bf7906001600160a01b0316306124f8565b90509091565b6000610c11610c0a612599565b848461259d565b5060015b92915050565b600b546001600160a01b031681565b60025490565b6000610c456001600160a01b038516306124f8565b1580610c615750610c5f6001600160a01b038416306124f8565b155b15610c6e57506000610dcf565b610c766136af565b6040805180820190915280610c946001600160a01b038816306124f8565b8152602001610cac6001600160a01b038716306124f8565b90529050610cb86136af565b610cc06136af565b6040518060400160405280610cd3612345565b8152602001610ce0610eca565b905290506000610cee6111fc565b84516001600160a01b038a166000908152600e60209081526040918290208251808401909352805483526001015464ffffffffff1690820152919250610d3691908390612689565b8084528451610d4591906126e5565b83526020808501516001600160a01b0389166000908152600f83526040908190208151808301909252805482526001015464ffffffffff1692810192909252610d9091908390612689565b6020808501829052850151610da591906126fc565b60208085018290528451845191850151610dc8938c938c938c939092919061270b565b9450505050505b9392505050565b6000610de3848484612804565b610e5384610def612599565b610e4e856040518060600160405280602881526020016137bc602891396001600160a01b038a16600090815260016020526040812090610e2d612599565b6001600160a01b03168152602081019190915260400160002054919061295f565b61259d565b5060019392505050565b6000610e676136c9565b604080518082018252610eb691869060029083908390808284376000920191909152505060408051808201825291508690600290839083908082843760009201919091525033915061178c9050565b915091509250929050565b60055460ff1690565b60095490565b6000610c11610edd612599565b84610e4e8560016000610eee612599565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906129f6565b610f266136c9565b60026006541415610f7e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655610f8b6136c9565b5060408051808201909152600b546001600160a01b039081168252600c541660208201526000610fb9610c2a565b90506000610fc56111fc565b9050610fd13388612a50565b60005b6002811015611126576000848260028110610feb57fe5b6020020151905060006110076001600160a01b038316306124f8565b9050600061101f86611019848e612b4c565b90612ba5565b90506110356001600160a01b0384168a83612c0c565b8088856002811061104257fe5b602002015289518410158061106a575089848151811061105e57fe5b60200260200101518110155b6110bb576040805162461bcd60e51b815260206004820152601f60248201527f48656c696f737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b6110eb85836110ca898f612c75565b6001600160a01b0387166000908152600e602052604090209291908a612cd2565b61111b85836110fa898f612c75565b6001600160a01b0387166000908152600f602052604090209291908a612cd2565b505050600101610fd4565b508351602080860151604080518b8152928301939093528183015290516001600160a01b0387169133917f7c86c7542e7b655e787a864b22133e97cdb77c70732e528e65a9ab7a0e64acc79181900360600190a350506001600655509392505050565b60008061119f6001600160a01b038416306124f8565b90506111f36111ed6111af6111fc565b6001600160a01b0386166000908152600f60209081526040918290208251808401909352805483526001015464ffffffffff16908201529084612689565b826126fc565b9150505b919050565b600a5490565b60008161121b5750600b546001600160a01b03166111f7565b81600114156112365750600c546001600160a01b03166111f7565b6040805162461bcd60e51b815260206004820152601360248201527f506f6f6c206861732074776f20746f6b656e7300000000000000000000000000604482015290519081900360640190fd5b61128b6136c9565b6112ca84848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250339250610f1e915050565b949350505050565b600f602052600090815260409020805460019091015464ffffffffff1682565b600e602052600090815260409020805460019091015464ffffffffff1682565b6001600160a01b031660009081526020819052604090205490565b611335612599565b6001600160a01b0316611346611717565b6001600160a01b0316146113a1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36005805474ffffffffffffffffffffffffffffffffffffffff0019169055565b60026006541415611456576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611463612599565b6001600160a01b0316611474611717565b6001600160a01b0316146114cf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600b546000906114e8906001600160a01b0316306124f8565b600c54909150600090611504906001600160a01b0316306124f8565b905061151a6001600160a01b0385163385612c0c565b600b548290611532906001600160a01b0316306124f8565b1015611585576040805162461bcd60e51b815260206004820152601860248201527f48656c696f737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b600c54819061159d906001600160a01b0316306124f8565b10156115f0576040805162461bcd60e51b815260206004820152601860248201527f48656c696f737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b6103e86115fc30611312565b101561164f576040805162461bcd60e51b815260206004820152601860248201527f48656c696f737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b505060016006555050565b611662612599565b6001600160a01b0316611673611717565b6001600160a01b0316146116ce576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6007546001600160a01b031681565b60055461010090046001600160a01b031690565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bb95780601f10610b8e57610100808354040283529160200191610bb9565b60006117966136c9565b600260065414156117ee576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026006556117fb6136c9565b5060408051808201909152600b546001600160a01b039081168252600c541660208201526118398160005b60200201516001600160a01b0316612d2a565b61185e57611848816001611826565b611853576000611859565b60208601515b611861565b85515b34146118b4576040805162461bcd60e51b815260206004820152601c60248201527f48656c696f737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b60006118be610c2a565b905080611a4a576118d26103e86063612b4c565b93506118e0306103e8612d37565b60005b6002811015611a4457611906858983600281106118fc57fe5b60200201516126e5565b9450600088826002811061191657fe5b60200201511161196d576040805162461bcd60e51b815260206004820152601960248201527f48656c696f737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b86816002811061197957fe5b602002015188826002811061198a57fe5b602002015110156119e2576040805162461bcd60e51b815260206004820181905260248201527f48656c696f737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b611a1a33308a84600281106119f357fe5b6020020151868560028110611a0457fe5b60200201516001600160a01b0316929190612e27565b878160028110611a2657fe5b6020020151848260028110611a3757fe5b60200201526001016118e3565b50611d5d565b611a526136c9565b60005b6002811015611ac057611aa7611a7085836002811061182657fe5b611a7b576000611a7d565b345b611aa130878560028110611a8d57fe5b60200201516001600160a01b0316906124f8565b90612c75565b828260028110611ab357fe5b6020020152600101611a55565b50600019945060005b6002811015611b1457611b0a86611b05848460028110611ae557fe5b60200201516110198d8660028110611af957fe5b60200201518890612b4c565b6126fc565b9550600101611ac9565b508460005b6002811015611ca15760008a8260028110611b3057fe5b602002015111611b87576040805162461bcd60e51b815260206004820152601960248201527f48656c696f737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b6000611bb58561101960018803611baf87898860028110611ba457fe5b602002015190612b4c565b906129f6565b9050898260028110611bc357fe5b6020020151811015611c1c576040805162461bcd60e51b815260206004820181905260248201527f48656c696f737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b611c2e333083898660028110611a0457fe5b611c52848360028110611c3d57fe5b6020020151611aa130898660028110611a8d57fe5b878360028110611c5e57fe5b6020020152611c9688611b05868560028110611c7657fe5b60200201516110198b8760028110611c8a57fe5b60200201518a90612b4c565b975050600101611b19565b506000611cac6111fc565b905060005b6002811015611d5857611d2082858360028110611cca57fe5b6020020151611cd9888c6129f6565b88600f60008c8860028110611cea57fe5b60200201516001600160a01b03166001600160a01b03168152602001908152602001600020612cd290949392919063ffffffff16565b611d5082858360028110611d3057fe5b6020020151611d3f888c6129f6565b88600e60008c8860028110611cea57fe5b600101611cb1565b505050505b60008411611db2576040805162461bcd60e51b815260206004820152601f60248201527f48656c696f737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b611dbc8585612d37565b825160208085015160408051888152928301939093528183015290516001600160a01b0387169133917f56834d20f2e2e6be7761b3cc46f1041891a7dfc6351686c628b2e6280b7a9ae59181900360600190a3505060016006559094909350915050565b6000610c11611e2d612599565b84610e4e856040518060600160405280602581526020016138786025913960016000611e57612599565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061295f565b6000610c11611e95612599565b8484612804565b600d602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b600060026006541415611f32576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655600754604080517f22f3e2d400000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916322f3e2d491600480820192602092909190829003018186803b158015611f9557600080fd5b505afa158015611fa9573d6000803e3d6000fd5b505050506040513d6020811015611fbf57600080fd5b5051612012576040805162461bcd60e51b815260206004820152601b60248201527f48656c696f737761703a20666163746f72792073687574646f776e0000000000604482015290519081900360640190fd5b612024866001600160a01b0316612d2a565b61202f576000612031565b835b3414612084576040805162461bcd60e51b815260206004820152601c60248201527f48656c696f737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b61208c6136af565b60405180604001604052806120cc6120ac8a6001600160a01b0316612d2a565b6120b75760006120b9565b345b611aa16001600160a01b038c16306124f8565b81526020016120e46001600160a01b038916306124f8565b9052905060006120f26136af565b6120fa6136af565b604051806040016040528061210d612345565b815260200161211a610eca565b9052905061212d8a8a8a8a8a8987612fb3565b809450819750829550505050896001600160a01b0316866001600160a01b0316336001600160a01b03167f297974aa1165e11e6af0758b29319ee97cf5e88ec74f2e51ea10215ed8a08b0e8c878a8860000151896020015160405180866001600160a01b031681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a46001600160a01b038a166000908152600d602090815260409182902080547fffffffffffffffffffffffffffffffff0000000000000000000000000000000081166fffffffffffffffffffffffffffffffff91821688018216178082167001000000000000000000000000000000009182900483168b019092160217905585518682015184518584015185519384529383019190915281840152606081019190915290517f8a53257cf39ef3750e5cf6406bc6eac8296e192481918339e24e6d3afe2b4d67916080908290030190a15050600160065550909695505050505050565b6000806122b76001600160a01b038416306124f8565b90506111f36123056122c76111fc565b6001600160a01b0386166000908152600e60209081526040918290208251808401909352805483526001015464ffffffffff16908201529084612689565b826126e5565b600c546001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60085490565b612353612599565b6001600160a01b0316612364611717565b6001600160a01b0316146123bf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166124045760405162461bcd60e51b815260040180806020018281038252602681526020018061372d6026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60006124878585858533611ed8565b95945050505050565b60006d010000000000000000000000000082106124f4576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2031303420626974730000604482015290519081900360640190fd5b5090565b600061250383612d2a565b1561251957506001600160a01b03811631610c15565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561256657600080fd5b505afa15801561257a573d6000803e3d6000fd5b505050506040513d602081101561259057600080fd5b50519050610c15565b3390565b6001600160a01b0383166125e25760405162461bcd60e51b815260040180806020018281038252602481526020018061382a6024913960400191505060405180910390fd5b6001600160a01b0382166126275760405162461bcd60e51b81526004018080602001828103825260228152602001806137536022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000806126ae84611b05876020015164ffffffffff1642612c7590919063ffffffff16565b905060006126bc8583612c75565b90506126db856110196126cf8786612b4c565b8951611baf9086612b4c565b9695505050505050565b6000818310156126f55781610dcf565b5090919050565b60008183106126f55781610dcf565b6000866001600160a01b0316886001600160a01b0316111561272b579596955b6000861180156127485750600b546001600160a01b038981169116145b80156127615750600c546001600160a01b038881169116145b156127f9576000612788612781670de0b6b3a76400006110198a88612b4c565b8890612c75565b9050600061279687836129f6565b905060006127a882611019858a612b4c565b905060006127cb6127b98786612b4c565b611aa1670de0b6b3a764000086612b4c565b905060006127e1670de0b6b3a764000085612b4c565b90506127f1816110198585612b4c565b955050505050505b979650505050505050565b6001600160a01b0383166128495760405162461bcd60e51b81526004018080602001828103825260258152602001806138056025913960400191505060405180910390fd5b6001600160a01b03821661288e5760405162461bcd60e51b81526004018080602001828103825260238152602001806136e86023913960400191505060405180910390fd5b612899838383612c70565b6128d681604051806060016040528060268152602001613775602691396001600160a01b038616600090815260208190526040902054919061295f565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461290590826129f6565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156129ee5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129b357818101518382015260200161299b565b50505050905090810190601f1680156129e05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610dcf576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038216612a955760405162461bcd60e51b81526004018080602001828103825260218152602001806137e46021913960400191505060405180910390fd5b612aa182600083612c70565b612ade8160405180606001604052806022815260200161370b602291396001600160a01b038516600090815260208190526040902054919061295f565b6001600160a01b038316600090815260208190526040902055600254612b049082612c75565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082612b5b57506000610c15565b82820282848281612b6857fe5b0414610dcf5760405162461bcd60e51b815260040180806020018281038252602181526020018061379b6021913960400191505060405180910390fd5b6000808211612bfb576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612c0457fe5b049392505050565b8015612c7057612c1b83612d2a565b15612c5c576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612c56573d6000803e3d6000fd5b50612c70565b612c706001600160a01b038416838361321e565b505050565b600082821115612ccc576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b612d2385612d1e83611019612ce8826001612c75565b604080518082019091528b54815260018c015464ffffffffff166020820152611baf908990612d18908d8d612689565b90612b4c565b61329e565b5050505050565b6001600160a01b03161590565b6001600160a01b038216612d92576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b612d9e60008383612c70565b600254612dab90826129f6565b6002556001600160a01b038216600090815260208190526040902054612dd190826129f6565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b8015612fad57612e3684612d2a565b15612f985780341015612e90576040805162461bcd60e51b815260206004820152601a60248201527f556e6945524332303a206e6f7420656e6f7567682076616c7565000000000000604482015290519081900360640190fd5b6001600160a01b0383163314612eed576040805162461bcd60e51b815260206004820152601660248201527f66726f6d206973206e6f74206d73672e73656e64657200000000000000000000604482015290519081900360640190fd5b6001600160a01b0382163014612f4a576040805162461bcd60e51b815260206004820152600e60248201527f746f206973206e6f742074686973000000000000000000000000000000000000604482015290519081900360640190fd5b80341115612f93576001600160a01b0383166108fc612f693484612c75565b6040518115909202916000818181858888f19350505050158015612f91573d6000803e3d6000fd5b505b612fad565b612fad6001600160a01b0385168484846132f1565b50505050565b600080612fbe6136af565b6000612fc86111fc565b86516001600160a01b038d166000908152600e60209081526040918290208251808401909352805483526001015464ffffffffff169082015291925061301091908390612689565b808352865161301f91906126e5565b82526020808701516001600160a01b038c166000908152600f83526040908190208151808301909252805482526001015464ffffffffff169281019290925261306a91908390612689565b602080840182905287015161307f91906126fc565b60208301526130996001600160a01b038c1633308c612e27565b85516130b290611aa16001600160a01b038e16306124f8565b93506130d38b8b86856000015186602001518a600001518b6020015161270b565b92506000831180156130e55750878310155b613136576040805162461bcd60e51b815260206004820152601f60248201527f48656c696f737761703a2072657475726e206973206e6f7420656e6f75676800604482015290519081900360640190fd5b61314a6001600160a01b038b168885612c0c565b85518251146131815781516131819061316390866129f6565b6001600160a01b038d166000908152600e602052604090209061329e565b85602001518260200151146131c15760208201516131c1906131a39085612c75565b6001600160a01b038c166000908152600f602052604090209061329e565b85516001600160a01b038c166000908152600f602052604090206131e6918390613379565b6020808701516001600160a01b038c166000908152600e9092526040909120613210918390613379565b509750975097945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052612c709084906133a9565b6132a78161345a565b6132b0426134cc565b60018401805464ffffffffff191664ffffffffff929092169190911790557affffffffffffffffffffffffffffffffffffffffffffffffffffff1690915550565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612fad9085906133a9565b6040805180820190915283548152600184015464ffffffffff166020820152612c70908490612d1e908585612689565b60606133fe826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166135289092919063ffffffff16565b805190915015612c705780806020019051602081101561341d57600080fd5b5051612c705760405162461bcd60e51b815260040180806020018281038252602a81526020018061384e602a913960400191505060405180910390fd5b60007b0100000000000000000000000000000000000000000000000000000082106124f4576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2032313620626974730000604482015290519081900360640190fd5b60006501000000000082106124f4576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034302062697473000000604482015290519081900360640190fd5b60606112ca84846000858561353c85613643565b61358d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106135cc5780518252601f1990920191602091820191016135ad565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461362e576040519150601f19603f3d011682016040523d82523d6000602084013e613633565b606091505b50915091506127f9828286613649565b3b151590565b60608315613658575081610dcf565b8251156136685782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156129b357818101518382015260200161299b565b604051806040016040528060008152602001600081525090565b6040518060400160405280600290602082028036833750919291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f1417e7e313b8bffc287bf84c84ebd6fb7c8bf8bcf656abf02ab95942ce5944764736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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