Contract 0xef27da039f846e9663efda422470096fa6d55c4a

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xd9d95ce170be00d6386835cc95be3a9739026f45e31a00a478157080cea8307fClaim326592512022-03-05 21:37:57202 days 22 hrs ago0x732b613b80e4a5bd7103584fdeb454e5d4b14e44 IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.033380125316
0x8d5a4f52f74e6ae5543ea06645901a2c16c084f9fb8a30b2cfe07c074b74c953Pause315131132022-02-20 11:50:42216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.00652783842
0x1d8a620743cc6e9a61fa9aa3e7b9d76d4aec5de08b6e587f8cc66bcc4e4bbddaUnpause315130522022-02-20 11:49:40216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.017915593254
0x16929b3e6ff75e5ec4229922d3d5841539288847d579f7987acb8018d9dcd5b5Unpause315129052022-02-20 11:47:30216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.018680338648
0x71baa2c549b343e563155f90e9b8558f9a3d5867a60483d6fc39f5e8fd803218Unpause315127522022-02-20 11:45:21216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.018034458283
0xf3ed3850e51928e1a44dbfdcd6ec7e7118ad4574d3a26d314ff9e80c5ac33a34Unpause315125892022-02-20 11:43:12216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.018303985527
0xefc2d8ff1290b1789d01b439cbd1fb6b88ea28a2d907b2d7aaa2ae42b9771258Unpause315124282022-02-20 11:41:02216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021204096373
0x682fec005ee315a85561f7cd6bacdffc651665ee6d5c00f132c03515e7dfc244Unpause315122782022-02-20 11:38:54216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.020422098701
0xf1545a1b52b2118dc59d925501eaef3b620e1a8b1aa12b0e9ee974976136e518Unpause315121722022-02-20 11:36:48216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.01981628164
0xf84f67502248e0196a8e3e7a83bf627aa35116a64a14d2695d4b0702d3cd7d4cUnpause315120182022-02-20 11:34:35216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.018900672418
0xc731916165855bd31477b92dd0c54359b086c23b21a5e8ef59f3f6291a580041Unpause315118602022-02-20 11:32:27216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.020839494387
0xc5071c5e0c8774cc74adee8fa79453cb870c97bb2f8c8c6b7badb1cd19362ca5Unpause315116942022-02-20 11:30:17216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021252195379
0x4006e4267cd9b25aadd3bd3f5d6b0d441f0d631c398f1f369f748fdb66f3a35eUnpause315115512022-02-20 11:28:08216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.020918209706
0xaca3eb07aa011877df31ee16daf5207b61528bcb2b7a306aedc33e3809654c23Unpause315113852022-02-20 11:25:59216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021273825531
0xd64c3dec29e14342c0b603668fb02c28fdfa1d6dec41aed19e7fd30dbf7eb98aUnpause315112252022-02-20 11:23:53216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021721146286
0xb41acd0368e26ce67ee46427e373035d49d5b09cf20177afeac4a18def7d2961Unpause315110592022-02-20 11:21:41216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021833674919
0x0b2c7ca88454d159c74b7dd0a2dfbecb4080a7802b267fbf48e024b0c049c981Unpause315109232022-02-20 11:19:31216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.023159709791
0x85616c9700ae6b1cb2e4e077871dbde4efe2dad959fccfcf1c01bfb47d815304Unpause315107832022-02-20 11:17:24216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.022056946473
0x5b0a8c7230fb5426809f8e9d845e4249daee4ac9aef19dcc117b6f9196a8c422Unpause315106202022-02-20 11:15:13216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.024159650683
0x2990d638fad76832f075d8a30511296e7054859ef07a688f5742a1f7b5216786Unpause315104572022-02-20 11:13:04216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.024728457432
0xfada327245b94946e1b1c7b6872aec0a2124ccafefc0845bc857997fe0c0bd1cUnpause315103822022-02-20 11:11:52216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021599631492
0xdde029d6164658adaff905c1e68b99af47d483e2d7aa239c51f721aef22ff42fUnpause315102002022-02-20 11:08:46216 days 8 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.021733329448
0x0c602f6711868443b5e997dcd051336ecf86f924959b74bc2a3cfb1c4003ebc5Unpause315100522022-02-20 11:06:37216 days 9 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.024280071009
0xa19af30b9698ea3b2d6b313548a1cba3f06e7fd9dcd61608387dff814a868800Unpause315099092022-02-20 11:04:36216 days 9 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.024111983704
0x360a0a3a2983f05cd89a45c8e0e391a630a468b3f57b055661177fb0f09354a4Unpause315097922022-02-20 11:02:27216 days 9 hrs ago0x0232349bc20422b3e49c4fea56456551c6f4521a IN  0xef27da039f846e9663efda422470096fa6d55c4a0 FTM0.023593263286
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xd9d95ce170be00d6386835cc95be3a9739026f45e31a00a478157080cea8307f326592512022-03-05 21:37:57202 days 22 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x732b613b80e4a5bd7103584fdeb454e5d4b14e441.86 FTM
0x7fcf4632c69997388b2cc254d07f98af95cfa4567e7fe121e8143214367ba91c313341872022-02-18 14:32:55218 days 5 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb6.045 FTM
0x5d7e6e51d6ce70ecffdd378452b8b433ed8ea176a5123ff6bd2fcad0725613b6312879162022-02-18 2:57:05218 days 17 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0xb6418a83c4a232d3cff232733f591d3fe90434620.93 FTM
0xaf72957b603c993f35f8693329d631f9bfb4a0206748a41def8fbfd65b468fc2312746432022-02-17 23:35:38218 days 20 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x9aff981d8b7102eece893c92bd7a63633c614ccb1.86 FTM
0x4fcd6861ab5528a6b3db3384a53db977995282ade0c6ddd76c39ff9c4fde89a8312728142022-02-17 23:10:50218 days 20 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x9aff981d8b7102eece893c92bd7a63633c614ccb4.65 FTM
0x4d27e2efc2a243ebcce36cf8313dc5105a79487cf3642522a65a56af1c99152f312206312022-02-17 9:56:23219 days 10 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x092b497b9cae4eb7022c3b2cdb70590af4e2b20e6.51 FTM
0x3373a9e9f72ed9f5be47a66963dbf1dc1aabc1b739de2819d0e48fc6e3f96049312185582022-02-17 9:27:34219 days 10 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0xb5f147f38c2de90830766a2b6969d21f57e38b591.55 FTM
0xd76253ee8c3612f32cbd2f0dbd96261f6df167b8b2cbc1fac6bae91c73a5a0c1312176362022-02-17 9:13:25219 days 10 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x289d4eec4c7a0e32b24d182c75d6f57f394f32b80.93 FTM
0xd4d56851b721161148bc0036fb4a10b21761cee18afd86101db9038795a875b9312174112022-02-17 9:10:31219 days 10 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x3076cd642c9361392ecee113d6796ed0f3a5d8cf1.86 FTM
0xfca60fe536b511cb13f2dc60441e45a7a0e8ad9c1f92d12379a70dfd26b4a26c312170252022-02-17 9:04:46219 days 11 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x289d4eec4c7a0e32b24d182c75d6f57f394f32b82.325 FTM
0x3c7c78a6a9c6105c06f2d677d71437c152a14dab04e0f2d2799af9c9689826bd312167722022-02-17 9:01:17219 days 11 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x289d4eec4c7a0e32b24d182c75d6f57f394f32b83.1 FTM
0x85c7c215e1d60b43106dc1721a3d569bbfefd5ed1e98b2aba91ac80abe33573c311859392022-02-17 1:08:17219 days 19 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb1.86 FTM
0x508a96b87b7df0d1a062b13f1b6add45cd4bc14e9b601e9530b438e95ecd4313311832152022-02-17 0:26:25219 days 19 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb1 FTM
0x574d7089cfd895653f8d3d5496235a03b64007e0e79ac27598d01a1b58588654311813942022-02-17 0:00:54219 days 20 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb1 FTM
0xc6574d15cec230f65065f136012d66aa4dc4a8edc730e3e50f53e522b726a697311359752022-02-16 12:19:56220 days 7 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb2.79 FTM
0xeca047d98be91bd141290b922cbf57f7efade9f7b86faabb184679cf87683137311358102022-02-16 12:15:18220 days 7 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x289d4eec4c7a0e32b24d182c75d6f57f394f32b83.72 FTM
0xae09628495081489def8326f51e338f329d9869e67421222ea3caf1681e6932a311352612022-02-16 12:07:32220 days 8 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0xb5f147f38c2de90830766a2b6969d21f57e38b590.93 FTM
0xe111d78b7f71079d4858982e9c33680e94e9f73b4841c546d77a07216de1f811310988892022-02-16 3:04:48220 days 17 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0xd6fb5bde7b32f6cd78a2d055d67bf899c584cb8e3.758321588539211788 FTM
0x99e77a748b6e81d2af7bc628d5af853d5afea81fae98dc14abbde2df99769238310703362022-02-15 20:04:46221 days 3 mins ago 0xef27da039f846e9663efda422470096fa6d55c4a0x569df433b7b87be64f0011043d3b49efbd7d28e89.3 FTM
0x378094049c16fa2ce57bb088353288740f857543391cfc8eddfece50d58dee66310696622022-02-15 19:53:54221 days 14 mins ago 0xef27da039f846e9663efda422470096fa6d55c4a0x569df433b7b87be64f0011043d3b49efbd7d28e84.65 FTM
0xe4df7dbd51670ca4e9f0e99743fb2dc892a3b1b2987f24ae7764f802fb37c32e309561162022-02-14 15:53:26222 days 4 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0xd6fb5bde7b32f6cd78a2d055d67bf899c584cb8e2.001867978883007526 FTM
0x2e36ea83932656860ddcacc89a0190b5d5eb70a4a2b91485fadc4e802675ae47309328472022-02-14 10:08:53222 days 9 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb0.93 FTM
0x36f638670347812339aa23f5aea3e3bb8ba257694f4a66ff985de93366dfc1ea308508002022-02-13 14:10:12223 days 5 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x9bb17d05ba03a2807733ad9479efdfaa141bdd850.93 FTM
0x01e0d5d45e68803ba6f03a8b0eec943aaec20c60f3a82e91c20925d1d295b009307872832022-02-12 23:13:25223 days 20 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x32c773c2dafde17ee81109fefdfd1bf84d8907bb1.86 FTM
0x784541911c989d3f5bba1ead1e92946f67d15934ee394081388ded3758ec93c9307350722022-02-12 10:42:03224 days 9 hrs ago 0xef27da039f846e9663efda422470096fa6d55c4a0x0232349bc20422b3e49c4fea56456551c6f4521a31.186985722940659995 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DegenHausPrediction

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 10 : DegenHausPrediction.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/Pausable.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./libs/AggregatorV3Interface.sol";

