Contract 0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c

Contract Overview

Balance:
0 MATIC
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0xaeef062316382eb3893545aca8680693f62d35e8f3707f31d8bb39d1c428821bCreate For283367192022-09-28 8:18:59359 days 20 hrs ago0xe5f4ce72bde494669332286dca5cc50b2a907cc2 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0306114 40
0x244bf339eaa4372c9b83645178fb5236fab6fbfe5d0bd0863e96b1951c485341Create For283367142022-09-28 8:18:34359 days 20 hrs ago0xe5f4ce72bde494669332286dca5cc50b2a907cc2 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0299274 40
0xf178c5b42d2fa94b6ee5acb08f4e70b4ee95ccffdf709fecfcc77edd2dbbe44eCreate For283332042022-09-28 3:25:07360 days 1 hr ago0x6bf0d446a60b83ea424331406673c91b26efb7b0 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0299278 40
0xe575ad0d36d7bf347156fac9c880ce39e5f2be76d1984b3e5e58a09492fafd75Create For283331992022-09-28 3:24:42360 days 1 hr ago0x6bf0d446a60b83ea424331406673c91b26efb7b0 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0298158 40
0x61dd4627ea7abd46bbd0b30ecbe8cde6b300055d0986db05a87fc7207b611151Create For283318612022-09-28 1:32:51360 days 3 hrs ago0x4a75ada691a1e205d44bd75e37a82eb95493b6dc IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981492 40
0xe52a359ef7b934330003a7195964fbfa0bbfb69772916fbd81e8ffe4e94e346cCreate For283273982022-09-27 19:19:46360 days 9 hrs ago0xc2bcc2967b08c1c3cc1f9030b596df36db1794c6 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0304998 40
0xd4f202b826ee95b388873b7a9ea6923ceec6b00ca5a3a01d7bac08cfd7d032a5Create For283235782022-09-27 14:00:26360 days 14 hrs ago0xec48ec785b6bb8f298fe4f4a7868ac4f679e4c39 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02992788 40
0xd67879036535850664dae83f841313cfa500cc572734e79c40c8fed6baeaaa60Create For283205282022-09-27 9:45:29360 days 19 hrs ago0x5fbdc9fc797bc23d716c758821049e9110314428 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.030611440
0x6a1b4c62615bc24c55d7d21e82ee4b906b204d3415419fbe6ea5c59ac304d36dCreate For283205202022-09-27 9:44:49360 days 19 hrs ago0x5fbdc9fc797bc23d716c758821049e9110314428 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.030499440
0xd4c3a6e49e527be11802ebe6752c9b89028cd3a020cbaf3d304f40896f08d9aeCreate For283203602022-09-27 9:31:26360 days 19 hrs ago0x66e1840a664a0392387492968833e53b8915759c IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0298158 40
0x574294d1de4f33bde842b804640da250865c78ef47afb4efe91504ed277ad5c1Create For283203502022-09-27 9:30:36360 days 19 hrs ago0x66e1840a664a0392387492968833e53b8915759c IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0299274 40
0xfa367bf1ea3210c15a5bbfc5d52a507e12d96a37df0976f62b26908a0f1c2893Create For283203412022-09-27 9:29:51360 days 19 hrs ago0x66e1840a664a0392387492968833e53b8915759c IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0298154 40
0x524e4c6ca367c488d947529c59dc96f8dfe9c6a27658f33db1bcabc1f19c9dcdCreate For283203302022-09-27 9:28:56360 days 19 hrs ago0x66e1840a664a0392387492968833e53b8915759c IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0298158 40
0x9deeef2df8ea5dc0151b16371d1db848ad171bdb970fb46b609408ded414582eCreate For283203192022-09-27 9:28:00360 days 19 hrs ago0x66e1840a664a0392387492968833e53b8915759c IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0299274 40
0x2021215959ba9e8ccc55b5eb0582462e3adb482d6cb9e9036f458ac2405d891bCreate For283143462022-09-27 1:08:17361 days 3 hrs ago0x4a75ada691a1e205d44bd75e37a82eb95493b6dc IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981492 40
0xb231c5d55c81673a96f39b3d5aa910045580e87be54bef30de3ce0b9a3894385Create For283142692022-09-27 1:01:51361 days 3 hrs ago0x4a75ada691a1e205d44bd75e37a82eb95493b6dc IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.0306114 40
0xccda70dd6ec194c123f8bf04db233cff017f6f317de35227e52907959175ea6fCreate For283110042022-09-26 20:28:55361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981532 40
0x7ec643f4fe72165ec214f65a3fee04ebfe62589cee7d061e374bc80e057797c7Create For283109992022-09-26 20:28:30361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981492 40
0x5be3e36824b024efb77ab7882e2a2a98ae369abc4035000b06a94212d3fd1cceCreate For283109952022-09-26 20:28:10361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981484 40
0x19f90bc050d9636836ef561846f9fe4b52a15210578b0011b23edec374f384e3Create For283109912022-09-26 20:27:50361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981444 40
0xbe605d88a4741a6e9bc0d5283e1af196d5af9a0a9661c1209f400b13457aa93fCreate For283109862022-09-26 20:27:25361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981484 40
0x4e0da160ffd1b7652a56ab772b2d3a533c9bdb9d778a3ac25be6ab1b8c88cb11Create For283109812022-09-26 20:27:00361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981444 40
0xa81a56643ba960e02068c83a90b28ff72a9c2dbb4ecf6d286f04da123f4db179Create For283109742022-09-26 20:26:24361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981484 40
0x8accaaf1c29bb3f955e2c2201deaa9bfb520ee219c86c0734a17dc36dc4d868bCreate For283109702022-09-26 20:26:04361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981444 40
0x84e00a45b813a3de3cf9d3a25e1dcfe438f214083a33849bfb8611ef4a845023Create For283109622022-09-26 20:25:24361 days 8 hrs ago0x12a35ed6c8f3b8950cc98500a4e0b17a99e426d1 IN  0x8b7c9c4bd40fdb996fe02e7373cb24c623187d2c0 MATIC0.02981484 40
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Router

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at PolygonScan.com on 2022-08-27
*/

