Contract 0x3DB0Bc1987427a3AC34518C8968eFdd4f9C28d29 1

 
Txn Hash Method
Block
From
To
Value
0xc0fe13065d2b386b4ba9a165624307e9ca756529c426f540ba75079f50b69cbdAdd Pair Info71515962023-11-27 13:42:19140 days 17 hrs agoAlienBase: Deployer IN  0x3db0bc1987427a3ac34518c8968efdd4f9c28d290 ETH0.0000584304440.010000056
0x51243a67b60f19a4f4c8fd9cc57b4195ddc244d729e31b7e9582d259d0023ccdAdd Pair Info71515942023-11-27 13:42:15140 days 17 hrs agoAlienBase: Deployer IN  0x3db0bc1987427a3ac34518c8968efdd4f9c28d290 ETH0.0000588564640.010000056
0xf357506c486db00f1dc06f0d204bd11fa2c5c26165193de9c77ba46e10791d0a0x6080604071512372023-11-27 13:30:21140 days 17 hrs agoAlienBase: Deployer IN  Create: StableSwapViewer0 ETH0.0023605455040.01
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StableSwapViewer

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 10 : 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 2 of 10 : 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 3 of 10 : 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 4 of 10 : ISwap.sol
// SPDX-License-Identifier: MIT
pragma solidity  >=0.6.0 <0.8.0;


import "../libraries/SafeERC20.sol";

interface ISwap {
    // pool data view functions
    function getA() external view returns (uint256);

    function getToken(uint8 index) external view returns (IERC20);

    function getTokenIndex(address tokenAddress) external view returns (uint8);

    function getTokenBalance(uint8 index) external view returns (uint256);

    function getVirtualPrice() external view returns (uint256);

    function getNumberOfTokens() external view returns (uint256);

    function getLpToken() external view returns (IERC20);

