Token BSGGStaking

 

Overview ERC-721

Total Supply:
89 BSGGStaking

Holders:
78 addresses

Transfers:
-

Loading
[ Download CSV Export  ] 
Loading
Loading

Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
BSGGStaking

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 16 : BSGGStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "./interfaces/IBSGGStaking.sol";

contract BSGGStaking is IBSGGStaking, ERC721, ERC721Enumerable, Pausable, Ownable {
    uint32 public ticketCounter;
    uint32 public ticketTypeCounter;

    // Stake holders can withdraw the amounts they staked, no profit
    bool public emergencyMode = false;

    // Shortlisted accounts only can by tickets
    bool public privilegedMode = false;

    // Accounts which can buy tickets when privilegedMode is enbabled
    mapping(address => bool) public privilegedAccounts;

    IERC20 public immutable BSGG;

    mapping(uint => Ticket) public tickets;
    mapping(uint => TicketType) public ticketTypes;


    // If min / max limit mode is enabled
    bool public maxLimitMode = false;

    // Limit the min volumes accounts can stake
    uint public minLimitAmount;

    // Limit the max volumes accounts can stake at a time
    uint public maxLimitAmount;
    

    // Total staked amount by the account. Limiting by the maxLimitAmount;
    // ticketType => address => amount
    mapping(uint => mapping(address => uint)) public activeStaked;

    modifier allGood() {
        require(!emergencyMode, "Emergency mode is enabled. Withdrawal only");
        _;
    }

    modifier alarmed() {
        require(emergencyMode, "Emergency mode is not activated");
        _;
    }

    modifier minMaxLimit(uint _ticketTypeId, uint _amount) {
        if (maxLimitMode == true) {
            uint stakedAlready = activeStaked[_ticketTypeId][msg.sender];
            require((_amount + stakedAlready) <= maxLimitAmount, "Max staked amount per account is reached");
            require((stakedAlready + _amount) >= minLimitAmount, "Amount is less than min allowed");
        }
        _;
    }

    constructor(IERC20 _BSGG) ERC721("BSGGStaking", "BSGGStaking") {
        BSGG = _BSGG;
    }

    /// @notice Pause new Staking
    /// @return bool
    function pause() external onlyOwner returns (bool) {
        _pause();
        emit Paused(true);
        return true;
    }

    /// @notice Unpause new Staking
    /// @return bool
    function unpause() external onlyOwner returns (bool){
        _unpause();
        emit Paused(false);
        return true;
    }

    /// @notice Allocate BSGG for distribution
    /// @param _amount Amount of BSGG
    /// @param _ticketTypeId Ticket id that will be funded
    /// @return bool
    function allocateBSGG(uint _amount, uint _ticketTypeId) external onlyOwner allGood returns (bool) {
        require(_ticketTypeId < ticketTypeCounter, "Bad ticket type");
        require(ticketTypes[_ticketTypeId].active == true, "Ticket type must be active");
        require(_amount <= BSGG.balanceOf(msg.sender), "Insuficient funds");
        require(_amount <= BSGG.allowance(msg.sender, address(this)), "Allowance required");
        
        uint16 totalSeasons = uint16(ticketTypes[_ticketTypeId].seasons.length);
        uint16 currentSeason = this.currentSeasonId(_ticketTypeId);

        totalSeasons -= currentSeason;

        uint amountPerSeason = uint(_amount / totalSeasons);
        uint amountLeft = _amount;

        for (uint16 i = currentSeason; i < uint16(ticketTypes[_ticketTypeId].seasons.length); i++) {
            uint currentSeasonAmount = amountPerSeason;

            // Last season takes the rest amount in full
            if (i == (uint16(ticketTypes[_ticketTypeId].seasons.length) - 1)) {
                currentSeasonAmount = amountLeft;
            }

            if (currentSeasonAmount > 0) {
                ticketTypes[_ticketTypeId].seasons[i].BSGGAllocation += currentSeasonAmount;
                ticketTypes[_ticketTypeId].seasons[i].BSGGAllTimeAllocation += currentSeasonAmount;

                amountLeft -= currentSeasonAmount;
            }   
        }

        // Send Tokens to Staking Smart Contract
        bool success = BSGG.transferFrom(msg.sender, address(this), _amount);
        
        require(success == true, "Transfer Failed");

        emit AllocatedNewBSGG(_amount, _ticketTypeId);

        return true;
    }

    /// @notice Creates a new ticket type
    /// @param _minLockAmount Minimal amount of BSGG to stake
    /// @param _lockDuration Fund lock period in seconds
    /// @param _gainMultiplier Total reward rate per stake period (0 - 0%, 1500000 is 150%)
    /// @param _seasons Total number of seasons
    /// @return bool
    function addTicketType(
        uint128 _minLockAmount,
        uint32 _lockDuration,
        uint32 _gainMultiplier,
        uint16 _seasons
    ) external onlyOwner allGood returns (bool) {
        require(_minLockAmount >= 1 ether, "Bad minimum lock amount");
        require(_lockDuration >= 1 hours, "Lock duration is too short");
        require(_gainMultiplier > 0, "Gain multiplier lower or equal to base");
        require(_seasons > 0, "Seasons must be equal to 1 or higher");

        ticketTypes[ticketTypeCounter].id               = ticketTypeCounter;
        ticketTypes[ticketTypeCounter].active           = true;
        ticketTypes[ticketTypeCounter].minLockAmount    = _minLockAmount;
        ticketTypes[ticketTypeCounter].lockDuration     = _lockDuration;
        ticketTypes[ticketTypeCounter].gainMultiplier   = _gainMultiplier;
        ticketTypes[ticketTypeCounter].APR              = uint(_gainMultiplier) * 365 * 86400 / uint(_lockDuration);

        uint timeStart = block.timestamp;

        // Create seasons for ticket type
        for (uint16 i = 0; i < _seasons; i++) {
            Season memory s = Season({
                startTime: timeStart,
                BSGGAllocation: 0,
                BSGGAllTimeAllocation: 0,
                BSGGTotalTokensLocked: 0
            });

            ticketTypes[ticketTypeCounter].seasons.push(s);
            timeStart += _lockDuration;
        }

        ticketTypeCounter++;

        emit TicketTypeAdded(ticketTypeCounter);

        return true;
    }

    /// @notice Updates a ticket type, for new stake holders only
    /// @param _id Ticket type id
    /// @param _minLockAmount Minimal amount of BSGG to stake
    /// @param _lockDuration Fund lock period in seconds
    /// @param _gainMultiplier Total reward rate per stake period (0 - 0%, 1500000 is 150%)
    /// @return bool
    function updateTicketType(
        uint32 _id,
        uint128 _minLockAmount,
        uint32 _lockDuration,
        uint32 _gainMultiplier
    ) external onlyOwner allGood returns(bool) {
        require(_id < ticketTypeCounter, "Invalid ticket type");
        require(_minLockAmount >= 1 ether, "Invalid minimum lock amount");
        require(_lockDuration >= 1 hours, "Lock duration is too short");
        require(_gainMultiplier > 0, "Gain multiplier is lower or equal to base");

        ticketTypes[_id].minLockAmount    = _minLockAmount;
        ticketTypes[_id].lockDuration     = _lockDuration;
        ticketTypes[_id].gainMultiplier   = _gainMultiplier;
        ticketTypes[_id].APR = uint(_gainMultiplier) * 365 * 86400 / uint(_lockDuration);

        emit TicketTypeUpdated(_id);

        return true;
    }

    /// @notice Deactivate a ticket type
    /// @param _ticketTypeId Ticket type id
    /// @return bool
    function deactivateTicketType(uint32 _ticketTypeId) external onlyOwner allGood returns(bool) {
        require( _ticketTypeId < ticketTypeCounter, "Not existing ticket type id");
        ticketTypes[_ticketTypeId].active = false;

        emit TicketTypeUpdated(_ticketTypeId);

        return true;
    }

    /// @notice Activate selected ticket type
    /// @param _ticketTypeId Ticket type id
    /// @return bool
    function activateTicketType(uint32 _ticketTypeId) external onlyOwner allGood returns(bool) {
        require( _ticketTypeId < ticketTypeCounter, "Not existing ticket type id");
        ticketTypes[_ticketTypeId].active = true;

        emit TicketTypeUpdated(_ticketTypeId);

        return true;
    }

    /// @notice Stake and lock BSGG
    /// @param _amount BSGG stake amount
    /// @param _ticketTypeId ticket type id
    /// @param _to ticket receiver
    /// @return bool
    function buyTicket(
        uint _amount, 
        uint32 _ticketTypeId, 
        address _to
    ) external override whenNotPaused allGood minMaxLimit(_ticketTypeId, _amount) returns(bool) {
        require(ticketTypes[_ticketTypeId].active, "Ticket is not available");
        require(_amount >= ticketTypes[_ticketTypeId].minLockAmount, "Too small stake amount");
        require(_amount <= BSGG.balanceOf(msg.sender), "Insuficient funds");
        require(_amount <= BSGG.allowance(msg.sender, address(this)), "Allowance is required");
        
        uint amountToGain = (_amount * ticketTypes[_ticketTypeId].gainMultiplier) / 1e6;

        uint16 currentSeason = this.currentSeasonId(_ticketTypeId);

        require(amountToGain <= ticketTypes[_ticketTypeId].seasons[currentSeason].BSGGAllocation, "Sold out");

        if (privilegedMode == true) {
            require(privilegedAccounts[msg.sender] == true, "Privileged mode is enabled");
        }

        uint32 ticketId = ++ticketCounter;

        tickets[ticketId].id                 = ticketId;
        tickets[ticketId].ticketType         = _ticketTypeId;
        tickets[ticketId].seasonId           = currentSeason;
        tickets[ticketId].mintTimestamp      = block.timestamp;
        tickets[ticketId].lockedToTimestamp  = block.timestamp + ticketTypes[_ticketTypeId].lockDuration;
        tickets[ticketId].amountLocked       = _amount;
        tickets[ticketId].amountToGain       = amountToGain;

        // Re-allocate unused amount from previous seasons
        _reallocateSeasonUnallocated(_ticketTypeId, currentSeason);

        ticketTypes[_ticketTypeId].seasons[currentSeason].BSGGTotalTokensLocked += _amount;
        ticketTypes[_ticketTypeId].seasons[currentSeason].BSGGAllocation -= tickets[ticketId].amountToGain;

        activeStaked[_ticketTypeId][msg.sender] += _amount;

        (bool success) = BSGG.transferFrom(msg.sender, address(this), _amount);
        require(success == true, "Transfer Failed");

        // Mint the token
        _safeMint(_to, ticketId);

        emit TicketBought(
            _to, 
            ticketId, 
            _amount,
            tickets[ticketId].amountToGain, 
            ticketTypes[_ticketTypeId].lockDuration
        );

        return true;
    }

    /// @notice Unlock and send staked tokens and rewards to staker(with or without penalties depending on the time passed).
    /// @param _ticketId ticket type id
    /// @return bool
    function redeemTicket(uint _ticketId) external override allGood returns(bool) {
        require(ownerOf(_ticketId) == msg.sender, "Not token owner");

        (uint pendingStakeAmountToWithdraw, uint pendingRewardTokensToClaim) = this.getPendingTokens(_ticketId);
        uint totalAmountToWithdraw = pendingStakeAmountToWithdraw + pendingRewardTokensToClaim;

        require(totalAmountToWithdraw <= BSGG.balanceOf(address(this)), "Insuficient funds");

        uint totalAmountToReAllocate = (tickets[_ticketId].amountToGain - pendingRewardTokensToClaim) + (tickets[_ticketId].amountLocked - pendingStakeAmountToWithdraw);
        
        ticketTypes[tickets[_ticketId].ticketType].seasons[tickets[_ticketId].seasonId].BSGGAllocation += totalAmountToReAllocate;
        ticketTypes[tickets[_ticketId].ticketType].seasons[tickets[_ticketId].seasonId].BSGGTotalTokensLocked -= tickets[_ticketId].amountLocked;

        activeStaked[tickets[_ticketId].ticketType][msg.sender] -= tickets[_ticketId].amountLocked;

        delete tickets[_ticketId];
        _burn(_ticketId);

        (bool success) = BSGG.transfer(msg.sender, totalAmountToWithdraw);
        require(success == true, "Transfer Failed");

        emit TicketRedeemed(msg.sender, _ticketId);

        return true;
    }

    /// @notice Unlock and send staked tokens in case of emergency, staked amount only
    /// @param _ticketId ticket type id
    /// @return bool
    function redeemTicketEmergency(uint _ticketId) external alarmed returns(bool) {
        require(ownerOf(_ticketId) == msg.sender, "Not token owner");

        require(tickets[_ticketId].amountLocked <= BSGG.balanceOf(address(this)), "Insuficient funds");

        uint amountRedeem = tickets[_ticketId].amountLocked;

        delete tickets[_ticketId];
        _burn(_ticketId);

        (bool success) = BSGG.transfer(msg.sender, amountRedeem);
        require(success == true, "Transfer Failed");

        emit TicketRedeemed(msg.sender, _ticketId);

        return true;
    }

    /// @notice Get amount of staked tokens and reward
    /// @param _ticketId Ticket type id
    /// @return stakeAmount , rewardAmount
    function getPendingTokens(uint _ticketId) external view returns (uint stakeAmount, uint rewardAmount) {
        uint lockDuration = tickets[_ticketId].lockedToTimestamp - tickets[_ticketId].mintTimestamp;
        uint halfPeriodTimestamp = tickets[_ticketId].lockedToTimestamp - (lockDuration / 2);

        if (block.timestamp < tickets[_ticketId].lockedToTimestamp) {
            stakeAmount = (tickets[_ticketId].amountLocked * 800000) / 1e6; // 20% penalty applied to staked amount

            // If staked for at least the half of the period
            if (block.timestamp >= halfPeriodTimestamp){
                uint pendingReward = _calculatePendingRewards(
                    block.timestamp,
                    tickets[_ticketId].mintTimestamp,
                    tickets[_ticketId].lockedToTimestamp,
                    tickets[_ticketId].amountToGain
                );
                rewardAmount = pendingReward / 2; // The account can get 50% of pending rewards
            }
        } else { // Lock period is over. The account can receive all staked and reward tokens.
            stakeAmount = tickets[_ticketId].amountLocked;
            rewardAmount = tickets[_ticketId].amountToGain;
        }
    }

    /// @notice Checks pending rewards by the date. Returns 0 in deleted ticket Id
    /// @param _ticketId Ticket type id
    /// @return amount
    function getPendingRewards(uint _ticketId) external view returns (uint amount) {
        amount = _calculatePendingRewards(
            block.timestamp < tickets[_ticketId].lockedToTimestamp ? block.timestamp : tickets[_ticketId].lockedToTimestamp,
            tickets[_ticketId].mintTimestamp,
            tickets[_ticketId].lockedToTimestamp,
            tickets[_ticketId].amountToGain
        );
    }

    /// @notice Outputs parameters of all account tickets
    /// @param _account Account Address
    /// @return accountInfo
    function getAccountInfo(address _account) external view returns(AccountSet memory accountInfo) {
        uint countOfTicket = balanceOf(_account);
        Ticket[] memory accountTickets = new Ticket[](countOfTicket);
        uint allocatedBSGG;
        uint pendingBSGGEarning;

        for (uint i = 0; i < countOfTicket; i++){
            uint ticketId = tokenOfOwnerByIndex(_account, i);
            accountTickets[i] = tickets[ticketId];
            allocatedBSGG += tickets[ticketId].amountLocked;
            pendingBSGGEarning += this.getPendingRewards(ticketId);
        }

        accountInfo.accountTickets = accountTickets;
        accountInfo.allocatedBSGG = allocatedBSGG;
        accountInfo.pendingBSGGEarning = pendingBSGGEarning;
    }

    /// @notice Returns all available tickets and their parameters
    /// @return allTicketTypes
    function getTicketTypes() external view returns(TicketType[] memory allTicketTypes) {
        allTicketTypes = new TicketType[](ticketTypeCounter);
        for (uint i = 0; i < ticketTypeCounter; i++) {
            allTicketTypes[i] = ticketTypes[i];
        }
    }

    /// @notice TVL across all pools
    /// @return TVL Total Tokens Locked in all ticket types
    function getTVL() external view returns(uint TVL){
        for (uint i = 0; i < ticketTypeCounter; i++) {
            for (uint16 j = 0; j < ticketTypes[i].seasons.length; j++) {
                TVL += ticketTypes[i].seasons[j].BSGGTotalTokensLocked;
                TVL += ticketTypes[i].seasons[j].BSGGAllocation;
            }
        }
    }

    /// @notice Get amount the account has active staked in a ticket type
    /// @param _ticketTypeId Ticket Type ID
    /// @param _account Account
    /// @return uint
    function getActiveStaked(uint _ticketTypeId, address _account) external view returns (uint) {
        return activeStaked[_ticketTypeId][_account];
    }

    /// @notice Set emergency state
    /// @param code A security code. Requiered in case of unaccidentaly call of this function
    /// @return bool
    function triggerEmergency(uint code) external onlyOwner allGood returns(bool) {
        require(code == 111000111, "You need write 111000111");

        emergencyMode = true;
        _pause();

        emit EmergencyModeEnabled();

        return true;
    }

    /// @notice Enable PrivilegedMode, shortlisted accounts only can buy tickets
    /// @return bool
    function enablePrivilegedMode() external onlyOwner returns(bool) {
        privilegedMode = true;
        emit PrivilegedMode(privilegedMode);

        return true;
    }

    /// @notice Disable PrivilegedMode, all accounts can buy tickets
    /// @return bool
    function disablePrivilegedMode() external onlyOwner returns(bool) {
        privilegedMode = false;
        emit PrivilegedMode(privilegedMode);

        return true;
    }

    /// @notice Add previledged accounts
    /// @param _accounts Account to make privileged
    /// @return bool
    function addPrivilegedAccounts(address[] memory _accounts) external onlyOwner returns(bool) {
        require(_accounts.length < 400, "Too many accounts to add");

        for (uint16 i = 0; i < _accounts.length; i++) {
            privilegedAccounts[_accounts[i]] = true;
        }

        emit PrivilegedMode(privilegedMode);

        return true;
    }

    /// @notice Remove previledged accounts
    /// @param _accounts Account to make privileged
    /// @return bool
    function removePrivilegedAccounts(address[] memory _accounts) external onlyOwner returns(bool) {
        require(_accounts.length < 400, "Too many accounts to remove");

        for (uint16 i = 0; i < _accounts.length; i++) {
            privilegedAccounts[_accounts[i]] = false;
        }

        emit PrivilegedMode(privilegedMode);

        return true;
    }

    /// @notice Maximum allocation (balance) available for a season by ticket type id
    /// @param _ticketTypeId Ticket type id
    /// @return uint256
    function maxAllocationSeason(uint _ticketTypeId) external view returns (uint256) {
        uint currentTime = block.timestamp;
        uint maxBalance = 0;

        for (uint16 i = 0; i < ticketTypes[_ticketTypeId].seasons.length; i++) {
            if (ticketTypes[_ticketTypeId].seasons[i].startTime > currentTime) {
                break;
            }

            maxBalance += ticketTypes[_ticketTypeId].seasons[i].BSGGAllocation;
        }

        return maxBalance;
    }

    /// @notice Total staked amount (balance) by users in ticket type id
    /// @param _ticketTypeId Ticket type id
    /// @return uint256
    function amountLockedSeason(uint _ticketTypeId) external view returns (uint256) {
        uint currentTime = block.timestamp;
        uint amount = 0;

        for (uint16 i = 0; i < ticketTypes[_ticketTypeId].seasons.length; i++) {
            if (ticketTypes[_ticketTypeId].seasons[i].startTime > currentTime) {
                break;
            }

            amount += ticketTypes[_ticketTypeId].seasons[i].BSGGTotalTokensLocked;
        }

        return amount;
    }

    /// @notice Get current season id by ticket type id
    /// @param _ticketTypeId Ticket type id
    /// @return uint16
    function currentSeasonId(uint _ticketTypeId) external view returns (uint16) {
        uint currentTime = block.timestamp;

        uint16 seasonId = 0;

        for (uint16 i = 0; i < ticketTypes[_ticketTypeId].seasons.length; i++) {
            if (ticketTypes[_ticketTypeId].seasons[i].startTime > currentTime) {
                break;
            }

            seasonId = i;
        }

        return seasonId;
    }


    /// @notice Withdraw previously allocated BSGG, but only not reserved for accounts
    /// @param _amount Amount of BSGG to remove from allocation
    /// @param _ticketTypeId Ticket type id
    /// @return bool
    function withdrawNonReservedBSGG(uint _amount, uint32 _ticketTypeId, uint16 _seasonId, address _account) external onlyOwner returns(bool) {
        uint withdrawAmount = ticketTypes[_ticketTypeId].seasons[_seasonId].BSGGAllocation >= _amount ? _amount : ticketTypes[_ticketTypeId].seasons[_seasonId].BSGGAllocation;
        
        require(withdrawAmount <= BSGG.balanceOf(address(this)), "Insuficient funds");

        ticketTypes[_ticketTypeId].seasons[_seasonId].BSGGAllTimeAllocation -= withdrawAmount;
        ticketTypes[_ticketTypeId].seasons[_seasonId].BSGGAllocation -= withdrawAmount;

        (bool success) = BSGG.transfer(_account, withdrawAmount);
        require(success == true, "Transfer Failed");

        emit TicketTypeUpdated(_ticketTypeId);

        return true;
    }

    /// @notice Set Max and Min amounts for staking per account
    /// @param _minAmount Min amount
    /// @param _maxAmount Max amount
    /// @param _status Enabled true/ false
    /// @return bool
    function changeMinMaxLimits(uint _minAmount, uint _maxAmount, bool _status) external onlyOwner returns(bool) {
        require(_minAmount <= _maxAmount, "Invalid min and max amounts");

        maxLimitMode = _status;
        minLimitAmount = _minAmount;
        maxLimitAmount = _maxAmount;

        emit MinMaxLimitChanged(_minAmount, _maxAmount, _status);

        return true;
    }

    /// @notice Calculates pending rewards
    /// @return amount amount
    function _calculatePendingRewards(
        uint timestamp,
        uint mintTimestamp,
        uint lockedToTimestamp,
        uint amountToGain
    ) pure internal returns (uint amount){
        return amountToGain * (timestamp - mintTimestamp) / (lockedToTimestamp - mintTimestamp);
    }

    /// @notice Reuse unallocated balance from previous seasons
    /// @param _ticketTypeId Ticket type id
    /// @return amount
    function _reallocateSeasonUnallocated(uint _ticketTypeId, uint16 _currentSeasonId) internal returns (bool){
        uint reAllocationAmount = 0;

        for (uint16 i = 0; i < ticketTypes[_ticketTypeId].seasons.length; i++) {
            // Season is sold out
            if (ticketTypes[_ticketTypeId].seasons[i].BSGGAllocation <= 0) {
                continue;
            }

            // Current season or seson not available yet
            if (i == _currentSeasonId || ticketTypes[_ticketTypeId].seasons[i].startTime >= block.timestamp) {
                break;
            }

            reAllocationAmount += ticketTypes[_ticketTypeId].seasons[i].BSGGAllocation;
            ticketTypes[_ticketTypeId].seasons[i].BSGGAllTimeAllocation -= ticketTypes[_ticketTypeId].seasons[i].BSGGAllocation;
            ticketTypes[_ticketTypeId].seasons[i].BSGGAllocation = 0;
        }

        if (reAllocationAmount > 0) {
            ticketTypes[_ticketTypeId].seasons[_currentSeasonId].BSGGAllTimeAllocation += reAllocationAmount;
            ticketTypes[_ticketTypeId].seasons[_currentSeasonId].BSGGAllocation += reAllocationAmount;
        }

        return true;
    }
    
    function _beforeTokenTransfer(address from, address to, uint ticketId) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, ticketId);
    }

    /// @notice The following functions are overrides required by Solidity
    /// @param interfaceId Interface ID
    /// @return bool
    function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