// File: Context.sol

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: IERC20.sol

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

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

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

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

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

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

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

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

// File: InterfacesBinary.sol

interface IBufferBinaryOptions {
    event Create(
        uint256 indexed id,
        address indexed account,
        uint256 settlementFee,
        uint256 totalFee
    );

    event Exercise(uint256 indexed id, uint256 profit);
    event Expire(uint256 indexed id, uint256 premium);
    event PayReferralFee(address indexed referrer, uint256 amount);
    event PayAdminFee(address indexed owner, uint256 amount);

    function createFromRouter(
        address user,
        uint256 totalFee,
        uint256 period,
        bool isYes,
        bool isAbove,
        address referrer,
        uint256 strike,
        uint256 amount
    ) external returns (uint256 optionID);

    function checkParams(
        address user,
        uint256 totalFee,
        uint256 period,
        bool isYes,
        bool isAbove,
        address referrer
    ) external returns (uint256 strike, uint256 amount);

    enum State {
        Inactive,
        Active,
        Exercised,
        Expired
    }
    enum OptionType {
        Invalid,
        Put,
        Call
    }
    enum PaymentMethod {
        Usdc,
        TokenX
    }

    struct OptionDetails {
        uint256 period;
        uint256 amount;
        uint256 strike;
        bool isYes;
        bool isAbove;
    }

    struct Option {
        State state;
        uint256 strike;
        uint256 amount;
        uint256 lockedAmount;
        uint256 premium;
        uint256 expiration;
        OptionType optionType;
        uint256 totalFee;
        uint256 createdAt;
    }

    struct BinaryOptionType {
        bool isYes;
        bool isAbove;
    }

    struct SlotDetail {
        uint256 strike;
        uint256 expiration;
        OptionType optionType;
        bool isValid;
    }
}

interface IBufferOptions {
    event UpdateOptionCreationWindow(
        uint256 startHour,
        uint256 startMinute,
        uint256 endHour,
        uint256 endMinute
    );
    event TransferUnits(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId,
        uint256 targetTokenId,
        uint256 transferUnits
    );

