ETH Price: $3,054.57 (+1.49%)
Gas: 3 Gwei

Contract

0xBc0043bc5b0c394D9d05d49768f9548F8CF9587b
 

Overview

ETH Balance

49.421083552787291129 ETH

Eth Value

$150,960.39 (@ $3,054.57/ETH)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Stake Blaze202614382024-07-08 11:17:351 hr ago1720437455IN
0xBc0043bc...F8CF9587b
0 ETH0.001084063.33196054
Stake Blaze202610952024-07-08 10:07:592 hrs ago1720433279IN
0xBc0043bc...F8CF9587b
0 ETH0.000655422.88973522
Stake Blaze202594732024-07-08 4:41:357 hrs ago1720413695IN
0xBc0043bc...F8CF9587b
0 ETH0.000323681.42711466
Stake Blaze202565042024-07-07 18:44:3517 hrs ago1720377875IN
0xBc0043bc...F8CF9587b
0 ETH0.000474532.06274466
Stake Blaze202564952024-07-07 18:42:4717 hrs ago1720377767IN
0xBc0043bc...F8CF9587b
0 ETH0.00049222.170239
Stake Blaze202557502024-07-07 16:12:4720 hrs ago1720368767IN
0xBc0043bc...F8CF9587b
0 ETH0.000834153.67775092
Stake Blaze202523942024-07-07 4:57:5931 hrs ago1720328279IN
0xBc0043bc...F8CF9587b
0 ETH0.000575511.62086019
Stake Blaze202516422024-07-07 2:26:2334 hrs ago1720319183IN
0xBc0043bc...F8CF9587b
0 ETH0.000286121.26159597
Stake Blaze202515372024-07-07 2:05:1134 hrs ago1720317911IN
0xBc0043bc...F8CF9587b
0 ETH0.000316561.39581192
Stake Blaze202509622024-07-07 0:09:4736 hrs ago1720310987IN
0xBc0043bc...F8CF9587b
0 ETH0.000487732.15039089
Stake Blaze202503042024-07-06 21:58:1138 hrs ago1720303091IN
0xBc0043bc...F8CF9587b
0 ETH0.000458132.01989065
Claim Fee Reward...202494222024-07-06 19:00:2341 hrs ago1720292423IN
0xBc0043bc...F8CF9587b
0 ETH0.000279021.90718017
Stake Blaze202492852024-07-06 18:32:5941 hrs ago1720290779IN
0xBc0043bc...F8CF9587b
0 ETH0.000532272.34691513
Stake Blaze202487812024-07-06 16:51:5943 hrs ago1720284719IN
0xBc0043bc...F8CF9587b
0 ETH0.001380065.99930762
Stake Blaze202486932024-07-06 16:34:2343 hrs ago1720283663IN
0xBc0043bc...F8CF9587b
0 ETH0.001016934.48389717
Stake Blaze202486452024-07-06 16:24:4744 hrs ago1720283087IN
0xBc0043bc...F8CF9587b
0 ETH0.000740963.40835613
Stake Blaze202485132024-07-06 15:58:2344 hrs ago1720281503IN
0xBc0043bc...F8CF9587b
0 ETH0.000983434.27489969
Stake Blaze202484962024-07-06 15:54:5944 hrs ago1720281299IN
0xBc0043bc...F8CF9587b
0 ETH0.001008194.44536399
Stake Blaze202484392024-07-06 15:43:3544 hrs ago1720280615IN
0xBc0043bc...F8CF9587b
0 ETH0.001033814.23851919
Claim Fee Reward...202483992024-07-06 15:35:3544 hrs ago1720280135IN
0xBc0043bc...F8CF9587b
0 ETH0.000664794.54390496
Claim Fee Reward...202474152024-07-06 12:18:352 days ago1720268315IN
0xBc0043bc...F8CF9587b
0 ETH0.000411492.56619341
Stake Blaze202470772024-07-06 11:10:232 days ago1720264223IN
0xBc0043bc...F8CF9587b
0 ETH0.000527322.28557511
Stake Blaze202454042024-07-06 5:32:232 days ago1720243943IN
0xBc0043bc...F8CF9587b
0 ETH0.000378581.64567593
Claim Fee Reward...202427112024-07-05 20:31:472 days ago1720211507IN
0xBc0043bc...F8CF9587b
0 ETH0.000446013.04854254
Stake Blaze202419412024-07-05 17:56:592 days ago1720202219IN
0xBc0043bc...F8CF9587b
0 ETH0.001486986.4637556
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
202613352024-07-08 10:56:351 hr ago1720436195
0xBc0043bc...F8CF9587b
0.00046886 ETH
202613352024-07-08 10:56:351 hr ago1720436195
0xBc0043bc...F8CF9587b
0.02771329 ETH
202613352024-07-08 10:56:351 hr ago1720436195
0xBc0043bc...F8CF9587b
0.14208 ETH
202613332024-07-08 10:56:111 hr ago1720436171
0xBc0043bc...F8CF9587b
0.00046886 ETH
202613332024-07-08 10:56:111 hr ago1720436171
0xBc0043bc...F8CF9587b
0.02771329 ETH
202613332024-07-08 10:56:111 hr ago1720436171
0xBc0043bc...F8CF9587b
0.14208 ETH
202610872024-07-08 10:06:232 hrs ago1720433183
0xBc0043bc...F8CF9587b
0.0008448 ETH
202610872024-07-08 10:06:232 hrs ago1720433183
0xBc0043bc...F8CF9587b
0.04993387 ETH
202610872024-07-08 10:06:232 hrs ago1720433183
0xBc0043bc...F8CF9587b
0.256 ETH
202610332024-07-08 9:55:352 hrs ago1720432535
0xBc0043bc...F8CF9587b
0.00059136 ETH
202610332024-07-08 9:55:352 hrs ago1720432535
0xBc0043bc...F8CF9587b
0.03495371 ETH
202610332024-07-08 9:55:352 hrs ago1720432535
0xBc0043bc...F8CF9587b
0.1792 ETH
202609622024-07-08 9:40:592 hrs ago1720431659
0xBc0043bc...F8CF9587b
0.0016896 ETH
202609622024-07-08 9:40:592 hrs ago1720431659
0xBc0043bc...F8CF9587b
0.09986774 ETH
202609622024-07-08 9:40:592 hrs ago1720431659
0xBc0043bc...F8CF9587b
0.512 ETH
202609612024-07-08 9:40:472 hrs ago1720431647
0xBc0043bc...F8CF9587b
0.00270336 ETH
202609612024-07-08 9:40:472 hrs ago1720431647
0xBc0043bc...F8CF9587b
0.15978839 ETH
202609612024-07-08 9:40:472 hrs ago1720431647
0xBc0043bc...F8CF9587b
0.8192 ETH
202609552024-07-08 9:39:352 hrs ago1720431575
0xBc0043bc...F8CF9587b
0.0022894 ETH
202609552024-07-08 9:39:352 hrs ago1720431575
0xBc0043bc...F8CF9587b
0.13532079 ETH
202609552024-07-08 9:39:352 hrs ago1720431575
0xBc0043bc...F8CF9587b
0.69376 ETH
202609382024-07-08 9:36:112 hrs ago1720431371
0xBc0043bc...F8CF9587b
0.00141081 ETH
202609382024-07-08 9:36:112 hrs ago1720431371
0xBc0043bc...F8CF9587b
0.08338956 ETH
202609382024-07-08 9:36:112 hrs ago1720431371
0xBc0043bc...F8CF9587b
0.42752 ETH
202608202024-07-08 9:12:233 hrs ago1720429943
0xBc0043bc...F8CF9587b
0.0008448 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BlazeStaking

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 13 : blazeStaking.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./interfaces/IDiamondHand.sol";
import "./utils/constants.sol";
import "./utils/userDefinedType.sol";