    // min return calculation functions
    function calculateSwap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx
    ) external view returns (uint256);

    function calculateTokenAmount(uint256[] calldata amounts, bool deposit)
        external
        view
        returns (uint256);

    function calculateRemoveLiquidity(uint256 amount)
        external
        view
        returns (uint256[] memory);

    function calculateRemoveLiquidityOneToken(
        uint256 tokenAmount,
        uint8 tokenIndex
    ) external view returns (uint256 availableTokenAmount);

    // state modifying functions
    function initialize(
        IERC20[] memory pooledTokens,
        uint8[] memory decimals,
        string memory lpTokenName,
        string memory lpTokenSymbol,
        uint256 a,
        uint256 fee,
        uint256 adminFee,
        address lpTokenTargetAddress
    ) external;

    function swap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external returns (uint256);

    function addLiquidity(
        uint256[] calldata amounts,
        uint256 minToMint,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidity(
        uint256 amount,
        uint256[] calldata minAmounts,
        uint256 deadline
    ) external returns (uint256[] memory);

    function removeLiquidityOneToken(
        uint256 tokenAmount,
        uint8 tokenIndex,
        uint256 minAmount,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidityImbalance(
        uint256[] calldata amounts,
        uint256 maxBurnAmount,
        uint256 deadline
    ) external returns (uint256);
}

File 5 of 10 : 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 6 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../interfaces/IERC20.sol";
import "./SafeMath.sol";
import "./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 7 of 10 : 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 8 of 10 : IStableSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;

interface IStableSwap {
// SPDX-License-Identifier: MIT

    struct Swap {
        // variables around the ramp management of A,
        // the amplification coefficient * n * (n - 1)
        // see https://www.curve.fi/stableswap-paper.pdf for details
        uint256 initialA;
        uint256 futureA;
        uint256 initialATime;
        uint256 futureATime;
        // fee calculation
        uint256 swapFee;
        uint256 adminFee;
        address lpToken;
        // contract references for all tokens being pooled
        address[] pooledTokens;
        // multipliers for each pooled token's precision to get to POOL_PRECISION_DECIMALS
        // for example, TBTC has 18 decimals, so the multiplier should be 1. WBTC
        // has 8, so the multiplier should be 10 ** 18 / 10 ** 8 => 10 ** 10
        uint256[] tokenPrecisionMultipliers;
        // the pool balance of each token, in the token's precision
        // the contract's actual token balance might differ
        uint256[] balances;
    }

    // pool data view functions
    function getA() external view returns (uint256);

    function getToken(uint8 index) external view returns (address);

    function getTokenIndex(address tokenAddress) external view returns (uint8);

    function getTokenBalance(uint8 index) external view returns (uint256);

    function getVirtualPrice() external view returns (uint256);

    function getNumberOfTokens() external view returns (uint256);

    function getLpToken() external view returns (address);

    function swapStorage() external view returns(Swap memory);

    // min return calculation functions
    function calculateSwap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx
    ) external view returns (uint256);

    function calculateTokenAmount(uint256[] calldata amounts, bool deposit)
    external
    view
    returns (uint256);

    function calculateRemoveLiquidity(uint256 amount)
    external
    view
    returns (uint256[] memory);

    function calculateRemoveLiquidityOneToken(
        uint256 tokenAmount,
        uint8 tokenIndex
    ) external view returns (uint256 availableTokenAmount);

    // state modifying functions
    function initialize(
        address[] memory pooledTokens,
        uint8[] memory decimals,
        string memory lpTokenName,
        string memory lpTokenSymbol,
        uint256 a,
        uint256 fee,
        uint256 adminFee,
        address lpTokenTargetAddress
    ) external;

    function swap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external returns (uint256);

    function addLiquidity(
        uint256[] calldata amounts,
        uint256 minToMint,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidity(
        uint256 amount,
        uint256[] calldata minAmounts,
        uint256 deadline
    ) external returns (uint256[] memory);

    function removeLiquidityOneToken(
        uint256 tokenAmount,
        uint8 tokenIndex,
        uint256 minAmount,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidityImbalance(
        uint256[] calldata amounts,
        uint256 maxBurnAmount,
        uint256 deadline
    ) external returns (uint256);
}

File 9 of 10 : IStableSwapFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;

interface IStableSwapFactory {
    struct StableSwapPairInfo {
        address swapContract;
        address token0;
        address token1;
        address LPContract;
    }

    struct StableSwapThreePoolPairInfo {
        address swapContract;
        address token0;
        address token1;
        address token2;
        address LPContract;
    }

    // solium-disable-next-line mixedcase
    function pairLength() external view returns (uint256);

    function getPairInfo(address _tokenA, address _tokenB) 
        external 
        view 
        returns (StableSwapPairInfo memory info);

    function getThreePoolPairInfo(address _tokenA, address _tokenB)
        external
        view
        returns (StableSwapThreePoolPairInfo memory info);

    function get_dx(
        address _swap,
        uint256 i,
        uint256 j,
        uint256 dy,
        uint256 max_dx
    ) external view returns (uint256);
        
}

File 10 of 10 : StableSwapViewer.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.7.6;
pragma abicoder v2;

import "./interfaces/IStableSwapFactory.sol";
import "./interfaces/IStableSwap.sol";
import "@openzeppelin/contracts-3.4.1/access/Ownable.sol";
import "../../stable-amm/interfaces/ISwap.sol";
//import "../../stable-amm/interfaces/ISwap.sol";

contract StableSwapViewer is IStableSwapFactory, Ownable {

    mapping(address => mapping(address => mapping(address => StableSwapThreePoolPairInfo))) public stableSwapPairInfo;
    // Query three pool pair information by two tokens.
    mapping(address => mapping(address => StableSwapThreePoolPairInfo)) threePoolInfo;
    mapping(uint256 => address) public swapPairContract;

    address constant ZEROADDRESS = address(0);
    uint256 public constant FEE_DENOMINATOR = 1e10;
    uint256 public constant PRECISION = 1e18;
    uint256 public constant N_COINS = 2;

    uint256 public override pairLength;

    event NewStableSwapPair(address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP);

    /**
     * View only "factory" to query existing StableSwap pairs
     * Pairs are added manually by owner
     *
     *
     */
    constructor() {

    }

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, "IDENTICAL_ADDRESSES");
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
    }

    function sortTokens(
        address tokenA,
        address tokenB,
        address tokenC
    )
    internal
    pure
    returns (
        address,
        address,
        address
    )
    {
        require(tokenA != tokenB && tokenA != tokenC && tokenB != tokenC, "IDENTICAL_ADDRESSES");
        address tmp;
        if (tokenA > tokenB) {
            tmp = tokenA;
            tokenA = tokenB;
            tokenB = tmp;
        }
        if (tokenB > tokenC) {
            tmp = tokenB;
            tokenB = tokenC;
            tokenC = tmp;
            if (tokenA > tokenB) {
                tmp = tokenA;
                tokenA = tokenB;
                tokenB = tmp;
            }
        }
        return (tokenA, tokenB, tokenC);
    }

    function addPairInfoInternal(
        address _swapContract,
        address _t0,
        address _t1,
        address _t2,
        address _LP
    ) internal {
        StableSwapThreePoolPairInfo storage info = stableSwapPairInfo[_t0][_t1][_t2];
        info.swapContract = _swapContract;
        info.token0 = _t0;
        info.token1 = _t1;
        info.token2 = _t2;
        info.LPContract = _LP;
        swapPairContract[pairLength] = _swapContract;
        pairLength += 1;
        if (_t2 != ZEROADDRESS) {
            addThreePoolPairInfo(_t0, _t1, _t2, info);
        }

        emit NewStableSwapPair(_swapContract, _t0, _t1, _t2, _LP);
    }

    function addThreePoolPairInfo(
        address _t0,
        address _t1,
        address _t2,
        StableSwapThreePoolPairInfo memory info
    ) internal {
        threePoolInfo[_t0][_t1] = info;
        threePoolInfo[_t0][_t2] = info;
        threePoolInfo[_t1][_t2] = info;
    }

    function addPairInfo(address _swapContract) external onlyOwner {
        ISwap swap = ISwap(_swapContract);
        if (N_COINS == 2) {
            addPairInfoInternal(_swapContract, address(swap.getToken(0)), address(swap.getToken(1)), ZEROADDRESS, address(swap.getLpToken()));
        } else if (N_COINS == 3) {
            addPairInfoInternal(_swapContract, address(swap.getToken(0)), address(swap.getToken(1)), address(swap.getToken(2)), address(swap.getLpToken()));
        }
    }

    function getPairInfo(address _tokenA, address _tokenB) external override view returns (StableSwapPairInfo memory info) {
        (address t0, address t1) = sortTokens(_tokenA, _tokenB);
        StableSwapThreePoolPairInfo memory pairInfo = stableSwapPairInfo[t0][t1][ZEROADDRESS];
        info.swapContract = pairInfo.swapContract;
        info.token0 = pairInfo.token0;
        info.token1 = pairInfo.token1;
        info.LPContract = pairInfo.LPContract;
    }

    function getThreePoolPairInfo(address _tokenA, address _tokenB)
    external
    override
    view
    returns (StableSwapThreePoolPairInfo memory info)
    {
        (address t0, address t1) = sortTokens(_tokenA, _tokenB);
        info = threePoolInfo[t0][t1];
    }

    //Functions ported from StableSwapInfo

    function balances(IStableSwap _swap) public view returns (uint256[N_COINS] memory swapBalances) {
        for (uint8 i = 0; i < N_COINS; i++) {
            swapBalances[i] = _swap.getTokenBalance(i);
        }
    }

    function RATES(IStableSwap _swap) public view returns (uint256[N_COINS] memory swapRATES) {
        for (uint256 i = 0; i < N_COINS; i++) {
            swapRATES[i] = _swap.getVirtualPrice(); //Pancake has a per token rate
        }
    }

    function _xp_mem(IStableSwap _swap, uint256[N_COINS] memory _balances)
    public
    view
    returns (uint256[N_COINS] memory result)
    {
        result = RATES(_swap);
        for (uint256 i = 0; i < N_COINS; i++) {
            result[i] = (result[i] * _balances[i]) / PRECISION;
        }
    }

    function _getSwapFee(IStableSwap _swap) internal view returns (uint256 swapFee) {
        swapFee = _swap.swapStorage().swapFee;
    }

    function get_D(uint256[N_COINS] memory xp, uint256 amp) internal pure returns (uint256) {
        uint256 S;
        for (uint256 i = 0; i < N_COINS; i++) {
            S += xp[i];
        }
        if (S == 0) {
            return 0;
        }

        uint256 Dprev;
        uint256 D = S;
        uint256 Ann = amp * N_COINS;
        for (uint256 j = 0; j < 255; j++) {
            uint256 D_P = D;
            for (uint256 k = 0; k < N_COINS; k++) {
                D_P = (D_P * D) / (xp[k] * N_COINS); // If division by 0, this will be borked: only withdrawal will work. And that is good
            }
            Dprev = D;
            D = ((Ann * S + D_P * N_COINS) * D) / ((Ann - 1) * D + (N_COINS + 1) * D_P);
            // Equality with the precision of 1
            if (D > Dprev) {
                if (D - Dprev <= 1) {
                    break;
                }
            } else {
                if (Dprev - D <= 1) {
                    break;
                }
            }
        }
        return D;
    }

    function get_y(
        address _swap,
        uint256 i,
        uint256 j,
        uint256 x,
        uint256[N_COINS] memory xp_
    ) internal view returns (uint256) {
        IStableSwap swap = IStableSwap(_swap);
        uint256 amp = swap.getA();
        uint256 D = get_D(xp_, amp);
        uint256 c = D;
        uint256 S_;
        uint256 Ann = amp * N_COINS;

        uint256 _x;
        for (uint256 k = 0; k < N_COINS; k++) {
            if (k == i) {
                _x = x;
            } else if (k != j) {
                _x = xp_[k];
            } else {
                continue;
            }
            S_ += _x;
            c = (c * D) / (_x * N_COINS);
        }
        c = (c * D) / (Ann * N_COINS);
        uint256 b = S_ + D / Ann; // - D
        uint256 y_prev;
        uint256 y = D;

        for (uint256 m = 0; m < 255; m++) {
            y_prev = y;
            y = (y * y + c) / (2 * y + b - D);
            // Equality with the precision of 1
            if (y > y_prev) {
                if (y - y_prev <= 1) {
                    break;
                }
            } else {
                if (y_prev - y <= 1) {
                    break;
                }
            }
        }
        return y;
    }

    function get_dx(
        address _swap,
        uint256 i,
        uint256 j,
        uint256 dy,
        uint256 max_dx
    ) external override view returns (uint256) {
        IStableSwap swap = IStableSwap(_swap);
        uint256[N_COINS] memory old_balances = balances(swap);
        uint256[N_COINS] memory xp = _xp_mem(swap, old_balances);

        uint256 dy_with_fee = (dy * FEE_DENOMINATOR) / (FEE_DENOMINATOR - _getSwapFee(swap));
        require(dy_with_fee < old_balances[j], "Excess balance");
        uint256[N_COINS] memory rates = RATES(swap);
        uint256 y = xp[j] - (dy_with_fee * rates[j]) / PRECISION;
        uint256 x = get_y(_swap, j, i, y, xp);

        uint256 dx = x - xp[i];

        // Convert all to real units
        dx = (dx * PRECISION) / rates[i] + 1; // +1 for round lose.
        require(dx <= max_dx, "Exchange resulted in fewer coins than expected");
        return dx;
    }

}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"swapContract","type":"address"},{"indexed":false,"internalType":"address","name":"tokenA","type":"address"},{"indexed":false,"internalType":"address","name":"tokenB","type":"address"},{"indexed":false,"internalType":"address","name":"tokenC","type":"address"},{"indexed":false,"internalType":"address","name":"LP","type":"address"}],"name":"NewStableSwapPair","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"},{"inputs":[],"name":"FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"N_COINS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IStableSwap","name":"_swap","type":"address"}],"name":"RATES","outputs":[{"internalType":"uint256[2]","name":"swapRATES","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IStableSwap","name":"_swap","type":"address"},{"internalType":"uint256[2]","name":"_balances","type":"uint256[2]"}],"name":"_xp_mem","outputs":[{"internalType":"uint256[2]","name":"result","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swapContract","type":"address"}],"name":"addPairInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IStableSwap","name":"_swap","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256[2]","name":"swapBalances","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenA","type":"address"},{"internalType":"address","name":"_tokenB","type":"address"}],"name":"getPairInfo","outputs":[{"components":[{"internalType":"address","name":"swapContract","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"address","name":"LPContract","type":"address"}],"internalType":"struct IStableSwapFactory.StableSwapPairInfo","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenA","type":"address"},{"internalType":"address","name":"_tokenB","type":"address"}],"name":"getThreePoolPairInfo","outputs":[{"components":[{"internalType":"address","name":"swapContract","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"address","name":"token2","type":"address"},{"internalType":"address","name":"LPContract","type":"address"}],"internalType":"struct IStableSwapFactory.StableSwapThreePoolPairInfo","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_swap","type":"address"},{"internalType":"uint256","name":"i","type":"uint256"},{"internalType":"uint256","name":"j","type":"uint256"},{"internalType":"uint256","name":"dy","type":"uint256"},{"internalType":"uint256","name":"max_dx","type":"uint256"}],"name":"get_dx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"stableSwapPairInfo","outputs":[{"internalType":"address","name":"swapContract","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"address","name":"token2","type":"address"},{"internalType":"address","name":"LPContract","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"swapPairContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b6119fe8061007d6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c8063923093cb11610097578063ca4bc71411610066578063ca4bc7141461021a578063d73792a91461022d578063f2fde38b14610235578063fcc9136c1461024857610100565b8063923093cb146101cc578063aaf5eb68146101ec578063ae6452b4146101f4578063b3c0e8461461020757610100565b8063400f7a1e116100d3578063400f7a1e1461017a578063636e66a01461019a578063715018a6146101ba5780638da5cb5b146101c457610100565b80632494acbd1461010557806327e235e31461012e578063293577501461014157806338802f1a14610156575b600080fd5b61011861011336600461149f565b610250565b60405161012591906117dc565b60405180910390f35b61011861013c36600461149f565b6102f4565b6101496103a3565b6040516101259190611968565b6101696101643660046114fa565b6103a8565b6040516101259594939291906117aa565b61018d6101883660046114c2565b6103fa565b60405161012591906118e6565b6101ad6101a836600461173b565b6104b0565b604051610125919061176b565b6101c26104cb565b005b6101ad610596565b6101df6101da3660046114c2565b6105a5565b6040516101259190611921565b61014961062e565b6101186102023660046115a3565b61063a565b6101c261021536600461149f565b6106ad565b610149610228366004611544565b61089b565b6101496109dd565b6101c261024336600461149f565b6109e6565b610149610b07565b61025861134d565b60005b60028110156102ee57826001600160a01b031663e25aa5fa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561029d57600080fd5b505afa1580156102b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d59190611753565b8282600281106102e157fe5b602002015260010161025b565b50919050565b6102fc61134d565b60005b60028160ff1610156102ee576040516391ceb3eb60e01b81526001600160a01b038416906391ceb3eb9061033790849060040161180d565b60206040518083038186803b15801561034f57600080fd5b505afa158015610363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190611753565b828260ff166002811061039657fe5b60200201526001016102ff565b600281565b6001602081815260009485526040808620825293855283852090529083529120805491810154600282015460038301546004909301546001600160a01b03948516949283169391831692918216911685565b61040261136b565b60008061040f8585610b0d565b6001600160a01b0391821660009081526001602081815260408084209486168452938152838320838052815291839020835160a08101855281548616808252928201548616818501908152600283015487168287019081526003840154881660608085019190915260049094015488166080909301928352938a52518616938901939093529051841692870192909252519091169084015250909392505050565b6003602052600090815260409020546001600160a01b031681565b6104d3610b70565b6001600160a01b03166104e4610596565b6001600160a01b03161461053f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031690565b6105ad611392565b6000806105ba8585610b0d565b6001600160a01b039182166000908152600260208181526040808420948616845293815291839020835160a081018552815486168152600182015486169381019390935290810154841692820192909252600382015483166060820152600490910154909116608082015295945050505050565b670de0b6b3a764000081565b61064261134d565b61064b83610250565b905060005b60028110156106a657670de0b6b3a764000083826002811061066e57fe5b602002015183836002811061067f57fe5b6020020151028161068c57fe5b0482826002811061069957fe5b6020020152600101610650565b5092915050565b6106b5610b70565b6001600160a01b03166106c6610596565b6001600160a01b031614610721576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8061089782826001600160a01b03166382b8660060006040518263ffffffff1660e01b8152600401610753919061180d565b60206040518083038186803b15801561076b57600080fd5b505afa15801561077f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a39190611587565b60405162415c3360e91b81526001600160a01b038516906382b86600906107cf9060019060040161180d565b60206040518083038186803b1580156107e757600080fd5b505afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f9190611587565b6000856001600160a01b0316638214f5a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561085a57600080fd5b505afa15801561086e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108929190611587565b610b74565b5050565b600085816108a8826102f4565b905060006108b6838361063a565b905060006108c384610cd1565b6402540be400036402540be4008802816108d957fe5b0490508288600281106108e857fe5b602002015181106109145760405162461bcd60e51b815260040161090b9061181b565b60405180910390fd5b600061091f85610250565b90506000670de0b6b3a7640000828b6002811061093857fe5b602002015184028161094657fe5b04848b6002811061095357fe5b6020020151039050600061096a8d8c8e8589610d52565b90506000858d6002811061097a57fe5b602002015182039050838d6002811061098f57fe5b6020020151670de0b6b3a76400008202816109a657fe5b046001019050898111156109cc5760405162461bcd60e51b815260040161090b90611852565b9d9c50505050505050505050505050565b6402540be40081565b6109ee610b70565b6001600160a01b03166109ff610596565b6001600160a01b031614610a5a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610a9f5760405162461bcd60e51b81526004018080602001828103825260268152602001806119cc6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60045481565b600080826001600160a01b0316846001600160a01b03161415610b425760405162461bcd60e51b815260040161090b906118af565b826001600160a01b0316846001600160a01b031610610b62578284610b65565b83835b909590945092505050565b3390565b6001600160a01b03808516600081815260016020818152604080842089871680865290835281852089881680875290845282862080548e8a1673ffffffffffffffffffffffffffffffffffffffff199182168117835582880180548316909a17909955600282018054821690941790935560038082018054851684179055600480830180549b8d169b86169b909b17909a558954885290945291909420805490941690941790925583540190925515610c82576040805160a08101825282546001600160a01b039081168252600184015481166020830152600284015481169282019290925260038301548216606082015260048301549091166080820152610c8290869086908690610ed1565b856001600160a01b03167f48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea193353286868686604051610cc1949392919061177f565b60405180910390a2505050505050565b6000816001600160a01b0316635fd65f0f6040518163ffffffff1660e01b815260040160006040518083038186803b158015610d0c57600080fd5b505afa158015610d20573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d489190810190611633565b6080015192915050565b6000808690506000816001600160a01b031663d46300fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9357600080fd5b505afa158015610da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcb9190611753565b90506000610dd9858361125e565b90508060006002840281805b6002811015610e40578c811415610dfe578a9150610e22565b8b8114610e1d57898160028110610e1157fe5b60200201519150610e22565b610e38565b928101926002820285870281610e3457fe5b0494505b600101610de5565b506002820285850281610e4f57fe5b0493506000828681610e5d57fe5b0484019050600086815b60ff811015610ebd578192508884836002020103888384020181610e8757fe5b04915082821115610ea657600183830311610ea157610ebd565b610eb5565b600182840311610eb557610ebd565b600101610e67565b509f9e505050505050505050505050505050565b8060026000866001600160a01b03166001600160a01b031681526020019081526020016000206000856001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050508060026000866001600160a01b03166001600160a01b031681526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050508060026000856001600160a01b03166001600160a01b031681526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555090505050505050565b60008060005b600281101561128b5784816002811061127957fe5b60200201519190910190600101611264565b508061129b576000915050611347565b60008160028502825b60ff81101561133f578260005b60028110156112e35760028a82600281106112c857fe5b602002015102858302816112d857fe5b0491506001016112b1565b508394508060026001010284600185030201846002830288860201028161130657fe5b0493508484111561132657600185850311611321575061133f565b611336565b600184860311611336575061133f565b506001016112a4565b509093505050505b92915050565b60405180604001604052806002906020820280368337509192915050565b60408051608081018252600080825260208201819052918101829052606081019190915290565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b80516113cb816119b3565b919050565b600082601f8301126113e0578081fd5b815160206113f56113f083611995565b611971565b8281528181019085830183850287018401881015611411578586fd5b855b85811015611438578151611426816119b3565b84529284019290840190600101611413565b5090979650505050505050565b600082601f830112611455578081fd5b815160206114656113f083611995565b8281528181019085830183850287018401881015611481578586fd5b855b8581101561143857815184529284019290840190600101611483565b6000602082840312156114b0578081fd5b81356114bb816119b3565b9392505050565b600080604083850312156114d4578081fd5b82356114df816119b3565b915060208301356114ef816119b3565b809150509250929050565b60008060006060848603121561150e578081fd5b8335611519816119b3565b92506020840135611529816119b3565b91506040840135611539816119b3565b809150509250925092565b600080600080600060a0868803121561155b578081fd5b8535611566816119b3565b97602087013597506040870135966060810135965060800135945092505050565b600060208284031215611598578081fd5b81516114bb816119b3565b600080606083850312156115b5578182fd5b82356115c0816119b3565b91506020603f840185136115d2578182fd5b6040516040810181811067ffffffffffffffff821117156115ef57fe5b6040528085830160608701881015611605578485fd5b845b600281101561162457813583529184019190840190600101611607565b50505080925050509250929050565b600060208284031215611644578081fd5b815167ffffffffffffffff8082111561165b578283fd5b8184019150610140808387031215611671578384fd5b61167a81611971565b9050825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201526116be60c084016113c0565b60c082015260e0830151828111156116d4578485fd5b6116e0878286016113d0565b60e08301525061010080840151838111156116f9578586fd5b61170588828701611445565b828401525050610120808401518381111561171e578586fd5b61172a88828701611445565b918301919091525095945050505050565b60006020828403121561174c578081fd5b5035919050565b600060208284031215611764578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03948516815292841660208401529083166040830152909116606082015260800190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b60408101818360005b60028110156118045781518352602092830192909101906001016117e5565b50505092915050565b60ff91909116815260200190565b6020808252600e908201527f4578636573732062616c616e6365000000000000000000000000000000000000604082015260600190565b6020808252602e908201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360408201527f207468616e206578706563746564000000000000000000000000000000000000606082015260800190565b60208082526013908201527f4944454e544943414c5f41444452455353455300000000000000000000000000604082015260600190565b81516001600160a01b039081168252602080840151821690830152604080840151821690830152606092830151169181019190915260800190565b81516001600160a01b039081168252602080840151821690830152604080840151821690830152606080840151821690830152608092830151169181019190915260a00190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561198d57fe5b604052919050565b600067ffffffffffffffff8211156119a957fe5b5060209081020190565b6001600160a01b03811681146119c857600080fd5b5056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a164736f6c6343000706000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063923093cb11610097578063ca4bc71411610066578063ca4bc7141461021a578063d73792a91461022d578063f2fde38b14610235578063fcc9136c1461024857610100565b8063923093cb146101cc578063aaf5eb68146101ec578063ae6452b4146101f4578063b3c0e8461461020757610100565b8063400f7a1e116100d3578063400f7a1e1461017a578063636e66a01461019a578063715018a6146101ba5780638da5cb5b146101c457610100565b80632494acbd1461010557806327e235e31461012e578063293577501461014157806338802f1a14610156575b600080fd5b61011861011336600461149f565b610250565b60405161012591906117dc565b60405180910390f35b61011861013c36600461149f565b6102f4565b6101496103a3565b6040516101259190611968565b6101696101643660046114fa565b6103a8565b6040516101259594939291906117aa565b61018d6101883660046114c2565b6103fa565b60405161012591906118e6565b6101ad6101a836600461173b565b6104b0565b604051610125919061176b565b6101c26104cb565b005b6101ad610596565b6101df6101da3660046114c2565b6105a5565b6040516101259190611921565b61014961062e565b6101186102023660046115a3565b61063a565b6101c261021536600461149f565b6106ad565b610149610228366004611544565b61089b565b6101496109dd565b6101c261024336600461149f565b6109e6565b610149610b07565b61025861134d565b60005b60028110156102ee57826001600160a01b031663e25aa5fa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561029d57600080fd5b505afa1580156102b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d59190611753565b8282600281106102e157fe5b602002015260010161025b565b50919050565b6102fc61134d565b60005b60028160ff1610156102ee576040516391ceb3eb60e01b81526001600160a01b038416906391ceb3eb9061033790849060040161180d565b60206040518083038186803b15801561034f57600080fd5b505afa158015610363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190611753565b828260ff166002811061039657fe5b60200201526001016102ff565b600281565b6001602081815260009485526040808620825293855283852090529083529120805491810154600282015460038301546004909301546001600160a01b03948516949283169391831692918216911685565b61040261136b565b60008061040f8585610b0d565b6001600160a01b0391821660009081526001602081815260408084209486168452938152838320838052815291839020835160a08101855281548616808252928201548616818501908152600283015487168287019081526003840154881660608085019190915260049094015488166080909301928352938a52518616938901939093529051841692870192909252519091169084015250909392505050565b6003602052600090815260409020546001600160a01b031681565b6104d3610b70565b6001600160a01b03166104e4610596565b6001600160a01b03161461053f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031690565b6105ad611392565b6000806105ba8585610b0d565b6001600160a01b039182166000908152600260208181526040808420948616845293815291839020835160a081018552815486168152600182015486169381019390935290810154841692820192909252600382015483166060820152600490910154909116608082015295945050505050565b670de0b6b3a764000081565b61064261134d565b61064b83610250565b905060005b60028110156106a657670de0b6b3a764000083826002811061066e57fe5b602002015183836002811061067f57fe5b6020020151028161068c57fe5b0482826002811061069957fe5b6020020152600101610650565b5092915050565b6106b5610b70565b6001600160a01b03166106c6610596565b6001600160a01b031614610721576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8061089782826001600160a01b03166382b8660060006040518263ffffffff1660e01b8152600401610753919061180d565b60206040518083038186803b15801561076b57600080fd5b505afa15801561077f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a39190611587565b60405162415c3360e91b81526001600160a01b038516906382b86600906107cf9060019060040161180d565b60206040518083038186803b1580156107e757600080fd5b505afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f9190611587565b6000856001600160a01b0316638214f5a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561085a57600080fd5b505afa15801561086e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108929190611587565b610b74565b5050565b600085816108a8826102f4565b905060006108b6838361063a565b905060006108c384610cd1565b6402540be400036402540be4008802816108d957fe5b0490508288600281106108e857fe5b602002015181106109145760405162461bcd60e51b815260040161090b9061181b565b60405180910390fd5b600061091f85610250565b90506000670de0b6b3a7640000828b6002811061093857fe5b602002015184028161094657fe5b04848b6002811061095357fe5b6020020151039050600061096a8d8c8e8589610d52565b90506000858d6002811061097a57fe5b602002015182039050838d6002811061098f57fe5b6020020151670de0b6b3a76400008202816109a657fe5b046001019050898111156109cc5760405162461bcd60e51b815260040161090b90611852565b9d9c50505050505050505050505050565b6402540be40081565b6109ee610b70565b6001600160a01b03166109ff610596565b6001600160a01b031614610a5a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610a9f5760405162461bcd60e51b81526004018080602001828103825260268152602001806119cc6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60045481565b600080826001600160a01b0316846001600160a01b03161415610b425760405162461bcd60e51b815260040161090b906118af565b826001600160a01b0316846001600160a01b031610610b62578284610b65565b83835b909590945092505050565b3390565b6001600160a01b03808516600081815260016020818152604080842089871680865290835281852089881680875290845282862080548e8a1673ffffffffffffffffffffffffffffffffffffffff199182168117835582880180548316909a17909955600282018054821690941790935560038082018054851684179055600480830180549b8d169b86169b909b17909a558954885290945291909420805490941690941790925583540190925515610c82576040805160a08101825282546001600160a01b039081168252600184015481166020830152600284015481169282019290925260038301548216606082015260048301549091166080820152610c8290869086908690610ed1565b856001600160a01b03167f48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea193353286868686604051610cc1949392919061177f565b60405180910390a2505050505050565b6000816001600160a01b0316635fd65f0f6040518163ffffffff1660e01b815260040160006040518083038186803b158015610d0c57600080fd5b505afa158015610d20573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d489190810190611633565b6080015192915050565b6000808690506000816001600160a01b031663d46300fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9357600080fd5b505afa158015610da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcb9190611753565b90506000610dd9858361125e565b90508060006002840281805b6002811015610e40578c811415610dfe578a9150610e22565b8b8114610e1d57898160028110610e1157fe5b60200201519150610e22565b610e38565b928101926002820285870281610e3457fe5b0494505b600101610de5565b506002820285850281610e4f57fe5b0493506000828681610e5d57fe5b0484019050600086815b60ff811015610ebd578192508884836002020103888384020181610e8757fe5b04915082821115610ea657600183830311610ea157610ebd565b610eb5565b600182840311610eb557610ebd565b600101610e67565b509f9e505050505050505050505050505050565b8060026000866001600160a01b03166001600160a01b031681526020019081526020016000206000856001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050508060026000866001600160a01b03166001600160a01b031681526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050508060026000856001600160a01b03166001600160a01b031681526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555090505050505050565b60008060005b600281101561128b5784816002811061127957fe5b60200201519190910190600101611264565b508061129b576000915050611347565b60008160028502825b60ff81101561133f578260005b60028110156112e35760028a82600281106112c857fe5b602002015102858302816112d857fe5b0491506001016112b1565b508394508060026001010284600185030201846002830288860201028161130657fe5b0493508484111561132657600185850311611321575061133f565b611336565b600184860311611336575061133f565b506001016112a4565b509093505050505b92915050565b60405180604001604052806002906020820280368337509192915050565b60408051608081018252600080825260208201819052918101829052606081019190915290565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b80516113cb816119b3565b919050565b600082601f8301126113e0578081fd5b815160206113f56113f083611995565b611971565b8281528181019085830183850287018401881015611411578586fd5b855b85811015611438578151611426816119b3565b84529284019290840190600101611413565b5090979650505050505050565b600082601f830112611455578081fd5b815160206114656113f083611995565b8281528181019085830183850287018401881015611481578586fd5b855b8581101561143857815184529284019290840190600101611483565b6000602082840312156114b0578081fd5b81356114bb816119b3565b9392505050565b600080604083850312156114d4578081fd5b82356114df816119b3565b915060208301356114ef816119b3565b809150509250929050565b60008060006060848603121561150e578081fd5b8335611519816119b3565b92506020840135611529816119b3565b91506040840135611539816119b3565b809150509250925092565b600080600080600060a0868803121561155b578081fd5b8535611566816119b3565b97602087013597506040870135966060810135965060800135945092505050565b600060208284031215611598578081fd5b81516114bb816119b3565b600080606083850312156115b5578182fd5b82356115c0816119b3565b91506020603f840185136115d2578182fd5b6040516040810181811067ffffffffffffffff821117156115ef57fe5b6040528085830160608701881015611605578485fd5b845b600281101561162457813583529184019190840190600101611607565b50505080925050509250929050565b600060208284031215611644578081fd5b815167ffffffffffffffff8082111561165b578283fd5b8184019150610140808387031215611671578384fd5b61167a81611971565b9050825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201526116be60c084016113c0565b60c082015260e0830151828111156116d4578485fd5b6116e0878286016113d0565b60e08301525061010080840151838111156116f9578586fd5b61170588828701611445565b828401525050610120808401518381111561171e578586fd5b61172a88828701611445565b918301919091525095945050505050565b60006020828403121561174c578081fd5b5035919050565b600060208284031215611764578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03948516815292841660208401529083166040830152909116606082015260800190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b60408101818360005b60028110156118045781518352602092830192909101906001016117e5565b50505092915050565b60ff91909116815260200190565b6020808252600e908201527f4578636573732062616c616e6365000000000000000000000000000000000000604082015260600190565b6020808252602e908201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360408201527f207468616e206578706563746564000000000000000000000000000000000000606082015260800190565b60208082526013908201527f4944454e544943414c5f41444452455353455300000000000000000000000000604082015260600190565b81516001600160a01b039081168252602080840151821690830152604080840151821690830152606092830151169181019190915260800190565b81516001600160a01b039081168252602080840151821690830152604080840151821690830152606080840151821690830152608092830151169181019190915260a00190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561198d57fe5b604052919050565b600067ffffffffffffffff8211156119a957fe5b5060209081020190565b6001600160a01b03811681146119c857600080fd5b5056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a164736f6c6343000706000a

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.