File 2 of 16 : IBSGGStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;

interface IBSGGStaking {
    struct Ticket {
        uint128 id;
        uint32 ticketType;
        uint16 seasonId;
        uint mintTimestamp;
        uint lockedToTimestamp;
        uint amountLocked;
        uint amountToGain;
    }

    struct Season {
        uint startTime;
        uint BSGGAllocation;
        uint BSGGAllTimeAllocation;
        uint BSGGTotalTokensLocked;
    }

    struct TicketType {
        uint32 id;
        bool active;
        uint128 minLockAmount;
        uint32 lockDuration;
        uint32 gainMultiplier;
        Season[] seasons;
        uint APR;
    }

    struct AccountSet {
        Ticket[] accountTickets;
        uint allocatedBSGG;
        uint pendingBSGGEarning;
    }

    event TicketTypeAdded(uint32 ticketTypeId);
    event TicketTypeUpdated(uint32 ticketTypeId);
    event TicketBought(address owner, uint ticketId, uint stakeAmount, uint gainAmount, uint lockDuration);
    event TicketRedeemed(address owner, uint ticketId);
    event AllocatedNewBSGG(uint amount, uint ticketTypeId);
    event EmergencyModeEnabled();
    event PrivilegedMode(bool status);
    event Paused(bool status);
    event MinMaxLimitChanged(uint minAmount, uint maxAmount, bool status);


