Contract 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x8d3824219d07993737b6bfe555efb90c281a41b2b8dd33e3b9edc39e783a34720x60806040251401532022-09-18 15:55:40142 days 11 hrs ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Create: SmolRacing0 ETH0.00095559
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x7619feb593bf19189234b9dca1ca1f93874242d1625813bba699970f05c22e6a260207972022-09-22 18:41:42138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xcd96921ef85c3d46f50b7ad3123d81aedb9dd926d8d7e2429dc729bafc6a4f9d260207942022-09-22 18:41:41138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x2311aa53a4c5aaa1c0c3419c4955fdbb9c7966767eabcc5a25cb98cdc7c8f764260206472022-09-22 18:40:55138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x2311aa53a4c5aaa1c0c3419c4955fdbb9c7966767eabcc5a25cb98cdc7c8f764260206472022-09-22 18:40:55138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x2311aa53a4c5aaa1c0c3419c4955fdbb9c7966767eabcc5a25cb98cdc7c8f764260206472022-09-22 18:40:55138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xa6b01ccc7b513fddd89d7c3fa1f09186ef1392cdcb0afefeaa1b2d5473fa97e6260206272022-09-22 18:40:46138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xba9eb6703635bbeb844b39b1c51808479b03e025e44be36b2f0d33deff2f8f60260206132022-09-22 18:40:41138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xba9eb6703635bbeb844b39b1c51808479b03e025e44be36b2f0d33deff2f8f60260206132022-09-22 18:40:41138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xba9eb6703635bbeb844b39b1c51808479b03e025e44be36b2f0d33deff2f8f60260206132022-09-22 18:40:41138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x4975825bee03b6f415068bd8fba3cbeb29927ed5847090b3b9b8edd3e28623ee260204172022-09-22 18:39:29138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xb86902565c96d0bdae7047cfd3cd24f816d7d2f97cda4ef2d3910c2bc2b7a24d260203992022-09-22 18:39:19138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x7bbe048f923d06400a8a6cd0230256950a93cf87774527fb5181c02e714ff1b2260203802022-09-22 18:39:13138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0xae3ef1763c9b7dc87964ef2bf1e3f7b57c937bf34022c2b96cd34461211902b8260201262022-09-22 18:37:45138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x6b946f372c051631820ad118c1a015c5ad2d6dfa1eeb75348a7fe8e167639fc7260196932022-09-22 18:35:25138 days 8 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x47abbc3a36e7f9a0d286c2368fded276b8343db5ba398ef4d8b0537ed9dfeb42260191582022-09-22 18:32:09138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x47abbc3a36e7f9a0d286c2368fded276b8343db5ba398ef4d8b0537ed9dfeb42260191582022-09-22 18:32:09138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x47abbc3a36e7f9a0d286c2368fded276b8343db5ba398ef4d8b0537ed9dfeb42260191582022-09-22 18:32:09138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x000438a10f2780c957309ef04a833fb8a64b8a1811dac38a5ee70f174755f6a5260191312022-09-22 18:31:49138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x547d9ad826439810005c06cd6c44f6eecb8f4c9192aeedd2a1ba0f7c4beb3178260190332022-09-22 18:30:56138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x4ed53ced82a31db9c38ca7dff09bd87e9564b256bbbcf79e87b85d2d921cb3ed260188082022-09-22 18:29:24138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x4ed53ced82a31db9c38ca7dff09bd87e9564b256bbbcf79e87b85d2d921cb3ed260188082022-09-22 18:29:24138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x4ed53ced82a31db9c38ca7dff09bd87e9564b256bbbcf79e87b85d2d921cb3ed260188082022-09-22 18:29:24138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x362fce515eeb40821c6616a2c26c6ec03ec1812c7702ddec894c5a2507ab36c6260188032022-09-22 18:29:19138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x2e2b6d479d256b27e7511299199f5611513360cb2ac576e5fcd35edfe4d4e2bb260187452022-09-22 18:28:53138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
0x2e2b6d479d256b27e7511299199f5611513360cb2ac576e5fcd35edfe4d4e2bb260187452022-09-22 18:28:53138 days 9 hrs ago 0xec895f620d1c103d5bbc85cce3b623c958ce35cc 0xad467e7a4ed144c16e8ac9495e969d8e3783d9f20 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SmolRacing

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 30 : SmolRacing.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import "./ISmolRacing.sol";
import "./SmolRacingAdmin.sol";

