Taiko Hekla Testnet

Contract

0xBF640425d199D33b84E150DAc80D2d961F63AD51

Overview

ETH Balance

Taiko Hekla  LogoTaiko Hekla  LogoTaiko Hekla  Logo0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Update Leaderboa...9777072024-11-16 13:50:36157 days ago1731765036IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9776492024-11-16 13:26:48157 days ago1731763608IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9774052024-11-16 11:56:12158 days ago1731758172IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9750332024-11-15 14:26:48158 days ago1731680808IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9750302024-11-15 14:24:36158 days ago1731680676IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9750282024-11-15 14:23:24158 days ago1731680604IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9750222024-11-15 14:20:12158 days ago1731680412IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9750172024-11-15 14:16:36158 days ago1731680196IN
0xBF640425...61F63AD51
0 ETH0.000010170.10884718
Update Leaderboa...9748482024-11-15 12:41:12159 days ago1731674472IN
0xBF640425...61F63AD51
0 ETH0.000012030.10884718

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Leaderboard

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 3 : Leaderboard.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

/// @title Leaderboard
/// @notice Leaderboard entries for the Race Grid blockchain racing game.
contract Leaderboard is Ownable {
    /// @notice The results for each race.
    struct Result {
        address player;
        uint256 time;
        uint256 date;
    }

    /// @notice The list of results.
    Result[] private results;

    /// @notice Initialize the contract with the caller as owner.
    constructor() Ownable(msg.sender) {}

    /// @notice Add new entry to the leaderboard.
    /// @param player The address of the player.
    /// @param time The duration of the race.
    // For hackathon or testnets it's okay to leave this open. For mainnet needs to be `onlyOwner`.
    function updateLeaderboard(address player, uint256 time) external {
        results.push(Result({player: player, time: time, date: block.timestamp}));
    }

    /// @notice Retrieve leaderboard results.
    /// @param startIndex The start index, inclusive.
    /// @param endIndex The end index, exclusive.
    /// @return The array with the paginated results.
    /// @dev Using pagination to avoid OOG. Client is responsible for aggregation and sorting.
    function getResultsPaginated(uint256 startIndex, uint256 endIndex) external view returns (Result[] memory) {
        Result[] memory resultsCopy = results;
        Result[] memory paginatedResults = new Result[](endIndex - startIndex);
        uint256 paginatedResultsIndex;
        for (uint256 i = startIndex; i < endIndex; ++i) {
            paginatedResults[paginatedResultsIndex] = resultsCopy[i];
            ++paginatedResultsIndex;
        }
        return paginatedResults;
    }

    /// @notice Delete one entry from the leaderboard.
    /// @param targetIndex The index to delete.
    /// @dev Mainly used for testing.
    function deleteLeaderboardEntry(uint256 targetIndex) external onlyOwner {
        Result[] memory resultsCopy = results;
        uint256 lastIndex = results.length - 1;
        if (targetIndex != lastIndex) {
            Result memory lastItem = resultsCopy[targetIndex];
            results[lastIndex] = resultsCopy[targetIndex];
            results[targetIndex] = lastItem;
        }
        results.pop();
    }

    /// @notice Delete the entire leaderboard.
    /// @dev Mainly used for testing.
    function deleteLeaderboard() external onlyOwner {
        delete results;
    }

    /// @notice Retrive leaderboard length.
    /// @dev Can to be used when calling with pagination.
    function getResultsLength() external view returns (uint256) {
        return results.length;
    }
}

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

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

pragma solidity ^0.8.20;

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

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

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