    function allocateBSGG(uint _amount, uint _ticketTypeId) external returns(bool);
    function addTicketType(uint128 _minLockAmount, uint32 _lockDuration, uint32 _gainMultiplier, uint16 _seasons) external returns(bool);
    function updateTicketType(uint32 _id, uint128 _minLockAmount, uint32 _lockDuration,uint32 _gainMultiplier) external returns(bool);
    function deactivateTicketType(uint32 _ticketTypeId) external returns(bool);
    function activateTicketType(uint32 _ticketTypeId) external returns(bool);
    function buyTicket(uint _amount, uint32 _ticketTypeId, address _to) external returns(bool);
    function redeemTicket(uint _ticketId) external returns(bool);  
    function getPendingTokens(uint _ticketId) external view returns (uint, uint);
    function getPendingRewards(uint _ticketId) external view returns (uint);
    function getAccountInfo(address _account) external view returns(AccountSet memory);
    function getTicketTypes() external view returns(TicketType[] memory);
    function getTVL() external view returns(uint);
    function getActiveStaked(uint _ticketTypeId, address _account) external view returns (uint);
    function triggerEmergency(uint code) external returns(bool);
    function enablePrivilegedMode() external returns(bool);
    function disablePrivilegedMode() external returns(bool);
    function addPrivilegedAccounts(address[] memory _accounts) external returns(bool);
    function removePrivilegedAccounts(address[] memory _accounts) external returns(bool);
    function redeemTicketEmergency(uint _ticketId) external returns(bool);
    function maxAllocationSeason(uint _ticketTypeId) external view returns (uint256);
    function currentSeasonId(uint _ticketTypeId) external view returns (uint16);
    function withdrawNonReservedBSGG(uint _amount, uint32 _ticketTypeId, uint16 _seasonId, address _account) external returns(bool);
    function changeMinMaxLimits(uint _minAmount, uint _maxAmount, bool _status) external returns(bool);

}

File 3 of 16 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 4 of 16 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 5 of 16 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 6 of 16 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 7 of 16 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 16 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 9 of 16 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 10 of 16 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

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

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 11 of 16 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 12 of 16 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 13 of 16 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

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

