Contract Address Details

0x7e868A484CAC2d024051e3c4f74Dbd2ED0EE2277

Contract Name
RaceResult
Creator
0xe4bc3d–a61c7a at 0x284fc4–2e9057
Balance
0 ADIL ( )
Tokens
Fetching tokens...
Transactions
1,166,226 Transactions
Transfers
0 Transfers
Gas Used
151,553,979,147
Last Balance Update
13020218
Contract name:
RaceResult




Optimization enabled
true
Compiler version
v0.8.2+commit.661d1103




Optimization runs
999999
EVM Version
default




Verified at
2023-04-19 03:45:04.236249Z

Contract source code

// Sources flattened with hardhat v2.12.6 https://hardhat.org

// File @openzeppelin/contracts/utils/Context.sol@v4.2.0

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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


// File @openzeppelin/contracts/access/Ownable.sol@v4.2.0


pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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


// File contracts/libraries/OwnerOperator.sol

pragma solidity ^0.8.0;
abstract contract OwnerOperator is Ownable {
    mapping(address => bool) public operators;

    constructor() Ownable() {}

    modifier operatorOrOwner() {
        require(operators[msg.sender] || owner() == msg.sender, "OwnerOperator: !operator, !owner");
        _;
    }

    modifier onlyOperator() {
        require(operators[msg.sender], "OwnerOperator: !operator");
        _;
    }

    function addOperator(address operator) external virtual onlyOwner {
        require(operator != address(0), "OwnerOperator: operator is the zero address");
        operators[operator] = true;
    }

    function removeOperator(address operator) external virtual onlyOwner {
        require(operator != address(0), "OwnerOperator: operator is the zero address");
        operators[operator] = false;
    }
}


