ETH Price: $1,986.01 (+2.57%)
Gas: 0.11 Gwei
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Otoken199246972024-05-22 10:02:23648 days ago1716372143IN
0x38A75D01...d93b909e2
0 ETH0.004465247.77190995

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x60806040241635742026-01-04 20:05:1155 days ago1767557111
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040240266882025-12-16 17:33:3575 days ago1765906415
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040238197982025-11-17 15:31:59104 days ago1763393519
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040235944552025-10-17 2:39:47135 days ago1760668787
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040233489072025-09-12 18:54:35169 days ago1757703275
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040231619142025-08-17 16:17:11196 days ago1755447431
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040230189462025-07-28 16:50:47216 days ago1753721447
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040229117772025-07-13 17:33:59231 days ago1752428039
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040226759462025-06-10 18:25:59263 days ago1749579959
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040224969632025-05-16 16:58:35289 days ago1747414715
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040223410102025-04-24 19:39:35310 days ago1745523575
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040221901812025-04-03 18:29:35331 days ago1743704975
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040220040152025-03-08 18:42:35357 days ago1741459355
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040218680652025-02-17 19:04:23376 days ago1739819063
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040217970502025-02-07 20:34:59386 days ago1738960499
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040217218672025-01-28 8:35:59397 days ago1738053359
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040216687152025-01-20 22:33:23404 days ago1737412403
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040215985842025-01-11 3:33:47414 days ago1736566427
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040215456942025-01-03 18:17:35421 days ago1735928255
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040214916242024-12-27 5:11:11429 days ago1735276271
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040214323172024-12-18 22:12:23437 days ago1734559943
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040213826802024-12-11 23:55:35444 days ago1733961335
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040213265952024-12-04 3:57:23452 days ago1733284643
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040212734292024-11-26 17:30:47460 days ago1732642247
0x38A75D01...d93b909e2
 Contract Creation0 ETH
0x60806040212083332024-11-17 15:30:11469 days ago1731857411
0x38A75D01...d93b909e2
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OtokenFactory

Compiler Version
v0.6.10+commit.00c0fcaf

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion
pragma solidity =0.6.10;

import {OtokenSpawner} from "./OtokenSpawner.sol";
import {SafeMath} from "../packages/oz/SafeMath.sol";
import {AddressBookInterface} from "../interfaces/AddressBookInterface.sol";
import {OtokenInterface} from "../interfaces/OtokenInterface.sol";
import {WhitelistInterface} from "../interfaces/WhitelistInterface.sol";

/**
 * SPDX-License-Identifier: UNLICENSED
 * @title A factory to create Opyn oTokens
 * @author Opyn Team
 * @notice Create new oTokens and keep track of all created tokens
 * @dev Calculate contract address before each creation with CREATE2
 * and deploy eip-1167 minimal proxies for oToken logic contract
 */