contract SmolRacing is Initializable, ISmolRacing, ReentrancyGuardUpgradeable, SmolRacingAdmin {

    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    // -------------------------------------------------------------
    //                         Initializer
    // -------------------------------------------------------------

    function initialize() external initializer {
        SmolRacingAdmin.__SmolRacingAdmin_init();
    }

    // -------------------------------------------------------------
    //                      External functions
    // -------------------------------------------------------------

    function stakeVehicles(
        SmolCar[] calldata _cars,
        Swolercycle[] calldata _cycles)
    external
    nonReentrant
    contractsAreSet
    whenNotPaused
    {
        require(_cars.length > 0 || _cycles.length > 0, "no tokens given");
        for(uint256 i = 0; i < _cars.length; i++) {
            SmolCar calldata car = _cars[i];
            require(car.numDrivers > 0, "no car drivers given");
            // validation occurs in _stakeVehicleStart
            _stakeVehicle(smolBrains, address(smolCars), Vehicle({
                driverIds: car.driverIds,
                vehicleId: car.carId,
                numRaces: car.numRaces,
                numDrivers: car.numDrivers,
                boostTreasureIds: car.boostTreasureIds,
                boostTreasureQuantities: car.boostTreasureQuantities
            }));
        }
        for(uint256 i = 0; i < _cycles.length; i++) {
            Swolercycle calldata cycle = _cycles[i];
            require(cycle.numDrivers > 0, "no cycle drivers given");
            // validation occurs in _stakeVehicleStart
            uint64[4] memory drivers;
            drivers[0] = cycle.driverIds[0];
            drivers[1] = cycle.driverIds[1];
            _stakeVehicle(smolBodies, address(swolercycles), Vehicle({
                driverIds: drivers,
                vehicleId: cycle.cycleId,
                numRaces: cycle.numRaces,
                numDrivers: cycle.numDrivers,
                boostTreasureIds: cycle.boostTreasureIds,
                boostTreasureQuantities: cycle.boostTreasureQuantities
            }));
        }
    }

    function unstakeVehicles(
        uint256[] calldata _carTokens,
        uint256[] calldata _cycleTokens)
    external
    nonReentrant
    contractsAreSet
    whenNotPaused
    {
        require(_carTokens.length > 0 || _cycleTokens.length > 0, "no tokens given");
        for(uint256 i = 0; i < _carTokens.length; i++) {
            _unstakeVehicle(smolBrains, address(smolCars), _carTokens[i]);
        }
        for(uint256 i = 0; i < _cycleTokens.length; i++) {
            _unstakeVehicle(smolBodies, address(swolercycles), _cycleTokens[i]);
        }
    }

    function claimRewardsForVehicles(
        uint256[] calldata _carTokens,
        uint256[] calldata _cycleTokens)
    external
    nonReentrant
    contractsAreSet
    whenNotPaused
    {
        require(_carTokens.length > 0 || _cycleTokens.length > 0, "no tokens given");
        for(uint256 i = 0; i < _carTokens.length; i++) {
           _claimRewardsForVehicle(address(smolCars), _carTokens[i]);
        }
        for(uint256 i = 0; i < _cycleTokens.length; i++) {
           _claimRewardsForVehicle(address(swolercycles), _cycleTokens[i]);
        }
    }

    function ownsVehicle(address _collection, address _owner, uint256 _tokenId) external view returns (bool) {
        return userToVehiclesStaked[_collection][_owner].contains(_tokenId);
    }

    function vehiclesOfOwner(address _collection, address _owner) external view returns (uint256[] memory) { 
        return userToVehiclesStaked[_collection][_owner].values();
    }

    // Gassy, do not call from other contracts
    function smolsOfOwner(address _collection, address _owner) external view returns (uint256[] memory) { 
        uint256[] memory vehicles = userToVehiclesStaked[_collection][_owner].values();
        uint256 numDrivers;
        for (uint i = 0; i < vehicles.length; i++) {
            uint256 vehicleId = vehicles[i];
            numDrivers += vehicleIdToVehicleInfo[_collection][vehicleId].numDrivers;
        }

        uint256[] memory retVal = new uint256[](numDrivers);
        for (uint i = 0; i < vehicles.length; i++) {
            Vehicle memory vehicleInfo = vehicleIdToVehicleInfo[_collection][vehicles[i]];
            // numDrivers may be < 4 if the vehicle isn't full of smols
            for (uint j = 0; j < vehicleInfo.numDrivers; j++) {
                uint256 driverCur = vehicleInfo.driverIds[j];
                if(driverCur == 0) {
                    continue;
                }
                retVal[i + j] = driverCur;
            }
        }
        return retVal;
    }

    //Will return 0 if vehicle isnt staked or there are no races to claim
    function numberOfRacesToClaim(address _vehicleAddress, uint256 _tokenId) public view returns(uint256) {
        uint64 curTime = (endEmissionTime == 0 || block.timestamp < endEmissionTime)
            ? uint64(block.timestamp) : uint64(endEmissionTime);

        RacingInfo memory _info = vehicleIdToRacingInfo[_vehicleAddress][_tokenId];

        // Not staked, otherwise this would be the timestamp that the user was staked at
        if(_info.lastClaimed == 0) {
            return 0;
        }

        uint8 maxAvailable = _info.totalRaces - _info.racesCompleted;
        uint256 uncappedPending = (curTime - _info.lastClaimed) / timeForReward;

        if(uncappedPending > maxAvailable) {
            return maxAvailable;
        }
        return uncappedPending;
    }

    //Will return 0 if vehicle isnt staked or there are no races to claim
    function vehicleOddsBoost(address _vehicleAddress, uint256 _tokenId) public view returns(uint256) {
        return vehicleIdToRacingInfo[_vehicleAddress][_tokenId].boostedOdds;
    }

    // -------------------------------------------------------------
    //                       Private functions
    // -------------------------------------------------------------

    function _stakeVehicle(IERC721 _smol, address _vehicleAddress, Vehicle memory _vehicle) private {
        require(_vehicle.driverIds.length > 0, "No drivers");

        userToVehiclesStaked[_vehicleAddress][msg.sender].add(_vehicle.vehicleId);
        vehicleIdToVehicleInfo[_vehicleAddress][_vehicle.vehicleId] = _vehicle;
        uint64 curTime = uint64(block.timestamp);
        vehicleIdToRacingInfo[_vehicleAddress][_vehicle.vehicleId] = RacingInfo({
            racingStartTime: curTime,
            totalRaces: _vehicle.numRaces,
            racesCompleted: 0,
            lastClaimed: curTime,
            boostedOdds: _calculateBoostOdds(_vehicleAddress, _vehicle)
        });

        uint256 numDrivers;
        for (uint i = 0; i < _vehicle.driverIds.length; i++) {
            // Doesn't have to have a full vehicle
            if(_vehicle.driverIds[i] == 0) {
                break;
            }
            numDrivers += 1;
            // will revert if does not own
            _smol.safeTransferFrom(msg.sender, address(this), _vehicle.driverIds[i]);
            emit SmolStaked(msg.sender, address(_smol), _vehicle.driverIds[i], curTime);
        }

        // Verify that the given number of drivers match the array.
        // This info is needed to not have to loop for every claim
        require(numDrivers == _vehicle.numDrivers, "incorrect number of drivers given");

        // will revert if does not own
        IERC721(_vehicleAddress).safeTransferFrom(msg.sender, address(this), _vehicle.vehicleId);

        uint256 _requestId = randomizer.requestRandomNumber();
        // always set this, as it will re-set any previous request ids
        //  to get new randoms when staking/unstaking
        tokenIdToRequestId[_vehicleAddress][_vehicle.vehicleId] = _requestId;

        emit StartRacing(
            msg.sender,
            _vehicleAddress,
            _vehicle.vehicleId,
            curTime,
            _vehicle.numRaces,
            _vehicle.driverIds,
            _requestId
        );
    }

    function _unstakeVehicle(IERC721 _smol, address _vehicleAddress, uint256 _tokenId) private {
        require(userToVehiclesStaked[_vehicleAddress][msg.sender].contains(_tokenId), "token not staked");

        // store needed state in memory
        Vehicle memory vehicleInfo = vehicleIdToVehicleInfo[_vehicleAddress][_tokenId];
        RacingInfo memory racingInfo = vehicleIdToRacingInfo[_vehicleAddress][_tokenId];
        uint256 pendingRaceRewards = numberOfRacesToClaim(_vehicleAddress, _tokenId);

        // Must finish their racing circuit before returning
        require(racingInfo.racesCompleted + pendingRaceRewards >= racingInfo.totalRaces, "not done racing");

        // remove state
        delete vehicleIdToVehicleInfo[_vehicleAddress][_tokenId];
        delete vehicleIdToRacingInfo[_vehicleAddress][_tokenId];
        userToVehiclesStaked[_vehicleAddress][msg.sender].remove(_tokenId);

        // claim any rewards pending
        if(pendingRaceRewards > 0) {
            _claimRewards(pendingRaceRewards, _vehicleAddress, _tokenId, racingInfo);
        }

        // unstake all
        uint64 curTime = uint64(block.timestamp);
        for (uint i = 0; i < vehicleInfo.driverIds.length; i++) {
            // Doesn't have to have a full vehicle
            if(vehicleInfo.driverIds[i] == 0) {
                break;
            }
            _smol.safeTransferFrom(address(this), msg.sender, vehicleInfo.driverIds[i]);
            emit SmolUnstaked(msg.sender, address(_smol), vehicleInfo.driverIds[i]);
        }

        IERC721(_vehicleAddress).safeTransferFrom(address(this), msg.sender, vehicleInfo.vehicleId);

        emit StopRacing(
            msg.sender,
            _vehicleAddress,
            vehicleInfo.vehicleId,
            curTime,
            vehicleInfo.numRaces
        );
    }

    function _claimRewardsForVehicle(address _vehicleAddress, uint256 _tokenId) private {
        require(userToVehiclesStaked[_vehicleAddress][msg.sender].contains(_tokenId), "not vehicle owner");

        uint256 count = numberOfRacesToClaim(_vehicleAddress, _tokenId);
        require(count > 0, "nothing to claim");

        RacingInfo memory racingInfo = vehicleIdToRacingInfo[_vehicleAddress][_tokenId];
        racingInfo.lastClaimed += uint64(count * timeForReward);

        _claimRewards(count, _vehicleAddress, _tokenId, racingInfo);
        
        racingInfo.racesCompleted += uint8(count);

        vehicleIdToRacingInfo[_vehicleAddress][_tokenId] = racingInfo;
    }

    function _claimRewards(uint256 numRewards, address _vehicleAddress, uint256 _tokenId, RacingInfo memory _info) private {
        uint256 seed = _getRandomSeedForVehicle(_vehicleAddress, _tokenId);
        for (uint i = 0; i < numRewards; i++) {
            uint256 curRace = _info.racesCompleted + i + 1;
            uint256 random = uint256(keccak256(abi.encode(seed, curRace)));
            _claimReward(_vehicleAddress, _tokenId, _info.boostedOdds, random);
        }
    }

    function _claimReward(address _vehicleAddress, uint256 _tokenId, uint32 _boostedOdds, uint256 _randomNumber) private {
        uint256 _rewardResult = (_randomNumber % ODDS_DENOMINATOR) + _boostedOdds;
        if(_rewardResult >= ODDS_DENOMINATOR) {
            _rewardResult = ODDS_DENOMINATOR - 1; // This is the 0 based max value for modulus
        }

        uint256 _topRange = 0;
        uint256 _claimedRewardId = 0;
        for(uint256 i = 0; i < rewardOptions.length; i++) {
            uint256 _rewardId = rewardOptions[i];
            _topRange += rewardIdToOdds[_rewardId];
            if(_rewardResult < _topRange) {
                // _rewardId of 0 denotes that a reward should not be minted (bad luck roll)
                if(_rewardId != 0) {
                    _claimedRewardId = _rewardId;

                    // Each driver earns a reward
                    racingTrophies.mint(msg.sender, _claimedRewardId, 1);
                }
                break; // always break to avoid walking the array
            }
        }
        if(_claimedRewardId > 0) {
            emit RewardClaimed(msg.sender, _vehicleAddress, _tokenId, _claimedRewardId, 1);
        }
        else {
            emit NoRewardEarned(msg.sender, _vehicleAddress, _tokenId);
        }
    }

    function _calculateBoostOdds(address _vehicleAddress, Vehicle memory _vehicle) private returns (uint32 boostOdds_) {
        // Additional driver boosts
        if(_vehicleAddress == address(smolCars)) {
            boostOdds_ += ((_vehicle.numDrivers - 1) * additionalSmolBrainBoost); 
        }
        else if(_vehicleAddress == address(swolercycles)) {
            if(_vehicle.numDrivers == 2) {
                boostOdds_ += additionalSmolBodyBoost; 
            }
        }

        // Treasure boosts
        uint256 numBoostItems = _vehicle.boostTreasureIds.length;
        require(numBoostItems == _vehicle.boostTreasureQuantities.length, "Number of treasures much match quantities");
        for (uint i = 0; i < numBoostItems; i++) {
            // burn vs burnBatch because we are already looping which batch would also do
            treasures.burn(msg.sender, _vehicle.boostTreasureIds[i], _vehicle.boostTreasureQuantities[i]);
            
            uint32 boostPerItem = smolTreasureIdToOddsBoost[_vehicle.boostTreasureIds[i]];
            boostOdds_ += boostPerItem * _vehicle.boostTreasureQuantities[i];
        }
        if(boostOdds_ > maxOddsBoostAllowed) {
            // Cannot exceed the max amount of boosted odds
            boostOdds_ = maxOddsBoostAllowed;
        }
    }

    function _getRandomSeedForVehicle(address _vehicleAddress, uint256 _tokenId) private view returns (uint256) {
        uint256 _requestId = tokenIdToRequestId[_vehicleAddress][_tokenId];
        // No need to do sanity checks as they already happen inside of the randomizer
        return randomizer.revealRandomNumber(_requestId);
    }

}