// File contracts/RaceResult.sol
pragma solidity ^0.8.0;
contract RaceResult is OwnerOperator {
    constructor() OwnerOperator() {}

    // Base URI of all token ==> for all race results
    string public baseURI;

    struct RaceData {
        string proofHash;
    }

    //mapping from raceId to RaceData
    mapping(uint256 => RaceData) public raceData;

    event SaveRaceResult(uint256 raceId, string proofHash);
    event BatchSaveRaceResult(uint256[] arrayRaceId, string[] arrayproofHash);

    function saveRaceResult(uint256 _raceId, string memory _proofHash) public virtual onlyOperator {
        raceData[_raceId] = RaceData(_proofHash);
        emit SaveRaceResult(_raceId, _proofHash);
    }

    function batchSaveRaceResult(
        uint256[] memory _arrayRaceId,
        string[] memory _arrayProofHash
    ) public virtual onlyOperator {
        for (uint256 i = 0; i < _arrayRaceId.length; i++) {
            raceData[_arrayRaceId[i]] = RaceData(_arrayProofHash[i]);
        }
        emit BatchSaveRaceResult(_arrayRaceId, _arrayProofHash);
    }

    function getRaceResult(uint256 _raceId) public view returns (string memory) {
        return string(abi.encodePacked(baseURI, raceData[_raceId].proofHash));
    }

    function setBaseURI(string memory _baseURI) external virtual onlyOperator {
        baseURI = _baseURI;
    }
}
        
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"BatchSaveRaceResult","inputs":[{"type":"uint256[]","name":"arrayRaceId","internalType":"uint256[]","indexed":false},{"type":"string[]","name":"arrayproofHash","internalType":"string[]","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SaveRaceResult","inputs":[{"type":"uint256","name":"raceId","internalType":"uint256","indexed":false},{"type":"string","name":"proofHash","internalType":"string","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"baseURI","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchSaveRaceResult","inputs":[{"type":"uint256[]","name":"_arrayRaceId","internalType":"uint256[]"},{"type":"string[]","name":"_arrayProofHash","internalType":"string[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getRaceResult","inputs":[{"type":"uint256","name":"_raceId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"operators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"proofHash","internalType":"string"}],"name":"raceData","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"saveRaceResult","inputs":[{"type":"uint256","name":"_raceId","internalType":"uint256"},{"type":"string","name":"_proofHash","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBaseURI","inputs":[{"type":"string","name":"_baseURI","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063715018a611610081578063ac8a584a1161005b578063ac8a584a146101b7578063e2727a0b146101ca578063f2fde38b146101dd576100d4565b8063715018a6146101745780638da5cb5b1461017c5780639870d7fe146101a4576100d4565b806332566ec4116100b257806332566ec41461014657806355f804b3146101595780636c0360eb1461016c576100d4565b806307e710d2146100d957806313e7c9d8146100ee5780632e86c88214610126575b600080fd5b6100ec6100e7366004610e47565b6101f0565b005b6101116100fc366004610d02565b60016020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b610139610134366004610e2f565b6102df565b60405161011d9190611082565b6100ec610154366004610d3d565b610319565b6100ec610167366004610df4565b6104a5565b610139610535565b6100ec6105c3565b60005460405173ffffffffffffffffffffffffffffffffffffffff909116815260200161011d565b6100ec6101b2366004610d02565b610650565b6100ec6101c5366004610d02565b6107c6565b6101396101d8366004610e2f565b610936565b6100ec6101eb366004610d02565b6109d4565b3360009081526001602052604090205460ff1661026e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e65724f70657261746f723a20216f70657261746f72000000000000000060448201526064015b60405180910390fd5b604080516020808201835283825260008581526003825292909220815180519293919261029e9284920190610b79565b509050507f071383608143bc2a28bdb1246eb4b4c1ea77b678b6237395cb5b80203268781082826040516102d3929190611095565b60405180910390a15050565b60008181526003602090815260409182902091516060926103039260029201610fba565b6040516020818303038152906040529050919050565b3360009081526001602052604090205460ff16610392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e65724f70657261746f723a20216f70657261746f7200000000000000006044820152606401610265565b60005b82518110156104735760405180602001604052808383815181106103e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518152506003600085848151811061042a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518152602001908152602001600020600082015181600001908051906020019061045c929190610b79565b50905050808061046b90611175565b915050610395565b507f30fb9024e196a00a82e8a63aab46dfd06a2c166c1ee2b7d3951619b63b50503d82826040516102d3929190610fcf565b3360009081526001602052604090205460ff1661051e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f776e65724f70657261746f723a20216f70657261746f7200000000000000006044820152606401610265565b8051610531906002906020840190610b79565b5050565b6002805461054290611121565b80601f016020809104026020016040519081016040528092919081815260200182805461056e90611121565b80156105bb5780601f10610590576101008083540402835291602001916105bb565b820191906000526020600020905b81548152906001019060200180831161059e57829003601f168201915b505050505081565b60005473ffffffffffffffffffffffffffffffffffffffff163314610644576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610265565b61064e6000610b04565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610265565b73ffffffffffffffffffffffffffffffffffffffff8116610774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f20616464726573730000000000000000000000000000000000000000006064820152608401610265565b73ffffffffffffffffffffffffffffffffffffffff16600090815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610265565b73ffffffffffffffffffffffffffffffffffffffff81166108ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f20616464726573730000000000000000000000000000000000000000006064820152608401610265565b73ffffffffffffffffffffffffffffffffffffffff16600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b60036020526000908152604090208054819061095190611121565b80601f016020809104026020016040519081016040528092919081815260200182805461097d90611121565b80156109ca5780601f1061099f576101008083540402835291602001916109ca565b820191906000526020600020905b8154815290600101906020018083116109ad57829003601f168201915b5050505050905081565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610265565b73ffffffffffffffffffffffffffffffffffffffff8116610af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610265565b610b0181610b04565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054610b8590611121565b90600052602060002090601f016020900481019282610ba75760008555610bed565b82601f10610bc057805160ff1916838001178555610bed565b82800160010185558215610bed579182015b82811115610bed578251825591602001919060010190610bd2565b50610bf9929150610bfd565b5090565b5b80821115610bf95760008155600101610bfe565b600082601f830112610c22578081fd5b81356020610c37610c32836110fd565b6110ae565b82815281810190858301855b85811015610c6c57610c5a898684358b0101610c79565b84529284019290840190600101610c43565b5090979650505050505050565b600082601f830112610c89578081fd5b813567ffffffffffffffff811115610ca357610ca36111d3565b610cd460207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016110ae565b818152846020838601011115610ce8578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215610d13578081fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610d36578182fd5b9392505050565b60008060408385031215610d4f578081fd5b823567ffffffffffffffff80821115610d66578283fd5b818501915085601f830112610d79578283fd5b81356020610d89610c32836110fd565b82815281810190858301838502870184018b1015610da5578788fd5b8796505b84871015610dc7578035835260019690960195918301918301610da9565b5096505086013592505080821115610ddd578283fd5b50610dea85828601610c12565b9150509250929050565b600060208284031215610e05578081fd5b813567ffffffffffffffff811115610e1b578182fd5b610e2784828501610c79565b949350505050565b600060208284031215610e40578081fd5b5035919050565b60008060408385031215610e59578182fd5b82359150602083013567ffffffffffffffff811115610e76578182fd5b610dea85828601610c79565b60008151808452815b81811015610ea757602081850181015186830182015201610e8b565b81811115610eb85782602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805460009060028104600180831680610f0557607f831692505b6020808410821415610f3e577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015610f525760018114610f8157610fae565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650610fae565b60008881526020902060005b86811015610fa65781548b820152908501908301610f8d565b505084890196505b50505050505092915050565b6000610e27610fc98386610eeb565b84610eeb565b604080825283519082018190526000906020906060840190828701845b8281101561100857815184529284019290840190600101610fec565b5050508381038285015284518082528282019080840283018401878501865b83811015611073577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868403018552611061838351610e82565b94870194925090860190600101611027565b50909998505050505050505050565b600060208252610d366020830184610e82565b600083825260406020830152610e276040830184610e82565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156110f5576110f56111d3565b604052919050565b600067ffffffffffffffff821115611117576111176111d3565b5060209081020190565b60028104600182168061113557607f821691505b6020821081141561116f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156111cc577f4e487b710000000000000000000000000000000000000000000000000000000081526011600452602481fd5b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fdfea26469706673582212209d412bfc4c105fba5acb82921601502d1ca4b07229a02f2de6f9bc3e98d3742d64736f6c63430008020033