File 14 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 15 of 16 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

File 16 of 16 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_BSGG","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ticketTypeId","type":"uint256"}],"name":"AllocatedNewBSGG","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"EmergencyModeEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"MinMaxLimitChanged","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"PrivilegedMode","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"ticketId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gainAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockDuration","type":"uint256"}],"name":"TicketBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"ticketId","type":"uint256"}],"name":"TicketRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"ticketTypeId","type":"uint32"}],"name":"TicketTypeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"ticketTypeId","type":"uint32"}],"name":"TicketTypeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BSGG","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_ticketTypeId","type":"uint32"}],"name":"activateTicketType","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"activeStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_accounts","type":"address[]"}],"name":"addPrivilegedAccounts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_minLockAmount","type":"uint128"},{"internalType":"uint32","name":"_lockDuration","type":"uint32"},{"internalType":"uint32","name":"_gainMultiplier","type":"uint32"},{"internalType":"uint16","name":"_seasons","type":"uint16"}],"name":"addTicketType","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_ticketTypeId","type":"uint256"}],"name":"allocateBSGG","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketTypeId","type":"uint256"}],"name":"amountLockedSeason","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint32","name":"_ticketTypeId","type":"uint32"},{"internalType":"address","name":"_to","type":"address"}],"name":"buyTicket","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"changeMinMaxLimits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketTypeId","type":"uint256"}],"name":"currentSeasonId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_ticketTypeId","type":"uint32"}],"name":"deactivateTicketType","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disablePrivilegedMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enablePrivilegedMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getAccountInfo","outputs":[{"components":[{"components":[{"internalType":"uint128","name":"id","type":"uint128"},{"internalType":"uint32","name":"ticketType","type":"uint32"},{"internalType":"uint16","name":"seasonId","type":"uint16"},{"internalType":"uint256","name":"mintTimestamp","type":"uint256"},{"internalType":"uint256","name":"lockedToTimestamp","type":"uint256"},{"internalType":"uint256","name":"amountLocked","type":"uint256"},{"internalType":"uint256","name":"amountToGain","type":"uint256"}],"internalType":"struct IBSGGStaking.Ticket[]","name":"accountTickets","type":"tuple[]"},{"internalType":"uint256","name":"allocatedBSGG","type":"uint256"},{"internalType":"uint256","name":"pendingBSGGEarning","type":"uint256"}],"internalType":"struct IBSGGStaking.AccountSet","name":"accountInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketTypeId","type":"uint256"},{"internalType":"address","name":"_account","type":"address"}],"name":"getActiveStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketId","type":"uint256"}],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketId","type":"uint256"}],"name":"getPendingTokens","outputs":[{"internalType":"uint256","name":"stakeAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTVL","outputs":[{"internalType":"uint256","name":"TVL","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTicketTypes","outputs":[{"components":[{"internalType":"uint32","name":"id","type":"uint32"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint128","name":"minLockAmount","type":"uint128"},{"internalType":"uint32","name":"lockDuration","type":"uint32"},{"internalType":"uint32","name":"gainMultiplier","type":"uint32"},{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"BSGGAllocation","type":"uint256"},{"internalType":"uint256","name":"BSGGAllTimeAllocation","type":"uint256"},{"internalType":"uint256","name":"BSGGTotalTokensLocked","type":"uint256"}],"internalType":"struct IBSGGStaking.Season[]","name":"seasons","type":"tuple[]"},{"internalType":"uint256","name":"APR","type":"uint256"}],"internalType":"struct IBSGGStaking.TicketType[]","name":"allTicketTypes","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketTypeId","type":"uint256"}],"name":"maxAllocationSeason","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLimitAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLimitMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minLimitAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"privilegedAccounts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"privilegedMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketId","type":"uint256"}],"name":"redeemTicket","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ticketId","type":"uint256"}],"name":"redeemTicketEmergency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_accounts","type":"address[]"}],"name":"removePrivilegedAccounts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ticketCounter","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ticketTypeCounter","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ticketTypes","outputs":[{"internalType":"uint32","name":"id","type":"uint32"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint128","name":"minLockAmount","type":"uint128"},{"internalType":"uint32","name":"lockDuration","type":"uint32"},{"internalType":"uint32","name":"gainMultiplier","type":"uint32"},{"internalType":"uint256","name":"APR","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tickets","outputs":[{"internalType":"uint128","name":"id","type":"uint128"},{"internalType":"uint32","name":"ticketType","type":"uint32"},{"internalType":"uint16","name":"seasonId","type":"uint16"},{"internalType":"uint256","name":"mintTimestamp","type":"uint256"},{"internalType":"uint256","name":"lockedToTimestamp","type":"uint256"},{"internalType":"uint256","name":"amountLocked","type":"uint256"},{"internalType":"uint256","name":"amountToGain","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"code","type":"uint256"}],"name":"triggerEmergency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_id","type":"uint32"},{"internalType":"uint128","name":"_minLockAmount","type":"uint128"},{"internalType":"uint32","name":"_lockDuration","type":"uint32"},{"internalType":"uint32","name":"_gainMultiplier","type":"uint32"}],"name":"updateTicketType","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint32","name":"_ticketTypeId","type":"uint32"},{"internalType":"uint16","name":"_seasonId","type":"uint16"},{"internalType":"address","name":"_account","type":"address"}],"name":"withdrawNonReservedBSGG","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