File 2 of 30 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 3 of 30 : ERC1155BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC1155Upgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {
    function __ERC1155Burnable_init() internal onlyInitializing {
    }

    function __ERC1155Burnable_init_unchained() internal onlyInitializing {
    }
    function burn(
        address account,
        uint256 id,
        uint256 value
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 4 of 30 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 5 of 30 : ISmolRacing.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


interface ISmolRacing {
}

File 6 of 30 : SmolRacingAdmin.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./SmolRacingState.sol";

abstract contract SmolRacingAdmin is Initializable, SmolRacingState {

    // -------------------------------------------------------------
    //                         Initializer
    // -------------------------------------------------------------

    function __SmolRacingAdmin_init() internal initializer {
        SmolRacingState.__SmolRacingState_init();
    }

    // -------------------------------------------------------------
    //                      External functions
    // -------------------------------------------------------------

    function setContracts(
        address _treasures,
        address _smolBrains,
        address _smolBodies,
        address _smolCars,
        address _swolercycles,
        address _racingTrophies,
        address _randomizer)
    external requiresEitherRole(ADMIN_ROLE, OWNER_ROLE)
    {
        treasures = ISmolTreasures(_treasures);
        smolBrains = IERC721(_smolBrains);
        smolBodies = IERC721(_smolBodies);
        smolCars = IERC721(_smolCars);
        swolercycles = IERC721(_swolercycles);
        racingTrophies = ISmolRacingTrophies(_racingTrophies);
        randomizer = IRandomizer(_randomizer);
    }

    function setRewards(
        uint256[] calldata _rewardIds,
        uint32[] calldata _rewardOdds)
    external
    requiresEitherRole(ADMIN_ROLE, OWNER_ROLE)
    {
        require(_rewardIds.length == _rewardOdds.length, "Bad lengths");

        delete rewardOptions;

        uint32 _totalOdds;
        for(uint256 i = 0; i < _rewardIds.length; i++) {
            _totalOdds += _rewardOdds[i];

            rewardOptions.push(_rewardIds[i]);
            rewardIdToOdds[_rewardIds[i]] = _rewardOdds[i];
        }

        require(_totalOdds == ODDS_DENOMINATOR, "Bad total odds");
    }

    function setTimeForReward(uint256 _rewardTime) external requiresEitherRole(ADMIN_ROLE, OWNER_ROLE) {
        timeForReward = _rewardTime;
    }

    function setEndTimeForEmissions(uint256 _endTime) external requiresEitherRole(ADMIN_ROLE, OWNER_ROLE) {
        endEmissionTime = _endTime;
    }

    // -------------------------------------------------------------
    //                           Modifiers
    // -------------------------------------------------------------

    modifier contractsAreSet() {
        require(areContractsSet(), "Contracts aren't set");
        _;
    }

    function areContractsSet() public view returns(bool) {
        return address(treasures) != address(0)
            && address(randomizer) != address(0)
            && address(smolBrains) != address(0)
            && address(smolBodies) != address(0)
            && address(smolCars) != address(0)
            && address(swolercycles) != address(0)
            && address(racingTrophies) != address(0);
    }
}

File 7 of 30 : AddressUpgradeable.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 AddressUpgradeable {
    /**
     * @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 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 30 : ERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155Upgradeable.sol";
import "./IERC1155ReceiverUpgradeable.sol";
import "./extensions/IERC1155MetadataURIUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {
    using AddressUpgradeable for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    function __ERC1155_init(string memory uri_) internal onlyInitializing {
        __ERC1155_init_unchained(uri_);
    }

    function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);
    }

    /**
     * @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, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[47] private __gap;
}

File 9 of 30 : IERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 10 of 30 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 11 of 30 : IERC1155MetadataURIUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155Upgradeable.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 12 of 30 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 14 of 30 : IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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 15 of 30 : SmolRacingState.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../../shared/UtilitiesV2Upgradeable.sol";
import "../../shared/randomizer/IRandomizer.sol";
import "../treasures/ISmolTreasures.sol";
import "../racingtrophy/ISmolRacingTrophies.sol";

abstract contract SmolRacingState is
    Initializable,
    UtilitiesV2Upgradeable,
    ERC721HolderUpgradeable
{
    event SmolStaked(
        address indexed _owner,
        address indexed _smolAddress,
        uint256 indexed _tokenId,
        uint64 _stakeTime
    );
    event StartRacing(
        address indexed _owner,
        address indexed _vehicleAddress,
        uint256 indexed _tokenId,
        uint64 _stakeTime,
        uint8 _totalRaces,
        uint64[4] _driverIds,
        uint256 _requestId
    );
    event StopRacing(
        address indexed _owner,
        address indexed _vehicleAddress,
        uint256 indexed _tokenId,
        uint64 _stakeTime,
        uint8 _totalRaces
    );
    event SmolUnstaked(
        address indexed _owner,
        address indexed _smolAddress,
        uint256 indexed _tokenId
    );
    event RewardClaimed(
        address indexed _owner,
        address indexed _vehicleAddress,
        uint256 indexed _tokenId,
        uint256 _claimedRewardId,
        uint256 _amount
    );
    event NoRewardEarned(
        address indexed _owner,
        address indexed _vehicleAddress,
        uint256 indexed _tokenId
    );

    ISmolRacingTrophies public racingTrophies;
    ISmolTreasures public treasures;

    IRandomizer public randomizer;

    IERC721 public smolBrains;
    IERC721 public smolBodies;
    IERC721 public smolCars;
    IERC721 public swolercycles;

    // collection address -> user address -> tokens staked for collection
    // collection address can be either SmolCars or Swolercycles
    // token staked is the tokenId of the SmolCar or Swolercycle
    // data for staked smols is in the following mapping
    mapping(address => mapping(address => EnumerableSetUpgradeable.UintSet))
        internal userToVehiclesStaked;

    // collection address => tokenId => Vehicle
    // collection address can be either SmolCars or Swolercycles
    // tokenId is the id of the SmolCar or Swolercycle
    // Vehicle contains ids of who is inside the vehicle and other racing info
    // It is assumed that SmolCars have SmolBrains in them, and Swolercycles have SmolBodies in them
    mapping(address => mapping(uint256 => Vehicle))
        internal vehicleIdToVehicleInfo;

    // collection address => tokenId => Vehicle
    // collection address can be either SmolCars or Swolercycles
    // tokenId is the id of the SmolCar or Swolercycle
    // RacingInfo contains metadata for calculating rewards and determining unstake-ability
    mapping(address => mapping(uint256 => RacingInfo))
        internal vehicleIdToRacingInfo;

    // collection address -> tokenId -> info
    // collection address can be either SmolCars or Swolercycles
    // tokenId is the id of the SmolCar or Swolercycle
    mapping(address => mapping(uint256 => uint256)) public tokenIdToRequestId;

    mapping(address => mapping(uint256 => uint256))
        public tokenIdToStakeStartTime;
    mapping(address => mapping(uint256 => uint256))
        public tokenIdToRewardsClaimed;
    mapping(address => mapping(uint256 => uint256))
        public tokenIdToRewardsInProgress;

    mapping(uint256 => uint32) public smolTreasureIdToOddsBoost;

    uint32 public constant ODDS_DENOMINATOR = 100_000_000;
    uint32 public maxOddsBoostAllowed;
    uint32 public additionalSmolBrainBoost;
    uint32 public additionalSmolBodyBoost;

    uint256[] public rewardOptions;
    // Odds out of 100,000,000
    // treasureTokenId -> Odds of getting reward
    mapping(uint256 => uint32) public rewardIdToOdds;

    uint256 public timeForReward;

    uint256 public endEmissionTime;

    function __SmolRacingState_init() internal initializer {
        UtilitiesV2Upgradeable.__Utilities_init();
        ERC721HolderUpgradeable.__ERC721Holder_init();

        timeForReward = 1 days;

        // Odds are calculated out of 100,000,000 (100 million). This is to obtain the 6 digit precision needed for treasure boost amounts
        // .667% increase per smol after the first one (since the max in a car is 4, caps at 2.001%)
        additionalSmolBrainBoost = 667_000;
        // Having a second body on a cycle increases odds by 1%
        additionalSmolBodyBoost = 1_000_000; // 1 million out of 100 million is 1%
        maxOddsBoostAllowed = 2_500_000; // 2.5% max boost

        uint256 moonrockId = 1;
        uint256 stardustId = 2;
        uint256 cometShardId = 3;
        uint256 lunarGoldId = 4;

        smolTreasureIdToOddsBoost[moonrockId] = 2;     // 0.000002% increase per moonrock
        smolTreasureIdToOddsBoost[stardustId] = 5;     // 0.000005% increase per stardust
        smolTreasureIdToOddsBoost[cometShardId] = 12;  // 0.000012% increase per comet shard
        smolTreasureIdToOddsBoost[lunarGoldId] = 27;   // 0.000027% increase per lunar gold

        // rewards setup after initialization
    }

    struct BoostItem {
        uint64 treasureId;
        uint64 quantity;
    }

    struct BoostItemOdds {
        uint64 quantityNeededForBoost;
        uint32 oddsBoostPerQuantity;
    }

    struct SmolCar {
        uint64[4] driverIds;
        uint64 carId;
        uint8 numRaces;
        uint8 numDrivers;
        uint64[] boostTreasureIds;
        uint32[] boostTreasureQuantities;
    }

    struct Swolercycle {
        uint64[2] driverIds;
        uint64 cycleId;
        uint8 numRaces;
        uint8 numDrivers;
        uint64[] boostTreasureIds;
        uint32[] boostTreasureQuantities;
    }

    struct Vehicle {
        uint64[4] driverIds;
        uint64 vehicleId;
        uint8 numRaces;
        uint8 numDrivers;
        uint64[] boostTreasureIds;
        uint32[] boostTreasureQuantities;
    }

    struct RacingInfo {
        uint64 racingStartTime;
        uint8 totalRaces;
        uint8 racesCompleted;
        uint64 lastClaimed;
        uint32 boostedOdds; // out of 100,000,000 (6 digit precision)
    }
}

File 16 of 30 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 17 of 30 : ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 18 of 30 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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`.
     *
     * 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;

    /**
     * @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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

File 19 of 30 : UtilitiesV2Upgradeable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

// A base class for all contracts.
// Includes basic utility functions, access control, and the ability to pause the contract.
contract UtilitiesV2Upgradeable is Initializable, AccessControlEnumerableUpgradeable, PausableUpgradeable {

    bytes32 internal constant OWNER_ROLE = keccak256("OWNER");
    bytes32 internal constant ADMIN_ROLE = keccak256("ADMIN");
    bytes32 internal constant ROLE_GRANTER_ROLE = keccak256("ROLE_GRANTER");

    function __Utilities_init() internal onlyInitializing {
        AccessControlEnumerableUpgradeable.__AccessControlEnumerable_init();
        PausableUpgradeable.__Pausable_init();

        __Utilities_init_unchained();
    }

    function __Utilities_init_unchained() internal onlyInitializing {
        _pause();

        _grantRole(OWNER_ROLE, msg.sender);
    }

    function setPause(bool _shouldPause) external requiresEitherRole(ADMIN_ROLE, OWNER_ROLE) {
        if(_shouldPause) {
            _pause();
        } else {
            _unpause();
        }
    }

    function grantRole(bytes32 _role, address _account) public override requiresEitherRole(ROLE_GRANTER_ROLE, OWNER_ROLE) {
        require(_role != OWNER_ROLE, "Cannot change owner role through grantRole");
        _grantRole(_role, _account);
    }

    function revokeRole(bytes32 _role, address _account) public override requiresEitherRole(ROLE_GRANTER_ROLE, OWNER_ROLE) {
        require(_role != OWNER_ROLE, "Cannot change owner role through grantRole");
        _revokeRole(_role, _account);
    }

    function compareStrings(string memory a, string memory b) internal pure returns (bool) {
        return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));
    }

    modifier onlyEOA() {
        /* solhint-disable avoid-tx-origin */
        require(msg.sender == tx.origin, "No contracts");
        _;
    }

    modifier requiresRole(bytes32 _role) {
        require(hasRole(_role, msg.sender), "Does not have required role");
        _;
    }

    modifier requiresEitherRole(bytes32 _roleOption1, bytes32 _roleOption2) {
        require(hasRole(_roleOption1, msg.sender) || hasRole(_roleOption2, msg.sender), "Does not have required role");

        _;
    }
}

File 20 of 30 : IRandomizer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IRandomizer {

    // Sets the number of blocks that must pass between increment the commitId and seeding the random
    // Admin
    function setNumBlocksAfterIncrement(uint8 _numBlocksAfterIncrement) external;

    // Increments the commit id.
    // Admin
    function incrementCommitId() external;

    // Adding the random number needs to be done AFTER incrementing the commit id on a separate transaction. If
    // these are done together, there is a potential vulnerability to front load a commit when the bad actor
    // sees the value of the random number.
    function addRandomForCommit(uint256 _seed) external;

    // Returns a request ID for a random number. This is unique.
    function requestRandomNumber() external returns(uint256);

    // Returns the random number for the given request ID. Will revert
    // if the random is not ready.
    function revealRandomNumber(uint256 _requestId) external view returns(uint256);

    // Returns if the random number for the given request ID is ready or not. Call
    // before calling revealRandomNumber.
    function isRandomReady(uint256 _requestId) external view returns(bool);
}

File 21 of 30 : ISmolTreasures.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";

interface ISmolTreasures is IERC1155Upgradeable {

    function mint(address _to, uint256 _id, uint256 _amount) external;

    function burn(address account, uint256 id, uint256 value) external;

    function burnBatch(address account, uint256[] memory ids, uint256[] memory values) external;

    function adminSafeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount) external;

    function adminSafeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts) external;
}

