Sonic Blaze Testnet

Contract

0x9b35D4097Be89c0923593b56eb0bD9E0C6B7AD7c

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Oracle62084492024-12-23 3:17:135 days ago1734923833IN
0x9b35D409...0C6B7AD7c
0 S0.000030781.1
Add Token To Whi...62078972024-12-23 3:14:225 days ago1734923662IN
0x9b35D409...0C6B7AD7c
0 S0.001104021.1

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

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

Contract Name:
Factory

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : Factory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is disstributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity 0.6.12;
import "../base/WhiteToken.sol";
import "../interfaces/IBFactory.sol";
import "../libraries/SafeERC20.sol";

contract Factory is WhiteToken {
    using SafeERC20 for IERC20;

    event LOG_NEW_POOL(address indexed caller, address indexed pool);
    event LOG_BLABS(address indexed caller, address indexed blabs);
    event LOG_ROUTER(address indexed caller, address indexed router);
    event LOG_VAULT(address indexed vault, address indexed caller);
    event LOG_USER_VAULT(address indexed vault, address indexed caller);
    event LOG_MANAGER(address indexed manager, address indexed caller);
    event LOG_ORACLE(address indexed caller, address indexed oracle);
    event SYSTEM_MODULE_CHANGED(address module, bool state);
    event MODULE_STATUS_CHANGE(address etf, address module, bool status);
    event PAUSED_STATUS(bool state);

    mapping(address => bool) private _isLiquidityPool;
    mapping(address => bool) private _isSystemModule;
    mapping(address => mapping(address => bool)) private _isModuleRegistered;
    uint private counters;
    bytes private bytecodes;
    bool public isPaused;

    address private _blabs;
    address private _oracle;
    address private _vaultAddress;
    address private _userVaultAddress;

    constructor(
      address oracle,
      address vault,
      address userVault
    ) public {
        _blabs = msg.sender;
        _oracle = oracle;
        _vaultAddress = vault;
        _userVaultAddress = userVault;
    }

    function addTokenToWhitelist(uint[] memory sort, address[] memory token) external onlyBlabs {
        require(sort.length == token.length, "ERR_SORT_TOKEN_MISMATCH");
        for (uint i = 0; i < sort.length; i++) {
            _addTokenToWhitelist(sort[i], token[i]);
        }
    }

    function removeTokenFromWhitelist(uint[] memory sort, address[] memory token) external onlyBlabs {
        require(sort.length == token.length, "ERR_SORT_TOKEN_MISMATCH");
        for (uint i = 0; i < sort.length; i++) {
            _removeTokenFromWhitelist(sort[i], token[i]);
        }
    }

    function isTokenWhitelistedForVerify(uint sort, address token) external view returns (bool) {
        return _isTokenWhitelistedForVerify(sort, token);
    }

    function isTokenWhitelistedForVerify(address token) external view returns (bool) {
        return _queryIsTokenWhitelisted(token);
    }

    function isLiquidityPool(address b) external view returns (bool) {
        return _isLiquidityPool[b];
    }

    function createPool() internal returns (address base) {
        bytes memory bytecode = bytecodes;
        bytes32 salt = keccak256(abi.encodePacked(counters++));

        assembly {
            base := create2(0, add(bytecode, 32), mload(bytecode), salt)
            if iszero(extcodesize(base)) {
                revert(0, 0)
            }
        }
        counters++;
    }

    function newLiquidityPool() external returns (IBPool) {
        address lpool = createPool();
        _isLiquidityPool[lpool] = true;
        emit LOG_NEW_POOL(msg.sender, lpool);
        IBPool(lpool).setController(msg.sender);
        return IBPool(lpool);
    }

    function getBLabs() external view returns (address) {
        return _blabs;
    }

    function setBLabs(address b) external onlyBlabs {
        require(b != address(0), "ERR_ZERO_ADDRESS");
        emit LOG_BLABS(msg.sender, b);
        _blabs = b;
    }

    function getModuleStatus(address etf, address module) external view returns (bool) {
        return _isSystemModule[module] || _isModuleRegistered[etf][module];
    }

    function getOracleAddress() external view returns (address) {
        return _oracle;
    }

    function setSystemModule(address module, bool state) external onlyBlabs {
        require(module != address(0), "ZERO ADDRESS");

        _isSystemModule[module] = state;

        emit SYSTEM_MODULE_CHANGED(module, state);
    }

    function registerModule(address etf, address module) external onlyBlabs {
        require(etf != address(0), "ZERO ETF ADDRESS");
        require(module != address(0), "ZERO ADDRESS");

        _isModuleRegistered[etf][module] = true;

        emit MODULE_STATUS_CHANGE(etf, module, true);
    }

    function removeModule(address etf, address module) external onlyBlabs {
        require(etf != address(0), "ZERO ETF ADDRESS");
        require(module != address(0), "ZERO ADDRESS");

        _isModuleRegistered[etf][module] = false;

        emit MODULE_STATUS_CHANGE(etf, module, false);
    }

    function setOracle(address oracle) external onlyBlabs {
        require(oracle != address(0), "ERR_ZERO_ADDRESS");
        emit LOG_ORACLE(msg.sender, oracle);
        _oracle = oracle;
    }

    function collect(IERC20 token) external onlyBlabs {
        uint collected = token.balanceOf(address(this));
        token.safeTransfer(_blabs, collected);
    }

    function getVault() external view returns (address) {
        return _vaultAddress;
    }

    function setVault(address newVault) external onlyBlabs {
        require(newVault != address(0), "ERR_ZERO_ADDRESS");
        _vaultAddress = newVault;
        emit LOG_VAULT(newVault, msg.sender);
    }

    function getUserVault() external view returns (address) {
        return _userVaultAddress;
    }

    function setUserVault(address newVault) external onlyBlabs {
        require(newVault != address(0), "ERR_ZERO_ADDRESS");
        _userVaultAddress = newVault;
        emit LOG_USER_VAULT(newVault, msg.sender);
    }

    function setProtocolPaused(bool state) external onlyBlabs {
        isPaused = state;
        emit PAUSED_STATUS(state);
    }

    function setByteCodes(bytes memory _bytecode) external onlyBlabs {
        bytecodes = _bytecode;
    }

    modifier onlyBlabs() {
        require(msg.sender == _blabs, "ERR_NOT_BLABS");
        _;
    }
}