Settings
{
  "remappings": [
    "forge-std/=dependencies/forge-std-1.9.3/src/",
    "@openzeppelin/contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.0.2/",
    "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.0.2/",
    "openzeppelin-foundry-upgrades/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/",
    "solidity-stringutils/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/",
    "@openzeppelin-contracts-5.0.2/=dependencies/@openzeppelin-contracts-5.0.2/",
    "@openzeppelin-contracts-upgradeable-5.0.2/=dependencies/@openzeppelin-contracts-upgradeable-5.0.2/",
    "ds-test/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/lib/ds-test/src/",
    "forge-std-1.9.3/=dependencies/forge-std-1.9.3/src/",
    "forge-std/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/forge-std/src/",
    "openzeppelin-foundry-upgrades-0.3.6/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"deleteLeaderboard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"targetIndex","type":"uint256"}],"name":"deleteLeaderboardEntry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getResultsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"endIndex","type":"uint256"}],"name":"getResultsPaginated","outputs":[{"components":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"date","type":"uint256"}],"internalType":"struct Leaderboard.Result[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"uint256","name":"time","type":"uint256"}],"name":"updateLeaderboard","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052348015600f57600080fd5b503380603557604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b603c816041565b506091565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61082e806100a06000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063715018a61161005b578063715018a6146100e457806381a745e5146100ec5780638da5cb5b146101bb578063f2fde38b146101d657600080fd5b80630f6df9651461008d57806319615328146100b65780634824bcd1146100c75780636a9d68a1146100d1575b600080fd5b6100a061009b36600461066c565b6101e9565b6040516100ad919061068e565b60405180910390f35b6001546040519081526020016100ad565b6100cf610355565b005b6100cf6100df3660046106f3565b61036b565b6100cf61054d565b6100cf6100fa366004610728565b604080516060810182526001600160a01b039384168152602081019283524291810191825260018054808201825560009190915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6600390920291820180546001600160a01b031916919095161790935590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7830155517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890910155565b6000546040516001600160a01b0390911681526020016100ad565b6100cf6101e4366004610752565b61055f565b606060006001805480602002602001604051908101604052809291908181526020016000905b82821015610264576000848152602090819020604080516060810182526003860290920180546001600160a01b031683526001808201548486015260029091015491830191909152908352909201910161020f565b50505050905060008484610278919061078a565b67ffffffffffffffff8111156102905761029061079d565b6040519080825280602002602001820160405280156102ee57816020015b6102db604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b8152602001906001900390816102ae5790505b5090506000855b858110156103485783818151811061030f5761030f6107b3565b6020026020010151838381518110610329576103296107b3565b60200260200101819052508161033e906107c9565b91506001016102f5565b5090925050505b92915050565b61035d6105a2565b6103696001600061061f565b565b6103736105a2565b60006001805480602002602001604051908101604052809291908181526020016000905b828210156103ec576000848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018082015484860152600290910154918301919091529083529092019101610397565b505050509050600060018080549050610405919061078a565b9050808314610507576000828481518110610422576104226107b3565b6020026020010151905082848151811061043e5761043e6107b3565b602002602001015160018381548110610459576104596107b3565b906000526020600020906003020160008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015590505080600185815481106104bf576104bf6107b3565b600091825260209182902083516003929092020180546001600160a01b0319166001600160a01b03909216919091178155908201516001820155604090910151600290910155505b6001805480610518576105186107e2565b60008281526020812060036000199093019283020180546001600160a01b031916815560018101829055600201559055505050565b6105556105a2565b61036960006105cf565b6105676105a2565b6001600160a01b03811661059657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61059f816105cf565b50565b6000546001600160a01b031633146103695760405163118cdaa760e01b815233600482015260240161058d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b508054600082556003029060005260206000209081019061059f91905b808211156106685780546001600160a01b0319168155600060018201819055600282015560030161063c565b5090565b6000806040838503121561067f57600080fd5b50508035926020909101359150565b602080825282518282018190526000918401906040840190835b818110156106e857835180516001600160a01b031684526020808201518186015260409182015191850191909152909301926060909201916001016106a8565b509095945050505050565b60006020828403121561070557600080fd5b5035919050565b80356001600160a01b038116811461072357600080fd5b919050565b6000806040838503121561073b57600080fd5b6107448361070c565b946020939093013593505050565b60006020828403121561076457600080fd5b61076d8261070c565b9392505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561034f5761034f610774565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600182016107db576107db610774565b5060010190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220c86a683b4aaa2b1f104f3388571ac7db8657d0a24f3063ce4c0035ad4a1ada3664736f6c634300081a0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063715018a61161005b578063715018a6146100e457806381a745e5146100ec5780638da5cb5b146101bb578063f2fde38b146101d657600080fd5b80630f6df9651461008d57806319615328146100b65780634824bcd1146100c75780636a9d68a1146100d1575b600080fd5b6100a061009b36600461066c565b6101e9565b6040516100ad919061068e565b60405180910390f35b6001546040519081526020016100ad565b6100cf610355565b005b6100cf6100df3660046106f3565b61036b565b6100cf61054d565b6100cf6100fa366004610728565b604080516060810182526001600160a01b039384168152602081019283524291810191825260018054808201825560009190915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6600390920291820180546001600160a01b031916919095161790935590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7830155517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890910155565b6000546040516001600160a01b0390911681526020016100ad565b6100cf6101e4366004610752565b61055f565b606060006001805480602002602001604051908101604052809291908181526020016000905b82821015610264576000848152602090819020604080516060810182526003860290920180546001600160a01b031683526001808201548486015260029091015491830191909152908352909201910161020f565b50505050905060008484610278919061078a565b67ffffffffffffffff8111156102905761029061079d565b6040519080825280602002602001820160405280156102ee57816020015b6102db604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b8152602001906001900390816102ae5790505b5090506000855b858110156103485783818151811061030f5761030f6107b3565b6020026020010151838381518110610329576103296107b3565b60200260200101819052508161033e906107c9565b91506001016102f5565b5090925050505b92915050565b61035d6105a2565b6103696001600061061f565b565b6103736105a2565b60006001805480602002602001604051908101604052809291908181526020016000905b828210156103ec576000848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018082015484860152600290910154918301919091529083529092019101610397565b505050509050600060018080549050610405919061078a565b9050808314610507576000828481518110610422576104226107b3565b6020026020010151905082848151811061043e5761043e6107b3565b602002602001015160018381548110610459576104596107b3565b906000526020600020906003020160008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015590505080600185815481106104bf576104bf6107b3565b600091825260209182902083516003929092020180546001600160a01b0319166001600160a01b03909216919091178155908201516001820155604090910151600290910155505b6001805480610518576105186107e2565b60008281526020812060036000199093019283020180546001600160a01b031916815560018101829055600201559055505050565b6105556105a2565b61036960006105cf565b6105676105a2565b6001600160a01b03811661059657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61059f816105cf565b50565b6000546001600160a01b031633146103695760405163118cdaa760e01b815233600482015260240161058d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b508054600082556003029060005260206000209081019061059f91905b808211156106685780546001600160a01b0319168155600060018201819055600282015560030161063c565b5090565b6000806040838503121561067f57600080fd5b50508035926020909101359150565b602080825282518282018190526000918401906040840190835b818110156106e857835180516001600160a01b031684526020808201518186015260409182015191850191909152909301926060909201916001016106a8565b509095945050505050565b60006020828403121561070557600080fd5b5035919050565b80356001600160a01b038116811461072357600080fd5b919050565b6000806040838503121561073b57600080fd5b6107448361070c565b946020939093013593505050565b60006020828403121561076457600080fd5b61076d8261070c565b9392505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561034f5761034f610774565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000600182016107db576107db610774565b5060010190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220c86a683b4aaa2b1f104f3388571ac7db8657d0a24f3063ce4c0035ad4a1ada3664736f6c634300081a0033

Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

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

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