/**
 * @title DegenHausPrediction
 */
contract DegenHausPrediction is Ownable, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    AggregatorV3Interface public oracle;

    bool public genesisLockOnce = false;
    bool public genesisStartOnce = false;

    address public adminAddress; // address of the admin
    address public operatorAddress; // address of the operator

    uint256 public bufferSeconds; // number of seconds for valid execution of a prediction round
    uint256 public intervalSeconds; // interval in seconds between two prediction rounds

    uint256 public minBetAmount; // minimum betting amount (denominated in wei)
    uint256 public treasuryFee; // treasury rate (e.g. 200 = 2%, 150 = 1.50%)
    uint256 public treasuryAmount; // treasury amount that was not claimed

    uint256 public currentEpoch; // current epoch for prediction round

    uint256 public oracleLatestRoundId; // converted from uint80 (Chainlink)
    uint256 public oracleUpdateAllowance; // seconds

    uint256 public constant MAX_TREASURY_FEE = 1000; // 10%

    mapping(uint256 => mapping(address => BetInfo)) public ledger;
    mapping(uint256 => Round) public rounds;
    mapping(address => uint256[]) public userRounds;

    enum Position {
        Bull,
        Bear
    }

    struct Round {
        uint256 epoch;
        uint256 startTimestamp;
        uint256 lockTimestamp;
        uint256 closeTimestamp;
        int256 lockPrice;
        int256 closePrice;
        uint256 lockOracleId;
        uint256 closeOracleId;
        uint256 totalAmount;
        uint256 bullAmount;
        uint256 bearAmount;
        uint256 rewardBaseCalAmount;
        uint256 rewardAmount;
        bool oracleCalled;
    }

    struct BetInfo {
        Position position;
        uint256 amount;
        bool claimed; // default false
    }

    event BetBear(address indexed sender, uint256 indexed epoch, uint256 amount);
    event BetBull(address indexed sender, uint256 indexed epoch, uint256 amount);
    event Claim(address indexed sender, uint256 indexed epoch, uint256 amount);
    event EndRound(uint256 indexed epoch, uint256 indexed roundId, int256 price);
    event LockRound(uint256 indexed epoch, uint256 indexed roundId, int256 price);

    event NewAdminAddress(address admin);
    event NewBufferAndIntervalSeconds(uint256 bufferSeconds, uint256 intervalSeconds);
    event NewMinBetAmount(uint256 indexed epoch, uint256 minBetAmount);
    event NewTreasuryFee(uint256 indexed epoch, uint256 treasuryFee);
    event NewOperatorAddress(address operator);
    event NewOracle(address oracle);
    event NewOracleUpdateAllowance(uint256 oracleUpdateAllowance);

    event Pause(uint256 indexed epoch);
    event RewardsCalculated(
        uint256 indexed epoch,
        uint256 rewardBaseCalAmount,
        uint256 rewardAmount,
        uint256 treasuryAmount
    );

    event StartRound(uint256 indexed epoch);
    event TokenRecovery(address indexed token, uint256 amount);
    event TreasuryClaim(uint256 amount);
    event Unpause(uint256 indexed epoch);

    modifier onlyAdmin() {
        require(msg.sender == adminAddress, "Not admin");
        _;
    }

    modifier onlyAdminOrOperator() {
        require(msg.sender == adminAddress || msg.sender == operatorAddress, "Not operator/admin");
        _;
    }

    modifier onlyOperator() {
        require(msg.sender == operatorAddress, "Not operator");
        _;
    }

    modifier notContract() {
        require(!_isContract(msg.sender), "Contract not allowed");
        require(msg.sender == tx.origin, "Proxy contract not allowed");
        _;
    }

    /**
     * @notice Constructor
     * @param _oracleAddress: oracle address
     * @param _adminAddress: admin address
     * @param _operatorAddress: operator address
     * @param _intervalSeconds: number of time within an interval
     * @param _bufferSeconds: buffer of time for resolution of price
     * @param _minBetAmount: minimum bet amounts (in wei)
     * @param _oracleUpdateAllowance: oracle update allowance
     * @param _treasuryFee: treasury fee (1000 = 10%)
     */
    constructor(
        address _oracleAddress,
        address _adminAddress,
        address _operatorAddress,
        uint256 _intervalSeconds,
        uint256 _bufferSeconds,
        uint256 _minBetAmount,
        uint256 _oracleUpdateAllowance,
        uint256 _treasuryFee
    ) {
        require(_treasuryFee <= MAX_TREASURY_FEE, "Treasury fee too high");

        oracle = AggregatorV3Interface(_oracleAddress);
        adminAddress = _adminAddress;
        operatorAddress = _operatorAddress;
        intervalSeconds = _intervalSeconds;
        bufferSeconds = _bufferSeconds;
        minBetAmount = _minBetAmount;
        oracleUpdateAllowance = _oracleUpdateAllowance;
        treasuryFee = _treasuryFee;
    }

    /**
     * @notice Bet bear position
     * @param epoch: epoch
     */
    function betBear(uint256 epoch) external payable whenNotPaused nonReentrant notContract {
        require(epoch == currentEpoch, "Bet is too early/late");
        require(_bettable(epoch), "Round not bettable");
        require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount");
        require(ledger[epoch][msg.sender].amount == 0, "Can only bet once per round");

        // Update round data
        uint256 amount = msg.value;
        Round storage round = rounds[epoch];
        round.totalAmount = round.totalAmount + amount;
        round.bearAmount = round.bearAmount + amount;

        // Update user data
        BetInfo storage betInfo = ledger[epoch][msg.sender];
        betInfo.position = Position.Bear;
        betInfo.amount = amount;
        userRounds[msg.sender].push(epoch);

        emit BetBear(msg.sender, epoch, amount);
    }

    /**
     * @notice Bet bull position
     * @param epoch: epoch
     */
    function betBull(uint256 epoch) external payable whenNotPaused nonReentrant notContract {
        require(epoch == currentEpoch, "Bet is too early/late");
        require(_bettable(epoch), "Round not bettable");
        require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount");
        require(ledger[epoch][msg.sender].amount == 0, "Can only bet once per round");

        // Update round data
        uint256 amount = msg.value;
        Round storage round = rounds[epoch];
        round.totalAmount = round.totalAmount + amount;
        round.bullAmount = round.bullAmount + amount;

        // Update user data
        BetInfo storage betInfo = ledger[epoch][msg.sender];
        betInfo.position = Position.Bull;
        betInfo.amount = amount;
        userRounds[msg.sender].push(epoch);

        emit BetBull(msg.sender, epoch, amount);
    }

    /**
     * @notice Claim reward for an array of epochs
     * @param epochs: array of epochs
     */
    function claim(uint256[] calldata epochs) external nonReentrant notContract {
        uint256 reward; // Initializes reward

        for (uint256 i = 0; i < epochs.length; i++) {
            require(rounds[epochs[i]].startTimestamp != 0, "Round has not started");
            require(block.timestamp > rounds[epochs[i]].closeTimestamp, "Round has not ended");

            uint256 addedReward = 0;

            // Round valid, claim rewards
            if (rounds[epochs[i]].oracleCalled) {
                require(claimable(epochs[i], msg.sender), "Not eligible for claim");
                Round memory round = rounds[epochs[i]];
                addedReward = (ledger[epochs[i]][msg.sender].amount * round.rewardAmount) / round.rewardBaseCalAmount;
            }
            // Round invalid, refund bet amount
            else {
                require(refundable(epochs[i], msg.sender), "Not eligible for refund");
                addedReward = ledger[epochs[i]][msg.sender].amount;
            }

            ledger[epochs[i]][msg.sender].claimed = true;
            reward += addedReward;

            emit Claim(msg.sender, epochs[i], addedReward);
        }

        if (reward > 0) {
            _safeTransferBNB(address(msg.sender), reward);
        }
    }

    /**
     * @notice Start the next round n, lock price for round n-1, end round n-2
     * @dev Callable by operator
     */
    function executeRound() external whenNotPaused onlyOperator {
        require(
            genesisStartOnce && genesisLockOnce,
            "Can only run after genesisStartRound and genesisLockRound is triggered"
        );

        (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle();

        oracleLatestRoundId = uint256(currentRoundId);

        // CurrentEpoch refers to previous round (n-1)
        _safeLockRound(currentEpoch, currentRoundId, currentPrice);
        _safeEndRound(currentEpoch - 1, currentRoundId, currentPrice);
        _calculateRewards(currentEpoch - 1);

        // Increment currentEpoch to current round (n)
        currentEpoch = currentEpoch + 1;
        _safeStartRound(currentEpoch);
    }

    /**
     * @notice Lock genesis round
     * @dev Callable by operator
     */
    function genesisLockRound() external whenNotPaused onlyOperator {
        require(genesisStartOnce, "Can only run after genesisStartRound is triggered");
        require(!genesisLockOnce, "Can only run genesisLockRound once");

        (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle();

        oracleLatestRoundId = uint256(currentRoundId);

        _safeLockRound(currentEpoch, currentRoundId, currentPrice);

        currentEpoch = currentEpoch + 1;
        _startRound(currentEpoch);
        genesisLockOnce = true;
    }

    /**
     * @notice Start genesis round
     * @dev Callable by admin or operator
     */
    function genesisStartRound() external whenNotPaused onlyOperator {
        require(!genesisStartOnce, "Can only run genesisStartRound once");

        currentEpoch = currentEpoch + 1;
        _startRound(currentEpoch);
        genesisStartOnce = true;
    }

    /**
     * @notice called by the admin to pause, triggers stopped state
     * @dev Callable by admin or operator
     */
    function pause() external whenNotPaused onlyAdminOrOperator {
        _pause();

        emit Pause(currentEpoch);
    }

    /**
     * @notice Claim all rewards in treasury
     * @dev Callable by admin
     */
    function claimTreasury() external nonReentrant onlyAdmin {
        uint256 currentTreasuryAmount = treasuryAmount;
        treasuryAmount = 0;
        _safeTransferBNB(adminAddress, currentTreasuryAmount);

        emit TreasuryClaim(currentTreasuryAmount);
    }

    /**
     * @notice called by the admin to unpause, returns to normal state
     * Reset genesis state. Once paused, the rounds would need to be kickstarted by genesis
     */
    function unpause() external whenPaused onlyAdmin {
        genesisStartOnce = false;
        genesisLockOnce = false;
        _unpause();

        emit Unpause(currentEpoch);
    }

    /**
     * @notice Set buffer and interval (in seconds)
     * @dev Callable by admin
     */
    function setBufferAndIntervalSeconds(uint256 _bufferSeconds, uint256 _intervalSeconds)
        external
        whenPaused
        onlyAdmin
    {
        require(_bufferSeconds < _intervalSeconds, "bufferSeconds must be inferior to intervalSeconds");
        bufferSeconds = _bufferSeconds;
        intervalSeconds = _intervalSeconds;

        emit NewBufferAndIntervalSeconds(_bufferSeconds, _intervalSeconds);
    }

    /**
     * @notice Set minBetAmount
     * @dev Callable by admin
     */
    function setMinBetAmount(uint256 _minBetAmount) external whenPaused onlyAdmin {
        require(_minBetAmount != 0, "Must be superior to 0");
        minBetAmount = _minBetAmount;

        emit NewMinBetAmount(currentEpoch, minBetAmount);
    }

    /**
     * @notice Set operator address
     * @dev Callable by admin
     */
    function setOperator(address _operatorAddress) external onlyAdmin {
        require(_operatorAddress != address(0), "Cannot be zero address");
        operatorAddress = _operatorAddress;

        emit NewOperatorAddress(_operatorAddress);
    }

    /**
     * @notice Set Oracle address
     * @dev Callable by admin
     */
    function setOracle(address _oracle) external whenPaused onlyAdmin {
        require(_oracle != address(0), "Cannot be zero address");
        oracleLatestRoundId = 0;
        oracle = AggregatorV3Interface(_oracle);

        // Dummy check to make sure the interface implements this function properly
        oracle.latestRoundData();

        emit NewOracle(_oracle);
    }

    /**
     * @notice Set oracle update allowance
     * @dev Callable by admin
     */
    function setOracleUpdateAllowance(uint256 _oracleUpdateAllowance) external whenPaused onlyAdmin {
        oracleUpdateAllowance = _oracleUpdateAllowance;

        emit NewOracleUpdateAllowance(_oracleUpdateAllowance);
    }

    /**
     * @notice Set treasury fee
     * @dev Callable by admin
     */
    function setTreasuryFee(uint256 _treasuryFee) external whenPaused onlyAdmin {
        require(_treasuryFee <= MAX_TREASURY_FEE, "Treasury fee too high");
        treasuryFee = _treasuryFee;

        emit NewTreasuryFee(currentEpoch, treasuryFee);
    }

    /**
     * @notice It allows the owner to recover tokens sent to the contract by mistake
     * @param _token: token address
     * @param _amount: token amount
     * @dev Callable by owner
     */
    function recoverToken(address _token, uint256 _amount) external onlyOwner {
        IERC20(_token).safeTransfer(address(msg.sender), _amount);

        emit TokenRecovery(_token, _amount);
    }

    /**
     * @notice Set admin address
     * @dev Callable by owner
     */
    function setAdmin(address _adminAddress) external onlyOwner {
        require(_adminAddress != address(0), "Cannot be zero address");
        adminAddress = _adminAddress;

        emit NewAdminAddress(_adminAddress);
    }

    /**
     * @notice Returns round epochs and bet information for a user that has participated
     * @param user: user address
     * @param cursor: cursor
     * @param size: size
     */
    function getUserRounds(
        address user,
        uint256 cursor,
        uint256 size
    )
        external
        view
        returns (
            uint256[] memory,
            BetInfo[] memory,
            uint256
        )
    {
        uint256 length = size;

        if (length > userRounds[user].length - cursor) {
            length = userRounds[user].length - cursor;
        }

        uint256[] memory values = new uint256[](length);
        BetInfo[] memory betInfo = new BetInfo[](length);

        for (uint256 i = 0; i < length; i++) {
            values[i] = userRounds[user][cursor + i];
            betInfo[i] = ledger[values[i]][user];
        }

        return (values, betInfo, cursor + length);
    }

    /**
     * @notice Returns round epochs length
     * @param user: user address
     */
    function getUserRoundsLength(address user) external view returns (uint256) {
        return userRounds[user].length;
    }

    /**
     * @notice Get the claimable stats of specific epoch and user account
     * @param epoch: epoch
     * @param user: user address
     */
    function claimable(uint256 epoch, address user) public view returns (bool) {
        BetInfo memory betInfo = ledger[epoch][user];
        Round memory round = rounds[epoch];
        if (round.lockPrice == round.closePrice) {
            return false;
        }
        return
            round.oracleCalled &&
            betInfo.amount != 0 &&
            !betInfo.claimed &&
            ((round.closePrice > round.lockPrice && betInfo.position == Position.Bull) ||
                (round.closePrice < round.lockPrice && betInfo.position == Position.Bear));
    }

    /**
     * @notice Get the refundable stats of specific epoch and user account
     * @param epoch: epoch
     * @param user: user address
     */
    function refundable(uint256 epoch, address user) public view returns (bool) {
        BetInfo memory betInfo = ledger[epoch][user];
        Round memory round = rounds[epoch];
        return
            !round.oracleCalled &&
            !betInfo.claimed &&
            block.timestamp > round.closeTimestamp + bufferSeconds &&
            betInfo.amount != 0;
    }

    /**
     * @notice Calculate rewards for round
     * @param epoch: epoch
     */
    function _calculateRewards(uint256 epoch) internal {
        require(rounds[epoch].rewardBaseCalAmount == 0 && rounds[epoch].rewardAmount == 0, "Rewards calculated");
        Round storage round = rounds[epoch];
        uint256 rewardBaseCalAmount;
        uint256 treasuryAmt;
        uint256 rewardAmount;

        // Bull wins
        if (round.closePrice > round.lockPrice) {
            rewardBaseCalAmount = round.bullAmount;
            treasuryAmt = (round.totalAmount * treasuryFee) / 10000;
            rewardAmount = round.totalAmount - treasuryAmt;
        }
        // Bear wins
        else if (round.closePrice < round.lockPrice) {
            rewardBaseCalAmount = round.bearAmount;
            treasuryAmt = (round.totalAmount * treasuryFee) / 10000;
            rewardAmount = round.totalAmount - treasuryAmt;
        }
        // House wins
        else {
            rewardBaseCalAmount = 0;
            rewardAmount = 0;
            treasuryAmt = round.totalAmount;
        }
        round.rewardBaseCalAmount = rewardBaseCalAmount;
        round.rewardAmount = rewardAmount;

        // Add to treasury
        treasuryAmount += treasuryAmt;

        emit RewardsCalculated(epoch, rewardBaseCalAmount, rewardAmount, treasuryAmt);
    }

    /**
     * @notice End round
     * @param epoch: epoch
     * @param roundId: roundId
     * @param price: price of the round
     */
    function _safeEndRound(
        uint256 epoch,
        uint256 roundId,
        int256 price
    ) internal {
        require(rounds[epoch].lockTimestamp != 0, "Can only end round after round has locked");
        require(block.timestamp >= rounds[epoch].closeTimestamp, "Can only end round after closeTimestamp");
        require(
            block.timestamp <= rounds[epoch].closeTimestamp + bufferSeconds,
            "Can only end round within bufferSeconds"
        );
        Round storage round = rounds[epoch];
        round.closePrice = price;
        round.closeOracleId = roundId;
        round.oracleCalled = true;

        emit EndRound(epoch, roundId, round.closePrice);
    }

    /**
     * @notice Lock round
     * @param epoch: epoch
     * @param roundId: roundId
     * @param price: price of the round
     */
    function _safeLockRound(
        uint256 epoch,
        uint256 roundId,
        int256 price
    ) internal {
        require(rounds[epoch].startTimestamp != 0, "Can only lock round after round has started");
        require(block.timestamp >= rounds[epoch].lockTimestamp, "Can only lock round after lockTimestamp");
        require(
            block.timestamp <= rounds[epoch].lockTimestamp + bufferSeconds,
            "Can only lock round within bufferSeconds"
        );
        Round storage round = rounds[epoch];
        round.closeTimestamp = block.timestamp + intervalSeconds;
        round.lockPrice = price;
        round.lockOracleId = roundId;

        emit LockRound(epoch, roundId, round.lockPrice);
    }

    /**
     * @notice Start round
     * Previous round n-2 must end
     * @param epoch: epoch
     */
    function _safeStartRound(uint256 epoch) internal {
        require(genesisStartOnce, "Can only run after genesisStartRound is triggered");
        require(rounds[epoch - 2].closeTimestamp != 0, "Can only start round after round n-2 has ended");
        require(
            block.timestamp >= rounds[epoch - 2].closeTimestamp,
            "Can only start new round after round n-2 closeTimestamp"
        );
        _startRound(epoch);
    }

    /**
     * @notice Transfer BNB in a safe way
     * @param to: address to transfer BNB to
     * @param value: BNB amount to transfer (in wei)
     */
    function _safeTransferBNB(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}("");
        require(success, "TransferHelper: BNB_TRANSFER_FAILED");
    }

    /**
     * @notice Start round
     * Previous round n-2 must end
     * @param epoch: epoch
     */
    function _startRound(uint256 epoch) internal {
        Round storage round = rounds[epoch];
        round.startTimestamp = block.timestamp;
        round.lockTimestamp = block.timestamp + intervalSeconds;
        round.closeTimestamp = block.timestamp + (2 * intervalSeconds);
        round.epoch = epoch;
        round.totalAmount = 0;

        emit StartRound(epoch);
    }

    /**
     * @notice Determine if a round is valid for receiving bets
     * Round must have started and locked
     * Current timestamp must be within startTimestamp and closeTimestamp
     */
    function _bettable(uint256 epoch) internal view returns (bool) {
        return
            rounds[epoch].startTimestamp != 0 &&
            rounds[epoch].lockTimestamp != 0 &&
            block.timestamp > rounds[epoch].startTimestamp &&
            block.timestamp < rounds[epoch].lockTimestamp;
    }

    /**
     * @notice Get latest recorded price from oracle
     * If it falls below allowed buffer or has not updated, it would be invalid.
     */
    function _getPriceFromOracle() internal view returns (uint80, int256) {
        uint256 leastAllowedTimestamp = block.timestamp + oracleUpdateAllowance;
        (uint80 roundId, int256 price, , uint256 timestamp, ) = oracle.latestRoundData();
        require(timestamp <= leastAllowedTimestamp, "Oracle update exceeded max timestamp allowance");
        require(
            uint256(roundId) > oracleLatestRoundId,
            "Oracle update roundId must be larger than oracleLatestRoundId"
        );
        return (roundId, price);
    }

    /**
     * @notice Returns true if `account` is a contract.
     * @param account: account address
     */
    function _isContract(address account) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }
}

