Contract 0x5806Af7AB22E2916fA582Ff05731Bf7C682387B2 1

 
Txn Hash
Method
Block
From
To
Value
0xb06b2897c479643f9eca55c0d2a24b280e414e6c9aa2163013faff4da918bc380x60806040125263142021-05-29 1:34:12443 days 23 hrs agoInstadapp: Deployer 3 IN  Create: ConnectV2InstaPool0 Ether0.‍0462959634
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ConnectV2InstaPool

Compiler Version
v0.7.0+commit.9e61f92b

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : main.sol
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { TokenInterface } from "../../../common/interfaces.sol";
import { AccountInterface } from "../interfaces.sol";
import { DSMath } from "../../../common/math.sol";
import { Stores } from "../../../common/stores.sol";
import { Variables } from ".././variables.sol";
import { Events } from ".././events.sol";

contract LiquidityResolver is DSMath, Stores, Variables, Events {
    using SafeERC20 for IERC20;

    /**
     * @dev Borrow Flashloan and Cast spells.
     * @param token Token Address.
     * @param amt Token Amount.
     * @param data targets & data for cast.
     */
    function flashBorrowAndCast(
        address token,
        uint amt,
        uint route,
        bytes memory data
    ) external payable {
        AccountInterface(address(this)).enable(address(instaPool));
        (string[] memory _targets, bytes[] memory callDatas) = abi.decode(data, (string[], bytes[]));

        bytes memory callData = abi.encodeWithSignature("cast(string[],bytes[],address)", _targets, callDatas, address(instaPool));

        instaPool.initiateFlashLoan(token, amt, route, callData);

        emit LogFlashBorrow(token, amt);
        AccountInterface(address(this)).disable(address(instaPool));
    }

    /**
     * @dev Return token to InstaPool.
     * @param token Token Address.
     * @param amt Token Amount.
     * @param getId Get token amount at this ID from `InstaMemory` Contract.
     * @param setId Set token amount at this ID in `InstaMemory` Contract.
    */
    function flashPayback(
        address token,
        uint amt,
        uint getId,
        uint setId
    ) external payable {
        uint _amt = getUint(getId, amt);
        
        IERC20 tokenContract = IERC20(token);

        if (token == ethAddr) {
            Address.sendValue(payable(address(instaPool)), _amt);
        } else {
            tokenContract.safeTransfer(address(instaPool), _amt);
        }


        setUint(setId, _amt);

        emit LogFlashPayback(token, _amt);
    }
}

contract ConnectV2InstaPool is LiquidityResolver {
    string public name = "Instapool-v1.1";
}

File 2 of 11 : 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 3 of 11 : 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 4 of 11 : 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 5 of 11 : interfaces.sol
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

interface TokenInterface {
    function approve(address, uint256) external;
    function transfer(address, uint) external returns (bool);
    function transferFrom(address, address, uint) external;
    function deposit() external payable;
    function withdraw(uint) external;
    function balanceOf(address) external view returns (uint);
    function decimals() external view returns (uint);
}

interface MemoryInterface {
    function getUint(uint id) external returns (uint num);
    function setUint(uint id, uint val) external;
}

File 6 of 11 : interfaces.sol
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

interface InstaFlashV2Interface {
    function initiateFlashLoan(address token, uint256 amt, uint256 route, bytes calldata data) external;
}


interface AccountInterface {
    function enable(address) external;
    function disable(address) external;
}

File 7 of 11 : math.sol
pragma solidity ^0.7.0;

import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";

contract DSMath {
    uint constant WAD = 10 ** 18;
    uint constant RAY = 10 ** 27;

    function add(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.add(x, y);
    }

    function sub(uint x, uint y) internal virtual pure returns (uint z) {
        z = SafeMath.sub(x, y);
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.mul(x, y);
    }

    function div(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.div(x, y);
    }

    function wmul(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.add(SafeMath.mul(x, y), WAD / 2) / WAD;
    }

    function wdiv(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.add(SafeMath.mul(x, WAD), y / 2) / y;
    }

    function rdiv(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.add(SafeMath.mul(x, RAY), y / 2) / y;
    }

    function rmul(uint x, uint y) internal pure returns (uint z) {
        z = SafeMath.add(SafeMath.mul(x, y), RAY / 2) / RAY;
    }

    function toInt(uint x) internal pure returns (int y) {
        y = int(x);
        require(y >= 0, "int-overflow");
    }

    function toRad(uint wad) internal pure returns (uint rad) {
        rad = mul(wad, 10 ** 27);
    }
}