contract BlazeStaking is ReentrancyGuard, Context, Ownable2Step {
    using SafeERC20 for IERC20;

    uint32 public immutable _deploymentTimeStamp;
    address private _blazeToken;

    address private _lastDistributionAddress;

    uint32 private _currentDayInContract;

    uint256 private _currentStakingShareRate;

    uint256 private _stakeIdCounter;

    uint256 private _totalShares;

    uint256 private _totalCompletedShares;

    uint256 private _totalBlazeTokenStaked;

    uint256 private _allCompletedStake;

    uint256 private _totalUndistributedCollectedFees;

    /* Distribution Variables*/
    DistributionTriggered private _isGlobalDistributionTriggered;

    //cycle => rewards
    mapping(uint16 => uint256) private _cycleDistributionTotalRewards;

    //cycle ==> index count
    mapping(uint16 => uint32) private _cycleDistributionIndexCount;

    mapping(uint16 => uint32) _nextCycleDistributionDay;

    //cycle => index count => reward Per share
    mapping(uint16 => mapping(uint32 => CycleRewardsPerShare)) private _cycleRewardsPerShare;

    mapping(address => mapping(uint16 => CycleClaimIndexCountForUser)) private _userAddressToCycleToLastClaimIndex;

    /* STaking Related variables */

    mapping(address => uint256) private _userAddressToStakeId;

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

    //global stake id to stake info
    mapping(uint256 => StakeInfo) private _stakeInfo;

    mapping(address => uint256) private _userLatestIndex;

    mapping(address => mapping(uint256 => UserSharesInfo)) private _userIndexToSharesInfo;

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

    event ETHDistributed(address indexed caller, uint256 indexed amount);
    event CycleDistributionTriggered(address indexed caller, uint256 indexed cycleNo, uint256 indexed rewardAmount);
    event DistributionRewardsClaimed(address indexed user, uint256 indexed rewardAmount);
    event StakeStarted(address indexed user,uint256 indexed globalStakeId,uint256 __blazeAmount,uint256 __durationInDays);
    event StakeEnded(address indexed user,uint256 indexed globalStakeId,uint256 indexed __blazeAmount);
    
    modifier dailyUpdate() {
        _dailyUpdate();
        _;
    }

    constructor(address _blazeTokenAddress) Ownable(_msgSender()) {
        _blazeToken = _blazeTokenAddress;
        _deploymentTimeStamp = uint32(block.timestamp);
        _currentDayInContract = 1;
        _currentStakingShareRate = START_SHARE_RATE;
        _nextCycleDistributionDay[DAY8] = DAY8;
        _nextCycleDistributionDay[DAY88] = DAY88;
        _nextCycleDistributionDay[DAY288] = DAY288;
    }

    receive() external payable {
        _totalUndistributedCollectedFees += msg.value;
    }

    function setLastDistributionAddress(address __lastDistributionAddress) external onlyOwner {
        require(__lastDistributionAddress != address(0), "blazeStaking:last distribution address can not be zero");
        _lastDistributionAddress = __lastDistributionAddress;
    }

    function stakeBlaze(uint256 __blazeAmount, uint256 __durationInDays) external dailyUpdate nonReentrant {
        // IBlazeToken(_blazeToken).burn(_msgSender(), __blazeAmount);
        // uint8 _isFirstStake = _stakeBlaze(_msgSender(), __blazeAmount, __durationInDays);

        uint256 stakeId = ++_userAddressToStakeId[_msgSender()];

        require(
            __durationInDays >= MINIMUM_STAKING_PERIOD && __durationInDays <= MAXIMUM_STAKING_PERIOD,
            "blazeStaking:blaze stake duration not valid"
        );
        //calculate shares
        (uint256 totalShares, ) = calculateSharesAndBonus(__blazeAmount, __durationInDays);
        uint256 globalStakeId = ++_stakeIdCounter;
        _userStakeIdToGlobalStakeId[_msgSender()][stakeId] = globalStakeId;

        uint32 stakeMaturityTimestamp = uint32(block.timestamp + (__durationInDays * SECONDS_IN_DAY));

        StakeInfo memory stakeInfo = StakeInfo({
            amount: __blazeAmount,
            shares: totalShares,
            stakeDurationInDays: uint16(__durationInDays),
            startTimestamp: uint32(block.timestamp),
            maturityTimestamp: stakeMaturityTimestamp,
            status: StakeStatus.ACTIVE
        });

        _stakeInfo[globalStakeId] = stakeInfo;

        //update shares changes
        uint8 _isFirstStake = _updateSharesStats(_msgSender(), totalShares, __blazeAmount, StakeAction.START);
        if (_isFirstStake == 1) {
            _firstStakeCycleConfig(_msgSender());
        }
        if (__durationInDays == MAXIMUM_STAKING_PERIOD) {
            _setDiamondHand(_msgSender(), __blazeAmount);
        }
        IERC20(_blazeToken).safeTransferFrom(_msgSender(), address(this), __blazeAmount);

        emit StakeStarted(_msgSender(),globalStakeId,__durationInDays,__blazeAmount);
    }

    function unstakeBlaze(address __user, uint256 __id) external dailyUpdate nonReentrant {
        uint256 amount = _unstakeBlaze(__user, __id);

        IERC20(_blazeToken).safeTransfer(__user, amount);

    }

    function dailyDetailsUpdater() external dailyUpdate {}

    // function unstakeBlazeForOthers(address __user, uint256 __id) external dailyUpdate nonReentrant {
    //     uint256 amount = _unstakeBlaze(__user, __id);
    //     IERC20(_blazeToken).safeTransfer(__user, amount);
    // }

    function setFeeRewardsForAllCycle() external dailyUpdate nonReentrant {
        (uint256 lastCycleDistributionPortion, uint256 incentiveAmount) = _distributeCollectedETH();
        require(_lastDistributionAddress != address(0), "blazeStaking:last cycle distribution address not set");
        _transferETH(_lastDistributionAddress, lastCycleDistributionPortion);
        if (incentiveAmount > 0) {
            _transferETH(_msgSender(), incentiveAmount);
        }
    }

    function distributeFeeRewardsForAll() external dailyUpdate nonReentrant {
        uint256 lastCycleDistributionPortion;
        uint256 incentiveAmount;
        if (_totalUndistributedCollectedFees != 0) {
            (lastCycleDistributionPortion, incentiveAmount) = _distributeCollectedETH();
        }

        uint256 currentActivateShares = _totalShares - _totalCompletedShares;
        require(currentActivateShares > 1, "blazeStaking:no active shares");

        uint32 currentDayInContract = _currentDayInContract;
        DistributionTriggered isDistributionCompleted = DistributionTriggered.NO;

        DistributionTriggered completed = _distributeFeeRewardsForCycle(
            DAY8,
            currentDayInContract,
            currentActivateShares
        );
        if (completed == DistributionTriggered.YES && isDistributionCompleted == DistributionTriggered.NO) {
            isDistributionCompleted = DistributionTriggered.YES;
        }

        completed = _distributeFeeRewardsForCycle(DAY88, currentDayInContract, currentActivateShares);
        if (completed == DistributionTriggered.YES && isDistributionCompleted == DistributionTriggered.NO) {
            isDistributionCompleted = DistributionTriggered.YES;
        }

        completed = _distributeFeeRewardsForCycle(DAY288, currentDayInContract, currentActivateShares);
        if (completed == DistributionTriggered.YES && isDistributionCompleted == DistributionTriggered.NO) {
            isDistributionCompleted = DistributionTriggered.YES;
        }

        if (
            isDistributionCompleted == DistributionTriggered.YES &&
            _isGlobalDistributionTriggered == DistributionTriggered.NO
        ) {
            _isGlobalDistributionTriggered = DistributionTriggered.YES;
        }

        require(_lastDistributionAddress != address(0), "blazeStaking:last cycle distribution address not set");
        if(lastCycleDistributionPortion>0){
            _transferETH(_lastDistributionAddress, lastCycleDistributionPortion);
        }
        if (incentiveAmount > 0) {
            _transferETH(_msgSender(), incentiveAmount);
        }
    }

    function claimFeeRewards() external dailyUpdate nonReentrant {
        uint256 reward = _claimCycleDistribution(DAY8);
        reward += _claimCycleDistribution(DAY88);
        reward += _claimCycleDistribution(DAY288);

        if (reward != 0) {
            _transferETH(_msgSender(), reward);
        }
        emit DistributionRewardsClaimed(_msgSender(), reward);
    }

    function getAvailableRewardsForClaim(address __user) external view returns (uint256 __totalRewards) {
        uint256 rewardsPerCycle;
        (rewardsPerCycle, , ) = _calculateUserCycleFeesReward(__user, DAY8);
        __totalRewards += rewardsPerCycle;
        (rewardsPerCycle, , ) = _calculateUserCycleFeesReward(__user, DAY88);
        __totalRewards += rewardsPerCycle;
        (rewardsPerCycle, , ) = _calculateUserCycleFeesReward(__user, DAY288);
        __totalRewards += rewardsPerCycle;
    }

    function getStakes(
        address __user,
        uint256 __cursor,
        uint256 __size
    ) external view returns (CompleteStakeInfo[] memory __stakes, uint256 __counter) {
        uint256 currentUserCounter = _userAddressToStakeId[__user];
        uint256 count = currentUserCounter;
        if (__cursor >= count) {
            return (new CompleteStakeInfo[](0), 0);
        }

        uint256 endIndex = __cursor + __size;
        if (endIndex > count) {
            endIndex = count;
        }

        __stakes = new CompleteStakeInfo[](endIndex - __cursor);

        for (uint256 i = 0; __cursor < endIndex; ++__cursor) {
            __stakes[i] = CompleteStakeInfo({
                userStakeId: __cursor + 1,
                globalStakeId: _userStakeIdToGlobalStakeId[__user][__cursor + 1],
                stakeInfo: getStakeInfoByUserStakeId(__user, __cursor + 1)
            });
            ++i;
        }

        return (__stakes, endIndex);
    }

    function getCurrentSharesOfUser(address __user) external view returns (uint256) {
        return _userIndexToSharesInfo[__user][getUserLatestShareIndex(__user)].currentShares;
    }

    function getUserSharesAtParticularUserIndex(
        address __user,
        uint256 __index
    ) external view returns (uint256 __shares, uint256 __updationDay) {
        return (
            _userIndexToSharesInfo[__user][__index].currentShares,
            _userIndexToSharesInfo[__user][__index].updationDay
        );
    }

    function getTotalStakesInfo()
        external
        view
        returns (uint256 __totalStakes, uint256 __totalCompletedStakes, uint256 __currentActiveStakes)
    {
        return (_stakeIdCounter, _allCompletedStake, _stakeIdCounter - _allCompletedStake);
    }

    function getTotalSharesInfo()
        external
        view
        returns (uint256 __totalSharesAllocated, uint256 __totalCompletedStakeShares, uint256 __currentActiveShares)
    {
        return (_totalShares, _totalCompletedShares, _totalShares - _totalCompletedShares);
    }

    function getTotalStakedTokens() external view returns (uint256 __blazeTokens) {
        return _totalBlazeTokenStaked;
    }

    function getTotalCycleRewards(uint16 __cycle) external view returns (uint256 __totalRewards) {
        return _cycleDistributionTotalRewards[__cycle];
    }

    function getNextCycleDistributionDay(uint16 __cycle) external view returns (uint256 __nextDistributionDay) {
        return _nextCycleDistributionDay[__cycle];
    }

    function getCurrentCycleIndex(uint16 __cycle) external view returns (uint256 __currentCycleIndex) {
        return _cycleDistributionIndexCount[__cycle];
    }

    function getCurrentShareRate() external view returns (uint256 __shareRate) {
        return _currentStakingShareRate;
    }

    function getGlobalDistributionTriggeringStatus() external view returns (DistributionTriggered) {
        return _isGlobalDistributionTriggered;
    }

    function getCurrentDayInContract() external view returns (uint256 __currentDay) {
        return _currentDayInContract;
    }

    function getTotalUndistributedFees() external view returns (uint256 __totalUndistributedFees) {
        return _totalUndistributedCollectedFees;
    }

    function getLastDistributionAddress() external view returns (address __lastDsitributionAddress) {
        return _lastDistributionAddress;
    }

    function getUser2888BlazeToken(address __user, uint256 __cycle) external view returns (uint256 _blazeTokenStaked) {
        return _user2888CycleBlazeTokenAmount[__user][__cycle];
    }

    function getUserLastCycleClaimIndex(
        address __user,
        uint16 __cycle
    ) public view returns (uint32 __cycleIndex, uint96 __sharesIndex) {
        return (
            _userAddressToCycleToLastClaimIndex[__user][__cycle].cycleIndex,
            _userAddressToCycleToLastClaimIndex[__user][__cycle].sharesIndex
        );
    }

    function getStakeInfoByUserStakeId(address __user, uint256 __userStakeId) public view returns (StakeInfo memory) {
        return _stakeInfo[_userStakeIdToGlobalStakeId[__user][__userStakeId]];
    }

    function getRewardsPerShare(
        uint16 __cycle,
        uint32 __index
    ) public view returns (uint256 __rewardsPerShare, uint256 __distributionDay) {
        return (_cycleRewardsPerShare[__cycle][__index].rewardPerShare, _cycleRewardsPerShare[__cycle][__index].day);
    }

    function getUserLatestShareIndex(address __user) public view returns (uint256 __userLatestIndex) {
        return _userLatestIndex[__user];
    }

    function calculateSharesAndBonus(
        uint256 __blazeAmount,
        uint256 __durationInDays
    ) public view returns (uint256 __shares, uint256 __bonus) {
        // Calculate regular shares
        __shares = __blazeAmount;

        // Calculate bonus based on duration
        __bonus = ((__durationInDays - MINIMUM_STAKING_PERIOD) * BASE_1e18) / Percent_In_Days;
        // Add bonus shares to total shares
        __shares = __shares + ((__shares * __bonus) / BASE_1e18);

        __shares = (__shares * BASE_1e18) / _currentStakingShareRate;

        return (__shares, __bonus);
    }

    function _dailyUpdate() private {
        uint32 currentDayInContract = _currentDayInContract;
        uint32 currentDay = uint32(((block.timestamp - _deploymentTimeStamp) / 1 days) + 1);

        if (currentDay > currentDayInContract) {
            uint256 newShareRate = _currentStakingShareRate;

            uint32 dayDifference = currentDay - currentDayInContract;

            uint32 tempDayInContract = currentDayInContract;

            for (uint32 i = 0; i < dayDifference; ++i) {
                ++tempDayInContract;

                if (tempDayInContract % DAY8 == 0) {
                    newShareRate = (newShareRate -
                        (newShareRate * EIGHTH_DAY_SHARE_RATE_DECREASE_PERCENTAGE) /
                        PERCENT_BASE);
                }
            }
            _currentStakingShareRate = newShareRate;
            _currentDayInContract = currentDay;
            _isGlobalDistributionTriggered = DistributionTriggered.NO;
        }
    }

    function _unstakeBlaze(address __user, uint256 __id) private returns (uint256 __blazeAmount) {
        uint256 globalStakeId = _userStakeIdToGlobalStakeId[__user][__id];
        require(globalStakeId != 0, "blazeStaking:blaze staking stake id not valid");

        StakeInfo memory stakeInfo = _stakeInfo[globalStakeId];
        require(stakeInfo.status != StakeStatus.COMPLETED, "blazeStaking:blaze stake has already ended");
        require(block.timestamp >= stakeInfo.maturityTimestamp, "blazeStaking:blaze stake not matured");

        //update shares changes
        uint256 shares = stakeInfo.shares;
        _updateSharesStats(__user, shares, stakeInfo.amount, StakeAction.END);

        ++_allCompletedStake;
        _stakeInfo[globalStakeId].status = StakeStatus.COMPLETED;

        __blazeAmount = stakeInfo.amount;

        emit StakeEnded(__user, globalStakeId,__blazeAmount);
    }

    function _updateSharesStats(
        address __user,
        uint256 __shares,
        uint256 __amount,
        StakeAction __action
    ) private returns (uint8 __firstStake) {
        uint256 index = _userLatestIndex[__user];
        uint256 currentUserShares = _userIndexToSharesInfo[__user][index].currentShares;
        if (__action == StakeAction.START) {
            if (index == 0) {
                __firstStake = 1;
            }
            _userIndexToSharesInfo[__user][++index].currentShares = currentUserShares + __shares;
            _totalShares += __shares;
            _totalBlazeTokenStaked += __amount;
        } else {
            _userIndexToSharesInfo[__user][++index].currentShares = currentUserShares - __shares;
            _totalCompletedShares += __shares;
            _totalBlazeTokenStaked -= __amount;
        }
        _userIndexToSharesInfo[__user][index].updationDay = uint32(
            _isGlobalDistributionTriggered == DistributionTriggered.NO
                ? _currentDayInContract
                : _currentDayInContract + 1
        );

        _userLatestIndex[__user] = index;
    }

    function _firstStakeCycleConfig(address __user) private {
        if (_cycleDistributionIndexCount[DAY8] != 0) {
            _userAddressToCycleToLastClaimIndex[__user][DAY8].cycleIndex = uint32(
                _cycleDistributionIndexCount[DAY8] + 1
            );

            _userAddressToCycleToLastClaimIndex[__user][DAY88].cycleIndex = uint32(
                _cycleDistributionIndexCount[DAY88] + 1
            );

            _userAddressToCycleToLastClaimIndex[__user][DAY288].cycleIndex = uint32(
                _cycleDistributionIndexCount[DAY288] + 1
            );
        }
    }

    function _distributeCollectedETH()
        private
        returns (uint256 __lastCycleDsitributionPortion, uint256 __incentiveAmount)
    {
        uint256 undistributedFees = _totalUndistributedCollectedFees;
        require(undistributedFees > 0, "blazeStaking:No fees to distribute");
        _totalUndistributedCollectedFees = 0;

        __incentiveAmount = (undistributedFees * PUBLIC_CALL_INCENTIVE) / PUBLIC_CALL_INCENTIVE_BASE;
        undistributedFees -= __incentiveAmount;

        uint256 feesPortionForCycle8 = (undistributedFees * PERCENT_FOR_CYCLE_8) / PERCENT_BASE;
        uint256 feesPortionForCycle88 = (undistributedFees * PERCENT_FOR_CYCLE_88) / PERCENT_BASE;
        uint256 feesPortionForCycle288 = (undistributedFees * PERCENT_FOR_CYCLE_288) / PERCENT_BASE;
        __lastCycleDsitributionPortion =
            undistributedFees -
            (feesPortionForCycle8 + feesPortionForCycle88 + feesPortionForCycle288);
        _addCycleDistributionPortion(DAY8, feesPortionForCycle8);
        _addCycleDistributionPortion(DAY88, feesPortionForCycle88);
        _addCycleDistributionPortion(DAY288, feesPortionForCycle288);
        emit ETHDistributed(_msgSender(), undistributedFees);
        return (__lastCycleDsitributionPortion, __incentiveAmount);
    }

    function _addCycleDistributionPortion(uint16 __cycle, uint256 __rewards) private {
        _cycleDistributionTotalRewards[__cycle] += __rewards;
    }

    function _distributeFeeRewardsForCycle(
        uint16 __cycle,
        uint32 __currentDay,
        uint256 __currentActiveShares
    ) private returns (DistributionTriggered __completed) {
        if (__currentDay < _nextCycleDistributionDay[__cycle]) {
            return DistributionTriggered.NO;
        }
        _calculateAndSetNextDistributionDay(__cycle);
        uint256 totalRewardsForThisCycle = _cycleDistributionTotalRewards[__cycle];
        if (totalRewardsForThisCycle == 0) {
            return DistributionTriggered.NO;
        }

        _setCycleRewardsPerShare(__cycle, __currentDay, __currentActiveShares, totalRewardsForThisCycle);
        _cycleDistributionTotalRewards[__cycle] = 0;
        emit CycleDistributionTriggered(_msgSender(), __cycle, totalRewardsForThisCycle);
        return DistributionTriggered.YES;
    }

    function _calculateAndSetNextDistributionDay(uint16 __cycle) private {
        uint32 mDay = _nextCycleDistributionDay[__cycle];
        uint32 currentDay = _currentDayInContract;
        if (currentDay >= mDay) {
            uint32 totalCycles = (((currentDay - mDay) / __cycle) + 1);
            _nextCycleDistributionDay[__cycle] += __cycle * totalCycles;
        }
    }

    function _transferETH(address __to, uint256 __amount) private {
        (bool successful, ) = payable(__to).call{value: __amount}("");
        require(successful, "blazeStaking:eth transfer failed");
    }

    function _setCycleRewardsPerShare(
        uint16 __cycle,
        uint32 __currentDay,
        uint256 __currentActiveShares,
        uint256 __totalRewards
    ) private {
        uint32 _currentCycleindex = ++_cycleDistributionIndexCount[__cycle];
        _cycleRewardsPerShare[__cycle][_currentCycleindex].rewardPerShare =
            (__totalRewards * BASE_1e18) /
            __currentActiveShares;
        _cycleRewardsPerShare[__cycle][_currentCycleindex].day = __currentDay;
    }

    function _claimCycleDistribution(uint16 __cycle) private returns (uint256) {
        (uint256 reward, uint256 userClaimSharesIndex, uint32 userClaimCycleIndex) = _calculateUserCycleFeesReward(
            _msgSender(),
            __cycle
        );

        _updateUserCycleClaimIndexes(_msgSender(), __cycle, userClaimCycleIndex, userClaimSharesIndex);

        return reward;
    }

    function _calculateUserCycleFeesReward(
        address __user,
        uint16 __cycle
    ) private view returns (uint256 _rewards, uint256 _userClaimSharesIndex, uint32 _userClaimCycleIndex) {
        uint32 latestCycleIndex = _cycleDistributionIndexCount[__cycle];

        (_userClaimCycleIndex, _userClaimSharesIndex) = getUserLastCycleClaimIndex(__user, __cycle);
        uint256 latestUserSharesIndex = _userLatestIndex[__user];

        for (uint32 j = _userClaimCycleIndex; j <= latestCycleIndex; ++j) {
            (uint256 rewardsPerShare, uint256 dayofDistribution) = getRewardsPerShare(__cycle, j);
            uint256 shares;

            for (uint256 k = _userClaimSharesIndex; k <= latestUserSharesIndex; ++k) {
                if (_userIndexToSharesInfo[__user][k].updationDay <= dayofDistribution)
                    shares = _userIndexToSharesInfo[__user][k].currentShares;
                else break;

                _userClaimSharesIndex = k;
            }

            if (rewardsPerShare != 0 && shares != 0) {
                //reward has 18 decimals scaling, so here divide by 1e18
                _rewards += (shares * rewardsPerShare) / BASE_1e18;
            }

            _userClaimCycleIndex = j + 1;
        }
    }

    function _updateUserCycleClaimIndexes(
        address __user,
        uint16 __cycle,
        uint32 __userClaimCycleIndex,
        uint256 __userClaimSharesIndex
    ) private {
        if (__userClaimCycleIndex != _userAddressToCycleToLastClaimIndex[__user][__cycle].cycleIndex)
            _userAddressToCycleToLastClaimIndex[__user][__cycle].cycleIndex = (__userClaimCycleIndex);

        if (__userClaimSharesIndex != _userAddressToCycleToLastClaimIndex[__user][__cycle].sharesIndex)
            _userAddressToCycleToLastClaimIndex[__user][__cycle].sharesIndex = uint64(__userClaimSharesIndex);
    }

    function _setDiamondHand(address __user, uint256 __amount) private {
        (uint256 currentDay, uint256 currentCycle, ) = IDiamondHand(_lastDistributionAddress)
            .getCurrentDayAndCycleDetails();
        uint256 cycleStartDay = (currentCycle - 1) * 888;
        uint256 cycleEndDay = cycleStartDay + 365;
        bool isEligible = currentDay <= cycleEndDay;
        if (isEligible) {
            _user2888CycleBlazeTokenAmount[__user][currentCycle] += __amount;
        }
    }
}