contract OtokenFactory is OtokenSpawner {
    using SafeMath for uint256;
    /// @notice Opyn AddressBook contract that records the address of the Whitelist module and the Otoken impl address. */
    address public addressBook;

    /// @notice array of all created otokens */
    address[] public otokens;

    /// @dev mapping from parameters hash to its deployed address
    mapping(bytes32 => address) private idToAddress;

    /// @dev max expiry that BokkyPooBahsDateTimeLibrary can handle. (2345/12/31)
    uint256 private constant MAX_EXPIRY = 11865398400;

    constructor(address _addressBook) public {
        addressBook = _addressBook;
    }

    /// @notice emitted when the factory creates a new Option
    event OtokenCreated(
        address tokenAddress,
        address creator,
        address indexed underlying,
        address indexed strike,
        address indexed collateral,
        uint256 strikePrice,
        uint256 expiry,
        bool isPut
    );

    /**
     * @notice create new oTokens
     * @dev deploy an eip-1167 minimal proxy with CREATE2 and register it to the whitelist module
     * @param _underlyingAsset asset that the option references
     * @param _strikeAsset asset that the strike price is denominated in
     * @param _collateralAsset asset that is held as collateral against short/written options
     * @param _strikePrice strike price with decimals = 18
     * @param _expiry expiration timestamp as a unix timestamp
     * @param _isPut True if a put option, False if a call option
     * @return newOtoken address of the newly created option
     */
    function createOtoken(
        address _underlyingAsset,
        address _strikeAsset,
        address _collateralAsset,
        uint256 _strikePrice,
        uint256 _expiry,
        bool _isPut
    ) external returns (address) {
        require(_expiry > now, "OtokenFactory: Can't create expired option");
        require(_expiry < MAX_EXPIRY, "OtokenFactory: Can't create option with expiry > 2345/12/31");
        // 8 hours = 3600 * 8 = 28800 seconds
        require(_expiry.sub(28800).mod(86400) == 0, "OtokenFactory: Option has to expire 08:00 UTC");
        bytes32 id = _getOptionId(_underlyingAsset, _strikeAsset, _collateralAsset, _strikePrice, _expiry, _isPut);
        require(idToAddress[id] == address(0), "OtokenFactory: Option already created");

        address whitelist = AddressBookInterface(addressBook).getWhitelist();
        require(
            WhitelistInterface(whitelist).isWhitelistedProduct(
                _underlyingAsset,
                _strikeAsset,
                _collateralAsset,
                _isPut
            ),
            "OtokenFactory: Unsupported Product"
        );

        require(!_isPut || _strikePrice > 0, "OtokenFactory: Can't create a $0 strike put option");

        address otokenImpl = AddressBookInterface(addressBook).getOtokenImpl();

        bytes memory initializationCalldata = abi.encodeWithSelector(
            OtokenInterface(otokenImpl).init.selector,
            addressBook,
            _underlyingAsset,
            _strikeAsset,
            _collateralAsset,
            _strikePrice,
            _expiry,
            _isPut
        );

        address newOtoken = _spawn(otokenImpl, initializationCalldata);

        idToAddress[id] = newOtoken;
        otokens.push(newOtoken);
        WhitelistInterface(whitelist).whitelistOtoken(newOtoken);

        emit OtokenCreated(
            newOtoken,
            msg.sender,
            _underlyingAsset,
            _strikeAsset,
            _collateralAsset,
            _strikePrice,
            _expiry,
            _isPut
        );

        return newOtoken;
    }

    /**
     * @notice get the total oTokens created by the factory
     * @return length of the oTokens array
     */
    function getOtokensLength() external view returns (uint256) {
        return otokens.length;
    }

    /**
     * @notice get the oToken address for an already created oToken, if no oToken has been created with these parameters, it will return address(0)
     * @param _underlyingAsset asset that the option references
     * @param _strikeAsset asset that the strike price is denominated in
     * @param _collateralAsset asset that is held as collateral against short/written options
     * @param _strikePrice strike price with decimals = 18
     * @param _expiry expiration timestamp as a unix timestamp
     * @param _isPut True if a put option, False if a call option
     * @return the address of target otoken.
     */
    function getOtoken(
        address _underlyingAsset,
        address _strikeAsset,
        address _collateralAsset,
        uint256 _strikePrice,
        uint256 _expiry,
        bool _isPut
    ) external view returns (address) {
        bytes32 id = _getOptionId(_underlyingAsset, _strikeAsset, _collateralAsset, _strikePrice, _expiry, _isPut);
        return idToAddress[id];
    }

    /**
     * @notice get the address at which a new oToken with these parameters would be deployed
     * @dev return the exact address that will be deployed at with _computeAddress
     * @param _underlyingAsset asset that the option references
     * @param _strikeAsset asset that the strike price is denominated in
     * @param _collateralAsset asset that is held as collateral against short/written options
     * @param _strikePrice strike price with decimals = 18
     * @param _expiry expiration timestamp as a unix timestamp
     * @param _isPut True if a put option, False if a call option
     * @return targetAddress the address this oToken would be deployed at
     */
    function getTargetOtokenAddress(
        address _underlyingAsset,
        address _strikeAsset,
        address _collateralAsset,
        uint256 _strikePrice,
        uint256 _expiry,
        bool _isPut
    ) external view returns (address) {
        address otokenImpl = AddressBookInterface(addressBook).getOtokenImpl();

        bytes memory initializationCalldata = abi.encodeWithSelector(
            OtokenInterface(otokenImpl).init.selector,
            addressBook,
            _underlyingAsset,
            _strikeAsset,
            _collateralAsset,
            _strikePrice,
            _expiry,
            _isPut
        );
        return _computeAddress(otokenImpl, initializationCalldata);
    }

    /**
     * @dev hash oToken parameters and return a unique option id
     * @param _underlyingAsset asset that the option references
     * @param _strikeAsset asset that the strike price is denominated in
     * @param _collateralAsset asset that is held as collateral against short/written options
     * @param _strikePrice strike price with decimals = 18
     * @param _expiry expiration timestamp as a unix timestamp
     * @param _isPut True if a put option, False if a call option
     * @return id the unique id of an oToken
     */
    function _getOptionId(
        address _underlyingAsset,
        address _strikeAsset,
        address _collateralAsset,
        uint256 _strikePrice,
        uint256 _expiry,
        bool _isPut
    ) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(_underlyingAsset, _strikeAsset, _collateralAsset, _strikePrice, _expiry, _isPut)
            );
    }
}