File 8 of 11 : stores.sol
pragma solidity ^0.7.0;

import { MemoryInterface } from "./interfaces.sol";


abstract contract Stores {

    /**
    * @dev Return ethereum address
    */
    address constant internal ethAddr = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    /**
    * @dev Return Wrapped ETH address
    */
    address constant internal wethAddr = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    /**
    * @dev Return memory variable address
    */
    MemoryInterface constant internal instaMemory = MemoryInterface(0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F);

    /**
    * @dev Get Uint value from InstaMemory Contract.
    */
    function getUint(uint getId, uint val) internal returns (uint returnVal) {
        returnVal = getId == 0 ? val : instaMemory.getUint(getId);
    }

    /**
    * @dev Set Uint value in InstaMemory Contract.
    */
    function setUint(uint setId, uint val) virtual internal {
        if (setId != 0) instaMemory.setUint(setId, val);
    }

}

File 9 of 11 : variables.sol
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

import { InstaFlashV2Interface } from "./interfaces.sol";

contract Variables {

    /**
    * @dev Instapool contract proxy
    */
    InstaFlashV2Interface public constant instaPool = InstaFlashV2Interface(0x2a1739D7F07d40e76852Ca8f0D82275Aa087992F);
}

File 10 of 11 : events.sol
pragma solidity >=0.7.0;
pragma experimental ABIEncoderV2;

contract Events {
    event LogFlashBorrow(address token, uint256 tokenAmt);
    event LogFlashPayback(address token, uint256 tokenAmt);

    event LogFlashMultiBorrow(address[] token, uint256[] tokenAmts);
    event LogFlashMultiPayback(address[] token, uint256[] tokenAmts);
}