File 2 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 13 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 4 of 13 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

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

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

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

File 5 of 13 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 6 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

File 7 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 8 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 9 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 10 of 13 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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 making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 11 of 13 : IDiamondHand.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;


interface IDiamondHand {
    function getCurrentDayAndCycleDetails() external view returns (uint256 currentDay, uint256 currentCycle, uint256 currentDayInCycle);
}

File 12 of 13 : constants.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

//Distribution Cycle Configurations
uint16 constant DAY8 = 8;
uint16 constant DAY88 = 88;
uint16 constant DAY288 = 288;
uint16 constant DAY888 = 888;
uint16 constant PERCENT_FOR_CYCLE_8 = 3261;
uint16 constant PERCENT_FOR_CYCLE_88 = 2608;
uint16 constant PERCENT_FOR_CYCLE_288 = 2174;
uint16 constant PERCENT_FOR_CYCLE_888 = 1957;

// Global
uint16 constant PERCENT_BASE = 10000;
uint32 constant SECONDS_IN_DAY = 86400;
uint256 constant BASE_1e18 = 1e18;

//Blaze Share Rate Configurations
uint256 constant START_SHARE_RATE = 1e18;
uint256 constant EIGHTH_DAY_SHARE_RATE_DECREASE_PERCENTAGE = 126;
uint256 constant SCALING_SHARES = 1e18;