/* SPDX-License-Identifier: UNLICENSED */

pragma solidity =0.6.10;

import {Spawn} from "../packages/Spawn.sol";
import {Create2} from "../packages/oz/Create2.sol";

/**
 * @title OtokenSpawner
 * @author Opyn Team
 * @notice This contract spawns and initializes eip-1167 minimal proxies that
 * point to existing logic contracts.
 * @notice This contract was modified from Spawner.sol
 * https://github.com/0age/Spawner/blob/master/contracts/Spawner.sol to fit into OtokenFactory
 */
contract OtokenSpawner {
    // fixed salt value because we will only deploy an oToken with the same init value once
    bytes32 private constant SALT = bytes32(0);

    /**
     * @notice internal function for spawning an eip-1167 minimal proxy using `CREATE2`
     * @param logicContract address of the logic contract
     * @param initializationCalldata calldata that will be supplied to the `DELEGATECALL`
     * from the spawned contract to the logic contract during contract creation
     * @return spawnedContract the address of the newly-spawned contract
     */
    function _spawn(address logicContract, bytes memory initializationCalldata) internal returns (address) {
        // place the creation code and constructor args of the contract to spawn in memory
        bytes memory initCode = abi.encodePacked(
            type(Spawn).creationCode,
            abi.encode(logicContract, initializationCalldata)
        );

        // spawn the contract using `CREATE2`
        return Create2.deploy(0, SALT, initCode);
    }

    /**
     * @notice internal view function for finding the address of the standard
     * eip-1167 minimal proxy created using `CREATE2` with a given logic contract
     * and initialization calldata payload
     * @param logicContract address of the logic contract
     * @param initializationCalldata calldata that will be supplied to the `DELEGATECALL`
     * from the spawned contract to the logic contract during contract creation
     * @return target address of the next spawned minimal proxy contract with the
     * given parameters.
     */
    function _computeAddress(address logicContract, bytes memory initializationCalldata)
        internal
        view
        returns (address target)
    {
        // place the creation code and constructor args of the contract to spawn in memory
        bytes memory initCode = abi.encodePacked(
            type(Spawn).creationCode,
            abi.encode(logicContract, initializationCalldata)
        );
        // get target address using the constructed initialization code
        bytes32 initCodeHash = keccak256(initCode);

        target = Create2.computeAddress(SALT, initCodeHash);
    }
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.10;

interface AddressBookInterface {
    /* Getters */

    function getOtokenImpl() external view returns (address);

    function getOtokenFactory() external view returns (address);

    function getWhitelist() external view returns (address);

    function getController() external view returns (address);

    function getOracle() external view returns (address);

    function getMarginPool() external view returns (address);

    function getMarginCalculator() external view returns (address);

    function getLiquidationManager() external view returns (address);

    function getAddress(bytes32 _id) external view returns (address);

    /* Setters */

    function setOtokenImpl(address _otokenImpl) external;

    function setOtokenFactory(address _factory) external;

    function setOracleImpl(address _otokenImpl) external;

    function setWhitelist(address _whitelist) external;

    function setController(address _controller) external;

    function setMarginPool(address _marginPool) external;

    function setMarginCalculator(address _calculator) external;

    function setLiquidationManager(address _liquidationManager) external;

    function setAddress(bytes32 _id, address _newImpl) external;
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.10;

interface OtokenInterface {
    function addressBook() external view returns (address);

    function underlyingAsset() external view returns (address);

    function strikeAsset() external view returns (address);

    function collateralAsset() external view returns (address);

    function strikePrice() external view returns (uint256);

    function expiryTimestamp() external view returns (uint256);

    function isPut() external view returns (bool);

    function init(
        address _addressBook,
        address _underlyingAsset,
        address _strikeAsset,
        address _collateralAsset,
        uint256 _strikePrice,
        uint256 _expiry,
        bool _isPut
    ) external;

    function getOtokenDetails()
        external
        view
        returns (
            address,
            address,
            address,
            uint256,
            uint256,
            bool
        );

    function mintOtoken(address account, uint256 amount) external;

    function burnOtoken(address account, uint256 amount) external;
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.10;

interface WhitelistInterface {
    /* View functions */

    function addressBook() external view returns (address);

    function isWhitelistedProduct(
        address _underlying,
        address _strike,
        address _collateral,
        bool _isPut
    ) external view returns (bool);

    function isWhitelistedCollateral(address _collateral) external view returns (bool);

    function isWhitelistedOtoken(address _otoken) external view returns (bool);

    function isWhitelistedCallee(address _callee) external view returns (bool);

    /* Admin / factory only functions */
    function whitelistProduct(
        address _underlying,
        address _strike,
        address _collateral,
        bool _isPut
    ) external;

    function blacklistProduct(
        address _underlying,
        address _strike,
        address _collateral,
        bool _isPut
    ) external;

    function whitelistCollateral(address _collateral) external;

    function blacklistCollateral(address _collateral) external;

    function whitelistOtoken(address _otoken) external;

    function blacklistOtoken(address _otoken) external;

    function whitelistCallee(address _callee) external;

    function blacklistCallee(address _callee) external;
}

File 6 of 8 : Spawn.sol
/* solhint-disable avoid-low-level-calls, indent, no-inline-assembly */
/* This contract is copied from Spawner package: https://github.com/0age/Spawner */
pragma solidity =0.6.10;

/**
 * @title Spawn
 * @author 0age
 * @notice This contract provides creation code that is used by Spawner in order
 * to initialize and deploy eip-1167 minimal proxies for a given logic contract.
 * SPDX-License-Identifier: MIT
 */
// version: https://github.com/0age/Spawner/blob/1b342afda0c1ec47e6a2d65828a6ca50f0a442fe/contracts/Spawner.sol
contract Spawn {
    constructor(address logicContract, bytes memory initializationCalldata) public payable {
        // delegatecall into the logic contract to perform initialization.
        (bool ok, ) = logicContract.delegatecall(initializationCalldata);
        if (!ok) {
            // pass along failure message from delegatecall and revert.
            assembly {
                returndatacopy(0, 0, returndatasize())
                revert(0, returndatasize())
            }
        }

        // place eip-1167 runtime code in memory.
        bytes memory runtimeCode = abi.encodePacked(
            bytes10(0x363d3d373d3d3d363d73),
            logicContract,
            bytes15(0x5af43d82803e903d91602b57fd5bf3)
        );

        // return eip-1167 code to write it to spawned contract runtime.
        assembly {
            return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length
        }
    }
}

// SPDX-License-Identifier: MIT
// openzeppelin-contracts v3.1.0
/* solhint-disable */

pragma solidity =0.6.10;

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(
        uint256 amount,
        bytes32 salt,
        bytes memory bytecode
    ) internal returns (address) {
        address addr;
        require(address(this).balance >= amount, "Create2: insufficient balance");
        require(bytecode.length != 0, "Create2: bytecode length is zero");
        // solhint-disable-next-line no-inline-assembly
        assembly {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(addr != address(0), "Create2: Failed on deploy");
        return addr;
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
     * `bytecodeHash` or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
        return computeAddress(salt, bytecodeHash, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(
        bytes32 salt,
        bytes32 bytecodeHash,
        address deployer
    ) internal pure returns (address) {
        bytes32 _data = keccak256(abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash));
        return address(uint256(_data));
    }
}

// SPDX-License-Identifier: MIT
// openzeppelin-contracts v3.1.0

/* solhint-disable */
pragma solidity ^0.6.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, 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) {
        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(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 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(uint256 a, uint256 b) internal pure returns (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 0;
        }

        uint256 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(uint256 a, uint256 b) internal pure returns (uint256) {
        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(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 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(uint256 a, uint256 b) internal pure returns (uint256) {
        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(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_addressBook","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"underlying","type":"address"},{"indexed":true,"internalType":"address","name":"strike","type":"address"},{"indexed":true,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"strikePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expiry","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isPut","type":"bool"}],"name":"OtokenCreated","type":"event"},{"inputs":[],"name":"addressBook","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_underlyingAsset","type":"address"},{"internalType":"address","name":"_strikeAsset","type":"address"},{"internalType":"address","name":"_collateralAsset","type":"address"},{"internalType":"uint256","name":"_strikePrice","type":"uint256"},{"internalType":"uint256","name":"_expiry","type":"uint256"},{"internalType":"bool","name":"_isPut","type":"bool"}],"name":"createOtoken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_underlyingAsset","type":"address"},{"internalType":"address","name":"_strikeAsset","type":"address"},{"internalType":"address","name":"_collateralAsset","type":"address"},{"internalType":"uint256","name":"_strikePrice","type":"uint256"},{"internalType":"uint256","name":"_expiry","type":"uint256"},{"internalType":"bool","name":"_isPut","type":"bool"}],"name":"getOtoken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOtokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_underlyingAsset","type":"address"},{"internalType":"address","name":"_strikeAsset","type":"address"},{"internalType":"address","name":"_collateralAsset","type":"address"},{"internalType":"uint256","name":"_strikePrice","type":"uint256"},{"internalType":"uint256","name":"_expiry","type":"uint256"},{"internalType":"bool","name":"_isPut","type":"bool"}],"name":"getTargetOtokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"otokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516112683803806112688339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055611203806100656000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c8063115470541461006757806346e63dc4146100cd578063b86b9a64146100e7578063c097463014610131578063de0120de1461017b578063f5887cdd14610198575b600080fd5b6100b1600480360360c081101561007d57600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a0013515156101a0565b604080516001600160a01b039092168252519081900360200190f35b6100d56101d5565b60408051918252519081900360200190f35b6100b1600480360360c08110156100fd57600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a0013515156101db565b6100b1600480360360c081101561014757600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a0013515156102db565b6100b16004803603602081101561019157600080fd5b503561081d565b6100b1610844565b6000806101b1888888888888610853565b6000908152600260205260409020546001600160a01b031698975050505050505050565b60015490565b600080546040805163a8de41d560e01b8152905183926001600160a01b03169163a8de41d5916004808301926020929190829003018186803b15801561022057600080fd5b505afa158015610234573d6000803e3d6000fd5b505050506040513d602081101561024a57600080fd5b5051600054604080516001600160a01b0392831660248201528b831660448201528a83166064820152918916608483015260a4820188905260c4820187905285151560e4808401919091528151808403909101815261010490920190526020810180516001600160e01b0316633d8c37cd60e21b1790529091506102ce82826108bb565b9998505050505050505050565b600042831161031b5760405162461bcd60e51b815260040180806020018281038252602a8152602001806110e8602a913960400191505060405180910390fd5b6402c33b9c80831061035e5760405162461bcd60e51b815260040180806020018281038252603b815260200180611166603b913960400191505060405180910390fd5b610383620151806103778561708063ffffffff610a4716565b9063ffffffff610a9016565b156103bf5760405162461bcd60e51b815260040180806020018281038252602d8152602001806111a1602d913960400191505060405180910390fd5b60006103cf888888888888610853565b6000818152600260205260409020549091506001600160a01b0316156104265760405162461bcd60e51b81526004018080602001828103825260258152602001806110c36025913960400191505060405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663d01f63f56040518163ffffffff1660e01b815260040160206040518083038186803b15801561047557600080fd5b505afa158015610489573d6000803e3d6000fd5b505050506040513d602081101561049f57600080fd5b50516040805163401a83cf60e01b81526001600160a01b038c811660048301528b811660248301528a81166044830152871515606483015291519293509083169163401a83cf91608480820192602092909190829003018186803b15801561050657600080fd5b505afa15801561051a573d6000803e3d6000fd5b505050506040513d602081101561053057600080fd5b505161056d5760405162461bcd60e51b81526004018080602001828103825260228152602001806111126022913960400191505060405180910390fd5b83158061057a5750600086115b6105b55760405162461bcd60e51b81526004018080602001828103825260328152602001806111346032913960400191505060405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663a8de41d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561060457600080fd5b505afa158015610618573d6000803e3d6000fd5b505050506040513d602081101561062e57600080fd5b505160008054604080516001600160a01b0392831660248201528e831660448201528d83166064820152918c16608483015260a482018b905260c482018a905288151560e4808401919091528151808403909101815261010490920190526020810180516001600160e01b0316633d8c37cd60e21b1790529192506106b38383610ad2565b60008681526002602052604080822080546001600160a01b038086166001600160a01b031992831681179093556001805480820182559086527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180549092168317909155825163763893db60e11b8152600481019290925291519394509087169263ec7127b69260248084019391929182900301818387803b15801561075957600080fd5b505af115801561076d573d6000803e3d6000fd5b50505050896001600160a01b03168b6001600160a01b03168d6001600160a01b03167fedf283b0b3396dd34e23a917cb887ad557f18a593be3a2e9c069fd59f19a811a84338e8e8e60405180866001600160a01b03166001600160a01b03168152602001856001600160a01b03166001600160a01b03168152602001848152602001838152602001821515151581526020019550505050505060405180910390a49b9a5050505050505050505050565b6001818154811061082a57fe5b6000918252602090912001546001600160a01b0316905081565b6000546001600160a01b031681565b604080516bffffffffffffffffffffffff19606098891b811660208084019190915297891b811660348301529590971b9094166048870152605c860192909252607c850152151560f81b609c8401528051607d818503018152609d9093019052815191012090565b60006060604051806020016108cf90610ec5565b601f1982820381018352601f9091011660408181526001600160a01b038716602083810191825282840192835287516060850152875189948994926080909101919085019080838360005b8381101561093257818101518382015260200161091a565b50505050905090810190601f16801561095f5780820380516001836020036101000a031916815260200191505b5093505050506040516020818303038152906040526040516020018083805190602001908083835b602083106109a65780518252601f199092019160209182019101610987565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106109ee5780518252601f1990920191602091820191016109cf565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050600081805190602001209050610a3e6000801b82610c53565b95945050505050565b6000610a8983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c60565b9392505050565b6000610a8983836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250610cf7565b6000606060405180602001610ae690610ec5565b601f1982820381018352601f9091011660408181526001600160a01b038716602083810191825282840192835287516060850152875189948994926080909101919085019080838360005b83811015610b49578181015183820152602001610b31565b50505050905090810190601f168015610b765780820380516001836020036101000a031916815260200191505b5093505050506040516020818303038152906040526040516020018083805190602001908083835b60208310610bbd5780518252601f199092019160209182019101610b9e565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310610c055780518252601f199092019160209182019101610be6565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050610c4b60008060001b83610d59565b949350505050565b6000610a89838330610e6a565b60008184841115610cef5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610cb4578181015183820152602001610c9c565b50505050905090810190601f168015610ce15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610d465760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610cb4578181015183820152602001610c9c565b50828481610d5057fe5b06949350505050565b60008084471015610db1576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b8251610e04576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116610c4b576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff191660218201526035810194909452605580850193909352805180850390930183526075909301909252805191012090565b6101f080610ed38339019056fe60806040526040516101f03803806101f08339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b506040525050506000826001600160a01b0316826040518082805190602001908083835b602083106101195780518252601f1990920191602091820191016100fa565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610179576040519150601f19603f3d011682016040523d82523d6000602084013e61017e565b606091505b5050905080610191573d6000803e3d6000fd5b6040805169363d3d373d3d3d363d7360b01b6020808301919091526001600160601b0319606087901b16602a8301526e5af43d82803e903d91602b57fd5bf360881b603e8301528251602d81840381018252604d9093019093528201f3fe4f746f6b656e466163746f72793a204f7074696f6e20616c726561647920637265617465644f746f6b656e466163746f72793a2043616e2774206372656174652065787069726564206f7074696f6e4f746f6b656e466163746f72793a20556e737570706f727465642050726f647563744f746f6b656e466163746f72793a2043616e277420637265617465206120243020737472696b6520707574206f7074696f6e4f746f6b656e466163746f72793a2043616e277420637265617465206f7074696f6e207769746820657870697279203e20323334352f31322f33314f746f6b656e466163746f72793a204f7074696f6e2068617320746f206578706972652030383a303020555443a2646970667358221220b9c39acad500b2372013674d08d75bbcfad2f914609747edf1a3a3c8d6483cdc64736f6c634300060a003300000000000000000000000048278272e570b78c330a2e17bcbafecb9d57e2de

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063115470541461006757806346e63dc4146100cd578063b86b9a64146100e7578063c097463014610131578063de0120de1461017b578063f5887cdd14610198575b600080fd5b6100b1600480360360c081101561007d57600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a0013515156101a0565b604080516001600160a01b039092168252519081900360200190f35b6100d56101d5565b60408051918252519081900360200190f35b6100b1600480360360c08110156100fd57600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a0013515156101db565b6100b1600480360360c081101561014757600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a0013515156102db565b6100b16004803603602081101561019157600080fd5b503561081d565b6100b1610844565b6000806101b1888888888888610853565b6000908152600260205260409020546001600160a01b031698975050505050505050565b60015490565b600080546040805163a8de41d560e01b8152905183926001600160a01b03169163a8de41d5916004808301926020929190829003018186803b15801561022057600080fd5b505afa158015610234573d6000803e3d6000fd5b505050506040513d602081101561024a57600080fd5b5051600054604080516001600160a01b0392831660248201528b831660448201528a83166064820152918916608483015260a4820188905260c4820187905285151560e4808401919091528151808403909101815261010490920190526020810180516001600160e01b0316633d8c37cd60e21b1790529091506102ce82826108bb565b9998505050505050505050565b600042831161031b5760405162461bcd60e51b815260040180806020018281038252602a8152602001806110e8602a913960400191505060405180910390fd5b6402c33b9c80831061035e5760405162461bcd60e51b815260040180806020018281038252603b815260200180611166603b913960400191505060405180910390fd5b610383620151806103778561708063ffffffff610a4716565b9063ffffffff610a9016565b156103bf5760405162461bcd60e51b815260040180806020018281038252602d8152602001806111a1602d913960400191505060405180910390fd5b60006103cf888888888888610853565b6000818152600260205260409020549091506001600160a01b0316156104265760405162461bcd60e51b81526004018080602001828103825260258152602001806110c36025913960400191505060405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663d01f63f56040518163ffffffff1660e01b815260040160206040518083038186803b15801561047557600080fd5b505afa158015610489573d6000803e3d6000fd5b505050506040513d602081101561049f57600080fd5b50516040805163401a83cf60e01b81526001600160a01b038c811660048301528b811660248301528a81166044830152871515606483015291519293509083169163401a83cf91608480820192602092909190829003018186803b15801561050657600080fd5b505afa15801561051a573d6000803e3d6000fd5b505050506040513d602081101561053057600080fd5b505161056d5760405162461bcd60e51b81526004018080602001828103825260228152602001806111126022913960400191505060405180910390fd5b83158061057a5750600086115b6105b55760405162461bcd60e51b81526004018080602001828103825260328152602001806111346032913960400191505060405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663a8de41d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561060457600080fd5b505afa158015610618573d6000803e3d6000fd5b505050506040513d602081101561062e57600080fd5b505160008054604080516001600160a01b0392831660248201528e831660448201528d83166064820152918c16608483015260a482018b905260c482018a905288151560e4808401919091528151808403909101815261010490920190526020810180516001600160e01b0316633d8c37cd60e21b1790529192506106b38383610ad2565b60008681526002602052604080822080546001600160a01b038086166001600160a01b031992831681179093556001805480820182559086527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180549092168317909155825163763893db60e11b8152600481019290925291519394509087169263ec7127b69260248084019391929182900301818387803b15801561075957600080fd5b505af115801561076d573d6000803e3d6000fd5b50505050896001600160a01b03168b6001600160a01b03168d6001600160a01b03167fedf283b0b3396dd34e23a917cb887ad557f18a593be3a2e9c069fd59f19a811a84338e8e8e60405180866001600160a01b03166001600160a01b03168152602001856001600160a01b03166001600160a01b03168152602001848152602001838152602001821515151581526020019550505050505060405180910390a49b9a5050505050505050505050565b6001818154811061082a57fe5b6000918252602090912001546001600160a01b0316905081565b6000546001600160a01b031681565b604080516bffffffffffffffffffffffff19606098891b811660208084019190915297891b811660348301529590971b9094166048870152605c860192909252607c850152151560f81b609c8401528051607d818503018152609d9093019052815191012090565b60006060604051806020016108cf90610ec5565b601f1982820381018352601f9091011660408181526001600160a01b038716602083810191825282840192835287516060850152875189948994926080909101919085019080838360005b8381101561093257818101518382015260200161091a565b50505050905090810190601f16801561095f5780820380516001836020036101000a031916815260200191505b5093505050506040516020818303038152906040526040516020018083805190602001908083835b602083106109a65780518252601f199092019160209182019101610987565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106109ee5780518252601f1990920191602091820191016109cf565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050600081805190602001209050610a3e6000801b82610c53565b95945050505050565b6000610a8983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c60565b9392505050565b6000610a8983836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250610cf7565b6000606060405180602001610ae690610ec5565b601f1982820381018352601f9091011660408181526001600160a01b038716602083810191825282840192835287516060850152875189948994926080909101919085019080838360005b83811015610b49578181015183820152602001610b31565b50505050905090810190601f168015610b765780820380516001836020036101000a031916815260200191505b5093505050506040516020818303038152906040526040516020018083805190602001908083835b60208310610bbd5780518252601f199092019160209182019101610b9e565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310610c055780518252601f199092019160209182019101610be6565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529050610c4b60008060001b83610d59565b949350505050565b6000610a89838330610e6a565b60008184841115610cef5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610cb4578181015183820152602001610c9c565b50505050905090810190601f168015610ce15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610d465760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610cb4578181015183820152602001610c9c565b50828481610d5057fe5b06949350505050565b60008084471015610db1576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b8251610e04576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116610c4b576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff191660218201526035810194909452605580850193909352805180850390930183526075909301909252805191012090565b6101f080610ed38339019056fe60806040526040516101f03803806101f08339818101604052604081101561002657600080fd5b81516020830180516040519294929383019291908464010000000082111561004d57600080fd5b90830190602082018581111561006257600080fd5b825164010000000081118282018810171561007c57600080fd5b82525081516020918201929091019080838360005b838110156100a9578181015183820152602001610091565b50505050905090810190601f1680156100d65780820380516001836020036101000a031916815260200191505b506040525050506000826001600160a01b0316826040518082805190602001908083835b602083106101195780518252601f1990920191602091820191016100fa565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610179576040519150601f19603f3d011682016040523d82523d6000602084013e61017e565b606091505b5050905080610191573d6000803e3d6000fd5b6040805169363d3d373d3d3d363d7360b01b6020808301919091526001600160601b0319606087901b16602a8301526e5af43d82803e903d91602b57fd5bf360881b603e8301528251602d81840381018252604d9093019093528201f3fe4f746f6b656e466163746f72793a204f7074696f6e20616c726561647920637265617465644f746f6b656e466163746f72793a2043616e2774206372656174652065787069726564206f7074696f6e4f746f6b656e466163746f72793a20556e737570706f727465642050726f647563744f746f6b656e466163746f72793a2043616e277420637265617465206120243020737472696b6520707574206f7074696f6e4f746f6b656e466163746f72793a2043616e277420637265617465206f7074696f6e207769746820657870697279203e20323334352f31322f33314f746f6b656e466163746f72793a204f7074696f6e2068617320746f206578706972652030383a303020555443a2646970667358221220b9c39acad500b2372013674d08d75bbcfad2f914609747edf1a3a3c8d6483cdc64736f6c634300060a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000048278272e570b78c330a2e17bcbafecb9d57e2de

-----Decoded View---------------
Arg [0] : _addressBook (address): 0x48278272E570B78c330A2e17BCbAFecB9d57e2de

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000048278272e570b78c330a2e17bcbafecb9d57e2de


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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