    event Split(
        address indexed owner,
        uint256 indexed tokenId,
        uint256 newTokenId,
        uint256 splitUnits
    );

    event Merge(
        address indexed owner,
        uint256 indexed tokenId,
        uint256 indexed targetTokenId,
        uint256 mergeUnits
    );

    event ApprovalUnits(
        address indexed approval,
        uint256 indexed tokenId,
        uint256 allowance
    );

    struct ApproveUnits {
        address[] approvals;
        mapping(address => uint256) allowances;
    }
}

interface ILiquidityPool {
    struct LockedLiquidity {
        uint256 amount;
        uint256 premium;
        bool locked;
    }

    event Profit(uint256 indexed id, uint256 amount);
    event Loss(uint256 indexed id, uint256 amount);
    event Provide(address indexed account, uint256 amount, uint256 writeAmount);
    event Withdraw(
        address indexed account,
        uint256 amount,
        uint256 writeAmount
    );

    function unlock(uint256 id) external;

    // function unlockPremium(uint256 amount) external;
    event UpdateRevertTransfersInLockUpPeriod(
        address indexed account,
        bool value
    );
    event InitiateWithdraw(uint256 tokenXAmount, address account);
    event ProcessWithdrawRequest(uint256 tokenXAmount, address account);
    event UpdatePoolState(bool hasPoolEnded);
    event PoolRollOver(uint256 round);
    event UpdateMaxLiquidity(uint256 indexed maxLiquidity);
    event UpdateExpiry(uint256 expiry);
    event UpdateProjectOwner(address account);

    function totalTokenXBalance() external view returns (uint256 amount);

    function unlockWithoutProfit(uint256 id) external;

    function send(
        uint256 id,
        address account,
        uint256 amount
    ) external;

    function lock(
        uint256 id,
        uint256 tokenXAmount,
        uint256 premium
    ) external;

    function changeLock(
        uint256 id,
        uint256 tokenXAmount,
        uint256 premium
    ) external;
}

interface IOptionsConfig {
    enum PermittedTradingType {
        All,
        OnlyPut,
        OnlyCall,
        None
    }
    event UpdateImpliedVolatility(uint256 value);
    event UpdateSettlementFeePercentage(uint256 value);
    event UpdateSettlementFeeRecipient(address account);
    event UpdateStakingFeePercentage(uint256 value);
    event UpdateReferralRewardPercentage(uint256 value);
    event UpdateOptionCollaterizationRatio(uint256 value);
    event UpdateNFTSaleRoyaltyPercentage(uint256 value);
    event UpdateTradingPermission(PermittedTradingType permissionType);
    event UpdateStrike(uint256 value);
    event UpdateUnits(uint256 value);
    event UpdateMaxPeriod(uint256 value);
    event UpdateOptionSizePerBlockLimitPercent(uint256 value);

    enum OptionType {
        Invalid,
        Put,
        Call
    }
}

interface IPriceProvider {
    function getUsdPrice() external view returns (uint256 _price);

    function getRoundData(uint256 _roundId)
        external
        view
        returns (
            uint80 roundId,
            uint256 price,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );

    function latestRoundData()
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );

    function decimals() external view returns (uint8);
}

// File: ReentrancyGuard.sol

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

// File: IERC20Metadata.sol

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// File: ERC20.sol

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

// File: Router.sol

/**
 * @author Heisenberg
 * @title Buffer TokenX Bidirectional (Call and Put) Options
 * @notice Buffer TokenX Options Contract
 */
contract Router is ReentrancyGuard {
    ERC20 public tokenX;
    IBufferBinaryOptions public optionsContract;

    constructor(ERC20 _tokenX) {
        tokenX = _tokenX;
    }

    /**
     * @notice Creates a new option
     * @return optionID Created option's ID
     */
    function createFor(
        uint256 totalFee,
        uint256 period,
        bool isYes,
        bool isAbove,
        address referrer,
        address contractAddress
    ) external nonReentrant returns (uint256 optionID) {
        optionsContract = IBufferBinaryOptions(contractAddress);
        (uint256 strike, uint256 amount) = optionsContract.checkParams(
            msg.sender,
            totalFee,
            period,
            isYes,
            isAbove,
            referrer
        );

        // User has to approve first inorder to execute this function
        tokenX.transferFrom(msg.sender, contractAddress, totalFee);

        optionsContract.createFromRouter(
            msg.sender,
            totalFee,
            period,
            isYes,
            isAbove,
            referrer,
            strike,
            amount
        );
    }
}