File 22 of 30 : ISmolRacingTrophies.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";

interface ISmolRacingTrophies is IERC1155Upgradeable {

    function mint(address _to, uint256 _id, uint256 _amount) external;

    function burn(address account, uint256 id, uint256 value) external;

    function burnBatch(address account, uint256[] memory ids, uint256[] memory values) external;

    function adminSafeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount) external;

    function adminSafeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _amounts) external;
}

File 23 of 30 : IERC721ReceiverUpgradeable.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 IERC721ReceiverUpgradeable {
    /**
     * @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 24 of 30 : 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 25 of 30 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 26 of 30 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _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());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 27 of 30 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 28 of 30 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 29 of 30 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    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);
    }
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_vehicleAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"NoRewardEarned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_vehicleAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_claimedRewardId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_smolAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_stakeTime","type":"uint64"}],"name":"SmolStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_smolAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"SmolUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_vehicleAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_stakeTime","type":"uint64"},{"indexed":false,"internalType":"uint8","name":"_totalRaces","type":"uint8"},{"indexed":false,"internalType":"uint64[4]","name":"_driverIds","type":"uint64[4]"},{"indexed":false,"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"StartRacing","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_vehicleAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_stakeTime","type":"uint64"},{"indexed":false,"internalType":"uint8","name":"_totalRaces","type":"uint8"}],"name":"StopRacing","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ODDS_DENOMINATOR","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"additionalSmolBodyBoost","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"additionalSmolBrainBoost","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"areContractsSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_carTokens","type":"uint256[]"},{"internalType":"uint256[]","name":"_cycleTokens","type":"uint256[]"}],"name":"claimRewardsForVehicles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endEmissionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_role","type":"bytes32"},{"internalType":"address","name":"_account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxOddsBoostAllowed","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vehicleAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"numberOfRacesToClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownsVehicle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"racingTrophies","outputs":[{"internalType":"contract ISmolRacingTrophies","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomizer","outputs":[{"internalType":"contract IRandomizer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_role","type":"bytes32"},{"internalType":"address","name":"_account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardIdToOdds","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardOptions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_treasures","type":"address"},{"internalType":"address","name":"_smolBrains","type":"address"},{"internalType":"address","name":"_smolBodies","type":"address"},{"internalType":"address","name":"_smolCars","type":"address"},{"internalType":"address","name":"_swolercycles","type":"address"},{"internalType":"address","name":"_racingTrophies","type":"address"},{"internalType":"address","name":"_randomizer","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"setEndTimeForEmissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_rewardIds","type":"uint256[]"},{"internalType":"uint32[]","name":"_rewardOdds","type":"uint32[]"}],"name":"setRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardTime","type":"uint256"}],"name":"setTimeForReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smolBodies","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"smolBrains","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"smolCars","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"smolTreasureIdToOddsBoost","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"smolsOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64[4]","name":"driverIds","type":"uint64[4]"},{"internalType":"uint64","name":"carId","type":"uint64"},{"internalType":"uint8","name":"numRaces","type":"uint8"},{"internalType":"uint8","name":"numDrivers","type":"uint8"},{"internalType":"uint64[]","name":"boostTreasureIds","type":"uint64[]"},{"internalType":"uint32[]","name":"boostTreasureQuantities","type":"uint32[]"}],"internalType":"struct SmolRacingState.SmolCar[]","name":"_cars","type":"tuple[]"},{"components":[{"internalType":"uint64[2]","name":"driverIds","type":"uint64[2]"},{"internalType":"uint64","name":"cycleId","type":"uint64"},{"internalType":"uint8","name":"numRaces","type":"uint8"},{"internalType":"uint8","name":"numDrivers","type":"uint8"},{"internalType":"uint64[]","name":"boostTreasureIds","type":"uint64[]"},{"internalType":"uint32[]","name":"boostTreasureQuantities","type":"uint32[]"}],"internalType":"struct SmolRacingState.Swolercycle[]","name":"_cycles","type":"tuple[]"}],"name":"stakeVehicles","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":"swolercycles","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeForReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToRewardsClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToRewardsInProgress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToStakeStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasures","outputs":[{"internalType":"contract ISmolTreasures","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_carTokens","type":"uint256[]"},{"internalType":"uint256[]","name":"_cycleTokens","type":"uint256[]"}],"name":"unstakeVehicles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vehicleAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"vehicleOddsBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"vehiclesOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506140e5806100206000396000f3fe608060405234801561001057600080fd5b506004361061028a5760003560e01c80637bd6babb1161015c578063ca15c873116100ce578063eb54d5c711610087578063eb54d5c714610689578063f10fb584146106b5578063f603a76e146106c9578063f636019b146106dc578063fe2fcbbf146106f0578063fe3cbd6e1461070357600080fd5b8063ca15c87314610611578063d3ff95c714610624578063d547741f14610637578063d6d6727a1461064a578063e0e3818e14610663578063ead657c71461067657600080fd5b806391d148541161012057806391d14854146105aa5780639b9580af146105bd5780639d1b27eb146105d0578063a217fddf146105e3578063a319ada9146105eb578063bedb86fb146105fe57600080fd5b80637bd6babb1461055f5780638129fc1c1461057357806388a5d4201461057b5780638cdcc4b41461058f5780639010d07c1461059757600080fd5b80632f2ff15d1161020057806349a5572b116101b957806349a5572b146104eb5780634f4463f4146104ff5780635877349a146105265780635c975abb14610530578063617a608f1461053b578063686dd20b1461054c57600080fd5b80632f2ff15d146104645780633245dad31461047957806333bd32041461049157806336568abe146104b1578063365c4ceb146104c45780633dc22fdd146104d857600080fd5b80631702e2fd116102525780631702e2fd1461036f57806319842fb5146103795780631f23c09b146103a55780631f823805146103e9578063248a9ca3146104155780632b5f94bd1461043857600080fd5b806301ffc9a71461028f578063030c4225146102b75780630a5ff95a146102f1578063150b7a021461032d57806315ca659d14610364575b600080fd5b6102a261029d366004613750565b610716565b60405190151581526020015b60405180910390f35b6102e36102c5366004613796565b61016b60209081526000928352604080842090915290825290205481565b6040519081526020016102ae565b6103186102ff3660046137c0565b6101706020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102ae565b61034b61033b3660046137ef565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016102ae565b6103186305f5e10081565b6102e36101715481565b6102e3610387366004613796565b61016960209081526000928352604080842090915290825290205481565b6102e36103b3366004613796565b6001600160a01b03919091166000908152610168602090815260408083209383529290522054600160901b900463ffffffff1690565b610160546103fd906001600160a01b031681565b6040516001600160a01b0390911681526020016102ae565b6102e36104233660046137c0565b60009081526097602052604090206001015490565b6102e3610446366004613796565b61016a60209081526000928352604080842090915290825290205481565b6104776104723660046138ca565b610741565b005b61016e5461031890600160401b900463ffffffff1681565b6104a461049f3660046138f6565b6107ee565b6040516102ae9190613920565b6104776104bf3660046138ca565b610b92565b61015f546103fd906001600160a01b031681565b6104a46104e63660046138f6565b610c10565b610162546103fd906001600160a01b031681565b61031861050d3660046137c0565b61016d6020526000908152604090205463ffffffff1681565b6102e36101725481565b60fb5460ff166102a2565b61016e546103189063ffffffff1681565b6102e361055a3660046137c0565b610c49565b610163546103fd906001600160a01b031681565b610477610c6b565b610164546103fd906001600160a01b031681565b6102a2610ce5565b6103fd6105a5366004613964565b610d86565b6102a26105b83660046138ca565b610d9e565b6104776105cb3660046137c0565b610dc9565b6102a26105de366004613986565b610e25565b6102e3600081565b6104776105f9366004613a0d565b610e5f565b61047761060c366004613a78565b611271565b6102e361061f3660046137c0565b6112e0565b610477610632366004613a9a565b6112f7565b6104776106453660046138ca565b6113d2565b61016e5461031890640100000000900463ffffffff1681565b610477610671366004613a0d565b611470565b6104776106843660046137c0565b61165c565b6102e3610697366004613796565b61016c60209081526000928352604080842090915290825290205481565b610161546103fd906001600160a01b031681565b6104776106d7366004613a0d565b6116b8565b610165546103fd906001600160a01b031681565b6102e36106fe366004613796565b6117dd565b610477610711366004613a0d565b6118ff565b60006001600160e01b03198216635a05180f60e01b148061073b575061073b82611a34565b92915050565b7fa2328fc90c90feb8f254e41caa67a90952094a7c9c879c5eb4f2088aaecb4ae860008051602061409083398151915261077b8233610d9e565b8061078b575061078b8133610d9e565b6107b05760405162461bcd60e51b81526004016107a790613b20565b60405180910390fd5b6000805160206140908339815191528414156107de5760405162461bcd60e51b81526004016107a790613b57565b6107e88484611a69565b50505050565b6001600160a01b0380831660009081526101666020908152604080832093851683529290529081206060919061082390611a8b565b90506000805b82518110156108a657600083828151811061084657610846613ba1565b6020908102919091018101516001600160a01b038916600090815261016783526040808220838352909352919091206001015490915061089090600160481b900460ff1684613bcd565b925050808061089e90613be5565b915050610829565b506000816001600160401b038111156108c1576108c16137d9565b6040519080825280602002602001820160405280156108ea578160200160208202803683370190505b50905060005b8351811015610b88576001600160a01b0387166000908152610167602052604081208551829087908590811061092857610928613ba1565b60209081029190910181015182528101919091526040908101600020815161014081019092528160c081018260048282826020028201916000905b82829054906101000a90046001600160401b03166001600160401b031681526020019060080190602082600701049283019260010382029150808411610963579050505050918352505060018201546001600160401b03811660208084019190915260ff600160401b83048116604080860191909152600160481b9093041660608401526002840180548351818402810184019094528084526080909401939091830182828015610a6557602002820191906000526020600020906000905b82829054906101000a90046001600160401b03166001600160401b031681526020019060080190602082600701049283019260010382029150808411610a225790505b5050505050815260200160038201805480602002602001604051908101604052809291908181526020018280548015610ae957602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff1681526020019060040190602082600301049283019260010382029150808411610aac5790505b505050505081525050905060005b816060015160ff16811015610b735781516000908260048110610b1c57610b1c613ba1565b60200201516001600160401b0316905080610b375750610b61565b8085610b438487613bcd565b81518110610b5357610b53613ba1565b602002602001018181525050505b80610b6b81613be5565b915050610af7565b50508080610b8090613be5565b9150506108f0565b5095945050505050565b6001600160a01b0381163314610c025760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016107a7565b610c0c8282611a98565b5050565b6001600160a01b03808316600090815261016660209081526040808320938516835292905220606090610c4290611a8b565b9392505050565b61016f8181548110610c5a57600080fd5b600091825260209091200154905081565b600054610100900460ff16610c865760005460ff1615610c8a565b303b155b610ca65760405162461bcd60e51b81526004016107a790613c00565b600054610100900460ff16158015610cc8576000805461ffff19166101011790555b610cd0611aba565b8015610ce2576000805461ff00191690555b50565b610160546000906001600160a01b031615801590610d0e5750610161546001600160a01b031615155b8015610d255750610162546001600160a01b031615155b8015610d3c5750610163546001600160a01b031615155b8015610d535750610164546001600160a01b031615155b8015610d6a5750610165546001600160a01b031615155b8015610d81575061015f546001600160a01b031615155b905090565b600082815260c960205260408120610c429083611b1f565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020614070833981519152600080516020614090833981519152610df18233610d9e565b80610e015750610e018133610d9e565b610e1d5760405162461bcd60e51b81526004016107a790613b20565b505061017255565b6001600160a01b038084166000908152610166602090815260408083209386168352929052908120610e579083611b2b565b949350505050565b60026001541415610e825760405162461bcd60e51b81526004016107a790613c4e565b6002600155610e8f610ce5565b610eab5760405162461bcd60e51b81526004016107a790613c85565b60fb5460ff1615610ece5760405162461bcd60e51b81526004016107a790613cb3565b82151580610edb57508015155b610ef75760405162461bcd60e51b81526004016107a790613cdd565b60005b838110156110b35736858583818110610f1557610f15613ba1565b9050602002810190610f279190613d06565b90506000610f3b60e0830160c08401613d27565b60ff1611610f825760405162461bcd60e51b815260206004820152601460248201527337379031b0b910323934bb32b9399033b4bb32b760611b60448201526064016107a7565b61016254610164546040805161014081019091526110a0926001600160a01b039081169216908060c08101866004828260808082843760009201919091525050508152602001610fd860a0870160808801613d4a565b6001600160401b03168152602001610ff660c0870160a08801613d27565b60ff16815260200161100e60e0870160c08801613d27565b60ff16815260200161102360e0870187613d73565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001611068610100870187613d73565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505050915250611b43565b50806110ab81613be5565b915050610efa565b5060005b8181101561126657368383838181106110d2576110d2613ba1565b90506020028101906110e49190613dbc565b905060006110f860a0830160808401613d27565b60ff16116111415760405162461bcd60e51b815260206004820152601660248201527537379031bcb1b63290323934bb32b9399033b4bb32b760511b60448201526064016107a7565b611149613505565b6111566020830183613d4a565b6001600160401b031681526111716040830160208401613d4a565b6001600160401b031660208083019190915261016354610165546040805160c081018252858152611251946001600160a01b0394851694909316929091908201906111c29060608901908901613d4a565b6001600160401b031681526020016111e06080880160608901613d27565b60ff1681526020016111f860a0880160808901613d27565b60ff16815260200161120d60a0880188613d73565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060200161106860c0880188613d73565b5050808061125e90613be5565b9150506110b7565b505060018055505050565b6000805160206140708339815191526000805160206140908339815191526112998233610d9e565b806112a957506112a98133610d9e565b6112c55760405162461bcd60e51b81526004016107a790613b20565b82156112d8576112d361209e565b505050565b6112d3612113565b600081815260c96020526040812061073b9061218d565b60008051602061407083398151915260008051602061409083398151915261131f8233610d9e565b8061132f575061132f8133610d9e565b61134b5760405162461bcd60e51b81526004016107a790613b20565b505061016080546001600160a01b03199081166001600160a01b03998a16179091556101628054821697891697909717909655610163805487169588169590951790945561016480548616938716939093179092556101658054851691861691909117905561015f8054841691851691909117905561016180549092169216919091179055565b7fa2328fc90c90feb8f254e41caa67a90952094a7c9c879c5eb4f2088aaecb4ae860008051602061409083398151915261140c8233610d9e565b8061141c575061141c8133610d9e565b6114385760405162461bcd60e51b81526004016107a790613b20565b6000805160206140908339815191528414156114665760405162461bcd60e51b81526004016107a790613b57565b6107e88484611a98565b6000805160206140708339815191526000805160206140908339815191526114988233610d9e565b806114a857506114a88133610d9e565b6114c45760405162461bcd60e51b81526004016107a790613b20565b8483146115015760405162461bcd60e51b815260206004820152600b60248201526a426164206c656e6774687360a81b60448201526064016107a7565b61150e61016f6000613523565b6000805b868110156116085785858281811061152c5761152c613ba1565b90506020020160208101906115419190613dd2565b61154b9083613df8565b915061016f88888381811061156257611562613ba1565b8354600181018555600094855260209485902091909402929092013591909201555085858281811061159657611596613ba1565b90506020020160208101906115ab9190613dd2565b61017060008a8a858181106115c2576115c2613ba1565b90506020020135815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff160217905550808061160090613be5565b915050611512565b5063ffffffff81166305f5e100146116535760405162461bcd60e51b815260206004820152600e60248201526d42616420746f74616c206f64647360901b60448201526064016107a7565b50505050505050565b6000805160206140708339815191526000805160206140908339815191526116848233610d9e565b8061169457506116948133610d9e565b6116b05760405162461bcd60e51b81526004016107a790613b20565b505061017155565b600260015414156116db5760405162461bcd60e51b81526004016107a790613c4e565b60026001556116e8610ce5565b6117045760405162461bcd60e51b81526004016107a790613c85565b60fb5460ff16156117275760405162461bcd60e51b81526004016107a790613cb3565b8215158061173457508015155b6117505760405162461bcd60e51b81526004016107a790613cdd565b60005b8381101561179c576101645461178a906001600160a01b031686868481811061177e5761177e613ba1565b90506020020135612197565b8061179481613be5565b915050611753565b5060005b8181101561126657610165546117cb906001600160a01b031684848481811061177e5761177e613ba1565b806117d581613be5565b9150506117a0565b60008061017254600014806117f457506101725442105b6118015761017254611803565b425b6001600160a01b038516600090815261016860209081526040808320878452825291829020825160a08101845290546001600160401b038082168352600160401b820460ff90811694840194909452600160481b820490931693820193909352600160501b830490911660608201819052600160901b90920463ffffffff1660808201529192506118995760009250505061073b565b6000816040015182602001516118af9190613e20565b90506000610171548360600151856118c79190613e43565b6001600160401b03166118da9190613e81565b90508160ff168111156118f5575060ff16925061073b915050565b9695505050505050565b600260015414156119225760405162461bcd60e51b81526004016107a790613c4e565b600260015561192f610ce5565b61194b5760405162461bcd60e51b81526004016107a790613c85565b60fb5460ff161561196e5760405162461bcd60e51b81526004016107a790613cb3565b8215158061197b57508015155b6119975760405162461bcd60e51b81526004016107a790613cdd565b60005b838110156119eb5761016254610164546119d9916001600160a01b0390811691168787858181106119cd576119cd613ba1565b905060200201356123ee565b806119e381613be5565b91505061199a565b5060005b81811015611266576101635461016554611a22916001600160a01b0390811691168585858181106119cd576119cd613ba1565b80611a2c81613be5565b9150506119ef565b60006001600160e01b03198216637965db0b60e01b148061073b57506301ffc9a760e01b6001600160e01b031983161461073b565b611a7382826129e0565b600082815260c9602052604090206112d39082612a66565b60606000610c4283612a7b565b611aa28282612ad7565b600082815260c9602052604090206112d39082612b3e565b600054610100900460ff16611ad55760005460ff1615611ad9565b303b155b611af55760405162461bcd60e51b81526004016107a790613c00565b600054610100900460ff16158015611b17576000805461ffff19166101011790555b610cd0612b53565b6000610c428383612cbd565b60008181526001830160205260408120541515610c42565b6020808201516001600160a01b03841660009081526101668352604080822033835290935291909120611b7e916001600160401b0316612ce7565b506001600160a01b038216600090815261016760209081526040808320828501516001600160401b0316845290915290208151829190611bc19082906004613541565b50602082810151600183018054604086015160608701516001600160401b0390941668ffffffffffffffffff1990921691909117600160401b60ff928316021769ff0000000000000000001916600160481b919093160291909117905560808301518051611c3592600285019201906135e6565b5060a08201518051611c51916003840191602090910190613658565b5090505060004290506040518060a00160405280826001600160401b03168152602001836040015160ff168152602001600060ff168152602001826001600160401b03168152602001611ca48585612cf3565b63ffffffff9081169091526001600160a01b038516600090815261016860209081526040808320878301516001600160401b0390811685529083528184208651815494880151938801516060890151608090990151909716600160901b0263ffffffff60901b19988416600160501b0267ffffffffffffffff60501b1960ff998a16600160481b021668ffffffffffffffffff60481b1999909616600160401b0268ffffffffffffffffff1990971692909416919091179490941795909516919091171793909316929092179055805b6004811015611ec05783518160048110611d9057611d90613ba1565b60200201516001600160401b0316611da757611ec0565b611db2600183613bcd565b9150856001600160a01b03166342842e0e333087600001518560048110611ddb57611ddb613ba1565b60200201516040518463ffffffff1660e01b8152600401611dfe93929190613e95565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b5050505083600001518160048110611e4657611e46613ba1565b60200201516001600160401b0316866001600160a01b0316336001600160a01b03167f11a9cf9fb826815e83a8636e49d456b2aea0a01a31a6cea2912e50d5ba49568e86604051611ea691906001600160401b0391909116815260200190565b60405180910390a480611eb881613be5565b915050611d74565b50826060015160ff168114611f215760405162461bcd60e51b815260206004820152602160248201527f696e636f7272656374206e756d626572206f66206472697665727320676976656044820152603760f91b60648201526084016107a7565b6020830151604051632142170760e11b81526001600160a01b038616916342842e0e91611f55913391309190600401613e95565b600060405180830381600087803b158015611f6f57600080fd5b505af1158015611f83573d6000803e3d6000fd5b50505050600061016160009054906101000a90046001600160a01b03166001600160a01b0316638678a7b26040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611fda57600080fd5b505af1158015611fee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120129190613ec1565b6001600160a01b03861660008181526101696020908152604080832089830180516001600160401b03908116865291909352928190208590559051888201518951925195965092169333927fb9aa1aef7b85a61602dc4fb998914a813dd1b708295c1c55e2b5b01f092817229261208e928a9291908990613eda565b60405180910390a4505050505050565b60fb5460ff16156120c15760405162461bcd60e51b81526004016107a790613cb3565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586120f63390565b6040516001600160a01b03909116815260200160405180910390a1565b60fb5460ff1661215c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016107a7565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336120f6565b600061073b825490565b6001600160a01b03821660009081526101666020908152604080832033845290915290206121c59082611b2b565b6122055760405162461bcd60e51b81526020600482015260116024820152703737ba103b32b434b1b6329037bbb732b960791b60448201526064016107a7565b600061221183836117dd565b9050600081116122565760405162461bcd60e51b815260206004820152601060248201526f6e6f7468696e6720746f20636c61696d60801b60448201526064016107a7565b6001600160a01b038316600090815261016860209081526040808320858452825291829020825160a08101845290546001600160401b038082168352600160401b820460ff90811694840194909452600160481b820490931693820193909352600160501b83049091166060820152600160901b90910463ffffffff166080820152610171546122e69083613f34565b816060018181516122f79190613f53565b6001600160401b031690525061230f82858584612f9a565b81816040018181516123219190613f75565b60ff9081169091526001600160a01b0390951660009081526101686020908152604080832096835295815290859020835181549285015196850151606086015160809096015163ffffffff16600160901b0263ffffffff60901b196001600160401b03978816600160501b0267ffffffffffffffff60501b19938c16600160481b029390931668ffffffffffffffffff60481b199a909b16600160401b0268ffffffffffffffffff1990961697909316969096179390931796909616969096171793909316179092555050565b6001600160a01b038216600090815261016660209081526040808320338452909152902061241c9082611b2b565b61245b5760405162461bcd60e51b815260206004820152601060248201526f1d1bdad95b881b9bdd081cdd185ad95960821b60448201526064016107a7565b6001600160a01b038216600090815261016760209081526040808320848452909152808220815161014081019283905291829060c082019083906004908288855b82829054906101000a90046001600160401b03166001600160401b03168152602001906008019060208260070104928301926001038202915080841161249c579050505050918352505060018201546001600160401b03811660208084019190915260ff600160401b83048116604080860191909152600160481b909304166060840152600284018054835181840281018401909452808452608090940193909183018282801561259e57602002820191906000526020600020906000905b82829054906101000a90046001600160401b03166001600160401b03168152602001906008019060208260070104928301926001038202915080841161255b5790505b505050505081526020016003820180548060200260200160405190810160405280929190818152602001828054801561262257602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116125e55790505b505050919092525050506001600160a01b0384166000908152610168602090815260408083208684528252808320815160a08101835290546001600160401b03808216835260ff600160401b8304811695840195909552600160481b820490941692820192909252600160501b8204909216606083015263ffffffff600160901b9091041660808201529192506126b985856117dd565b9050816020015160ff1681836040015160ff166126d69190613bcd565b10156127165760405162461bcd60e51b815260206004820152600f60248201526e6e6f7420646f6e6520726163696e6760881b60448201526064016107a7565b6001600160a01b03851660009081526101676020908152604080832087845290915281208181559060018201805469ffffffffffffffffffff191690556127616002830160006136f5565b61276f60038301600061371a565b50506001600160a01b038516600081815261016860209081526040808320888452825280832080546001600160b01b031916905592825261016681528282203383529052206127be908561303b565b5080156127d1576127d181868685612f9a565b4260005b60048110156128fa57845181600481106127f1576127f1613ba1565b60200201516001600160401b0316612808576128fa565b876001600160a01b03166342842e0e30338860000151856004811061282f5761282f613ba1565b60200201516040518463ffffffff1660e01b815260040161285293929190613e95565b600060405180830381600087803b15801561286c57600080fd5b505af1158015612880573d6000803e3d6000fd5b505050508460000151816004811061289a5761289a613ba1565b60200201516001600160401b0316886001600160a01b0316336001600160a01b03167f0e0892e64dffe15b2a80856d3fa02b3b3df09de56739118dc5b9a6050b8d553f60405160405180910390a4806128f281613be5565b9150506127d5565b506020840151604051632142170760e11b81526001600160a01b038816916342842e0e9161292f913091339190600401613e95565b600060405180830381600087803b15801561294957600080fd5b505af115801561295d573d6000803e3d6000fd5b5050505083602001516001600160401b0316866001600160a01b0316336001600160a01b03167f9befef7662aaefd702af59c4c6f9e9a369b3ab1f242afc3b04376387817533ee8488604001516040516129cf9291906001600160401b0392909216825260ff16602082015260400190565b60405180910390a450505050505050565b6129ea8282610d9e565b610c0c5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612a223390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610c42836001600160a01b038416613047565b606081600001805480602002602001604051908101604052809291908181526020018280548015612acb57602002820191906000526020600020905b815481526020019060010190808311612ab7575b50505050509050919050565b612ae18282610d9e565b15610c0c5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610c42836001600160a01b038416613096565b600054610100900460ff16612b6e5760005460ff1615612b72565b303b155b612b8e5760405162461bcd60e51b81526004016107a790613c00565b600054610100900460ff16158015612bb0576000805461ffff19166101011790555b612bb8613189565b612bc06131ca565b620151806101715561016e80546a0f4240000a2d78002625a06bffffffffffffffffffffffff1990911617905561016d6020527f6078124e71fd9c0560cfe3a4bc21fab1d9b8aec7d51bb7242640552dc617b3eb805463ffffffff199081166002179091557fa41153f7b441e5124984a1a7a25de80e57749aba77d03eb20616228c312fe9b88054821660051790557f7e8a02e2876e7ede23202519472266dc52bcb834242340746bda0c7bfc93350080548216600c17905560046000527ffd0335b1652bda6537bb20a5eac5c877b63e94b4b0a303d80d81478970b660df8054909116601b1790558015610ce2576000805461ff001916905550565b6000826000018281548110612cd457612cd4613ba1565b9060005260206000200154905092915050565b6000610c428383613047565b610164546000906001600160a01b0384811691161415612d505761016e60049054906101000a900463ffffffff1660018360600151612d329190613e20565b60ff16612d3f9190613f9a565b612d499082613df8565b9050612d95565b610165546001600160a01b0384811691161415612d9557816060015160ff1660021415612d955761016e54612d9290600160401b900463ffffffff1682613df8565b90505b60808201515160a0830151518114612e015760405162461bcd60e51b815260206004820152602960248201527f4e756d626572206f6620747265617375726573206d756368206d61746368207160448201526875616e74697469657360b81b60648201526084016107a7565b60005b81811015612f705761016054608085015180516001600160a01b039092169163f5298aca91339185908110612e3b57612e3b613ba1565b60200260200101518760a001518581518110612e5957612e59613ba1565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0390931660048401526001600160401b03909116602483015263ffffffff166044820152606401600060405180830381600087803b158015612ec057600080fd5b505af1158015612ed4573d6000803e3d6000fd5b50505050600061016d600086608001518481518110612ef557612ef5613ba1565b60200260200101516001600160401b0316815260200190815260200160002060009054906101000a900463ffffffff1690508460a001518281518110612f3d57612f3d613ba1565b602002602001015181612f509190613f9a565b612f5a9085613df8565b9350508080612f6890613be5565b915050612e04565b5061016e5463ffffffff9081169083161115612f935761016e5463ffffffff1691505b5092915050565b6000612fa684846131f1565b905060005b8581101561303357600081846040015160ff16612fc89190613bcd565b612fd3906001613bcd565b905060008382604051602001612ff3929190918252602082015260400190565b6040516020818303038152906040528051906020012060001c905061301e878787608001518461328f565b5050808061302b90613be5565b915050612fab565b505050505050565b6000610c428383613096565b600081815260018301602052604081205461308e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561073b565b50600061073b565b6000818152600183016020526040812054801561317f5760006130ba600183613fc6565b85549091506000906130ce90600190613fc6565b90508181146131335760008660000182815481106130ee576130ee613ba1565b906000526020600020015490508087600001848154811061311157613111613ba1565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061314457613144613fdd565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061073b565b600091505061073b565b600054610100900460ff166131b05760405162461bcd60e51b81526004016107a790613ff3565b6131b86131ca565b6131c061345c565b6131c861348b565b565b600054610100900460ff166131c85760405162461bcd60e51b81526004016107a790613ff3565b6001600160a01b0382811660009081526101696020908152604080832085845290915280822054610161549151634ad30a7560e01b81526004810182905292939092911690634ad30a759060240160206040518083038186803b15801561325757600080fd5b505afa15801561326b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e579190613ec1565b600063ffffffff83166132a66305f5e1008461403e565b6132b09190613bcd565b90506305f5e10081106132d5576132cc60016305f5e100614052565b63ffffffff1690505b60008060005b61016f548110156133c757600061016f82815481106132fc576132fc613ba1565b600091825260208083209091015480835261017090915260409091205490915061332c9063ffffffff1685613bcd565b9350838510156133b45780156133ae5761015f54604051630ab714fb60e11b8152336004820152602481018390526001604482015291935083916001600160a01b039091169063156e29f690606401600060405180830381600087803b15801561339557600080fd5b505af11580156133a9573d6000803e3d6000fd5b505050505b506133c7565b50806133bf81613be5565b9150506132db565b50801561341b57604080518281526001602082015287916001600160a01b038a169133917f17db246e2b79d27e01c800967d89cbee46000807213e933b6e4c4fddac899a78910160405180910390a4611653565b60405186906001600160a01b0389169033907fe3771e644816ae6e430f2ff06418f05ccfe72fc1288b1879824c02cf63f5748490600090a450505050505050565b600054610100900460ff166134835760405162461bcd60e51b81526004016107a790613ff3565b6131c86134d2565b600054610100900460ff166134b25760405162461bcd60e51b81526004016107a790613ff3565b6134ba61209e565b6131c860008051602061409083398151915233611a69565b600054610100900460ff166134f95760405162461bcd60e51b81526004016107a790613ff3565b60fb805460ff19169055565b60405180608001604052806004906020820280368337509192915050565b5080546000825590600052602060002090810190610ce2919061373b565b6001830191839082156135d65791602002820160005b838211156135a157835183826101000a8154816001600160401b0302191690836001600160401b031602179055509260200192600801602081600701049283019260010302613557565b80156135d45782816101000a8154906001600160401b0302191690556008016020816007010492830192600103026135a1565b505b506135e292915061373b565b5090565b828054828255906000526020600020906003016004900481019282156135d6579160200282016000838211156135a157835183826101000a8154816001600160401b0302191690836001600160401b031602179055509260200192600801602081600701049283019260010302613557565b828054828255906000526020600020906007016008900481019282156135d65791602002820160005b838211156136c557835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302613681565b80156135d45782816101000a81549063ffffffff02191690556004016020816003010492830192600103026136c5565b508054600082556003016004900490600052602060002090810190610ce2919061373b565b508054600082556007016008900490600052602060002090810190610ce291905b5b808211156135e2576000815560010161373c565b60006020828403121561376257600080fd5b81356001600160e01b031981168114610c4257600080fd5b80356001600160a01b038116811461379157600080fd5b919050565b600080604083850312156137a957600080fd5b6137b28361377a565b946020939093013593505050565b6000602082840312156137d257600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561380557600080fd5b61380e8561377a565b935061381c6020860161377a565b92506040850135915060608501356001600160401b038082111561383f57600080fd5b818701915087601f83011261385357600080fd5b813581811115613865576138656137d9565b604051601f8201601f19908116603f0116810190838211818310171561388d5761388d6137d9565b816040528281528a60208487010111156138a657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080604083850312156138dd57600080fd5b823591506138ed6020840161377a565b90509250929050565b6000806040838503121561390957600080fd5b6139128361377a565b91506138ed6020840161377a565b6020808252825182820181905260009190848201906040850190845b818110156139585783518352928401929184019160010161393c565b50909695505050505050565b6000806040838503121561397757600080fd5b50508035926020909101359150565b60008060006060848603121561399b57600080fd5b6139a48461377a565b92506139b26020850161377a565b9150604084013590509250925092565b60008083601f8401126139d457600080fd5b5081356001600160401b038111156139eb57600080fd5b6020830191508360208260051b8501011115613a0657600080fd5b9250929050565b60008060008060408587031215613a2357600080fd5b84356001600160401b0380821115613a3a57600080fd5b613a46888389016139c2565b90965094506020870135915080821115613a5f57600080fd5b50613a6c878288016139c2565b95989497509550505050565b600060208284031215613a8a57600080fd5b81358015158114610c4257600080fd5b600080600080600080600060e0888a031215613ab557600080fd5b613abe8861377a565b9650613acc6020890161377a565b9550613ada6040890161377a565b9450613ae86060890161377a565b9350613af66080890161377a565b9250613b0460a0890161377a565b9150613b1260c0890161377a565b905092959891949750929550565b6020808252601b908201527f446f6573206e6f74206861766520726571756972656420726f6c650000000000604082015260600190565b6020808252602a908201527f43616e6e6f74206368616e6765206f776e657220726f6c65207468726f756768604082015269206772616e74526f6c6560b01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115613be057613be0613bb7565b500190565b6000600019821415613bf957613bf9613bb7565b5060010190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526014908201527310dbdb9d1c9858dd1cc8185c995b89dd081cd95d60621b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600f908201526e3737903a37b5b2b7399033b4bb32b760891b604082015260600190565b6000823561011e19833603018112613d1d57600080fd5b9190910192915050565b600060208284031215613d3957600080fd5b813560ff81168114610c4257600080fd5b600060208284031215613d5c57600080fd5b81356001600160401b0381168114610c4257600080fd5b6000808335601e19843603018112613d8a57600080fd5b8301803591506001600160401b03821115613da457600080fd5b6020019150600581901b3603821315613a0657600080fd5b6000823560de19833603018112613d1d57600080fd5b600060208284031215613de457600080fd5b813563ffffffff81168114610c4257600080fd5b600063ffffffff808316818516808303821115613e1757613e17613bb7565b01949350505050565b600060ff821660ff841680821015613e3a57613e3a613bb7565b90039392505050565b60006001600160401b0383811690831681811015613e6357613e63613bb7565b039392505050565b634e487b7160e01b600052601260045260246000fd5b600082613e9057613e90613e6b565b500490565b6001600160a01b0393841681529190921660208201526001600160401b03909116604082015260600190565b600060208284031215613ed357600080fd5b5051919050565b600060e0820190506001600160401b038087168352602060ff871681850152604084018660005b6004811015613f20578151851683529183019190830190600101613f01565b50505050508260c083015295945050505050565b6000816000190483118215151615613f4e57613f4e613bb7565b500290565b60006001600160401b03808316818516808303821115613e1757613e17613bb7565b600060ff821660ff84168060ff03821115613f9257613f92613bb7565b019392505050565b600063ffffffff80831681851681830481118215151615613fbd57613fbd613bb7565b02949350505050565b600082821015613fd857613fd8613bb7565b500390565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008261404d5761404d613e6b565b500690565b600063ffffffff83811690831681811015613e6357613e63613bb756fedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec426270edb7c868f86fda4adedba75108201087268ea345934db8bad688e1feb91ba2646970667358221220e288b613c1fe791ca2fd1cf83f415fe6a828ec0b4f028c2abcabd5c41edf5b4464736f6c63430008090033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.