File 11 of 11 : 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;
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"name":"LogFlashBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"token","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"tokenAmts","type":"uint256[]"}],"name":"LogFlashMultiBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"token","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"tokenAmts","type":"uint256[]"}],"name":"LogFlashMultiPayback","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"name":"LogFlashPayback","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"},{"internalType":"uint256","name":"route","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashBorrowAndCast","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"},{"internalType":"uint256","name":"getId","type":"uint256"},{"internalType":"uint256","name":"setId","type":"uint256"}],"name":"flashPayback","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"instaPool","outputs":[{"internalType":"contract InstaFlashV2Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

60806040526040518060400160405280600e81526020017f496e737461706f6f6c2d76312e31000000000000000000000000000000000000815250600090805190602001906200005192919062000066565b503480156200005f57600080fd5b506200010c565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000a957805160ff1916838001178555620000da565b82800160010185558215620000da579182015b82811115620000d9578251825591602001919060010190620000bc565b5b509050620000e99190620000ed565b5090565b5b8082111562000108576000816000905550600101620000ee565b5090565b611744806200011c6000396000f3fe60806040526004361061003f5760003560e01c806306fdde0314610044578063213980e81461006f5780638d0a9b1b1461008b578063ab4cf226146100a7575b600080fd5b34801561005057600080fd5b506100596100d2565b6040516100669190611358565b60405180910390f35b61008960048036038101906100849190610cfb565b610170565b005b6100a560048036038101906100a09190610c80565b610279565b005b3480156100b357600080fd5b506100bc610503565b6040516100c9919061133d565b60405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101685780601f1061013d57610100808354040283529160200191610168565b820191906000526020600020905b81548152906001019060200180831161014b57829003601f168201915b505050505081565b600061017c838561051b565b9050600085905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156101ee576101e9732a1739d7f07d40e76852ca8f0d82275aa087992f836105d2565b61022e565b61022d732a1739d7f07d40e76852ca8f0d82275aa087992f838373ffffffffffffffffffffffffffffffffffffffff166106c69092919063ffffffff16565b5b610238838361074c565b7f722145682d5be32c0eb23574ce42a7781aa5af1ae945ea524c7581aaed28938f8683604051610269929190611283565b60405180910390a1505050505050565b3073ffffffffffffffffffffffffffffffffffffffff16635bfa1b68732a1739d7f07d40e76852ca8f0d82275aa087992f6040518263ffffffff1660e01b81526004016102c69190611268565b600060405180830381600087803b1580156102e057600080fd5b505af11580156102f4573d6000803e3d6000fd5b505050506060808280602001905181019061030f9190610d5e565b9150915060608282732a1739d7f07d40e76852ca8f0d82275aa087992f60405160240161033e939291906112f8565b6040516020818303038152906040527f9304c934000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050732a1739d7f07d40e76852ca8f0d82275aa087992f73ffffffffffffffffffffffffffffffffffffffff16631c302e30888888856040518563ffffffff1660e01b815260040161041094939291906112ac565b600060405180830381600087803b15801561042a57600080fd5b505af115801561043e573d6000803e3d6000fd5b505050507f43524507078093ea37d17a012f815220749b664408557436a62b3d3a251a94318787604051610473929190611283565b60405180910390a13073ffffffffffffffffffffffffffffffffffffffff1663e6c09edf732a1739d7f07d40e76852ca8f0d82275aa087992f6040518263ffffffff1660e01b81526004016104c89190611268565b600060405180830381600087803b1580156104e257600080fd5b505af11580156104f6573d6000803e3d6000fd5b5050505050505050505050565b732a1739d7f07d40e76852ca8f0d82275aa087992f81565b60008083146105c857738a5419cfc711b2343c17a6abf4b2bafabb06957f73ffffffffffffffffffffffffffffffffffffffff1663a9c70eaa846040518263ffffffff1660e01b8152600401610571919061141a565b602060405180830381600087803b15801561058b57600080fd5b505af115801561059f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c39190610df3565b6105ca565b815b905092915050565b80471015610615576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060c9061139a565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405161063b90611253565b60006040518083038185875af1925050503d8060008114610678576040519150601f19603f3d011682016040523d82523d6000602084013e61067d565b606091505b50509050806106c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b89061137a565b60405180910390fd5b505050565b6107478363a9059cbb60e01b84846040516024016106e5929190611283565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506107da565b505050565b600082146107d657738a5419cfc711b2343c17a6abf4b2bafabb06957f73ffffffffffffffffffffffffffffffffffffffff166361e3c94483836040518363ffffffff1660e01b81526004016107a3929190611435565b600060405180830381600087803b1580156107bd57600080fd5b505af11580156107d1573d6000803e3d6000fd5b505050505b5050565b606061083c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166108a19092919063ffffffff16565b905060008151111561089c578080602001905181019061085c9190610dca565b61089b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610892906113fa565b60405180910390fd5b5b505050565b60606108b084846000856108b9565b90509392505050565b6060824710156108fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f5906113ba565b60405180910390fd5b610907856109ce565b610946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093d906113da565b60405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff168587604051610970919061123c565b60006040518083038185875af1925050503d80600081146109ad576040519150601f19603f3d011682016040523d82523d6000602084013e6109b2565b606091505b50915091506109c28282866109e1565b92505050949350505050565b600080823b905060008111915050919050565b606083156109f157829050610a41565b600083511115610a045782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a389190611358565b60405180910390fd5b9392505050565b600081359050610a57816116c9565b92915050565b600082601f830112610a6e57600080fd5b8151610a81610a7c8261148b565b61145e565b9150818183526020840193506020810190508360005b83811015610ac75781518601610aad8882610bae565b845260208401935060208301925050600181019050610a97565b5050505092915050565b600082601f830112610ae257600080fd5b8151610af5610af0826114b3565b61145e565b9150818183526020840193506020810190508360005b83811015610b3b5781518601610b218882610c02565b845260208401935060208301925050600181019050610b0b565b5050505092915050565b600081519050610b54816116e0565b92915050565b600082601f830112610b6b57600080fd5b8135610b7e610b79826114db565b61145e565b91508082526020830160208301858383011115610b9a57600080fd5b610ba5838284611676565b50505092915050565b600082601f830112610bbf57600080fd5b8151610bd2610bcd826114db565b61145e565b91508082526020830160208301858383011115610bee57600080fd5b610bf9838284611685565b50505092915050565b600082601f830112610c1357600080fd5b8151610c26610c2182611507565b61145e565b91508082526020830160208301858383011115610c4257600080fd5b610c4d838284611685565b50505092915050565b600081359050610c65816116f7565b92915050565b600081519050610c7a816116f7565b92915050565b60008060008060808587031215610c9657600080fd5b6000610ca487828801610a48565b9450506020610cb587828801610c56565b9350506040610cc687828801610c56565b925050606085013567ffffffffffffffff811115610ce357600080fd5b610cef87828801610b5a565b91505092959194509250565b60008060008060808587031215610d1157600080fd5b6000610d1f87828801610a48565b9450506020610d3087828801610c56565b9350506040610d4187828801610c56565b9250506060610d5287828801610c56565b91505092959194509250565b60008060408385031215610d7157600080fd5b600083015167ffffffffffffffff811115610d8b57600080fd5b610d9785828601610ad1565b925050602083015167ffffffffffffffff811115610db457600080fd5b610dc085828601610a5d565b9150509250929050565b600060208284031215610ddc57600080fd5b6000610dea84828501610b45565b91505092915050565b600060208284031215610e0557600080fd5b6000610e1384828501610c6b565b91505092915050565b6000610e288383610f3d565b905092915050565b6000610e3c8383610fef565b905092915050565b610e4d8161160a565b82525050565b6000610e5e82611553565b610e688185611599565b935083602082028501610e7a85611533565b8060005b85811015610eb65784840389528151610e978582610e1c565b9450610ea28361157f565b925060208a01995050600181019050610e7e565b50829750879550505050505092915050565b6000610ed38261155e565b610edd81856115aa565b935083602082028501610eef85611543565b8060005b85811015610f2b5784840389528151610f0c8582610e30565b9450610f178361158c565b925060208a01995050600181019050610ef3565b50829750879550505050505092915050565b6000610f4882611569565b610f5281856115bb565b9350610f62818560208601611685565b610f6b816116b8565b840191505092915050565b6000610f8182611569565b610f8b81856115cc565b9350610f9b818560208601611685565b610fa4816116b8565b840191505092915050565b6000610fba82611569565b610fc481856115dd565b9350610fd4818560208601611685565b80840191505092915050565b610fe981611652565b82525050565b6000610ffa82611574565b61100481856115e8565b9350611014818560208601611685565b61101d816116b8565b840191505092915050565b600061103382611574565b61103d81856115f9565b935061104d818560208601611685565b611056816116b8565b840191505092915050565b600061106e603a836115f9565b91507f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008301527f6563697069656e74206d617920686176652072657665727465640000000000006020830152604082019050919050565b60006110d4601d836115f9565b91507f416464726573733a20696e73756666696369656e742062616c616e63650000006000830152602082019050919050565b60006111146026836115f9565b91507f416464726573733a20696e73756666696369656e742062616c616e636520666f60008301527f722063616c6c00000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061117a6000836115dd565b9150600082019050919050565b6000611194601d836115f9565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b60006111d4602a836115f9565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b61123681611648565b82525050565b60006112488284610faf565b915081905092915050565b600061125e8261116d565b9150819050919050565b600060208201905061127d6000830184610e44565b92915050565b60006040820190506112986000830185610e44565b6112a5602083018461122d565b9392505050565b60006080820190506112c16000830187610e44565b6112ce602083018661122d565b6112db604083018561122d565b81810360608301526112ed8184610f76565b905095945050505050565b600060608201905081810360008301526113128186610ec8565b905081810360208301526113268185610e53565b90506113356040830184610e44565b949350505050565b60006020820190506113526000830184610fe0565b92915050565b600060208201905081810360008301526113728184611028565b905092915050565b6000602082019050818103600083015261139381611061565b9050919050565b600060208201905081810360008301526113b3816110c7565b9050919050565b600060208201905081810360008301526113d381611107565b9050919050565b600060208201905081810360008301526113f381611187565b9050919050565b60006020820190508181036000830152611413816111c7565b9050919050565b600060208201905061142f600083018461122d565b92915050565b600060408201905061144a600083018561122d565b611457602083018461122d565b9392505050565b6000604051905081810181811067ffffffffffffffff8211171561148157600080fd5b8060405250919050565b600067ffffffffffffffff8211156114a257600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156114ca57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff8211156114f257600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561151e57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600061161582611628565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061165d82611664565b9050919050565b600061166f82611628565b9050919050565b82818337600083830152505050565b60005b838110156116a3578082015181840152602081019050611688565b838111156116b2576000848401525b50505050565b6000601f19601f8301169050919050565b6116d28161160a565b81146116dd57600080fd5b50565b6116e98161161c565b81146116f457600080fd5b50565b61170081611648565b811461170b57600080fd5b5056fea2646970667358221220af6cdb43a88c57169692a992057caa7d9c3e62536fe1463e2d936b765aebedbd64736f6c63430007000033

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

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.