File 2 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 3 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 10 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @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 a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 5 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 6 of 10 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 7 of 10 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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 8 of 10 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {

  function decimals()
    external
    view
    returns (
      uint8
    );

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

  function version()
    external
    view
    returns (
      uint256
    );

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(
    uint80 _roundId
  )
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

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

}

File 9 of 10 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 10 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with 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;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_oracleAddress","type":"address"},{"internalType":"address","name":"_adminAddress","type":"address"},{"internalType":"address","name":"_operatorAddress","type":"address"},{"internalType":"uint256","name":"_intervalSeconds","type":"uint256"},{"internalType":"uint256","name":"_bufferSeconds","type":"uint256"},{"internalType":"uint256","name":"_minBetAmount","type":"uint256"},{"internalType":"uint256","name":"_oracleUpdateAllowance","type":"uint256"},{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBear","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBull","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"price","type":"int256"}],"name":"EndRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"price","type":"int256"}],"name":"LockRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"NewAdminAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bufferSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"intervalSeconds","type":"uint256"}],"name":"NewBufferAndIntervalSeconds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"NewMinBetAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperatorAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"NewOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oracleUpdateAllowance","type":"uint256"}],"name":"NewOracleUpdateAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryFee","type":"uint256"}],"name":"NewTreasuryFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryAmount","type":"uint256"}],"name":"RewardsCalculated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"StartRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_TREASURY_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"betBear","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"betBull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"bufferSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"epochs","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"claimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executeRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisLockOnce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisLockRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisStartOnce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisStartRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"cursor","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"getUserRounds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"components":[{"internalType":"enum DegenHausPrediction.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"internalType":"struct DegenHausPrediction.BetInfo[]","name":"","type":"tuple[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserRoundsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"intervalSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"ledger","outputs":[{"internalType":"enum DegenHausPrediction.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBetAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleLatestRoundId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleUpdateAllowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"refundable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rounds","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"lockTimestamp","type":"uint256"},{"internalType":"uint256","name":"closeTimestamp","type":"uint256"},{"internalType":"int256","name":"lockPrice","type":"int256"},{"internalType":"int256","name":"closePrice","type":"int256"},{"internalType":"uint256","name":"lockOracleId","type":"uint256"},{"internalType":"uint256","name":"closeOracleId","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"bullAmount","type":"uint256"},{"internalType":"uint256","name":"bearAmount","type":"uint256"},{"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"bool","name":"oracleCalled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_adminAddress","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bufferSeconds","type":"uint256"},{"internalType":"uint256","name":"_intervalSeconds","type":"uint256"}],"name":"setBufferAndIntervalSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minBetAmount","type":"uint256"}],"name":"setMinBetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operatorAddress","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracle","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_oracleUpdateAllowance","type":"uint256"}],"name":"setOracleUpdateAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"name":"setTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRounds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040526002805461ffff60a01b191690553480156200001f57600080fd5b5060405162003bb338038062003bb383398101604081905262000042916200017e565b6200004d3362000111565b6000805460ff60a01b19169055600180556103e8811115620000b55760405162461bcd60e51b815260206004820152601560248201527f54726561737572792066656520746f6f20686967680000000000000000000000604482015260640160405180910390fd5b600280546001600160a01b03199081166001600160a01b039a8b1617909155600380548216988a1698909817909755600480549097169590971694909417909455600691909155600555600791909155600c55600855620001f8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200017957600080fd5b919050565b600080600080600080600080610100898b0312156200019b578384fd5b620001a68962000161565b9750620001b660208a0162000161565b9650620001c660408a0162000161565b9550606089015194506080890151935060a0890151925060c0890151915060e089015190509295985092959890939650565b6139ab80620002086000396000f3fe6080604052600436106102505760003560e01c80637dc0d1d011610139578063cc32d176116100b6578063ec3247031161007a578063ec324703146107a2578063f2b3c809146107b8578063f2fde38b146107ce578063f7fdec28146107ee578063fa968eea1461080f578063fc6f94681461082557600080fd5b8063cc32d17614610721578063cf2f503914610737578063d9d55eac14610757578063dd1f75961461076c578063eaba23611461078c57600080fd5b8063951fd600116100fd578063951fd6001461067f578063a0c7f71c146106ae578063aa6b873a146106ce578063b29a8140146106e1578063b3ab15fb1461070157600080fd5b80637dc0d1d0146105175780638456cb5914610537578063890dc7661461054c5780638c65c81f1461056c5780638da5cb5b1461066157600080fd5b80636ba4c138116101d25780637667180811610196578063766718081461047657806377e741c71461048c5780637adbf973146104ac5780637b3205f5146104cc5780637bf41254146104e15780637d1cd04f1461050157600080fd5b80636ba4c138146103a65780636c188593146103c6578063704b6c02146103e6578063715018a6146104065780637285c58b1461041b57600080fd5b80633f4ba83a116102195780633f4ba83a14610334578063452fd75a1461034957806357fb096f1461035e5780635c975abb14610371578063605540111461039057600080fd5b80623bdc74146102555780630f74174f1461026c578063127effb2146102a2578063273867d4146102da578063368acb091461031e575b600080fd5b34801561026157600080fd5b5061026a610845565b005b34801561027857600080fd5b5060025461028d90600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b3480156102ae57600080fd5b506004546102c2906001600160a01b031681565b6040516001600160a01b039091168152602001610299565b3480156102e657600080fd5b506103106102f5366004613378565b6001600160a01b03166000908152600f602052604090205490565b604051908152602001610299565b34801561032a57600080fd5b5061031060095481565b34801561034057600080fd5b5061026a6108f9565b34801561035557600080fd5b5061026a610990565b61026a61036c36600461347d565b610a7b565b34801561037d57600080fd5b50600054600160a01b900460ff1661028d565b34801561039c57600080fd5b50610310600c5481565b3480156103b257600080fd5b5061026a6103c13660046133ed565b610ce7565b3480156103d257600080fd5b5061026a6103e136600461347d565b61126d565b3480156103f257600080fd5b5061026a610401366004613378565b611344565b34801561041257600080fd5b5061026a6113e9565b34801561042757600080fd5b50610467610436366004613495565b600d60209081526000928352604080842090915290825290208054600182015460029092015460ff91821692911683565b60405161029993929190613610565b34801561048257600080fd5b50610310600a5481565b34801561049857600080fd5b5061026a6104a736600461347d565b61141f565b3480156104b857600080fd5b5061026a6104c7366004613378565b6114f4565b3480156104d857600080fd5b5061026a61163e565b3480156104ed57600080fd5b5061028d6104fc366004613495565b6117c3565b34801561050d57600080fd5b5061031060065481565b34801561052357600080fd5b506002546102c2906001600160a01b031681565b34801561054357600080fd5b5061026a61194f565b34801561055857600080fd5b5061026a6105673660046134c0565b611a13565b34801561057857600080fd5b506105f761058736600461347d565b600e60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600a8b0154600b8c0154600c8d0154600d909d01549b9c9a9b999a98999798969795969495939492939192909160ff168e565b604080519e8f5260208f019d909d529b8d019a909a5260608c019890985260808b019690965260a08a019490945260c089019290925260e088015261010087015261012086015261014085015261016084015261018083015215156101a08201526101c001610299565b34801561066d57600080fd5b506000546001600160a01b03166102c2565b34801561068b57600080fd5b5061069f61069a3660046133bb565b611b16565b6040516102999392919061356e565b3480156106ba57600080fd5b5061028d6106c9366004613495565b611ddd565b61026a6106dc36600461347d565b611fdd565b3480156106ed57600080fd5b5061026a6106fc366004613392565b61223e565b34801561070d57600080fd5b5061026a61071c366004613378565b6122c3565b34801561072d57600080fd5b5061031060085481565b34801561074357600080fd5b5061026a61075236600461347d565b612361565b34801561076357600080fd5b5061026a6123e9565b34801561077857600080fd5b50610310610787366004613392565b612533565b34801561079857600080fd5b5061031060055481565b3480156107ae57600080fd5b50610310600b5481565b3480156107c457600080fd5b506103106103e881565b3480156107da57600080fd5b5061026a6107e9366004613378565b612564565b3480156107fa57600080fd5b5060025461028d90600160a81b900460ff1681565b34801561081b57600080fd5b5061031060075481565b34801561083157600080fd5b506003546102c2906001600160a01b031681565b600260015414156108715760405162461bcd60e51b815260040161086890613826565b60405180910390fd5b60026001556003546001600160a01b031633146108a05760405162461bcd60e51b815260040161086890613883565b6009805460009091556003546108bf906001600160a01b0316826125ff565b6040518181527fb9197c6b8e21274bd1e2d9c956a88af5cfee510f630fab3f046300f88b4223619060200160405180910390a15060018055565b600054600160a01b900460ff166109225760405162461bcd60e51b815260040161086890613667565b6003546001600160a01b0316331461094c5760405162461bcd60e51b815260040161086890613883565b6002805461ffff60a01b191690556109626126b3565b600a546040517faaa520fdd7d2c83061d632fa017b0432407e798818af63ea908589fceda39ab790600090a2565b600054600160a01b900460ff16156109ba5760405162461bcd60e51b815260040161086890613760565b6004546001600160a01b031633146109e45760405162461bcd60e51b81526004016108689061385d565b600254600160a81b900460ff1615610a4a5760405162461bcd60e51b815260206004820152602360248201527f43616e206f6e6c792072756e2067656e657369735374617274526f756e64206f6044820152626e636560e81b6064820152608401610868565b600a54610a589060016138a6565b600a819055610a6690612729565b6002805460ff60a81b1916600160a81b179055565b600054600160a01b900460ff1615610aa55760405162461bcd60e51b815260040161086890613760565b60026001541415610ac85760405162461bcd60e51b815260040161086890613826565b6002600155333b15610aec5760405162461bcd60e51b8152600401610868906136e6565b333214610b0b5760405162461bcd60e51b8152600401610868906137ba565b600a548114610b545760405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606401610868565b610b5d816127a7565b610b9e5760405162461bcd60e51b8152602060048201526012602482015271526f756e64206e6f74206265747461626c6560701b6044820152606401610868565b600754341015610bc05760405162461bcd60e51b815260040161086890613714565b6000818152600d6020908152604080832033845290915290206001015415610c2a5760405162461bcd60e51b815260206004820152601b60248201527f43616e206f6e6c7920626574206f6e63652070657220726f756e6400000000006044820152606401610868565b6000818152600e602052604090206008810154349190610c4b9083906138a6565b60088201556009810154610c609083906138a6565b60098201556000838152600d6020908152604080832033808552908352818420805460ff191681556001808201889055600f855283862080549182018155865294849020909401879055905185815286927f438122d8cff518d18388099a5181f0d17a12b4f1b55faedf6e4a6acee0060c1291015b60405180910390a35050600180555050565b60026001541415610d0a5760405162461bcd60e51b815260040161086890613826565b6002600155333b15610d2e5760405162461bcd60e51b8152600401610868906136e6565b333214610d4d5760405162461bcd60e51b8152600401610868906137ba565b6000805b8281101561125357600e6000858584818110610d7d57634e487b7160e01b600052603260045260246000fd5b9050602002013581526020019081526020016000206001015460001415610dde5760405162461bcd60e51b8152602060048201526015602482015274149bdd5b99081a185cc81b9bdd081cdd185c9d1959605a1b6044820152606401610868565b600e6000858584818110610e0257634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020600301544211610e5f5760405162461bcd60e51b8152602060048201526013602482015272149bdd5b99081a185cc81b9bdd08195b991959606a1b6044820152606401610868565b6000600e6000868685818110610e8557634e487b7160e01b600052603260045260246000fd5b60209081029290920135835250810191909152604001600020600d015460ff161561108d57610eda858584818110610ecd57634e487b7160e01b600052603260045260246000fd5b9050602002013533611ddd565b610f1f5760405162461bcd60e51b81526020600482015260166024820152754e6f7420656c696769626c6520666f7220636c61696d60501b6044820152606401610868565b6000600e6000878786818110610f4557634e487b7160e01b600052603260045260246000fd5b905060200201358152602001908152602001600020604051806101c001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481526020016008820154815260200160098201548152602001600a8201548152602001600b8201548152602001600c8201548152602001600d820160009054906101000a900460ff1615151515815250509050806101600151816101800151600d600089898881811061103557634e487b7160e01b600052603260045260246000fd5b9050602002013581526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000206001015461107b91906138de565b61108591906138be565b91505061116c565b6110bd8585848181106110b057634e487b7160e01b600052603260045260246000fd5b90506020020135336117c3565b6111095760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606401610868565b600d600086868581811061112d57634e487b7160e01b600052603260045260246000fd5b9050602002013581526020019081526020016000206000336001600160a01b03166001600160a01b031681526020019081526020016000206001015490505b6001600d600087878681811061119257634e487b7160e01b600052603260045260246000fd5b6020908102929092013583525081810192909252604090810160009081203382529092529020600201805460ff19169115159190911790556111d481846138a6565b92508484838181106111f657634e487b7160e01b600052603260045260246000fd5b90506020020135336001600160a01b03167f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf78360405161123891815260200190565b60405180910390a3508061124b81613944565b915050610d51565b5080156112645761126433826125ff565b50506001805550565b600054600160a01b900460ff166112965760405162461bcd60e51b815260040161086890613667565b6003546001600160a01b031633146112c05760405162461bcd60e51b815260040161086890613883565b806113055760405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606401610868565b6007819055600a546040518281527f90eb87c560a0213754ceb3a7fa3012f01acab0a35602c1e1995adf69dabc9d50906020015b60405180910390a250565b6000546001600160a01b0316331461136e5760405162461bcd60e51b8152600401610868906137f1565b6001600160a01b0381166113945760405162461bcd60e51b81526004016108689061378a565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f137b621413925496477d46e5055ac0d56178bdd724ba8bf843afceef18268ba3906020015b60405180910390a150565b6000546001600160a01b031633146114135760405162461bcd60e51b8152600401610868906137f1565b61141d6000612812565b565b600054600160a01b900460ff166114485760405162461bcd60e51b815260040161086890613667565b6003546001600160a01b031633146114725760405162461bcd60e51b815260040161086890613883565b6103e88111156114bc5760405162461bcd60e51b81526020600482015260156024820152740a8e4cac2e6eae4f240cccaca40e8dede40d0d2ced605b1b6044820152606401610868565b6008819055600a546040518281527fb1c4ee38d35556741133da7ff9b6f7ab0fa88d0406133126ff128f635490a85790602001611339565b600054600160a01b900460ff1661151d5760405162461bcd60e51b815260040161086890613667565b6003546001600160a01b031633146115475760405162461bcd60e51b815260040161086890613883565b6001600160a01b03811661156d5760405162461bcd60e51b81526004016108689061378a565b6000600b55600280546001600160a01b0319166001600160a01b03831690811790915560408051633fabe5a360e21b8152905163feaf968c9160048082019260a092909190829003018186803b1580156115c657600080fd5b505afa1580156115da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fe91906134e1565b50506040516001600160a01b03851681527fb3eacd0e351fafdfefdec84e1cd19679b38dbcd63ea7c2c24da17fd2bc3b3c0e935060200191506113de9050565b600054600160a01b900460ff16156116685760405162461bcd60e51b815260040161086890613760565b6004546001600160a01b031633146116925760405162461bcd60e51b81526004016108689061385d565b600254600160a81b900460ff1680156116b45750600254600160a01b900460ff165b6117355760405162461bcd60e51b815260206004820152604660248201527f43616e206f6e6c792072756e2061667465722067656e6573697353746172745260448201527f6f756e6420616e642067656e657369734c6f636b526f756e642069732074726960648201526519d9d95c995960d21b608482015260a401610868565b600080611740612862565b91509150816001600160501b0316600b8190555061176a600a54836001600160501b0316836129fc565b61178c6001600a5461177c91906138fd565b836001600160501b031683612bca565b6117a36001600a5461179e91906138fd565b612d8b565b600a546117b19060016138a6565b600a8190556117bf90612f09565b5050565b6000828152600d602090815260408083206001600160a01b0385168452909152808220815160608101909252805483929190829060ff16600181111561181957634e487b7160e01b600052602160045260246000fd5b600181111561183857634e487b7160e01b600052602160045260246000fd5b815260018281015460208084019190915260029384015460ff908116151560409485015260008a8152600e835284902084516101c08101865281548152938101549284019290925293810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e082015260088201546101008201526009820154610120820152600a820154610140820152600b820154610160820152600c820154610180820152600d909101549091161580156101a08301819052929350909161191957508160400151155b80156119355750600554816060015161193291906138a6565b42115b80156119445750602082015115155b925050505b92915050565b600054600160a01b900460ff16156119795760405162461bcd60e51b815260040161086890613760565b6003546001600160a01b031633148061199c57506004546001600160a01b031633145b6119dd5760405162461bcd60e51b81526020600482015260126024820152712737ba1037b832b930ba37b917b0b236b4b760711b6044820152606401610868565b6119e5613059565b600a546040517f68b095021b1f40fe513109f513c66692f0b3219aee674a69f4efc57badb8201d90600090a2565b600054600160a01b900460ff16611a3c5760405162461bcd60e51b815260040161086890613667565b6003546001600160a01b03163314611a665760405162461bcd60e51b815260040161086890613883565b808210611acf5760405162461bcd60e51b815260206004820152603160248201527f6275666665725365636f6e6473206d75737420626520696e666572696f7220746044820152706f20696e74657276616c5365636f6e647360781b6064820152608401610868565b6005829055600681905560408051838152602081018390527fe60149e0431fec12df63dfab5fce2a9cefe9a4d3df5f41cb626f579ae1f2b91a910160405180910390a15050565b6001600160a01b0383166000908152600f602052604081205460609182918490611b419087906138fd565b811115611b6f576001600160a01b0387166000908152600f6020526040902054611b6c9087906138fd565b90505b60008167ffffffffffffffff811115611b9857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611bc1578160200160208202803683370190505b50905060008267ffffffffffffffff811115611bed57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611c3857816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611c0b5790505b50905060005b83811015611dbe576001600160a01b038a166000908152600f60205260409020611c68828b6138a6565b81548110611c8657634e487b7160e01b600052603260045260246000fd5b9060005260206000200154838281518110611cb157634e487b7160e01b600052603260045260246000fd5b602002602001018181525050600d6000848381518110611ce157634e487b7160e01b600052603260045260246000fd5b602090810291909101810151825281810192909252604090810160009081206001600160a01b038e168252909252908190208151606081019092528054829060ff166001811115611d4257634e487b7160e01b600052602160045260246000fd5b6001811115611d6157634e487b7160e01b600052602160045260246000fd5b81526001820154602082015260029091015460ff1615156040909101528251839083908110611da057634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080611db690613944565b915050611c3e565b508181611dcb858b6138a6565b95509550955050505093509350939050565b6000828152600d602090815260408083206001600160a01b0385168452909152808220815160608101909252805483929190829060ff166001811115611e3357634e487b7160e01b600052602160045260246000fd5b6001811115611e5257634e487b7160e01b600052602160045260246000fd5b815260018281015460208084019190915260029384015460ff908116151560409485015260008a8152600e835284902084516101c081018652815481529381015492840192909252938101549282019290925260038201546060820152600482015460808201819052600583015460a08301819052600684015460c0840152600784015460e084015260088401546101008401526009840154610120840152600a840154610140840152600b840154610160840152600c840154610180840152600d9093015490931615156101a08201529293501415611f3757600092505050611949565b806101a001518015611f4c5750602082015115155b8015611f5a57508160400151155b8015611944575080608001518160a00151138015611f985750600082516001811115611f9657634e487b7160e01b600052602160045260246000fd5b145b80611944575080608001518160a001511280156119445750600182516001811115611fd357634e487b7160e01b600052602160045260246000fd5b1495945050505050565b600054600160a01b900460ff16156120075760405162461bcd60e51b815260040161086890613760565b6002600154141561202a5760405162461bcd60e51b815260040161086890613826565b6002600155333b1561204e5760405162461bcd60e51b8152600401610868906136e6565b33321461206d5760405162461bcd60e51b8152600401610868906137ba565b600a5481146120b65760405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606401610868565b6120bf816127a7565b6121005760405162461bcd60e51b8152602060048201526012602482015271526f756e64206e6f74206265747461626c6560701b6044820152606401610868565b6007543410156121225760405162461bcd60e51b815260040161086890613714565b6000818152600d602090815260408083203384529091529020600101541561218c5760405162461bcd60e51b815260206004820152601b60248201527f43616e206f6e6c7920626574206f6e63652070657220726f756e6400000000006044820152606401610868565b6000818152600e6020526040902060088101543491906121ad9083906138a6565b6008820155600a8101546121c29083906138a6565b600a8201556000838152600d6020908152604080832033808552908352818420805460ff191660019081178255808201889055600f855283862080549182018155865294849020909401879055905185815286927f0d8c1fe3e67ab767116a81f122b83c2557a8c2564019cb7c4f83de1aeb1f1f0d9101610cd5565b6000546001600160a01b031633146122685760405162461bcd60e51b8152600401610868906137f1565b61227c6001600160a01b03831633836130be565b816001600160a01b03167f14f11966a996e0629572e51064726d2057a80fbd34efc066682c06a71dbb6e98826040516122b791815260200190565b60405180910390a25050565b6003546001600160a01b031633146122ed5760405162461bcd60e51b815260040161086890613883565b6001600160a01b0381166123135760405162461bcd60e51b81526004016108689061378a565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527fc47d127c07bdd56c5ccba00463ce3bd3c1bca71b4670eea6e5d0c02e4aa156e2906020016113de565b600054600160a01b900460ff1661238a5760405162461bcd60e51b815260040161086890613667565b6003546001600160a01b031633146123b45760405162461bcd60e51b815260040161086890613883565b600c8190556040518181527f93ccaceac092ffb842c46b8718667a13a80e9058dcd0bd403d0b47215b30da07906020016113de565b600054600160a01b900460ff16156124135760405162461bcd60e51b815260040161086890613760565b6004546001600160a01b0316331461243d5760405162461bcd60e51b81526004016108689061385d565b600254600160a81b900460ff166124665760405162461bcd60e51b815260040161086890613695565b600254600160a01b900460ff16156124cb5760405162461bcd60e51b815260206004820152602260248201527f43616e206f6e6c792072756e2067656e657369734c6f636b526f756e64206f6e604482015261636560f01b6064820152608401610868565b6000806124d6612862565b91509150816001600160501b0316600b81905550612500600a54836001600160501b0316836129fc565b600a5461250e9060016138a6565b600a81905561251c90612729565b50506002805460ff60a01b1916600160a01b179055565b600f602052816000526040600020818154811061254f57600080fd5b90600052602060002001600091509150505481565b6000546001600160a01b0316331461258e5760405162461bcd60e51b8152600401610868906137f1565b6001600160a01b0381166125f35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610868565b6125fc81612812565b50565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461264c576040519150601f19603f3d011682016040523d82523d6000602084013e612651565b606091505b50509050806126ae5760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a20424e425f5452414e534645525f46414960448201526213115160ea1b6064820152608401610868565b505050565b600054600160a01b900460ff166126dc5760405162461bcd60e51b815260040161086890613667565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000818152600e60205260409020426001820181905560065461274b916138a6565b600280830191909155600654612760916138de565b61276a90426138a6565b600382015581815560006008820181905560405183917f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b45291a25050565b6000818152600e6020526040812060010154158015906127d757506000828152600e602052604090206002015415155b80156127f357506000828152600e602052604090206001015442115b80156119495750506000908152600e6020526040902060020154421090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000600c544261287591906138a6565b90506000806000600260009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156128ca57600080fd5b505afa1580156128de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290291906134e1565b5093505092509250838111156129715760405162461bcd60e51b815260206004820152602e60248201527f4f7261636c6520757064617465206578636565646564206d61782074696d657360448201526d74616d7020616c6c6f77616e636560901b6064820152608401610868565b600b54836001600160501b0316116129f15760405162461bcd60e51b815260206004820152603d60248201527f4f7261636c652075706461746520726f756e644964206d757374206265206c6160448201527f72676572207468616e206f7261636c654c6174657374526f756e6449640000006064820152608401610868565b509094909350915050565b6000838152600e6020526040902060010154612a6e5760405162461bcd60e51b815260206004820152602b60248201527f43616e206f6e6c79206c6f636b20726f756e6420616674657220726f756e642060448201526a1a185cc81cdd185c9d195960aa1b6064820152608401610868565b6000838152600e6020526040902060020154421015612adf5760405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c79206c6f636b20726f756e64206166746572206c6f636b546960448201526606d657374616d760cc1b6064820152608401610868565b6005546000848152600e6020526040902060020154612afe91906138a6565b421115612b5e5760405162461bcd60e51b815260206004820152602860248201527f43616e206f6e6c79206c6f636b20726f756e642077697468696e206275666665604482015267725365636f6e647360c01b6064820152608401610868565b6000838152600e60205260409020600654612b7990426138a6565b60038201556004810182905560068101839055604051828152839085907f482e76a65b448a42deef26e99e58fb20c85e26f075defff8df6aa80459b39006906020015b60405180910390a350505050565b6000838152600e6020526040902060020154612c3a5760405162461bcd60e51b815260206004820152602960248201527f43616e206f6e6c7920656e6420726f756e6420616674657220726f756e642068604482015268185cc81b1bd8dad95960ba1b6064820152608401610868565b6000838152600e6020526040902060030154421015612cab5760405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e6420616674657220636c6f7365546960448201526606d657374616d760cc1b6064820152608401610868565b6005546000848152600e6020526040902060030154612cca91906138a6565b421115612d295760405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e642077697468696e206275666665726044820152665365636f6e647360c81b6064820152608401610868565b6000838152600e6020526040908190206005810183905560078101849055600d8101805460ff191660011790559051839085907fb6ff1fe915db84788cbbbc017f0d2bef9485fad9fd0bd8ce9340fde0d8410dd890612bbc9086815260200190565b6000818152600e60205260409020600b0154158015612db957506000818152600e60205260409020600c0154155b612dfa5760405162461bcd60e51b815260206004820152601260248201527114995dd85c991cc818d85b18dd5b185d195960721b6044820152606401610868565b6000818152600e6020526040812060048101546005820154919291829182911315612e5e57836009015492506127106008548560080154612e3b91906138de565b612e4591906138be565b9150818460080154612e5791906138fd565b9050612e97565b836004015484600501541215612e8a5783600a015492506127106008548560080154612e3b91906138de565b5050506008810154600090815b600b8401839055600c840181905560098054839190600090612eba9084906138a6565b9091555050604080518481526020810183905290810183905285907f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d9060600160405180910390a25050505050565b600254600160a81b900460ff16612f325760405162461bcd60e51b815260040161086890613695565b600e6000612f416002846138fd565b81526020019081526020016000206003015460001415612fba5760405162461bcd60e51b815260206004820152602e60248201527f43616e206f6e6c7920737461727420726f756e6420616674657220726f756e6460448201526d081b8b4c881a185cc8195b99195960921b6064820152608401610868565b600e6000612fc96002846138fd565b8152602001908152602001600020600301544210156130505760405162461bcd60e51b815260206004820152603760248201527f43616e206f6e6c79207374617274206e657720726f756e64206166746572207260448201527f6f756e64206e2d3220636c6f736554696d657374616d700000000000000000006064820152608401610868565b6125fc81612729565b600054600160a01b900460ff16156130835760405162461bcd60e51b815260040161086890613760565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861270c3390565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526126ae9286929160009161314e9185169084906131cb565b8051909150156126ae578080602001905181019061316c919061345d565b6126ae5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610868565b60606131da84846000856131e4565b90505b9392505050565b6060824710156132455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610868565b843b6132935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610868565b600080866001600160a01b031685876040516132af9190613552565b60006040518083038185875af1925050503d80600081146132ec576040519150601f19603f3d011682016040523d82523d6000602084013e6132f1565b606091505b509150915061330182828661330c565b979650505050505050565b6060831561331b5750816131dd565b82511561332b5782518084602001fd5b8160405162461bcd60e51b81526004016108689190613634565b80356001600160a01b038116811461335c57600080fd5b919050565b80516001600160501b038116811461335c57600080fd5b600060208284031215613389578081fd5b6131dd82613345565b600080604083850312156133a4578081fd5b6133ad83613345565b946020939093013593505050565b6000806000606084860312156133cf578081fd5b6133d884613345565b95602085013595506040909401359392505050565b600080602083850312156133ff578182fd5b823567ffffffffffffffff80821115613416578384fd5b818501915085601f830112613429578384fd5b813581811115613437578485fd5b8660208260051b850101111561344b578485fd5b60209290920196919550909350505050565b60006020828403121561346e578081fd5b815180151581146131dd578182fd5b60006020828403121561348e578081fd5b5035919050565b600080604083850312156134a7578182fd5b823591506134b760208401613345565b90509250929050565b600080604083850312156134d2578182fd5b50508035926020909101359150565b600080600080600060a086880312156134f8578081fd5b61350186613361565b945060208601519350604086015192506060860151915061352460808701613361565b90509295509295909350565b6002811061354e57634e487b7160e01b600052602160045260246000fd5b9052565b60008251613564818460208701613914565b9190910192915050565b60608082528451828201819052600091906020906080850190828901855b828110156135a85781518452928401929084019060010161358c565b50505084810382860152865180825287830191830190855b818110156135f95783516135d5848251613530565b808601518487015260409081015115159084015292840192918501916001016135c0565b505080945050505050826040830152949350505050565b6060810161361e8286613530565b8360208301528215156040830152949350505050565b6020815260008251806020840152613653816040850160208701613914565b601f01601f19169190910160400192915050565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526031908201527f43616e206f6e6c792072756e2061667465722067656e657369735374617274526040820152701bdd5b99081a5cc81d1c9a59d9d95c9959607a1b606082015260800190565b60208082526014908201527310dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b604082015260600190565b6020808252602c908201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060408201526b1b5a5b90995d105b5bdd5b9d60a21b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526016908201527543616e6e6f74206265207a65726f206164647265737360501b604082015260600190565b6020808252601a908201527f50726f787920636f6e7472616374206e6f7420616c6c6f776564000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600c908201526b2737ba1037b832b930ba37b960a11b604082015260600190565b6020808252600990820152682737ba1030b236b4b760b91b604082015260600190565b600082198211156138b9576138b961395f565b500190565b6000826138d957634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156138f8576138f861395f565b500290565b60008282101561390f5761390f61395f565b500390565b60005b8381101561392f578181015183820152602001613917565b8381111561393e576000848401525b50505050565b60006000198214156139585761395861395f565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e0e09627602b303e4759f15842f5d4faece4d18f524684c783085c8a0bc771ba64736f6c63430008040033000000000000000000000000f4766552d15ae4d256ad41b6cf2933482b0680dc000000000000000000000000dabad5d0da4b158187fd6a9d89aea5edce8f39930000000000000000000000000232349bc20422b3e49c4fea56456551c6f4521a000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000012c

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