File 2 of 7 : WhiteToken.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;

contract WhiteToken {
    // add token log
    event LOG_WHITELIST(address indexed spender, uint indexed sort, address indexed caller, address token);
    // del token log
    event LOG_DEL_WHITELIST(address indexed spender, uint indexed sort, address indexed caller, address token);

    // record the number of whitelists.
    uint private _whiteTokenCount;
    // token address => is white token.
    mapping(address => bool) private _isTokenWhitelisted;
    // Multi level white token.
    // type => token address => is white token.
    mapping(uint => mapping(address => bool)) private _tokenWhitelistedInfo;

    function _queryIsTokenWhitelisted(address token) internal view returns (bool) {
        return _isTokenWhitelisted[token];
    }

    // for factory to verify
    function _isTokenWhitelistedForVerify(uint sort, address token) internal view returns (bool) {
        return _tokenWhitelistedInfo[sort][token];
    }

    // add sort token
    function _addTokenToWhitelist(uint sort, address token) internal {
        require(token != address(0), "ERR_INVALID_TOKEN_ADDRESS");
        require(_queryIsTokenWhitelisted(token) == false, "ERR_HAS_BEEN_ADDED_WHITE");

        _tokenWhitelistedInfo[sort][token] = true;
        _isTokenWhitelisted[token] = true;
        _whiteTokenCount++;

        emit LOG_WHITELIST(address(this), sort, msg.sender, token);
    }

    // remove sort token
    function _removeTokenFromWhitelist(uint sort, address token) internal {
        require(_queryIsTokenWhitelisted(token) == true, "ERR_NOT_WHITE_TOKEN");

        require(_tokenWhitelistedInfo[sort][token], "ERR_SORT_NOT_MATCHED");

        _tokenWhitelistedInfo[sort][token] = false;
        _isTokenWhitelisted[token] = false;
        _whiteTokenCount--;
        emit LOG_DEL_WHITELIST(address(this), sort, msg.sender, token);
    }

    // already has init
    function _initWhiteTokenState() internal view returns (bool) {
        return _whiteTokenCount == 0 ?  false : true;
    }
}