//Stake Duration
uint16 constant MINIMUM_STAKING_PERIOD = 88;
uint16 constant MAXIMUM_STAKING_PERIOD = 2888;

//Bonus COnfiguration
uint256 constant Percent_In_Days = 972;

//Incentive Configuration
uint256 constant PUBLIC_CALL_INCENTIVE = 3300;
uint256 constant PUBLIC_CALL_INCENTIVE_BASE = 1_000_000;

File 13 of 13 : userDefinedType.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.24;

enum DistributionTriggered {
    NO,
    YES
}

enum StakeStatus {
    ACTIVE,
    COMPLETED
}

enum StakeAction {
    START,
    END
}
struct CycleRewardsPerShare {
    uint32 day;
    uint256 rewardPerShare;
}

struct CycleClaimIndexCountForUser {
    uint32 cycleIndex;
    uint96 sharesIndex;
}

struct StakeInfo {
    uint256 amount;
    uint256 shares;
    uint16 stakeDurationInDays;
    uint32 startTimestamp;
    uint32 maturityTimestamp;
    StakeStatus status;
}

struct UserSharesInfo {
    uint32 updationDay;
    uint256 currentShares;
}

struct CompleteStakeInfo {
    uint256 userStakeId;
    uint256 globalStakeId;
    StakeInfo stakeInfo;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_blazeTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint256","name":"cycleNo","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"CycleDistributionTriggered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"DistributionRewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ETHDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"globalStakeId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"__blazeAmount","type":"uint256"}],"name":"StakeEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"globalStakeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"__blazeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"__durationInDays","type":"uint256"}],"name":"StakeStarted","type":"event"},{"inputs":[],"name":"_deploymentTimeStamp","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"__blazeAmount","type":"uint256"},{"internalType":"uint256","name":"__durationInDays","type":"uint256"}],"name":"calculateSharesAndBonus","outputs":[{"internalType":"uint256","name":"__shares","type":"uint256"},{"internalType":"uint256","name":"__bonus","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFeeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dailyDetailsUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeFeeRewardsForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"}],"name":"getAvailableRewardsForClaim","outputs":[{"internalType":"uint256","name":"__totalRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"__cycle","type":"uint16"}],"name":"getCurrentCycleIndex","outputs":[{"internalType":"uint256","name":"__currentCycleIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentDayInContract","outputs":[{"internalType":"uint256","name":"__currentDay","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentShareRate","outputs":[{"internalType":"uint256","name":"__shareRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"}],"name":"getCurrentSharesOfUser","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalDistributionTriggeringStatus","outputs":[{"internalType":"enum DistributionTriggered","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastDistributionAddress","outputs":[{"internalType":"address","name":"__lastDsitributionAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"__cycle","type":"uint16"}],"name":"getNextCycleDistributionDay","outputs":[{"internalType":"uint256","name":"__nextDistributionDay","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"__cycle","type":"uint16"},{"internalType":"uint32","name":"__index","type":"uint32"}],"name":"getRewardsPerShare","outputs":[{"internalType":"uint256","name":"__rewardsPerShare","type":"uint256"},{"internalType":"uint256","name":"__distributionDay","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"},{"internalType":"uint256","name":"__userStakeId","type":"uint256"}],"name":"getStakeInfoByUserStakeId","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint16","name":"stakeDurationInDays","type":"uint16"},{"internalType":"uint32","name":"startTimestamp","type":"uint32"},{"internalType":"uint32","name":"maturityTimestamp","type":"uint32"},{"internalType":"enum StakeStatus","name":"status","type":"uint8"}],"internalType":"struct StakeInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"},{"internalType":"uint256","name":"__cursor","type":"uint256"},{"internalType":"uint256","name":"__size","type":"uint256"}],"name":"getStakes","outputs":[{"components":[{"internalType":"uint256","name":"userStakeId","type":"uint256"},{"internalType":"uint256","name":"globalStakeId","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint16","name":"stakeDurationInDays","type":"uint16"},{"internalType":"uint32","name":"startTimestamp","type":"uint32"},{"internalType":"uint32","name":"maturityTimestamp","type":"uint32"},{"internalType":"enum StakeStatus","name":"status","type":"uint8"}],"internalType":"struct StakeInfo","name":"stakeInfo","type":"tuple"}],"internalType":"struct CompleteStakeInfo[]","name":"__stakes","type":"tuple[]"},{"internalType":"uint256","name":"__counter","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"__cycle","type":"uint16"}],"name":"getTotalCycleRewards","outputs":[{"internalType":"uint256","name":"__totalRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalSharesInfo","outputs":[{"internalType":"uint256","name":"__totalSharesAllocated","type":"uint256"},{"internalType":"uint256","name":"__totalCompletedStakeShares","type":"uint256"},{"internalType":"uint256","name":"__currentActiveShares","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStakedTokens","outputs":[{"internalType":"uint256","name":"__blazeTokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStakesInfo","outputs":[{"internalType":"uint256","name":"__totalStakes","type":"uint256"},{"internalType":"uint256","name":"__totalCompletedStakes","type":"uint256"},{"internalType":"uint256","name":"__currentActiveStakes","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalUndistributedFees","outputs":[{"internalType":"uint256","name":"__totalUndistributedFees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"},{"internalType":"uint256","name":"__cycle","type":"uint256"}],"name":"getUser2888BlazeToken","outputs":[{"internalType":"uint256","name":"_blazeTokenStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"},{"internalType":"uint16","name":"__cycle","type":"uint16"}],"name":"getUserLastCycleClaimIndex","outputs":[{"internalType":"uint32","name":"__cycleIndex","type":"uint32"},{"internalType":"uint96","name":"__sharesIndex","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"}],"name":"getUserLatestShareIndex","outputs":[{"internalType":"uint256","name":"__userLatestIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"},{"internalType":"uint256","name":"__index","type":"uint256"}],"name":"getUserSharesAtParticularUserIndex","outputs":[{"internalType":"uint256","name":"__shares","type":"uint256"},{"internalType":"uint256","name":"__updationDay","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setFeeRewardsForAllCycle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__lastDistributionAddress","type":"address"}],"name":"setLastDistributionAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"__blazeAmount","type":"uint256"},{"internalType":"uint256","name":"__durationInDays","type":"uint256"}],"name":"stakeBlaze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__user","type":"address"},{"internalType":"uint256","name":"__id","type":"uint256"}],"name":"unstakeBlaze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162002c5f38038062002c5f8339810160408190526200003491620001c1565b600160005533806200006057604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200006b8162000151565b50600380546001600160a01b039092166001600160a01b031990921691909117905563ffffffff42166080526004805463ffffffff60a01b1916600160a01b179055670de0b6b3a7640000600555600f6020527f49a9092dc5c03b26195f6621c97b5cf515cb77afe659e3fe008a73456354eb68805463ffffffff199081166008179091557fe964b3448919c72de64fa3dcd533556c5d5462009d9e38e944aa8fb22b2ae4f180548216605817905561012060008190527fea77d611392f683169a5cefd9500ffd08b9271549e74ae6209b63313b49c9acb8054909216179055620001f3565b600280546001600160a01b03191690556200016c816200016f565b50565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620001d457600080fd5b81516001600160a01b0381168114620001ec57600080fd5b9392505050565b608051612a49620002166000396000818161047301526113390152612a496000f3fe6080604052600436106101fd5760003560e01c80638ac81ba21161010d578063b92f46cd116100a0578063cf9a33611161006f578063cf9a336114610702578063e30c397814610722578063f2fde38b14610740578063faa94d3b14610760578063fbf9529d1461079657600080fd5b8063b92f46cd14610665578063c0e764cb14610696578063c36e60a9146106b6578063c61697aa146106cb57600080fd5b8063a84dd993116100dc578063a84dd993146105d7578063aea80d8e1461060e578063b48a8fa014610630578063b729bd241461065057600080fd5b80638ac81ba2146105345780638da5cb5b146105545780638e48426f1461057257806392013f731461058757600080fd5b80632c1fc4921161019057806364deb9281161015f57806364deb92814610461578063715018a6146104aa57806373b714d3146104bf57806379ba50971461050a57806386491dd91461051f57600080fd5b80632c1fc492146103f45780632da496e31461040957806351d185981461043757806360484f1b1461044c57600080fd5b806313480222116101cc578063134802221461032157806324bc8d3f14610353578063260270c7146103a457806328e4e99e146103c457600080fd5b806301a4146f1461022157806304010c031461028e5780630d1269ac146102b057806310d3872a146102dd57600080fd5b3661021c5734600b60008282546102149190612554565b925050819055005b600080fd5b34801561022d57600080fd5b5061027461023c366004612583565b6001600160a01b039190911660009081526016602090815260408083209383529290522060018101549054909163ffffffff90911690565b604080519283526020830191909152015b60405180910390f35b34801561029a57600080fd5b506102ae6102a93660046125ad565b6107ab565b005b3480156102bc57600080fd5b506102d06102cb366004612583565b610a6e565b6040516102859190612658565b3480156102e957600080fd5b506102fd6102f8366004612678565b610b2d565b6040805163ffffffff90931683526001600160601b03909116602083015201610285565b34801561032d57600080fd5b506004546001600160a01b03165b6040516001600160a01b039091168152602001610285565b34801561035f57600080fd5b5061039661036e366004612583565b6001600160a01b03919091166000908152601760209081526040808320938352929052205490565b604051908152602001610285565b3480156103b057600080fd5b506102ae6103bf366004612583565b610b75565b3480156103d057600080fd5b506103d9610bb6565b60408051938452602084019290925290820152606001610285565b34801561040057600080fd5b506103d9610bdc565b34801561041557600080fd5b506104296104243660046126ab565b610bf7565b6040516102859291906126de565b34801561044357600080fd5b50600954610396565b34801561045857600080fd5b506102ae610d8a565b34801561046d57600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610285565b3480156104b657600080fd5b506102ae610e20565b3480156104cb57600080fd5b506103966104da36600461274c565b6001600160a01b031660009081526016602090815260408083206015835281842054845290915290206001015490565b34801561051657600080fd5b506102ae610e32565b34801561052b57600080fd5b506102ae610e76565b34801561054057600080fd5b50600c5460ff166040516102859190612767565b34801561056057600080fd5b506001546001600160a01b031661033b565b34801561057e57600080fd5b506102ae610eef565b34801561059357600080fd5b506102746105a236600461277a565b61ffff91909116600090815260106020908152604080832063ffffffff94851684529091529020600181015490549092911690565b3480156105e357600080fd5b506103966105f23660046127ba565b61ffff166000908152600f602052604090205463ffffffff1690565b34801561061a57600080fd5b50600454600160a01b900463ffffffff16610396565b34801561063c57600080fd5b5061027461064b3660046125ad565b610ef7565b34801561065c57600080fd5b50600b54610396565b34801561067157600080fd5b506103966106803660046127ba565b61ffff166000908152600d602052604090205490565b3480156106a257600080fd5b506102ae6106b136600461274c565b610f79565b3480156106c257600080fd5b506102ae611018565b3480156106d757600080fd5b506103966106e63660046127ba565b61ffff166000908152600e602052604090205463ffffffff1690565b34801561070e57600080fd5b5061039661071d36600461274c565b611247565b34801561072e57600080fd5b506002546001600160a01b031661033b565b34801561074c57600080fd5b506102ae61075b36600461274c565b6112a7565b34801561076c57600080fd5b5061039661077b36600461274c565b6001600160a01b031660009081526015602052604090205490565b3480156107a257600080fd5b50600554610396565b6107b3611318565b6107bb61143b565b336000908152601260205260408120805482906107d7906127d5565b91829055509050605882108015906107f15750610b488211155b6108565760405162461bcd60e51b815260206004820152602b60248201527f626c617a655374616b696e673a626c617a65207374616b65206475726174696f60448201526a1b881b9bdd081d985b1a5960aa1b60648201526084015b60405180910390fd5b60006108628484610ef7565b5090506000600660008154610876906127d5565b918290555033600090815260136020908152604080832087845290915281208290559091506108a862015180866127ee565b6108b29042612554565b905060006040518060c001604052808881526020018581526020018761ffff1681526020014263ffffffff1681526020018363ffffffff16815260200160006001811115610902576109026125cf565b90526000848152601460209081526040918290208351815590830151600180830191909155918301516002820180546060860151608087015163ffffffff908116600160301b0269ffffffff0000000000001991909216620100000265ffffffffffff1990931661ffff90951694909417919091179283168117825560a086015195965086959394919260ff60501b199091166affffffffff000000000000199091161790600160501b9084908111156109be576109be6125cf565b021790555090505060006109db6109d23390565b868a6000611465565b90508060ff166001036109f1576109f133611649565b610b47198701610a0557610a0533896117db565b610a1d336003546001600160a01b031690308b6118c5565b60408051888152602081018a9052859133917f91e6a00503577c865efb830697017859d45cac59ab84291faa9141b55bc5f23c910160405180910390a3505050505050610a6a6001600055565b5050565b610a766124e7565b6001600160a01b038316600090815260136020908152604080832085845282528083205483526014825291829020825160c0810184528154815260018083015493820193909352600282015461ffff81169482019490945263ffffffff62010000850481166060830152600160301b850416608082015292909160a084019160ff600160501b9091041690811115610b1057610b106125cf565b6001811115610b2157610b216125cf565b90525090505b92915050565b6001600160a01b0391909116600090815260116020908152604080832061ffff949094168352929052205463ffffffff8116916401000000009091046001600160601b031690565b610b7d611318565b610b8561143b565b6000610b918383611932565b600354909150610bab906001600160a01b03168483611bbc565b50610a6a6001600055565b6000806000600654600a54600a54600654610bd19190612805565b925092509250909192565b6000806000600754600854600854600754610bd19190612805565b6001600160a01b0383166000908152601260205260408120546060919080808610610c5b576040805160008082526020820190925290610c4d565b610c3a61251d565b815260200190600190039081610c325790505b506000935093505050610d82565b6000610c678688612554565b905081811115610c745750805b610c7e8782612805565b67ffffffffffffffff811115610c9657610c96612818565b604051908082528060200260200182016040528015610ccf57816020015b610cbc61251d565b815260200190600190039081610cb45790505b50945060005b81881015610d7c576040518060600160405280896001610cf59190612554565b81526001600160a01b038b166000908152601360209081526040822092019190610d208c6001612554565b8152602001908152602001600020548152602001610d458b8b60016102cb9190612554565b815250868281518110610d5a57610d5a61282e565b602002602001018190525080610d6f906127d5565b9050876001019750610cd5565b50925050505b935093915050565b610d92611318565b610d9a61143b565b6000610da66008611bf2565b9050610db26058611bf2565b610dbc9082612554565b9050610dc9610120611bf2565b610dd39082612554565b90508015610de657610de6335b82611c22565b604051819033907f2871b64e3818cfce24806c82238518bcaa75f39220abe2118583210f29c7af6090600090a350610e1e6001600055565b565b610e28611cc5565b610e1e6000611cf2565b60025433906001600160a01b03168114610e6a5760405163118cdaa760e01b81526001600160a01b038216600482015260240161084d565b610e7381611cf2565b50565b610e7e611318565b610e8661143b565b600080610e91611d0b565b60045491935091506001600160a01b0316610ebe5760405162461bcd60e51b815260040161084d90612844565b600454610ed4906001600160a01b031683611c22565b8015610ee357610ee333610de0565b5050610e1e6001600055565b610e1e611318565b8160006103cc670de0b6b3a7640000610f11605886612805565b610f1b91906127ee565b610f2591906128ae565b9050670de0b6b3a7640000610f3a82846127ee565b610f4491906128ae565b610f4e9083612554565b600554909250610f66670de0b6b3a7640000846127ee565b610f7091906128ae565b91509250929050565b610f81611cc5565b6001600160a01b038116610ff65760405162461bcd60e51b815260206004820152603660248201527f626c617a655374616b696e673a6c61737420646973747269627574696f6e20616044820152756464726573732063616e206e6f74206265207a65726f60501b606482015260840161084d565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b611020611318565b61102861143b565b600080600b546000146110435761103d611d0b565b90925090505b60006008546007546110559190612805565b9050600181116110a75760405162461bcd60e51b815260206004820152601d60248201527f626c617a655374616b696e673a6e6f2061637469766520736861726573000000604482015260640161084d565b600454600160a01b900463ffffffff166000806110c660088486611e67565b905060018160018111156110dc576110dc6125cf565b1480156110fa575060008260018111156110f8576110f86125cf565b145b1561110457600191505b61111060588486611e67565b90506001816001811115611126576111266125cf565b14801561114457506000826001811115611142576111426125cf565b145b1561114e57600191505b61115b6101208486611e67565b90506001816001811115611171576111716125cf565b14801561118f5750600082600181111561118d5761118d6125cf565b145b1561119957600191505b60018260018111156111ad576111ad6125cf565b1480156111d057506000600c5460ff1660018111156111ce576111ce6125cf565b145b156111e357600c805460ff191660011790555b6004546001600160a01b031661120b5760405162461bcd60e51b815260040161084d90612844565b851561122757600454611227906001600160a01b031687611c22565b8415611237576112373386611c22565b505050505050610e1e6001600055565b600080611255836008611f1b565b5090915061126590508183612554565b9150611272836058611f1b565b5090915061128290508183612554565b915061129083610120611f1b565b509091506112a090508183612554565b9392505050565b6112af611cc5565b600280546001600160a01b0383166001600160a01b031990911681179091556112e06001546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60045463ffffffff600160a01b909104811690600090620151809061135f907f00000000000000000000000000000000000000000000000000000000000000001642612805565b61136991906128ae565b611374906001612554565b90508163ffffffff168163ffffffff161115610a6a57600554600061139984846128c2565b90508360005b8263ffffffff168163ffffffff161015611403576113bc826128e6565b91506113c9600883612909565b63ffffffff166000036113fb576127106113e4607e866127ee565b6113ee91906128ae565b6113f89085612805565b93505b60010161139f565b5050506005556004805463ffffffff92909216600160a01b0263ffffffff60a01b1990921691909117905550600c805460ff19169055565b60026000540361145e57604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b6001600160a01b03841660009081526015602090815260408083205460168352818420818552909252822060010154828460018111156114a7576114a76125cf565b0361153357816000036114b957600192505b6114c38682612554565b6001600160a01b0388166000908152601660205260408120906114e5856127d5565b945084815260200190815260200160002060010181905550856007600082825461150f9190612554565b9250508190555084600960008282546115289190612554565b909155506115a89050565b61153d8682612805565b6001600160a01b03881660009081526016602052604081209061155f856127d5565b94508481526020019081526020016000206001018190555085600860008282546115899190612554565b9250508190555084600960008282546115a29190612805565b90915550505b6000600c5460ff1660018111156115c1576115c16125cf565b146115e6576004546115e190600160a01b900463ffffffff16600161292c565b6115f7565b600454600160a01b900463ffffffff165b6001600160a01b039790971660008181526016602090815260408083208684528252808320805463ffffffff191663ffffffff909c169b909b17909a5591815260159091529690962055949350505050565b6008600052600e6020527feab6bc3746954d8a0719de62c86ea908d362be2a58c781ada1046727253f9df25463ffffffff1615610e73576008600052600e6020527feab6bc3746954d8a0719de62c86ea908d362be2a58c781ada1046727253f9df2546116bd9063ffffffff16600161292c565b6001600160a01b03821660009081526011602090815260408083206008845282528220805463ffffffff191663ffffffff9485161790556058909152600e90527f5ea54d52ee8c9b980f7ee6f575aaaf3d4769efd8809d64a2e6f4c02f24b3e9225461172b9116600161292c565b6001600160a01b03821660009081526011602090815260408083206058845282528220805463ffffffff191663ffffffff948516179055610120909152600e90527f6a7f5fcd829d841f4ae5df66fd4f81e89c1ed4f8ab5607b4598ad4aaec7906785461179a9116600161292c565b6001600160a01b0391909116600090815260116020908152604080832061012084529091529020805463ffffffff191663ffffffff92909216919091179055565b6004805460408051633c42b34160e01b8152905160009384936001600160a01b031692633c42b34192818301926060928290030181865afa158015611824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118489190612949565b509092509050600061185b600183612805565b611867906103786127ee565b905060006118778261016d612554565b90508084118015906118bc576001600160a01b0387166000908152601760209081526040808320878452909152812080548892906118b6908490612554565b90915550505b50505050505050565b6040516001600160a01b03848116602483015283811660448301526064820183905261192c9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612099565b50505050565b6001600160a01b03821660009081526013602090815260408083208484529091528120548082036119bb5760405162461bcd60e51b815260206004820152602d60248201527f626c617a655374616b696e673a626c617a65207374616b696e67207374616b6560448201526c081a59081b9bdd081d985b1a59609a1b606482015260840161084d565b6000818152601460209081526040808320815160c0810183528154815260018083015494820194909452600282015461ffff81169382019390935262010000830463ffffffff9081166060830152600160301b840416608082015292909160a0840191600160501b90910460ff1690811115611a3957611a396125cf565b6001811115611a4a57611a4a6125cf565b905250905060018160a001516001811115611a6757611a676125cf565b03611ac75760405162461bcd60e51b815260206004820152602a60248201527f626c617a655374616b696e673a626c617a65207374616b652068617320616c726044820152691958591e48195b99195960b21b606482015260840161084d565b806080015163ffffffff16421015611b2d5760405162461bcd60e51b8152602060048201526024808201527f626c617a655374616b696e673a626c617a65207374616b65206e6f74206d61746044820152631d5c995960e21b606482015260840161084d565b60208101518151611b4390879083906001611465565b50600a60008154611b53906127d5565b90915550600083815260146020526040808220600201805460ff60501b1916600160501b17905583519051909550859185916001600160a01b038a16917f7d3d1f4caaa5edea815c2f70589d94440879c198ee4240e2fdf87137d497e19b91a450505092915050565b6040516001600160a01b03838116602483015260448201839052611bed91859182169063a9059cbb906064016118fa565b505050565b6000808080611c013386611f1b565b925092509250611c19611c113390565b8683856120fc565b50909392505050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611c6f576040519150601f19603f3d011682016040523d82523d6000602084013e611c74565b606091505b5050905080611bed5760405162461bcd60e51b815260206004820181905260248201527f626c617a655374616b696e673a657468207472616e73666572206661696c6564604482015260640161084d565b6001546001600160a01b03163314610e1e5760405163118cdaa760e01b815233600482015260240161084d565b600280546001600160a01b0319169055610e7381612206565b600b54600090819080611d6b5760405162461bcd60e51b815260206004820152602260248201527f626c617a655374616b696e673a4e6f206665657320746f206469737472696275604482015261746560f01b606482015260840161084d565b6000600b55620f4240611d80610ce4836127ee565b611d8a91906128ae565b9150611d968282612805565b90506000612710611da9610cbd846127ee565b611db391906128ae565b90506000612710611dc6610a30856127ee565b611dd091906128ae565b90506000612710611de361087e866127ee565b611ded91906128ae565b905080611dfa8385612554565b611e049190612554565b611e0e9085612805565b9550611e1b600884612258565b611e26605883612258565b611e3261012082612258565b604051849033907f55083a582b32208b745a21c8ce4f8d545be8cce1437f34637f08fc9d943eacb090600090a3505050509091565b61ffff83166000908152600f602052604081205463ffffffff9081169084161015611e94575060006112a0565b611e9d84612284565b61ffff84166000908152600d602052604081205490819003611ec35760009150506112a0565b611ecf85858584612337565b61ffff85166000818152600d60205260408082208290555183929133917f330997f7612b0eba67ced5af32716e9afe967ad3b31a80bf6601294e5055feea9190a4506001949350505050565b61ffff81166000908152600e60205260408120548190819063ffffffff16611f438686610b2d565b6001600160a01b0388166000908152601560205260409020546001600160601b039091169450909250825b8263ffffffff168163ffffffff161161208f5761ffff8716600090815260106020908152604080832063ffffffff858116855292528220600181015490549092911690875b858111612030576001600160a01b038c16600090815260166020908152604080832084845290915290205463ffffffff168310612018576001600160a01b038c166000908152601660209081526040808320848452909152902060010154915061201d565b612030565b975087612029816127d5565b9050611fb3565b50821580159061203f57508015155b1561206e57670de0b6b3a764000061205784836127ee565b61206191906128ae565b61206b908a612554565b98505b61207984600161292c565b965050505080612088906128e6565b9050611f6e565b5050509250925092565b60006120ae6001600160a01b038416836123e0565b905080516000141580156120d35750808060200190518101906120d19190612977565b155b15611bed57604051635274afe760e01b81526001600160a01b038416600482015260240161084d565b6001600160a01b038416600090815260116020908152604080832061ffff8716845290915290205463ffffffff83811691161461216e576001600160a01b038416600090815260116020908152604080832061ffff871684529091529020805463ffffffff191663ffffffff84161790555b6001600160a01b038416600090815260116020908152604080832061ffff8716845290915290205464010000000090046001600160601b0316811461192c576001600160a01b038416600090815260116020908152604080832061ffff871684529091529020805464010000000067ffffffffffffffff8416026fffffffffffffffffffffffff000000001990911617905550505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61ffff82166000908152600d60205260408120805483929061227b908490612554565b90915550505050565b61ffff81166000908152600f602052604090205460045463ffffffff91821691600160a01b90910416818110611bed57600061ffff84166122c584846128c2565b6122cf9190612999565b6122da90600161292c565b90506122ea8161ffff86166129bc565b61ffff85166000908152600f60205260408120805490919061231390849063ffffffff1661292c565b92506101000a81548163ffffffff021916908363ffffffff16021790555050505050565b61ffff84166000908152600e602052604081208054829061235d9063ffffffff166128e6565b91906101000a81548163ffffffff021916908363ffffffff1602179055905082670de0b6b3a76400008361239191906127ee565b61239b91906128ae565b61ffff95909516600090815260106020908152604080832063ffffffff948516845290915290206001810195909555845463ffffffff19169316929092179092555050565b60606112a08383600084600080856001600160a01b0316848660405161240691906129e4565b60006040518083038185875af1925050503d8060008114612443576040519150601f19603f3d011682016040523d82523d6000602084013e612448565b606091505b5091509150612458868383612462565b9695505050505050565b60608261247757612472826124be565b6112a0565b815115801561248e57506001600160a01b0384163b155b156124b757604051639996b31560e01b81526001600160a01b038516600482015260240161084d565b50806112a0565b8051156124ce5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160c08101825260008082526020820181905291810182905260608101829052608081018290529060a08201905b905290565b604051806060016040528060008152602001600081526020016125186124e7565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b2757610b2761253e565b80356001600160a01b038116811461257e57600080fd5b919050565b6000806040838503121561259657600080fd5b61259f83612567565b946020939093013593505050565b600080604083850312156125c057600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60028110610e7357634e487b7160e01b600052602160045260246000fd5b805182526020810151602083015261ffff6040820151166040830152606081015163ffffffff8082166060850152806080840151166080850152505060a081015161264d816125e5565b8060a0840152505050565b60c08101610b278284612603565b803561ffff8116811461257e57600080fd5b6000806040838503121561268b57600080fd5b61269483612567565b91506126a260208401612666565b90509250929050565b6000806000606084860312156126c057600080fd5b6126c984612567565b95602085013595506040909401359392505050565b60408082528351828201819052600091906020906060850190828801855b8281101561273657815180518552858101518686015286015161272187860182612603565b506101009390930192908401906001016126fc565b5050508093505050508260208301529392505050565b60006020828403121561275e57600080fd5b6112a082612567565b60208101612774836125e5565b91905290565b6000806040838503121561278d57600080fd5b61279683612666565b9150602083013563ffffffff811681146127af57600080fd5b809150509250929050565b6000602082840312156127cc57600080fd5b6112a082612666565b6000600182016127e7576127e761253e565b5060010190565b8082028115828204841417610b2757610b2761253e565b81810381811115610b2757610b2761253e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60208082526034908201527f626c617a655374616b696e673a6c617374206379636c652064697374726962756040820152731d1a5bdb881859191c995cdcc81b9bdd081cd95d60621b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826128bd576128bd612898565b500490565b63ffffffff8281168282160390808211156128df576128df61253e565b5092915050565b600063ffffffff8083168181036128ff576128ff61253e565b6001019392505050565b600063ffffffff8084168061292057612920612898565b92169190910692915050565b63ffffffff8181168382160190808211156128df576128df61253e565b60008060006060848603121561295e57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561298957600080fd5b815180151581146112a057600080fd5b600063ffffffff808416806129b0576129b0612898565b92169190910492915050565b63ffffffff8181168382160280821691908281146129dc576129dc61253e565b505092915050565b6000825160005b81811015612a0557602081860181015185830152016129eb565b50600092019182525091905056fea26469706673582212203019c5f9d26b888715161e7d35ba0c0d227209511141d60c0d8d5f989546bf7a64736f6c63430008180033000000000000000000000000fcd7ccee4071aa4ecfac1683b7cc0afecaf42a36