60a0604052600a805461ffff60e81b19169055600e805460ff191690553480156200002957600080fd5b5060405162005e1b38038062005e1b8339810160408190526200004c91620001d2565b604080518082018252600b8082526a425347475374616b696e6760a81b60208084018281528551808701909652928552840152815191929162000092916000916200012c565b508051620000a89060019060208401906200012c565b5050600a805460ff1916905550620000c033620000d2565b6001600160a01b031660805262000240565b600a80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200013a9062000204565b90600052602060002090601f0160209004810192826200015e5760008555620001a9565b82601f106200017957805160ff1916838001178555620001a9565b82800160010185558215620001a9579182015b82811115620001a95782518255916020019190600101906200018c565b50620001b7929150620001bb565b5090565b5b80821115620001b75760008155600101620001bc565b600060208284031215620001e557600080fd5b81516001600160a01b0381168114620001fd57600080fd5b9392505050565b600181811c908216806200021957607f821691505b6020821081036200023a57634e487b7160e01b600052602260045260246000fd5b50919050565b608051615b6b620002b06000396000818161049001528181610e1d01528181611099015281816113040152818161140c015281816120b8015281816121650152818161266701528181612e4b01528181612ef8015281816131830152818161376001526138c80152615b6b6000f3fe608060405234801561001057600080fd5b506004361061038e5760003560e01c80636352211e116101de57806397b3fcaa1161010f578063c93d39f4116100ad578063e9dbebce1161007c578063e9dbebce146108d2578063eee5b15e1461097b578063f2fde38b1461098e578063f9f87c18146109a157600080fd5b8063c93d39f414610867578063de540fb91461087b578063e80195841461088e578063e985e9c51461089657600080fd5b8063b88d4fde116100e9578063b88d4fde1461081b578063c23749701461082e578063c814873f14610841578063c87b56dd1461085457600080fd5b806397b3fcaa146107f8578063a22cb46514610800578063a23080e91461081357600080fd5b80637e6c38ba1161017c5780638456cb59116101565780638456cb59146107bb5780638c4d59d0146107c35780638da5cb5b146107da57806395d89b41146107f057600080fd5b80637e6c38ba1461077257806381f1f83e146107855780638399a5011461079857600080fd5b8063715018a6116101b8578063715018a61461072457806379890eed1461072c5780637b510fe81461073f5780637cb6538c1461075f57600080fd5b80636352211e146106eb57806365b05f6e146106fe57806370a082311461071157600080fd5b80632f745c59116102c35780634dbebab6116102615780635c6a486e116102305780635c6a486e146106945780635c975abb146106a75780635cbad460146106b25780635d4bf548146106c557600080fd5b80634dbebab6146105b95780634f6ccce7146105c257806350b44712146105d5578063565f76e91461067f57600080fd5b80633f4ba83a1161029d5780633f4ba83a1461057857806342842e0e14610580578063433805e4146105935780634456abe5146105a657600080fd5b80632f745c591461052657806336b87a42146105395780633b93f5181461056557600080fd5b8063095ea7b3116103305780631b2bed521161030a5780631b2bed521461048b57806323aa35e6146104b257806323b872dd146104dd5780632d673c8d146104f057600080fd5b8063095ea7b31461045b57806315f59d7f1461047057806318160ddd1461048357600080fd5b806307e2ddfc1161036c57806307e2ddfc146103dd578063081812fc146103f457806308cf8f061461041f5780630905f5601461044757600080fd5b806301ffc9a71461039357806306fdde03146103bb578063073233a9146103d0575b600080fd5b6103a66103a1366004614fdb565b6109b4565b60405190151581526020015b60405180910390f35b6103c36109c5565b6040516103b29190615050565b600e546103a69060ff1681565b6103e660105481565b6040519081526020016103b2565b610407610402366004615063565b610a57565b6040516001600160a01b0390911681526020016103b2565b61043261042d366004615063565b610af1565b604080519283526020830191909152016103b2565b600a546103a690600160e81b900460ff1681565b61046e610469366004615093565b610bfc565b005b6103a661047e366004615063565b610d11565b6008546103e6565b6104077f000000000000000000000000000000000000000000000000000000000000000081565b6103e66104c03660046150bd565b601160209081526000928352604080842090915290825290205481565b61046e6104eb3660046150e9565b61117a565b6103e66104fe3660046150bd565b60009182526011602090815260408084206001600160a01b0393909316845291905290205490565b6103e6610534366004615093565b6111ab565b600a5461055090600160c81b900463ffffffff1681565b60405163ffffffff90911681526020016103b2565b6103a6610573366004615063565b611241565b6103a66114e8565b61046e61058e3660046150e9565b61155e565b6103a66105a136600461516c565b611579565b6103a66105b4366004615254565b6116ba565b6103e6600f5481565b6103e66105d0366004615063565b611aeb565b6106326105e3366004615063565b600c60205260009081526040902080546001820154600283015460038401546004909401546001600160801b03841694600160801b850463ffffffff1694600160a01b900461ffff1693929187565b604080516001600160801b03909816885263ffffffff909616602088015261ffff909416948601949094526060850191909152608084015260a083019190915260c082015260e0016103b2565b610687611b7e565b6040516103b29190615305565b6103a66106a2366004615063565b611d58565b600a5460ff166103a6565b6103a66106c03660046153d7565b611e54565b6106d86106d3366004615063565b6127aa565b60405161ffff90911681526020016103b2565b6104076106f9366004615063565b61282b565b6103e661070c366004615063565b6128a2565b6103e661071f366004615413565b61295e565b61046e6129e5565b6103e661073a366004615063565b612a21565b61075261074d366004615413565b612add565b6040516103b2919061542e565b6103a661076d3660046154e4565b612d1e565b6103a6610780366004615514565b613263565b6103a661079336600461554d565b61334d565b6103a66107a6366004615413565b600b6020526000908152604090205460ff1681565b6103a6613453565b600a5461055090600160a81b900463ffffffff1681565b600a5461010090046001600160a01b0316610407565b6103c36134bf565b6103e66134ce565b61046e61080e366004615568565b6135bc565b6103a66135cb565b61046e61082936600461559f565b61364d565b6103a661083c36600461565f565b613685565b6103a661084f3660046156ae565b61398f565b6103c3610862366004615063565b613c3b565b600a546103a690600160f01b900460ff1681565b6103a661088936600461516c565b613d23565b6103a6613e18565b6103a66108a43660046156f7565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6109326108e0366004615063565b600d602052600090815260409020805460029091015463ffffffff8083169260ff640100000000820416926001600160801b03600160281b83041692600160a81b8304811692600160c81b9004169086565b6040805163ffffffff978816815295151560208701526001600160801b0390941693850193909352908416606084015292909216608082015260a081019190915260c0016103b2565b6103a661098936600461554d565b613e98565b61046e61099c366004615413565b613f97565b6103e66109af366004615063565b614038565b60006109bf82614093565b92915050565b6060600080546109d490615721565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0090615721565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610ad55760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000818152600c60205260408120600181015460029091015482918291610b189190615771565b90506000610b2760028361579e565b6000868152600c6020526040902060020154610b439190615771565b6000868152600c6020526040902060020154909150421015610bd6576000858152600c6020526040902060030154620f424090610b8390620c35006157b2565b610b8d919061579e565b9350804210610bd1576000858152600c6020526040812060018101546002820154600490920154610bc0924292916140b8565b9050610bcd60028261579e565b9350505b610bf5565b6000858152600c60205260409020600381015460049091015490945092505b5050915091565b6000610c078261282b565b9050806001600160a01b0316836001600160a01b031603610c745760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610acc565b336001600160a01b0382161480610c905750610c9081336108a4565b610d025760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610acc565b610d0c83836140eb565b505050565b600a54600090600160e81b900460ff1615610d3e5760405162461bcd60e51b8152600401610acc906157d1565b33610d488361282b565b6001600160a01b031614610d905760405162461bcd60e51b815260206004820152600f60248201526e2737ba103a37b5b2b71037bbb732b960891b6044820152606401610acc565b604051630467c78360e11b815260048101839052600090819030906308cf8f06906024016040805180830381865afa158015610dd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df4919061581b565b90925090506000610e05828461583f565b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610e6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e909190615857565b811115610eaf5760405162461bcd60e51b8152600401610acc90615870565b6000858152600c6020526040812060030154610ecc908590615771565b6000878152600c6020526040902060040154610ee9908590615771565b610ef3919061583f565b6000878152600c6020818152604080842054600160801b810463ffffffff168552600d8352908420938b90529190526001909101805492935083929091600160a01b900461ffff16908110610f4a57610f4a61589b565b90600052602060002090600402016001016000828254610f6a919061583f565b90915550506000868152600c6020818152604080842060038101549054600160801b810463ffffffff168652600d8452918520948b9052929091526001909201805491929091600160a01b90910461ffff16908110610fcb57610fcb61589b565b90600052602060002090600402016003016000828254610feb9190615771565b90915550506000868152600c6020908152604080832060038101549054600160801b900463ffffffff168452601183528184203385529092528220805491929091611037908490615771565b90915550506000868152600c6020526040812080546001600160b01b03191681556001810182905560028101829055600381018290556004015561107a86614159565b60405163a9059cbb60e01b8152336004820152602481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af11580156110ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110e91906158b1565b90506001811515146111325760405162461bcd60e51b8152600401610acc906158ce565b60408051338152602081018990527f04c83e3a48b8728bb2e4bf1933322209bd98584759a94f66ef94275e0bf770de910160405180910390a16001955050505050505b919050565b6111843382614200565b6111a05760405162461bcd60e51b8152600401610acc906158f7565b610d0c8383836142f3565b60006111b68361295e565b82106112185760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610acc565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a54600090600160e81b900460ff1661129d5760405162461bcd60e51b815260206004820152601f60248201527f456d657267656e6379206d6f6465206973206e6f7420616374697661746564006044820152606401610acc565b336112a78361282b565b6001600160a01b0316146112ef5760405162461bcd60e51b815260206004820152600f60248201526e2737ba103a37b5b2b71037bbb732b960891b6044820152606401610acc565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611353573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113779190615857565b6000838152600c602052604090206003015411156113a75760405162461bcd60e51b8152600401610acc90615870565b6000828152600c6020526040812060038101805482546001600160b01b03191683556001830184905560028301849055908390556004909101919091556113ed83614159565b60405163a9059cbb60e01b8152336004820152602481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561145d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148191906158b1565b90506001811515146114a55760405162461bcd60e51b8152600401610acc906158ce565b60408051338152602081018690527f04c83e3a48b8728bb2e4bf1933322209bd98584759a94f66ef94275e0bf770de910160405180910390a15060019392505050565b600a546000906001600160a01b0361010090910416331461151b5760405162461bcd60e51b8152600401610acc90615948565b61152361449a565b604051600081527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd2906020015b60405180910390a150600190565b610d0c8383836040518060200160405280600081525061364d565b600a546000906001600160a01b036101009091041633146115ac5760405162461bcd60e51b8152600401610acc90615948565b6101908251106115fe5760405162461bcd60e51b815260206004820152601b60248201527f546f6f206d616e79206163636f756e747320746f2072656d6f766500000000006044820152606401610acc565b60005b82518161ffff16101561166e576000600b6000858461ffff168151811061162a5761162a61589b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806116668161597d565b915050611601565b50600a54604051600160f01b90910460ff16151581527f0aa853fb86ec81e4b6ffc14dd958c600259fb623caff59954180710b4cb65aec906020015b60405180910390a1506001919050565b600a546000906001600160a01b036101009091041633146116ed5760405162461bcd60e51b8152600401610acc90615948565b600a54600160e81b900460ff16156117175760405162461bcd60e51b8152600401610acc906157d1565b670de0b6b3a7640000856001600160801b031610156117785760405162461bcd60e51b815260206004820152601760248201527f426164206d696e696d756d206c6f636b20616d6f756e740000000000000000006044820152606401610acc565b610e108463ffffffff1610156117d05760405162461bcd60e51b815260206004820152601a60248201527f4c6f636b206475726174696f6e20697320746f6f2073686f72740000000000006044820152606401610acc565b60008363ffffffff16116118355760405162461bcd60e51b815260206004820152602660248201527f4761696e206d756c7469706c696572206c6f776572206f7220657175616c20746044820152656f206261736560d01b6064820152608401610acc565b60008261ffff16116118955760405162461bcd60e51b8152602060048201526024808201527f536561736f6e73206d75737420626520657175616c20746f2031206f7220686960448201526333b432b960e11b6064820152608401610acc565b600a8054600160c81b9081900463ffffffff9081166000818152600d6020526040808220805463ffffffff1916909317909255845484900483168152818120805464010000000064ff0000000019909116179055845484900483168152818120805474ffffffffffffffffffffffffffffffff00000000001916600160281b6001600160801b038d1602179055845484900483168152818120805463ffffffff60a81b1916600160a81b8b86169081029190911790915594548490048316815220805463ffffffff60c81b191691871692830291909117905561197a9061016d6157b2565b61198790620151806157b2565b611991919061579e565b600a54600160c81b900463ffffffff166000908152600d602052604081206002019190915542905b8361ffff168161ffff161015611a6157604080516080810182528381526000602080830182815283850183815260608501848152600a5463ffffffff600160c81b90910481168652600d855296852060019081018054808301825590875294909520865160049095020193845591519383019390935591516002820155905160039091015590611a4b9088168461583f565b9250508080611a599061597d565b9150506119b9565b50600a8054600160c81b900463ffffffff16906019611a7f8361599e565b82546101009290920a63ffffffff818102199093169183160217909155600a54604051600160c81b90910490911681527f67d0031ef9a2783cfeb66997e5ec2bcfbdff4d29d49ea7282c2c37a8f410f852915060200160405180910390a160019150505b949350505050565b6000611af660085490565b8210611b595760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610acc565b60088281548110611b6c57611b6c61589b565b90600052602060002001549050919050565b600a54606090600160c81b900463ffffffff1667ffffffffffffffff811115611ba957611ba9615125565b604051908082528060200260200182016040528015611c0f57816020015b6040805160e0810182526000808252602080830182905292820181905260608083018290526080830182905260a083015260c08201528252600019909201910181611bc75790505b50905060005b600a54600160c81b900463ffffffff16811015611d54576000818152600d60209081526040808320815160e081018352815463ffffffff808216835260ff6401000000008304161515838701526001600160801b03600160281b83041683860152600160a81b820481166060840152600160c81b9091041660808201526001820180548451818702810187019095528085529195929460a0870194939192919084015b82821015611d12578382906000526020600020906004020160405180608001604052908160008201548152602001600182015481526020016002820154815260200160038201548152505081526020019060010190611cb8565b505050508152602001600282015481525050828281518110611d3657611d3661589b565b60200260200101819052508080611d4c906159b7565b915050611c15565b5090565b600a546000906001600160a01b03610100909104163314611d8b5760405162461bcd60e51b8152600401610acc90615948565b600a54600160e81b900460ff1615611db55760405162461bcd60e51b8152600401610acc906157d1565b8163069dba2f14611e085760405162461bcd60e51b815260206004820152601860248201527f596f75206e6565642077726974652031313130303031313100000000000000006044820152606401610acc565b600a805460ff60e81b1916600160e81b179055611e2361452d565b6040517f2064d51aa5a8bd67928c7675e267e05c67ad5adf7c9098d0a602d01f36fda9c590600090a1506001919050565b6000611e62600a5460ff1690565b15611ea25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610acc565b600a54600160e81b900460ff1615611ecc5760405162461bcd60e51b8152600401610acc906157d1565b600e5463ffffffff841690859060ff161515600103611fc8576000828152601160209081526040808320338452909152902054601054611f0c828461583f565b1115611f6b5760405162461bcd60e51b815260206004820152602860248201527f4d6178207374616b656420616d6f756e7420706572206163636f756e74206973604482015267081c995858da195960c21b6064820152608401610acc565b600f54611f78838361583f565b1015611fc65760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206973206c657373207468616e206d696e20616c6c6f776564006044820152606401610acc565b505b63ffffffff85166000908152600d6020526040902054640100000000900460ff166120355760405162461bcd60e51b815260206004820152601760248201527f5469636b6574206973206e6f7420617661696c61626c650000000000000000006044820152606401610acc565b63ffffffff85166000908152600d6020526040902054600160281b90046001600160801b03168610156120a35760405162461bcd60e51b8152602060048201526016602482015275151bdbc81cdb585b1b081cdd185ad948185b5bdd5b9d60521b6044820152606401610acc565b6040516370a0823160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212b9190615857565b86111561214a5760405162461bcd60e51b8152600401610acc90615870565b604051636eb1769f60e11b81523360048201523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063dd62ed3e90604401602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d89190615857565b86111561221f5760405162461bcd60e51b8152602060048201526015602482015274105b1b1bddd85b98d9481a5cc81c995c5d5a5c9959605a1b6044820152606401610acc565b63ffffffff8086166000908152600d60205260408120549091620f42409161225091600160c81b90910416896157b2565b61225a919061579e565b604051630ba97ea960e31b815263ffffffff881660048201529091506000903090635d4bf54890602401602060405180830381865afa1580156122a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c591906159d0565b9050600d60008863ffffffff1681526020019081526020016000206001018161ffff16815481106122f8576122f861589b565b9060005260206000209060040201600101548211156123445760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b6044820152606401610acc565b600a54600160f01b900460ff1615156001036123be57336000908152600b602052604090205460ff1615156001146123be5760405162461bcd60e51b815260206004820152601a60248201527f50726976696c65676564206d6f646520697320656e61626c65640000000000006044820152606401610acc565b6000600a601581819054906101000a900463ffffffff166123de9061599e565b91906101000a81548163ffffffff021916908363ffffffff160217905590508063ffffffff16600c60008363ffffffff16815260200190815260200160002060000160006101000a8154816001600160801b0302191690836001600160801b0316021790555087600c60008363ffffffff16815260200190815260200160002060000160106101000a81548163ffffffff021916908363ffffffff16021790555081600c60008363ffffffff16815260200190815260200160002060000160146101000a81548161ffff021916908361ffff16021790555042600c60008363ffffffff16815260200190815260200160002060010181905550600d60008963ffffffff16815260200190815260200160002060000160159054906101000a900463ffffffff1663ffffffff1642612515919061583f565b63ffffffff8083166000908152600c602052604090206002810192909255600382018b9055600490910184905561254e908916836145a8565b5088600d60008a63ffffffff1681526020019081526020016000206001018361ffff16815481106125815761258161589b565b906000526020600020906004020160030160008282546125a1919061583f565b909155505063ffffffff8082166000908152600c6020908152604080832060040154938c168352600d9091529020600101805461ffff85169081106125e8576125e861589b565b906000526020600020906004020160010160008282546126089190615771565b909155505063ffffffff88166000908152601160209081526040808320338452909152812080548b929061263d90849061583f565b90915550506040516323b872dd60e01b8152336004820152306024820152604481018a90526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af11580156126b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126dc91906158b1565b90506001811515146127005760405162461bcd60e51b8152600401610acc906158ce565b612710888363ffffffff1661482d565b63ffffffff8083166000818152600c60209081526040808320600401548e86168452600d8352928190205481516001600160a01b038f1681529283019490945281018e90526060810191909152600160a81b90910490911660808201527f3258c82e4d9b6128d8ec7da95e838a742b003d05eb7d48dc95cb9e5bd64b17739060a00160405180910390a15060019998505050505050505050565b60004281805b6000858152600d602052604090206001015461ffff82161015612823576000858152600d60205260409020600101805484919061ffff84169081106127f7576127f761589b565b90600052602060002090600402016000015411612823579050808061281b8161597d565b9150506127b0565b509392505050565b6000818152600260205260408120546001600160a01b0316806109bf5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610acc565b60004281805b6000858152600d602052604090206001015461ffff82161015612823576000858152600d60205260409020600101805484919061ffff84169081106128ef576128ef61589b565b90600052602060002090600402016000015411612823576000858152600d60205260409020600101805461ffff831690811061292d5761292d61589b565b9060005260206000209060040201600101548261294a919061583f565b9150806129568161597d565b9150506128a8565b60006001600160a01b0382166129c95760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610acc565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03610100909104163314612a155760405162461bcd60e51b8152600401610acc90615948565b612a1f6000614847565b565b60004281805b6000858152600d602052604090206001015461ffff82161015612823576000858152600d60205260409020600101805484919061ffff8416908110612a6e57612a6e61589b565b90600052602060002090600402016000015411612823576000858152600d60205260409020600101805461ffff8316908110612aac57612aac61589b565b90600052602060002090600402016003015482612ac9919061583f565b915080612ad58161597d565b915050612a27565b612b0160405180606001604052806060815260200160008152602001600081525090565b6000612b0c8361295e565b905060008167ffffffffffffffff811115612b2957612b29615125565b604051908082528060200260200182016040528015612bad57816020015b612b9a6040518060e0016040528060006001600160801b03168152602001600063ffffffff168152602001600061ffff168152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081612b475790505b50905060008060005b84811015612d0a576000612bca88836111ab565b6000818152600c6020908152604091829020825160e08101845281546001600160801b0381168252600160801b810463ffffffff1693820193909352600160a01b90920461ffff16928201929092526001820154606082015260028201546080820152600382015460a082015260049091015460c0820152865191925090869084908110612c5a57612c5a61589b565b6020026020010181905250600c60008281526020019081526020016000206003015484612c87919061583f565b604051631f3f0f8360e31b815260048101839052909450309063f9f87c1890602401602060405180830381865afa158015612cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cea9190615857565b612cf4908461583f565b9250508080612d02906159b7565b915050612bb6565b509184526020840152604083015250919050565b600a546000906001600160a01b03610100909104163314612d515760405162461bcd60e51b8152600401610acc90615948565b600a54600160e81b900460ff1615612d7b5760405162461bcd60e51b8152600401610acc906157d1565b600a54600160c81b900463ffffffff168210612dcb5760405162461bcd60e51b815260206004820152600f60248201526e426164207469636b6574207479706560881b6044820152606401610acc565b6000828152600d6020526040902054640100000000900460ff161515600114612e365760405162461bcd60e51b815260206004820152601a60248201527f5469636b65742074797065206d757374206265206163746976650000000000006044820152606401610acc565b6040516370a0823160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612e9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ebe9190615857565b831115612edd5760405162461bcd60e51b8152600401610acc90615870565b604051636eb1769f60e11b81523360048201523060248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015612f47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6b9190615857565b831115612faf5760405162461bcd60e51b8152602060048201526012602482015271105b1b1bddd85b98d9481c995c5d5a5c995960721b6044820152606401610acc565b6000828152600d6020526040808220600101549051630ba97ea960e31b8152600481018590529091903090635d4bf54890602401602060405180830381865afa158015613000573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061302491906159d0565b905061303081836159ed565b9150600061304261ffff84168761579e565b905085825b6000878152600d602052604090206001015461ffff908116908216101561315d576000878152600d602052604090206001908101548491613087916159ed565b61ffff168261ffff16036130985750815b801561314a576000888152600d60205260409020600101805482919061ffff85169081106130c8576130c861589b565b906000526020600020906004020160010160008282546130e8919061583f565b90915550506000888152600d60205260409020600101805482919061ffff85169081106131175761311761589b565b90600052602060002090600402016002016000828254613137919061583f565b9091555061314790508184615771565b92505b50806131558161597d565b915050613047565b506040516323b872dd60e01b8152336004820152306024820152604481018890526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af11580156131d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f891906158b1565b905060018115151461321c5760405162461bcd60e51b8152600401610acc906158ce565b60408051898152602081018990527f7a3f6cc62c26fcd679d04e8e37499e402d27f498afd9f68b2dd050fc73dd5e60910160405180910390a1506001979650505050505050565b600a546000906001600160a01b036101009091041633146132965760405162461bcd60e51b8152600401610acc90615948565b828411156132e65760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206d696e20616e64206d617820616d6f756e747300000000006044820152606401610acc565b600e805460ff1916831515908117909155600f85905560108490556040805186815260208101869052908101919091527f193b8eb9b1b0774e6dd9d79c38263f2f46fcbddd9513126a79ac69fe8b341a119060600160405180910390a15060019392505050565b600a546000906001600160a01b036101009091041633146133805760405162461bcd60e51b8152600401610acc90615948565b600a54600160e81b900460ff16156133aa5760405162461bcd60e51b8152600401610acc906157d1565b600a5463ffffffff600160c81b90910481169083161061340c5760405162461bcd60e51b815260206004820152601b60248201527f4e6f74206578697374696e67207469636b6574207479706520696400000000006044820152606401610acc565b63ffffffff82166000818152600d6020908152604091829020805464ff0000000019166401000000001790559051918252600080516020615b1683398151915291016116aa565b600a546000906001600160a01b036101009091041633146134865760405162461bcd60e51b8152600401610acc90615948565b61348e61452d565b604051600181527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd290602001611550565b6060600180546109d490615721565b6000805b600a54600160c81b900463ffffffff16811015611d545760005b6000828152600d602052604090206001015461ffff821610156135a9576000828152600d60205260409020600101805461ffff83169081106135305761353061589b565b9060005260206000209060040201600301548361354d919061583f565b6000838152600d6020526040902060010180549194509061ffff83169081106135785761357861589b565b90600052602060002090600402016001015483613595919061583f565b9250806135a18161597d565b9150506134ec565b50806135b4816159b7565b9150506134d2565b6135c73383836148a1565b5050565b600a546000906001600160a01b036101009091041633146135fe5760405162461bcd60e51b8152600401610acc90615948565b600a805460ff60f01b1916600160f01b908117918290556040517f0aa853fb86ec81e4b6ffc14dd958c600259fb623caff59954180710b4cb65aec9261155092900460ff161515815260200190565b6136573383614200565b6136735760405162461bcd60e51b8152600401610acc906158f7565b61367f8484848461496f565b50505050565b600a546000906001600160a01b036101009091041633146136b85760405162461bcd60e51b8152600401610acc90615948565b63ffffffff84166000908152600d60205260408120600101805487919061ffff87169081106136e9576136e961589b565b90600052602060002090600402016001015410156137465763ffffffff85166000908152600d60205260409020600101805461ffff861690811061372f5761372f61589b565b906000526020600020906004020160010154613748565b855b6040516370a0823160e01b81523060048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156137af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137d39190615857565b8111156137f25760405162461bcd60e51b8152600401610acc90615870565b80600d60008763ffffffff1681526020019081526020016000206001018561ffff16815481106138245761382461589b565b906000526020600020906004020160020160008282546138449190615771565b909155505063ffffffff85166000908152600d60205260409020600101805482919061ffff871690811061387a5761387a61589b565b9060005260206000209060040201600101600082825461389a9190615771565b909155505060405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390526000917f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015613913573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061393791906158b1565b905060018115151461395b5760405162461bcd60e51b8152600401610acc906158ce565b60405163ffffffff87168152600080516020615b168339815191529060200160405180910390a15060019695505050505050565b600a546000906001600160a01b036101009091041633146139c25760405162461bcd60e51b8152600401610acc90615948565b600a54600160e81b900460ff16156139ec5760405162461bcd60e51b8152600401610acc906157d1565b600a5463ffffffff600160c81b909104811690861610613a445760405162461bcd60e51b8152602060048201526013602482015272496e76616c6964207469636b6574207479706560681b6044820152606401610acc565b670de0b6b3a7640000846001600160801b03161015613aa55760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206d696e696d756d206c6f636b20616d6f756e7400000000006044820152606401610acc565b610e108363ffffffff161015613afd5760405162461bcd60e51b815260206004820152601a60248201527f4c6f636b206475726174696f6e20697320746f6f2073686f72740000000000006044820152606401610acc565b60008263ffffffff1611613b655760405162461bcd60e51b815260206004820152602960248201527f4761696e206d756c7469706c696572206973206c6f776572206f7220657175616044820152686c20746f206261736560b81b6064820152608401610acc565b63ffffffff8581166000908152600d60205260409020805465010000000000600160c81b031916600160281b6001600160801b0388160263ffffffff60a81b191617600160a81b8684169081029190911763ffffffff60c81b1916600160c81b9386169384021790915590613bdc9061016d6157b2565b613be990620151806157b2565b613bf3919061579e565b63ffffffff86166000818152600d60209081526040918290206002019390935551908152600080516020615b16833981519152910160405180910390a1506001949350505050565b6000818152600260205260409020546060906001600160a01b0316613cba5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610acc565b6000613cd160408051602081019091526000815290565b90506000815111613cf15760405180602001604052806000815250613d1c565b80613cfb846149a2565b604051602001613d0c929190615a10565b6040516020818303038152906040525b9392505050565b600a546000906001600160a01b03610100909104163314613d565760405162461bcd60e51b8152600401610acc90615948565b610190825110613da85760405162461bcd60e51b815260206004820152601860248201527f546f6f206d616e79206163636f756e747320746f2061646400000000000000006044820152606401610acc565b60005b82518161ffff16101561166e576001600b6000858461ffff1681518110613dd457613dd461589b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580613e108161597d565b915050613dab565b600a546000906001600160a01b03610100909104163314613e4b5760405162461bcd60e51b8152600401610acc90615948565b600a805460ff60f01b1916908190556040517f0aa853fb86ec81e4b6ffc14dd958c600259fb623caff59954180710b4cb65aec9161155091600160f01b90910460ff161515815260200190565b600a546000906001600160a01b03610100909104163314613ecb5760405162461bcd60e51b8152600401610acc90615948565b600a54600160e81b900460ff1615613ef55760405162461bcd60e51b8152600401610acc906157d1565b600a5463ffffffff600160c81b909104811690831610613f575760405162461bcd60e51b815260206004820152601b60248201527f4e6f74206578697374696e67207469636b6574207479706520696400000000006044820152606401610acc565b63ffffffff82166000818152600d6020908152604091829020805464ff00000000191690559051918252600080516020615b1683398151915291016116aa565b600a546001600160a01b03610100909104163314613fc75760405162461bcd60e51b8152600401610acc90615948565b6001600160a01b03811661402c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610acc565b61403581614847565b50565b6000818152600c60205260408120600201546109bf90421061406b576000838152600c602052604090206002015461406d565b425b6000848152600c60205260409020600181015460028201546004909201549091906140b8565b60006001600160e01b0319821663780e9d6360e01b14806109bf57506109bf82614aa3565b60006140c48484615771565b6140ce8587615771565b6140d890846157b2565b6140e2919061579e565b95945050505050565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906141208261282b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006141648261282b565b905061417281600084614af3565b61417d6000836140eb565b6001600160a01b03811660009081526003602052604081208054600192906141a6908490615771565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000818152600260205260408120546001600160a01b03166142795760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610acc565b60006142848361282b565b9050806001600160a01b0316846001600160a01b031614806142bf5750836001600160a01b03166142b484610a57565b6001600160a01b0316145b80611ae357506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff16611ae3565b826001600160a01b03166143068261282b565b6001600160a01b03161461436a5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610acc565b6001600160a01b0382166143cc5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610acc565b6143d7838383614af3565b6143e26000826140eb565b6001600160a01b038316600090815260036020526040812080546001929061440b908490615771565b90915550506001600160a01b038216600090815260036020526040812080546001929061443990849061583f565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a5460ff166144e35760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610acc565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600a5460ff16156145735760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610acc565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586145103390565b600080805b6000858152600d602052604090206001015461ffff8216101561477d576000858152600d60205260408120600101805461ffff84169081106145f1576145f161589b565b906000526020600020906004020160010154111561476b578361ffff168161ffff16148061465957506000858152600d60205260409020600101805442919061ffff84169081106146445761464461589b565b90600052602060002090600402016000015410155b61477d576000858152600d60205260409020600101805461ffff83169081106146845761468461589b565b906000526020600020906004020160010154826146a1919061583f565b6000868152600d6020526040902060010180549193509061ffff83169081106146cc576146cc61589b565b906000526020600020906004020160010154600d60008781526020019081526020016000206001018261ffff16815481106147095761470961589b565b906000526020600020906004020160020160008282546147299190615771565b90915550506000858152600d60205260408120600101805461ffff84169081106147555761475561589b565b9060005260206000209060040201600101819055505b806147758161597d565b9150506145ad565b508015614823576000848152600d60205260409020600101805482919061ffff86169081106147ae576147ae61589b565b906000526020600020906004020160020160008282546147ce919061583f565b90915550506000848152600d60205260409020600101805482919061ffff86169081106147fd576147fd61589b565b9060005260206000209060040201600101600082825461481d919061583f565b90915550505b5060019392505050565b6135c7828260405180602001604052806000815250614afe565b600a80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036149025760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610acc565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61497a8484846142f3565b61498684848484614b31565b61367f5760405162461bcd60e51b8152600401610acc90615a3f565b6060816000036149c95750506040805180820190915260018152600360fc1b602082015290565b8160005b81156149f357806149dd816159b7565b91506149ec9050600a8361579e565b91506149cd565b60008167ffffffffffffffff811115614a0e57614a0e615125565b6040519080825280601f01601f191660200182016040528015614a38576020820181803683370190505b5090505b8415611ae357614a4d600183615771565b9150614a5a600a86615a91565b614a6590603061583f565b60f81b818381518110614a7a57614a7a61589b565b60200101906001600160f81b031916908160001a905350614a9c600a8661579e565b9450614a3c565b60006001600160e01b031982166380ac58cd60e01b1480614ad457506001600160e01b03198216635b5e139f60e01b145b806109bf57506301ffc9a760e01b6001600160e01b03198316146109bf565b610d0c838383614c2f565b614b088383614ce7565b614b156000848484614b31565b610d0c5760405162461bcd60e51b8152600401610acc90615a3f565b60006001600160a01b0384163b15614c2757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614b75903390899088908890600401615aa5565b6020604051808303816000875af1925050508015614bb0575060408051601f3d908101601f19168201909252614bad91810190615ae2565b60015b614c0d573d808015614bde576040519150601f19603f3d011682016040523d82523d6000602084013e614be3565b606091505b508051600003614c055760405162461bcd60e51b8152600401610acc90615a3f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ae3565b506001611ae3565b6001600160a01b038316614c8a57614c8581600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b614cad565b816001600160a01b0316836001600160a01b031614614cad57614cad8382614e35565b6001600160a01b038216614cc457610d0c81614ed2565b826001600160a01b0316826001600160a01b031614610d0c57610d0c8282614f81565b6001600160a01b038216614d3d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610acc565b6000818152600260205260409020546001600160a01b031615614da25760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610acc565b614dae60008383614af3565b6001600160a01b0382166000908152600360205260408120805460019290614dd790849061583f565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001614e428461295e565b614e4c9190615771565b600083815260076020526040902054909150808214614e9f576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090614ee490600190615771565b60008381526009602052604081205460088054939450909284908110614f0c57614f0c61589b565b906000526020600020015490508060088381548110614f2d57614f2d61589b565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480614f6557614f65615aff565b6001900381819060005260206000200160009055905550505050565b6000614f8c8361295e565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160e01b03198116811461403557600080fd5b600060208284031215614fed57600080fd5b8135613d1c81614fc5565b60005b83811015615013578181015183820152602001614ffb565b8381111561367f5750506000910152565b6000815180845261503c816020860160208601614ff8565b601f01601f19169290920160200192915050565b602081526000613d1c6020830184615024565b60006020828403121561507557600080fd5b5035919050565b80356001600160a01b038116811461117557600080fd5b600080604083850312156150a657600080fd5b6150af8361507c565b946020939093013593505050565b600080604083850312156150d057600080fd5b823591506150e06020840161507c565b90509250929050565b6000806000606084860312156150fe57600080fd5b6151078461507c565b92506151156020850161507c565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561516457615164615125565b604052919050565b6000602080838503121561517f57600080fd5b823567ffffffffffffffff8082111561519757600080fd5b818501915085601f8301126151ab57600080fd5b8135818111156151bd576151bd615125565b8060051b91506151ce84830161513b565b81815291830184019184810190888411156151e857600080fd5b938501935b8385101561520d576151fe8561507c565b825293850193908501906151ed565b98975050505050505050565b80356001600160801b038116811461117557600080fd5b803563ffffffff8116811461117557600080fd5b61ffff8116811461403557600080fd5b6000806000806080858703121561526a57600080fd5b61527385615219565b935061528160208601615230565b925061528f60408601615230565b9150606085013561529f81615244565b939692955090935050565b600081518084526020808501945080840160005b838110156152fa5781518051885283810151848901526040808201519089015260609081015190880152608090960195908201906001016152be565b509495945050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156153c957603f19898403018552815160e063ffffffff8251168552888201511515898601526001600160801b0388830151168886015260608083015161537d8288018263ffffffff169052565b505060808281015163ffffffff169086015260a0808301518187018390526153a7838801826152aa565b60c094850151979094019690965250509487019492509086019060010161532c565b509098975050505050505050565b6000806000606084860312156153ec57600080fd5b833592506153fc60208501615230565b915061540a6040850161507c565b90509250925092565b60006020828403121561542557600080fd5b613d1c8261507c565b60006020808352608080840185516060808588015282825180855260a094508489019150868401935060005b818110156154c157845180516001600160801b031684528881015163ffffffff168985015260408082015161ffff169085015284810151858501528781015188850152868101518785015260c090810151908401529387019360e09092019160010161545a565b505085890151604089015260408901518289015280965050505050505092915050565b600080604083850312156154f757600080fd5b50508035926020909101359150565b801515811461403557600080fd5b60008060006060848603121561552957600080fd5b8335925060208401359150604084013561554281615506565b809150509250925092565b60006020828403121561555f57600080fd5b613d1c82615230565b6000806040838503121561557b57600080fd5b6155848361507c565b9150602083013561559481615506565b809150509250929050565b600080600080608085870312156155b557600080fd5b6155be8561507c565b935060206155cd81870161507c565b935060408601359250606086013567ffffffffffffffff808211156155f157600080fd5b818801915088601f83011261560557600080fd5b81358181111561561757615617615125565b615629601f8201601f1916850161513b565b9150808252898482850101111561563f57600080fd5b808484018584013760008482840101525080935050505092959194509250565b6000806000806080858703121561567557600080fd5b8435935061568560208601615230565b9250604085013561569581615244565b91506156a36060860161507c565b905092959194509250565b600080600080608085870312156156c457600080fd5b6156cd85615230565b93506156db60208601615219565b92506156e960408601615230565b91506156a360608601615230565b6000806040838503121561570a57600080fd5b6157138361507c565b91506150e06020840161507c565b600181811c9082168061573557607f821691505b60208210810361575557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156157835761578361575b565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826157ad576157ad615788565b500490565b60008160001904831182151516156157cc576157cc61575b565b500290565b6020808252602a908201527f456d657267656e6379206d6f646520697320656e61626c65642e205769746864604082015269726177616c206f6e6c7960b01b606082015260800190565b6000806040838503121561582e57600080fd5b505080516020909101519092909150565b600082198211156158525761585261575b565b500190565b60006020828403121561586957600080fd5b5051919050565b602080825260119082015270496e737566696369656e742066756e647360781b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156158c357600080fd5b8151613d1c81615506565b6020808252600f908201526e151c985b9cd9995c8811985a5b1959608a1b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600061ffff8083168181036159945761599461575b565b6001019392505050565b600063ffffffff8083168181036159945761599461575b565b6000600182016159c9576159c961575b565b5060010190565b6000602082840312156159e257600080fd5b8151613d1c81615244565b600061ffff83811690831681811015615a0857615a0861575b565b039392505050565b60008351615a22818460208801614ff8565b835190830190615a36818360208801614ff8565b01949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600082615aa057615aa0615788565b500690565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615ad890830184615024565b9695505050505050565b600060208284031215615af457600080fd5b8151613d1c81614fc5565b634e487b7160e01b600052603160045260246000fdfed5e204f643fa6c376ac49a403c65814ba19235eb4fedbef36e5eee44fa40417da264697066735822122007dfdbf18594e1bbab536be298f23f46edeba3dbf9a0b3915dd9ce6a1858e99464736f6c634300080d00330000000000000000000000005a33869045db8a6a16c9f351293501cfd92cf7ed

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

0000000000000000000000005a33869045db8a6a16c9f351293501cfd92cf7ed

-----Decoded View---------------
Arg [0] : _BSGG (address): 0x5a33869045db8a6a16c9f351293501cfd92cf7ed

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000005a33869045db8a6a16c9f351293501cfd92cf7ed


Loading