File 3 of 7 : IBFactory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

interface IBPool {
    function rebind(
        address token,
        uint balance,
        uint denorm
    ) external;

    function execute(
        address _target,
        uint _value,
        bytes calldata _data
    ) external returns (bytes memory _returnValue);

    function bind(
        address token,
        uint balance,
        uint denorm
    ) external;

    function unbind(address token) external;

    function unbindPure(address token) external;

    function isBound(address token) external view returns (bool);

    function getBalance(address token) external view returns (uint);

    function totalSupply() external view returns (uint);

    function isPublicSwap() external view returns (bool);

    function getDenormalizedWeight(address token) external view returns (uint);

    function getTotalDenormalizedWeight() external view returns (uint);

    function EXIT_FEE() external view returns (uint);

    function getCurrentTokens() external view returns (address[] memory tokens);

    function setController(address owner) external;
}

interface IBFactory {
    function newLiquidityPool() external returns (IBPool);

    function setBLabs(address b) external;

    function collect(IBPool pool) external;

    function isBPool(address b) external view returns (bool);

    function getBLabs() external view returns (address);

    function getVault() external view returns (address);

    function getUserVault() external view returns (address);

    function getVaultAddress() external view returns (address);

    function getOracleAddress() external view returns (address);

    function isTokenWhitelistedForVerify(uint sort, address token) external view returns (bool);

    function isTokenWhitelistedForVerify(address token) external view returns (bool);

    function getModuleStatus(address etf, address module) external view returns (bool);

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

interface IVault {
    function depositManagerToken(address[] calldata poolTokens, uint[] calldata tokensAmount) external;

    function depositIssueRedeemPToken(
        address[] calldata poolTokens,
        uint[] calldata tokensAmount,
        uint[] calldata tokensAmountP,
        bool isPerfermance
    ) external;

    function managerClaim(address pool) external;

    function getManagerClaimBool(address pool) external view returns (bool);
}

interface IUserVault {
    function recordTokenInfo(
        address kol,
        address user,
        address[] calldata poolTokens,
        uint[] calldata tokensAmount
    ) external;
}

interface Oracles {
    function getPrice(address tokenAddress) external returns (uint price);

    function getAllPrice(address[] calldata poolTokens, uint[] calldata tokensAmount) external returns (uint);
}

File 4 of 7 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import {IERC20} from "../interfaces/IERC20.sol";
import {SafeMath} from "./SafeMath.sol";
import {Address} from "./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 uint;
    using Address for address;

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

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