Deployed Bytecode

0x6080604052600436106101fd5760003560e01c80638ac81ba21161010d578063b92f46cd116100a0578063cf9a33611161006f578063cf9a336114610702578063e30c397814610722578063f2fde38b14610740578063faa94d3b14610760578063fbf9529d1461079657600080fd5b8063b92f46cd14610665578063c0e764cb14610696578063c36e60a9146106b6578063c61697aa146106cb57600080fd5b8063a84dd993116100dc578063a84dd993146105d7578063aea80d8e1461060e578063b48a8fa014610630578063b729bd241461065057600080fd5b80638ac81ba2146105345780638da5cb5b146105545780638e48426f1461057257806392013f731461058757600080fd5b80632c1fc4921161019057806364deb9281161015f57806364deb92814610461578063715018a6146104aa57806373b714d3146104bf57806379ba50971461050a57806386491dd91461051f57600080fd5b80632c1fc492146103f45780632da496e31461040957806351d185981461043757806360484f1b1461044c57600080fd5b806313480222116101cc578063134802221461032157806324bc8d3f14610353578063260270c7146103a457806328e4e99e146103c457600080fd5b806301a4146f1461022157806304010c031461028e5780630d1269ac146102b057806310d3872a146102dd57600080fd5b3661021c5734600b60008282546102149190612554565b925050819055005b600080fd5b34801561022d57600080fd5b5061027461023c366004612583565b6001600160a01b039190911660009081526016602090815260408083209383529290522060018101549054909163ffffffff90911690565b604080519283526020830191909152015b60405180910390f35b34801561029a57600080fd5b506102ae6102a93660046125ad565b6107ab565b005b3480156102bc57600080fd5b506102d06102cb366004612583565b610a6e565b6040516102859190612658565b3480156102e957600080fd5b506102fd6102f8366004612678565b610b2d565b6040805163ffffffff90931683526001600160601b03909116602083015201610285565b34801561032d57600080fd5b506004546001600160a01b03165b6040516001600160a01b039091168152602001610285565b34801561035f57600080fd5b5061039661036e366004612583565b6001600160a01b03919091166000908152601760209081526040808320938352929052205490565b604051908152602001610285565b3480156103b057600080fd5b506102ae6103bf366004612583565b610b75565b3480156103d057600080fd5b506103d9610bb6565b60408051938452602084019290925290820152606001610285565b34801561040057600080fd5b506103d9610bdc565b34801561041557600080fd5b506104296104243660046126ab565b610bf7565b6040516102859291906126de565b34801561044357600080fd5b50600954610396565b34801561045857600080fd5b506102ae610d8a565b34801561046d57600080fd5b506104957f00000000000000000000000000000000000000000000000000000000667be25b81565b60405163ffffffff9091168152602001610285565b3480156104b657600080fd5b506102ae610e20565b3480156104cb57600080fd5b506103966104da36600461274c565b6001600160a01b031660009081526016602090815260408083206015835281842054845290915290206001015490565b34801561051657600080fd5b506102ae610e32565b34801561052b57600080fd5b506102ae610e76565b34801561054057600080fd5b50600c5460ff166040516102859190612767565b34801561056057600080fd5b506001546001600160a01b031661033b565b34801561057e57600080fd5b506102ae610eef565b34801561059357600080fd5b506102746105a236600461277a565b61ffff91909116600090815260106020908152604080832063ffffffff94851684529091529020600181015490549092911690565b3480156105e357600080fd5b506103966105f23660046127ba565b61ffff166000908152600f602052604090205463ffffffff1690565b34801561061a57600080fd5b50600454600160a01b900463ffffffff16610396565b34801561063c57600080fd5b5061027461064b3660046125ad565b610ef7565b34801561065c57600080fd5b50600b54610396565b34801561067157600080fd5b506103966106803660046127ba565b61ffff166000908152600d602052604090205490565b3480156106a257600080fd5b506102ae6106b136600461274c565b610f79565b3480156106c257600080fd5b506102ae611018565b3480156106d757600080fd5b506103966106e63660046127ba565b61ffff166000908152600e602052604090205463ffffffff1690565b34801561070e57600080fd5b5061039661071d36600461274c565b611247565b34801561072e57600080fd5b506002546001600160a01b031661033b565b34801561074c57600080fd5b506102ae61075b36600461274c565b6112a7565b34801561076c57600080fd5b5061039661077b36600461274c565b6001600160a01b031660009081526015602052604090205490565b3480156107a257600080fd5b50600554610396565b6107b3611318565b6107bb61143b565b336000908152601260205260408120805482906107d7906127d5565b91829055509050605882108015906107f15750610b488211155b6108565760405162461bcd60e51b815260206004820152602b60248201527f626c617a655374616b696e673a626c617a65207374616b65206475726174696f60448201526a1b881b9bdd081d985b1a5960aa1b60648201526084015b60405180910390fd5b60006108628484610ef7565b5090506000600660008154610876906127d5565b918290555033600090815260136020908152604080832087845290915281208290559091506108a862015180866127ee565b6108b29042612554565b905060006040518060c001604052808881526020018581526020018761ffff1681526020014263ffffffff1681526020018363ffffffff16815260200160006001811115610902576109026125cf565b90526000848152601460209081526040918290208351815590830151600180830191909155918301516002820180546060860151608087015163ffffffff908116600160301b0269ffffffff0000000000001991909216620100000265ffffffffffff1990931661ffff90951694909417919091179283168117825560a086015195965086959394919260ff60501b199091166affffffffff000000000000199091161790600160501b9084908111156109be576109be6125cf565b021790555090505060006109db6109d23390565b868a6000611465565b90508060ff166001036109f1576109f133611649565b610b47198701610a0557610a0533896117db565b610a1d336003546001600160a01b031690308b6118c5565b60408051888152602081018a9052859133917f91e6a00503577c865efb830697017859d45cac59ab84291faa9141b55bc5f23c910160405180910390a3505050505050610a6a6001600055565b5050565b610a766124e7565b6001600160a01b038316600090815260136020908152604080832085845282528083205483526014825291829020825160c0810184528154815260018083015493820193909352600282015461ffff81169482019490945263ffffffff62010000850481166060830152600160301b850416608082015292909160a084019160ff600160501b9091041690811115610b1057610b106125cf565b6001811115610b2157610b216125cf565b90525090505b92915050565b6001600160a01b0391909116600090815260116020908152604080832061ffff949094168352929052205463ffffffff8116916401000000009091046001600160601b031690565b610b7d611318565b610b8561143b565b6000610b918383611932565b600354909150610bab906001600160a01b03168483611bbc565b50610a6a6001600055565b6000806000600654600a54600a54600654610bd19190612805565b925092509250909192565b6000806000600754600854600854600754610bd19190612805565b6001600160a01b0383166000908152601260205260408120546060919080808610610c5b576040805160008082526020820190925290610c4d565b610c3a61251d565b815260200190600190039081610c325790505b506000935093505050610d82565b6000610c678688612554565b905081811115610c745750805b610c7e8782612805565b67ffffffffffffffff811115610c9657610c96612818565b604051908082528060200260200182016040528015610ccf57816020015b610cbc61251d565b815260200190600190039081610cb45790505b50945060005b81881015610d7c576040518060600160405280896001610cf59190612554565b81526001600160a01b038b166000908152601360209081526040822092019190610d208c6001612554565b8152602001908152602001600020548152602001610d458b8b60016102cb9190612554565b815250868281518110610d5a57610d5a61282e565b602002602001018190525080610d6f906127d5565b9050876001019750610cd5565b50925050505b935093915050565b610d92611318565b610d9a61143b565b6000610da66008611bf2565b9050610db26058611bf2565b610dbc9082612554565b9050610dc9610120611bf2565b610dd39082612554565b90508015610de657610de6335b82611c22565b604051819033907f2871b64e3818cfce24806c82238518bcaa75f39220abe2118583210f29c7af6090600090a350610e1e6001600055565b565b610e28611cc5565b610e1e6000611cf2565b60025433906001600160a01b03168114610e6a5760405163118cdaa760e01b81526001600160a01b038216600482015260240161084d565b610e7381611cf2565b50565b610e7e611318565b610e8661143b565b600080610e91611d0b565b60045491935091506001600160a01b0316610ebe5760405162461bcd60e51b815260040161084d90612844565b600454610ed4906001600160a01b031683611c22565b8015610ee357610ee333610de0565b5050610e1e6001600055565b610e1e611318565b8160006103cc670de0b6b3a7640000610f11605886612805565b610f1b91906127ee565b610f2591906128ae565b9050670de0b6b3a7640000610f3a82846127ee565b610f4491906128ae565b610f4e9083612554565b600554909250610f66670de0b6b3a7640000846127ee565b610f7091906128ae565b91509250929050565b610f81611cc5565b6001600160a01b038116610ff65760405162461bcd60e51b815260206004820152603660248201527f626c617a655374616b696e673a6c61737420646973747269627574696f6e20616044820152756464726573732063616e206e6f74206265207a65726f60501b606482015260840161084d565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b611020611318565b61102861143b565b600080600b546000146110435761103d611d0b565b90925090505b60006008546007546110559190612805565b9050600181116110a75760405162461bcd60e51b815260206004820152601d60248201527f626c617a655374616b696e673a6e6f2061637469766520736861726573000000604482015260640161084d565b600454600160a01b900463ffffffff166000806110c660088486611e67565b905060018160018111156110dc576110dc6125cf565b1480156110fa575060008260018111156110f8576110f86125cf565b145b1561110457600191505b61111060588486611e67565b90506001816001811115611126576111266125cf565b14801561114457506000826001811115611142576111426125cf565b145b1561114e57600191505b61115b6101208486611e67565b90506001816001811115611171576111716125cf565b14801561118f5750600082600181111561118d5761118d6125cf565b145b1561119957600191505b60018260018111156111ad576111ad6125cf565b1480156111d057506000600c5460ff1660018111156111ce576111ce6125cf565b145b156111e357600c805460ff191660011790555b6004546001600160a01b031661120b5760405162461bcd60e51b815260040161084d90612844565b851561122757600454611227906001600160a01b031687611c22565b8415611237576112373386611c22565b505050505050610e1e6001600055565b600080611255836008611f1b565b5090915061126590508183612554565b9150611272836058611f1b565b5090915061128290508183612554565b915061129083610120611f1b565b509091506112a090508183612554565b9392505050565b6112af611cc5565b600280546001600160a01b0383166001600160a01b031990911681179091556112e06001546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60045463ffffffff600160a01b909104811690600090620151809061135f907f00000000000000000000000000000000000000000000000000000000667be25b1642612805565b61136991906128ae565b611374906001612554565b90508163ffffffff168163ffffffff161115610a6a57600554600061139984846128c2565b90508360005b8263ffffffff168163ffffffff161015611403576113bc826128e6565b91506113c9600883612909565b63ffffffff166000036113fb576127106113e4607e866127ee565b6113ee91906128ae565b6113f89085612805565b93505b60010161139f565b5050506005556004805463ffffffff92909216600160a01b0263ffffffff60a01b1990921691909117905550600c805460ff19169055565b60026000540361145e57604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b6001600160a01b03841660009081526015602090815260408083205460168352818420818552909252822060010154828460018111156114a7576114a76125cf565b0361153357816000036114b957600192505b6114c38682612554565b6001600160a01b0388166000908152601660205260408120906114e5856127d5565b945084815260200190815260200160002060010181905550856007600082825461150f9190612554565b9250508190555084600960008282546115289190612554565b909155506115a89050565b61153d8682612805565b6001600160a01b03881660009081526016602052604081209061155f856127d5565b94508481526020019081526020016000206001018190555085600860008282546115899190612554565b9250508190555084600960008282546115a29190612805565b90915550505b6000600c5460ff1660018111156115c1576115c16125cf565b146115e6576004546115e190600160a01b900463ffffffff16600161292c565b6115f7565b600454600160a01b900463ffffffff165b6001600160a01b039790971660008181526016602090815260408083208684528252808320805463ffffffff191663ffffffff909c169b909b17909a5591815260159091529690962055949350505050565b6008600052600e6020527feab6bc3746954d8a0719de62c86ea908d362be2a58c781ada1046727253f9df25463ffffffff1615610e73576008600052600e6020527feab6bc3746954d8a0719de62c86ea908d362be2a58c781ada1046727253f9df2546116bd9063ffffffff16600161292c565b6001600160a01b03821660009081526011602090815260408083206008845282528220805463ffffffff191663ffffffff9485161790556058909152600e90527f5ea54d52ee8c9b980f7ee6f575aaaf3d4769efd8809d64a2e6f4c02f24b3e9225461172b9116600161292c565b6001600160a01b03821660009081526011602090815260408083206058845282528220805463ffffffff191663ffffffff948516179055610120909152600e90527f6a7f5fcd829d841f4ae5df66fd4f81e89c1ed4f8ab5607b4598ad4aaec7906785461179a9116600161292c565b6001600160a01b0391909116600090815260116020908152604080832061012084529091529020805463ffffffff191663ffffffff92909216919091179055565b6004805460408051633c42b34160e01b8152905160009384936001600160a01b031692633c42b34192818301926060928290030181865afa158015611824573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118489190612949565b509092509050600061185b600183612805565b611867906103786127ee565b905060006118778261016d612554565b90508084118015906118bc576001600160a01b0387166000908152601760209081526040808320878452909152812080548892906118b6908490612554565b90915550505b50505050505050565b6040516001600160a01b03848116602483015283811660448301526064820183905261192c9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612099565b50505050565b6001600160a01b03821660009081526013602090815260408083208484529091528120548082036119bb5760405162461bcd60e51b815260206004820152602d60248201527f626c617a655374616b696e673a626c617a65207374616b696e67207374616b6560448201526c081a59081b9bdd081d985b1a59609a1b606482015260840161084d565b6000818152601460209081526040808320815160c0810183528154815260018083015494820194909452600282015461ffff81169382019390935262010000830463ffffffff9081166060830152600160301b840416608082015292909160a0840191600160501b90910460ff1690811115611a3957611a396125cf565b6001811115611a4a57611a4a6125cf565b905250905060018160a001516001811115611a6757611a676125cf565b03611ac75760405162461bcd60e51b815260206004820152602a60248201527f626c617a655374616b696e673a626c617a65207374616b652068617320616c726044820152691958591e48195b99195960b21b606482015260840161084d565b806080015163ffffffff16421015611b2d5760405162461bcd60e51b8152602060048201526024808201527f626c617a655374616b696e673a626c617a65207374616b65206e6f74206d61746044820152631d5c995960e21b606482015260840161084d565b60208101518151611b4390879083906001611465565b50600a60008154611b53906127d5565b90915550600083815260146020526040808220600201805460ff60501b1916600160501b17905583519051909550859185916001600160a01b038a16917f7d3d1f4caaa5edea815c2f70589d94440879c198ee4240e2fdf87137d497e19b91a450505092915050565b6040516001600160a01b03838116602483015260448201839052611bed91859182169063a9059cbb906064016118fa565b505050565b6000808080611c013386611f1b565b925092509250611c19611c113390565b8683856120fc565b50909392505050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611c6f576040519150601f19603f3d011682016040523d82523d6000602084013e611c74565b606091505b5050905080611bed5760405162461bcd60e51b815260206004820181905260248201527f626c617a655374616b696e673a657468207472616e73666572206661696c6564604482015260640161084d565b6001546001600160a01b03163314610e1e5760405163118cdaa760e01b815233600482015260240161084d565b600280546001600160a01b0319169055610e7381612206565b600b54600090819080611d6b5760405162461bcd60e51b815260206004820152602260248201527f626c617a655374616b696e673a4e6f206665657320746f206469737472696275604482015261746560f01b606482015260840161084d565b6000600b55620f4240611d80610ce4836127ee565b611d8a91906128ae565b9150611d968282612805565b90506000612710611da9610cbd846127ee565b611db391906128ae565b90506000612710611dc6610a30856127ee565b611dd091906128ae565b90506000612710611de361087e866127ee565b611ded91906128ae565b905080611dfa8385612554565b611e049190612554565b611e0e9085612805565b9550611e1b600884612258565b611e26605883612258565b611e3261012082612258565b604051849033907f55083a582b32208b745a21c8ce4f8d545be8cce1437f34637f08fc9d943eacb090600090a3505050509091565b61ffff83166000908152600f602052604081205463ffffffff9081169084161015611e94575060006112a0565b611e9d84612284565b61ffff84166000908152600d602052604081205490819003611ec35760009150506112a0565b611ecf85858584612337565b61ffff85166000818152600d60205260408082208290555183929133917f330997f7612b0eba67ced5af32716e9afe967ad3b31a80bf6601294e5055feea9190a4506001949350505050565b61ffff81166000908152600e60205260408120548190819063ffffffff16611f438686610b2d565b6001600160a01b0388166000908152601560205260409020546001600160601b039091169450909250825b8263ffffffff168163ffffffff161161208f5761ffff8716600090815260106020908152604080832063ffffffff858116855292528220600181015490549092911690875b858111612030576001600160a01b038c16600090815260166020908152604080832084845290915290205463ffffffff168310612018576001600160a01b038c166000908152601660209081526040808320848452909152902060010154915061201d565b612030565b975087612029816127d5565b9050611fb3565b50821580159061203f57508015155b1561206e57670de0b6b3a764000061205784836127ee565b61206191906128ae565b61206b908a612554565b98505b61207984600161292c565b965050505080612088906128e6565b9050611f6e565b5050509250925092565b60006120ae6001600160a01b038416836123e0565b905080516000141580156120d35750808060200190518101906120d19190612977565b155b15611bed57604051635274afe760e01b81526001600160a01b038416600482015260240161084d565b6001600160a01b038416600090815260116020908152604080832061ffff8716845290915290205463ffffffff83811691161461216e576001600160a01b038416600090815260116020908152604080832061ffff871684529091529020805463ffffffff191663ffffffff84161790555b6001600160a01b038416600090815260116020908152604080832061ffff8716845290915290205464010000000090046001600160601b0316811461192c576001600160a01b038416600090815260116020908152604080832061ffff871684529091529020805464010000000067ffffffffffffffff8416026fffffffffffffffffffffffff000000001990911617905550505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61ffff82166000908152600d60205260408120805483929061227b908490612554565b90915550505050565b61ffff81166000908152600f602052604090205460045463ffffffff91821691600160a01b90910416818110611bed57600061ffff84166122c584846128c2565b6122cf9190612999565b6122da90600161292c565b90506122ea8161ffff86166129bc565b61ffff85166000908152600f60205260408120805490919061231390849063ffffffff1661292c565b92506101000a81548163ffffffff021916908363ffffffff16021790555050505050565b61ffff84166000908152600e602052604081208054829061235d9063ffffffff166128e6565b91906101000a81548163ffffffff021916908363ffffffff1602179055905082670de0b6b3a76400008361239191906127ee565b61239b91906128ae565b61ffff95909516600090815260106020908152604080832063ffffffff948516845290915290206001810195909555845463ffffffff19169316929092179092555050565b60606112a08383600084600080856001600160a01b0316848660405161240691906129e4565b60006040518083038185875af1925050503d8060008114612443576040519150601f19603f3d011682016040523d82523d6000602084013e612448565b606091505b5091509150612458868383612462565b9695505050505050565b60608261247757612472826124be565b6112a0565b815115801561248e57506001600160a01b0384163b155b156124b757604051639996b31560e01b81526001600160a01b038516600482015260240161084d565b50806112a0565b8051156124ce5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6040805160c08101825260008082526020820181905291810182905260608101829052608081018290529060a08201905b905290565b604051806060016040528060008152602001600081526020016125186124e7565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b2757610b2761253e565b80356001600160a01b038116811461257e57600080fd5b919050565b6000806040838503121561259657600080fd5b61259f83612567565b946020939093013593505050565b600080604083850312156125c057600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60028110610e7357634e487b7160e01b600052602160045260246000fd5b805182526020810151602083015261ffff6040820151166040830152606081015163ffffffff8082166060850152806080840151166080850152505060a081015161264d816125e5565b8060a0840152505050565b60c08101610b278284612603565b803561ffff8116811461257e57600080fd5b6000806040838503121561268b57600080fd5b61269483612567565b91506126a260208401612666565b90509250929050565b6000806000606084860312156126c057600080fd5b6126c984612567565b95602085013595506040909401359392505050565b60408082528351828201819052600091906020906060850190828801855b8281101561273657815180518552858101518686015286015161272187860182612603565b506101009390930192908401906001016126fc565b5050508093505050508260208301529392505050565b60006020828403121561275e57600080fd5b6112a082612567565b60208101612774836125e5565b91905290565b6000806040838503121561278d57600080fd5b61279683612666565b9150602083013563ffffffff811681146127af57600080fd5b809150509250929050565b6000602082840312156127cc57600080fd5b6112a082612666565b6000600182016127e7576127e761253e565b5060010190565b8082028115828204841417610b2757610b2761253e565b81810381811115610b2757610b2761253e565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60208082526034908201527f626c617a655374616b696e673a6c617374206379636c652064697374726962756040820152731d1a5bdb881859191c995cdcc81b9bdd081cd95d60621b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826128bd576128bd612898565b500490565b63ffffffff8281168282160390808211156128df576128df61253e565b5092915050565b600063ffffffff8083168181036128ff576128ff61253e565b6001019392505050565b600063ffffffff8084168061292057612920612898565b92169190910692915050565b63ffffffff8181168382160190808211156128df576128df61253e565b60008060006060848603121561295e57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561298957600080fd5b815180151581146112a057600080fd5b600063ffffffff808416806129b0576129b0612898565b92169190910492915050565b63ffffffff8181168382160280821691908281146129dc576129dc61253e565b505092915050565b6000825160005b81811015612a0557602081860181015185830152016129eb565b50600092019182525091905056fea26469706673582212203019c5f9d26b888715161e7d35ba0c0d227209511141d60c0d8d5f989546bf7a64736f6c63430008180033

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

000000000000000000000000fcd7ccee4071aa4ecfac1683b7cc0afecaf42a36

-----Decoded View---------------
Arg [0] : _blazeTokenAddress (address): 0xfcd7cceE4071aA4ecFAC1683b7CC0aFeCAF42A36

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000fcd7ccee4071aa4ecfac1683b7cc0afecaf42a36


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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