000000000000000000000000f4766552d15ae4d256ad41b6cf2933482b0680dc000000000000000000000000dabad5d0da4b158187fd6a9d89aea5edce8f39930000000000000000000000000232349bc20422b3e49c4fea56456551c6f4521a000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000012c

-----Decoded View---------------
Arg [0] : _oracleAddress (address): 0xf4766552d15ae4d256ad41b6cf2933482b0680dc
Arg [1] : _adminAddress (address): 0xdabad5d0da4b158187fd6a9d89aea5edce8f3993
Arg [2] : _operatorAddress (address): 0x0232349bc20422b3e49c4fea56456551c6f4521a
Arg [3] : _intervalSeconds (uint256): 300
Arg [4] : _bufferSeconds (uint256): 30
Arg [5] : _minBetAmount (uint256): 1000000000000000000
Arg [6] : _oracleUpdateAllowance (uint256): 300
Arg [7] : _treasuryFee (uint256): 300

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000f4766552d15ae4d256ad41b6cf2933482b0680dc
Arg [1] : 000000000000000000000000dabad5d0da4b158187fd6a9d89aea5edce8f3993
Arg [2] : 0000000000000000000000000232349bc20422b3e49c4fea56456551c6f4521a
Arg [3] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [4] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [5] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [7] : 000000000000000000000000000000000000000000000000000000000000012c


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.