    function safeApprove(
        IERC20 token,
        address spender,
        uint value
    ) internal {
        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 callOptionalReturn(IERC20 token, bytes memory data) private {
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "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 5 of 7 : IERC20.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;

// Interface declarations

/* solhint-disable func-order */

interface IERC20 {
    // 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, uint value);

    // 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, uint value);

    // Returns the amount of tokens in existence
    function totalSupply() external view returns (uint);

    // Returns the amount of tokens owned by account
    function balanceOf(address account) external view returns (uint);

    // Returns the decimals of tokens
    function decimals() external view returns (uint8);

    function symbol() external view returns (string memory);

    // 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 (uint);

    // Sets amount as the allowance of spender over the caller’s tokens
    // Returns a boolean value indicating whether the operation succeeded
    // Emits an Approval event.
    function approve(address spender, uint amount) external returns (bool);

    // 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, uint amount) external returns (bool);

    // 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,
        uint amount
    ) external returns (bool);
}

File 6 of 7 : Address.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @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, uint 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");
    }

    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    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,
        uint 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,
        uint value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(
        address target,
        bytes memory data,
        uint weiValue,
        string memory errorMessage
    ) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value: weiValue}(data);
        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 7 of 7 : SafeMath.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @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, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint a, uint b) internal pure returns (uint) {
        uint 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(uint a, uint b) internal pure returns (uint) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(
        uint a,
        uint b,
        string memory errorMessage
    ) internal pure returns (uint) {
        require(b <= a, errorMessage);
        uint c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint a, uint b) internal pure returns (uint) {
        // 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 0;
        }

        uint c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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(uint a, uint b) internal pure returns (uint) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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(
        uint a,
        uint b,
        string memory errorMessage
    ) internal pure returns (uint) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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(uint a, uint b) internal pure returns (uint) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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(
        uint a,
        uint b,
        string memory errorMessage
    ) internal pure returns (uint) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"userVault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"blabs","type":"address"}],"name":"LOG_BLABS","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"sort","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"LOG_DEL_WHITELIST","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"manager","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"LOG_MANAGER","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"pool","type":"address"}],"name":"LOG_NEW_POOL","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"oracle","type":"address"}],"name":"LOG_ORACLE","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"router","type":"address"}],"name":"LOG_ROUTER","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"LOG_USER_VAULT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"caller","type":"address"}],"name":"LOG_VAULT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"sort","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"LOG_WHITELIST","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"etf","type":"address"},{"indexed":false,"internalType":"address","name":"module","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"MODULE_STATUS_CHANGE","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"PAUSED_STATUS","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"},{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"SYSTEM_MODULE_CHANGED","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"sort","type":"uint256[]"},{"internalType":"address[]","name":"token","type":"address[]"}],"name":"addTokenToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBLabs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"etf","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"getModuleStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOracleAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUserVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"b","type":"address"}],"name":"isLiquidityPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sort","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"isTokenWhitelistedForVerify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isTokenWhitelistedForVerify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"newLiquidityPool","outputs":[{"internalType":"contract IBPool","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"etf","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"registerModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"etf","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"removeModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"sort","type":"uint256[]"},{"internalType":"address[]","name":"token","type":"address[]"}],"name":"removeTokenFromWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"b","type":"address"}],"name":"setBLabs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_bytecode","type":"bytes"}],"name":"setByteCodes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oracle","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"setProtocolPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"setSystemModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newVault","type":"address"}],"name":"setUserVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newVault","type":"address"}],"name":"setVault","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101125760003560e01c806306ec16f814610117578063131d6a121461013f57806336ffb1671461026257806338f0d245146102865780636817031b146102c85780636a36e3a2146102ee578063703a9ec91461031c5780637adbf973146103245780638275d4711461034a5780638a53ea77146103695780638b0e8e67146103975780638d928af8146103bd5780638f49f44d146103c557806391cefde4146103f1578063a6c245c4146103f9578063b187bd261461051c578063b18b78dd14610524578063b2ebfea51461052c578063c6ce34fb146105d0578063db7ca46b146105f6578063e85455d71461061c578063f4b2f6ce14610642575b600080fd5b61013d6004803603602081101561012d57600080fd5b50356001600160a01b0316610670565b005b61013d6004803603604081101561015557600080fd5b810190602081018135600160201b81111561016f57600080fd5b82018360208201111561018157600080fd5b803590602001918460208302840111600160201b831117156101a257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156101f157600080fd5b82018360208201111561020357600080fd5b803590602001918460208302840111600160201b8311171561022457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610765945050505050565b61026a610852565b604080516001600160a01b039092168252519081900360200190f35b6102b46004803603604081101561029c57600080fd5b506001600160a01b0381358116916020013516610866565b604080519115158252519081900360200190f35b61013d600480360360208110156102de57600080fd5b50356001600160a01b03166108b9565b61013d6004803603604081101561030457600080fd5b506001600160a01b03813581169160200135166109a8565b61026a610b04565b61013d6004803603602081101561033a57600080fd5b50356001600160a01b0316610b13565b61013d6004803603602081101561036057600080fd5b50351515610c0d565b61013d6004803603604081101561037f57600080fd5b506001600160a01b0381358116916020013516610ca8565b61013d600480360360208110156103ad57600080fd5b50356001600160a01b0316610e0e565b61026a610efd565b6102b4600480360360408110156103db57600080fd5b50803590602001356001600160a01b0316610f0c565b61026a610f18565b61013d6004803603604081101561040f57600080fd5b810190602081018135600160201b81111561042957600080fd5b82018360208201111561043b57600080fd5b803590602001918460208302840111600160201b8311171561045c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156104ab57600080fd5b8201836020820111156104bd57600080fd5b803590602001918460208302840111600160201b831117156104de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610fd7945050505050565b6102b46110bf565b61026a6110c8565b61013d6004803603602081101561054257600080fd5b810190602081018135600160201b81111561055c57600080fd5b82018360208201111561056e57600080fd5b803590602001918460018302840111600160201b8311171561058f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506110d7945050505050565b61013d600480360360208110156105e657600080fd5b50356001600160a01b031661113e565b6102b46004803603602081101561060c57600080fd5b50356001600160a01b031661123e565b6102b46004803603602081101561063257600080fd5b50356001600160a01b031661124f565b61013d6004803603604081101561065857600080fd5b506001600160a01b038135169060200135151561126d565b60085461010090046001600160a01b031633146106c4576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561071357600080fd5b505afa158015610727573d6000803e3d6000fd5b505050506040513d602081101561073d57600080fd5b5051600854909150610761906001600160a01b03848116916101009004168361136f565b5050565b60085461010090046001600160a01b031633146107b9576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b8051825114610809576040805162461bcd60e51b815260206004820152601760248201527608aa4a4bea69ea4a8bea89e968a9cbe9a92a69a82a8869604b1b604482015290519081900360640190fd5b60005b825181101561084d5761084583828151811061082457fe5b602002602001015183838151811061083857fe5b60200260200101516113c1565b60010161080c565b505050565b60085461010090046001600160a01b031690565b6001600160a01b03811660009081526004602052604081205460ff16806108b257506001600160a01b0380841660009081526005602090815260408083209386168352929052205460ff165b9392505050565b60085461010090046001600160a01b0316331461090d576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b03811661095b576040805162461bcd60e51b815260206004820152601060248201526f4552525f5a45524f5f4144445245535360801b604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0383169081179091556040513391907fb4dea88882442451a462d3bdfdca2f8ef2b3516e079b0d5aaff6460ccdb706f490600090a350565b60085461010090046001600160a01b031633146109fc576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b038216610a4a576040805162461bcd60e51b815260206004820152601060248201526f5a45524f20455446204144445245535360801b604482015290519081900360640190fd5b6001600160a01b038116610a94576040805162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b604482015290519081900360640190fd5b6001600160a01b038083166000818152600560209081526040808320948616808452948252808320805460ff191690558051938452908301939093528183015290517f68c33efced6f26119f0dd6351ae1fb557d5329dfac87e377d4f9d1a1d77d8acb9181900360600190a15050565b600b546001600160a01b031690565b60085461010090046001600160a01b03163314610b67576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b038116610bb5576040805162461bcd60e51b815260206004820152601060248201526f4552525f5a45524f5f4144445245535360801b604482015290519081900360640190fd5b6040516001600160a01b0382169033907f7301a3fa5e149ffdc294fe3b3ac0abb0ec25be499c812f4daa2edacaa85e44cd90600090a3600980546001600160a01b0319166001600160a01b0392909216919091179055565b60085461010090046001600160a01b03163314610c61576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6008805482151560ff19909116811790915560408051918252517f2b68200aa3fdf77c32eaa2697db7199e738eb7ab3b8f47917991907193b751b79181900360200190a150565b60085461010090046001600160a01b03163314610cfc576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b038216610d4a576040805162461bcd60e51b815260206004820152601060248201526f5a45524f20455446204144445245535360801b604482015290519081900360640190fd5b6001600160a01b038116610d94576040805162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b604482015290519081900360640190fd5b6001600160a01b03808316600081815260056020908152604080832094861680845294825291829020805460ff191660019081179091558251938452908301939093528181019290925290517f68c33efced6f26119f0dd6351ae1fb557d5329dfac87e377d4f9d1a1d77d8acb9181900360600190a15050565b60085461010090046001600160a01b03163314610e62576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b038116610eb0576040805162461bcd60e51b815260206004820152601060248201526f4552525f5a45524f5f4144445245535360801b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040513391907fbe29361fcb0d6d7a528b06b7e3c978b225c152a431ac559470986926fe26692590600090a350565b600a546001600160a01b031690565b60006108b28383611504565b600080610f2361152f565b6001600160a01b038116600081815260036020526040808220805460ff1916600117905551929350909133917f8ccec77b0cb63ac2cafd0f5de8cdfadab91ce656d262240ba8a6343bccc5f94591a3604080516392eefe9b60e01b815233600482015290516001600160a01b038316916392eefe9b91602480830192600092919082900301818387803b158015610fb957600080fd5b505af1158015610fcd573d6000803e3d6000fd5b5092935050505090565b60085461010090046001600160a01b0316331461102b576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b805182511461107b576040805162461bcd60e51b815260206004820152601760248201527608aa4a4bea69ea4a8bea89e968a9cbe9a92a69a82a8869604b1b604482015290519081900360640190fd5b60005b825181101561084d576110b783828151811061109657fe5b60200260200101518383815181106110aa57fe5b6020026020010151611619565b60010161107e565b60085460ff1681565b6009546001600160a01b031690565b60085461010090046001600160a01b0316331461112b576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b8051610761906007906020840190611960565b60085461010090046001600160a01b03163314611192576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b0381166111e0576040805162461bcd60e51b815260206004820152601060248201526f4552525f5a45524f5f4144445245535360801b604482015290519081900360640190fd5b6040516001600160a01b0382169033907ff586fa6ee1fc42f5b727f3b214ccbd0b6d7e698c45d49ba32f224fbb8670155d90600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600061124982611748565b92915050565b6001600160a01b031660009081526003602052604090205460ff1690565b60085461010090046001600160a01b031633146112c1576040805162461bcd60e51b815260206004820152600d60248201526c4552525f4e4f545f424c41425360981b604482015290519081900360640190fd5b6001600160a01b03821661130b576040805162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b604482015290519081900360640190fd5b6001600160a01b038216600081815260046020908152604091829020805460ff191685151590811790915582519384529083015280517f745be35343868882339320dd5210770eb27ab2d12a1fbf39e7436e82102541379281900390910190a15050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261084d908490611766565b6113ca81611748565b1515600114611416576040805162461bcd60e51b815260206004820152601360248201527222a9292fa727aa2faba424aa22afaa27a5a2a760691b604482015290519081900360640190fd5b60008281526002602090815260408083206001600160a01b038516845290915290205460ff16611484576040805162461bcd60e51b815260206004820152601460248201527311549497d4d3d49517d393d517d3505510d2115160621b604482015290519081900360640190fd5b60008281526002602090815260408083206001600160a01b038516808552908352818420805460ff1990811690915560018452828520805490911690558354600019019093558051928352513392859230927ff27ed63b9bdfafba10ef35fe37741d317458bbdb30dddc979bd9df79fc8b5d4f9281900390910190a45050565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6007805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152600093606093919290918301828280156115bd5780601f10611592576101008083540402835291602001916115bd565b820191906000526020600020905b8154815290600101906020018083116115a057829003601f168201915b50506006805460018101909155604080516020808201939093528151808203840181529082019091528051908201208551959650948594509250850190506000f59250823b61160b57600080fd5b505060068054600101905590565b6001600160a01b038116611670576040805162461bcd60e51b81526020600482015260196024820152784552525f494e56414c49445f544f4b454e5f4144445245535360381b604482015290519081900360640190fd5b61167981611748565b156116c6576040805162461bcd60e51b81526020600482015260186024820152774552525f4841535f4245454e5f41444445445f574849544560401b604482015290519081900360640190fd5b60008281526002602090815260408083206001600160a01b0385168085529083528184208054600160ff1991821681179092558185528386208054909116821790558454019093558051928352513392859230927f5ab6a0d7af8e86f78c34acea4f8aff1be027227ce1bc29e03f57f39b788f4b049281900390910190a45050565b6001600160a01b031660009081526001602052604090205460ff1690565b611778826001600160a01b0316611924565b6117c9576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106118075780518252601f1990920191602091820191016117e8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611869576040519150601f19603f3d011682016040523d82523d6000602084013e61186e565b606091505b5091509150816118c5576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561191e578080602001905160208110156118e157600080fd5b505161191e5760405162461bcd60e51b815260040180806020018281038252602a8152602001806119f4602a913960400191505060405180910390fd5b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061195857508115155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106119a157805160ff19168380011785556119ce565b828001600101855582156119ce579182015b828111156119ce5782518255916020019190600101906119b3565b506119da9291506119de565b5090565b5b808211156119da57600081556001016119df56fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122073cc19b91eff745c93505102210ce7ab610d7d2a7ec933a0693f1490fe937d6064736f6c634300060c0033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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