Contract ABI

[{"inputs":[{"internalType":"contract ERC20","name":"_tokenX","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"totalFee","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"bool","name":"isYes","type":"bool"},{"internalType":"bool","name":"isAbove","type":"bool"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"address","name":"contractAddress","type":"address"}],"name":"createFor","outputs":[{"internalType":"uint256","name":"optionID","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"optionsContract","outputs":[{"internalType":"contract IBufferBinaryOptions","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenX","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516104d73803806104d783398101604081905261002f91610059565b6001600081905580546001600160a01b0319166001600160a01b0392909216919091179055610087565b60006020828403121561006a578081fd5b81516001600160a01b0381168114610080578182fd5b9392505050565b610441806100966000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630328c3931461004657806316dc165b146100765780636ee7785514610089575b600080fd5b600254610059906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b600154610059906001600160a01b031681565b61009c610097366004610391565b6100aa565b60405190815260200161006d565b6000600260005414156101035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640160405180910390fd5b6002600081815581546001600160a01b0319166001600160a01b03858116918217909355604051631d85709d60e31b8152336004820152602481018b9052604481018a90528815156064820152871515608482015292861660a4840152909182919063ec2b84e89060c4016040805180830381600087803b15801561018757600080fd5b505af115801561019b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101bf919061036e565b6001546040516323b872dd60e01b81523360048201526001600160a01b038881166024830152604482018e905293955091935091909116906323b872dd90606401602060405180830381600087803b15801561021a57600080fd5b505af115801561022e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102529190610333565b5060025460405163040be85960e31b8152336004820152602481018b9052604481018a9052881515606482015287151560848201526001600160a01b0387811660a483015260c4820185905260e482018490529091169063205f42c89061010401602060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103059190610356565b50506001600055509695505050505050565b80356001600160a01b038116811461032e57600080fd5b919050565b600060208284031215610344578081fd5b815161034f816103fa565b9392505050565b600060208284031215610367578081fd5b5051919050565b60008060408385031215610380578081fd5b505080516020909101519092909150565b60008060008060008060c087890312156103a9578182fd5b863595506020870135945060408701356103c2816103fa565b935060608701356103d2816103fa565b92506103e060808801610317565b91506103ee60a08801610317565b90509295509295509295565b801515811461040857600080fd5b5056fea2646970667358221220035d5fd0bd0236c47e9df859e0ae6c55109fff3b7e57a22393a4601812c7805b64736f6c634300080400330000000000000000000000003b6ab99c03cea60012054e49351d37e63d33fc00

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

0000000000000000000000003b6ab99c03cea60012054e49351d37e63d33fc00

-----Decoded View---------------
Arg [0] : _tokenX (address): 0x3b6ab99c03cea60012054e49351d37e63d33fc00

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000003b6ab99c03cea60012054e49351d37e63d33fc00


Deployed ByteCode Sourcemap

24766:1191:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;24834:43;;;;;-1:-1:-1;;;;;24834:43:0;;;;;;-1:-1:-1;;;;;3523:32:1;;;3505:51;;3493:2;3478:18;24834:43:0;;;;;;;;24808:19;;;;;-1:-1:-1;;;;;24808:19:0;;;25056:898;;;;;;:::i;:::-;;:::i;:::-;;;4309:25:1;;;4297:2;4282:18;25056:898:0;4264:76:1;25056:898:0;25270:16;11122:1;11718:7;;:19;;11710:63;;;;-1:-1:-1;;;11710:63:0;;4005:2:1;11710:63:0;;;3987:21:1;4044:2;4024:18;;;4017:30;4083:33;4063:18;;;4056:61;4134:18;;11710:63:0;;;;;;;;11122:1;11851:7;:18;;;25299:55;;-1:-1:-1;;;;;;25299:55:0::1;-1:-1:-1::0;;;;;25299:55:0;;::::1;::::0;;::::1;::::0;;;25400:172:::1;::::0;-1:-1:-1;;;25400:172:0;;25442:10:::1;25400:172;::::0;::::1;2282:34:1::0;2332:18;;;2325:34;;;2375:18;;;2368:34;;;2445:14;;2438:22;2418:18;;;2411:50;2505:14;;2498:22;2477:19;;;2470:51;2558:15;;;2537:19;;;2530:44;11851:7:0;;;;25299:55;25400:27:::1;::::0;2216:19:1;;25400:172:0::1;::::0;::::1;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;25656:6;::::0;:58:::1;::::0;-1:-1:-1;;;25656:58:0;;25676:10:::1;25656:58;::::0;::::1;1829:34:1::0;-1:-1:-1;;;;;1899:15:1;;;1879:18;;;1872:43;1931:18;;;1924:34;;;25365:207:0;;-1:-1:-1;25365:207:0;;-1:-1:-1;25656:6:0;;;::::1;::::0;:19:::1;::::0;1764:18:1;;25656:58:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;25727:15:0::1;::::0;:219:::1;::::0;-1:-1:-1;;;25727:219:0;;25774:10:::1;25727:219;::::0;::::1;2954:34:1::0;3004:18;;;2997:34;;;3047:18;;;3040:34;;;3117:14;;3110:22;3090:18;;;3083:50;3177:14;;3170:22;3149:19;;;3142:51;-1:-1:-1;;;;;3230:15:1;;;3209:19;;;3202:44;3262:19;;;3255:35;;;3306:19;;;3299:35;;;25727:15:0;;::::1;::::0;:32:::1;::::0;2888:19:1;;25727:219:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;11078:1:0;12030:7;:22;-1:-1:-1;25056:898:0;;-1:-1:-1;;;;;;25056:898:0:o;14:173:1:-;82:20;;-1:-1:-1;;;;;131:31:1;;121:42;;111:2;;177:1;174;167:12;111:2;63:124;;;:::o;192:255::-;259:6;312:2;300:9;291:7;287:23;283:32;280:2;;;333:6;325;318:22;280:2;370:9;364:16;389:28;411:5;389:28;:::i;:::-;436:5;270:177;-1:-1:-1;;;270:177:1:o;452:194::-;522:6;575:2;563:9;554:7;550:23;546:32;543:2;;;596:6;588;581:22;543:2;-1:-1:-1;624:16:1;;533:113;-1:-1:-1;533:113:1:o;651:255::-;730:6;738;791:2;779:9;770:7;766:23;762:32;759:2;;;812:6;804;797:22;759:2;-1:-1:-1;;840:16:1;;896:2;881:18;;;875:25;840:16;;875:25;;-1:-1:-1;749:157:1:o;911:673::-;1009:6;1017;1025;1033;1041;1049;1102:3;1090:9;1081:7;1077:23;1073:33;1070:2;;;1124:6;1116;1109:22;1070:2;1165:9;1152:23;1142:33;;1222:2;1211:9;1207:18;1194:32;1184:42;;1276:2;1265:9;1261:18;1248:32;1289:28;1311:5;1289:28;:::i;:::-;1336:5;-1:-1:-1;1393:2:1;1378:18;;1365:32;1406:30;1365:32;1406:30;:::i;:::-;1455:7;-1:-1:-1;1481:39:1;1515:3;1500:19;;1481:39;:::i;:::-;1471:49;;1539:39;1573:3;1562:9;1558:19;1539:39;:::i;:::-;1529:49;;1060:524;;;;;;;;:::o;4345:118::-;4431:5;4424:13;4417:21;4410:5;4407:32;4397:2;;4453:1;4450;4443:12;4397:2;4387:76;:::o

Swarm Source

ipfs://035d5fd0bd0236c47e9df859e0ae6c55109fff3b7e57a22393a4601812c7805b
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading