Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0x40067f4a61cDb51b6965DABbD4b0fF5E7D430B71
Balance 0.039002 ETH ($76.86)
Nonce 1
Code Size 7125 bytes
Indexed Transactions 0 (1 on-chain, 1.5% indexed)
External Etherscan · Sourcify

Contract Bytecode

7125 bytes
Copy Bytecode
0x60806040526004361061026b5760003560e01c8063778c7e0f11610144578063b4ac62c5116100b6578063d89135cd1161007a578063d89135cd14610796578063dd62ed3e146107ac578063eacdc5ff146107f2578063f6d361cc14610808578063f930191014610823578063fce589d814610839576102ba565b8063b4ac62c514610725578063bbdd366a1461073a578063c2e5220614610756578063c70caee61461076b578063c97cb16b14610780576102ba565b806392a1f9671161010857806392a1f967146106a657806393e84cd9146106bc57806395d89b41146106c4578063a035b1fe146106d9578063a9059cbb146106ef578063ac50c42a1461070f576102ba565b8063778c7e0f146106045780638265cd0c1461065057806385e63fc6146106655780638ae63d6d1461067b5780639228b1b214610691576102ba565b80633d6aa5e1116101dd5780634e71d92d116101a15780634e71d92d1461056457806350fca6d01461057957806355170e811461058e5780636827e764146105a357806370a08231146105b957806373f65a9f146105ef576102ba565b80633d6aa5e1146104c257806342966c68146104db57806347a523c9146104fb57806347cb7f68146105125780634df9d6ba1461052f576102ba565b806318160ddd1161022f57806318160ddd146103a85780631959a002146103bd57806323b872dd146104315780633120f3c714610451578063313ce567146104665780633ad10ef614610482576102ba565b806306fdde03146102fd578063089fe6aa14610328578063095ea7b31461034c5780630cbb0f831461037c578063146ca53114610392576102ba565b366102ba5734156102b857601180543490810190915560405190815233907f7c1fe88ddd5adea093929917992135756151935bae283669bdd15f438e32c3ed906020015b60405180910390a25b005b34156102b857601180543490810190915560405190815233907f7c1fe88ddd5adea093929917992135756151935bae283669bdd15f438e32c3ed906020016102af565b34801561030957600080fd5b5061031261084f565b60405161031f9190611995565b60405180910390f35b34801561033457600080fd5b5061033e60125481565b60405190815260200161031f565b34801561035857600080fd5b5061036c6103673660046119ff565b6108e1565b604051901515815260200161031f565b34801561038857600080fd5b5061033e600b5481565b34801561039e57600080fd5b5061033e60065481565b3480156103b457600080fd5b5060025461033e565b3480156103c957600080fd5b506104096103d8366004611a29565b600e60205260009081526040902080546001909101546001600160801b0380831692600160801b9004169060ff1683565b604080516001600160801b03948516815293909216602084015215159082015260600161031f565b34801561043d57600080fd5b5061036c61044c366004611a4b565b6108fb565b34801561045d57600080fd5b5061033e60b481565b34801561047257600080fd5b506040516012815260200161031f565b34801561048e57600080fd5b506104aa735f1eab5dda8f3a053e65e625b7325b006c28404e81565b6040516001600160a01b03909116815260200161031f565b3480156104ce57600080fd5b5061033e64e8d4a5100081565b3480156104e757600080fd5b506102b86104f6366004611a88565b61091f565b34801561050757600080fd5b5061033e6203345081565b34801561051e57600080fd5b5061033e6802b5e3af16b188000081565b34801561053b57600080fd5b5061054f61054a366004611a29565b610ab0565b6040805192835260208301919091520161031f565b34801561057057600080fd5b506102b8610bed565b34801561058557600080fd5b5061033e605081565b34801561059a57600080fd5b5061036c610c0a565b3480156105af57600080fd5b5061033e60135481565b3480156105c557600080fd5b5061033e6105d4366004611a29565b6001600160a01b031660009081526020819052604090205490565b3480156105fb57600080fd5b5061033e606481565b34801561061057600080fd5b5061040961061f366004611a88565b600d60205260009081526040902080546001909101546001600160801b0380831692600160801b9004169060ff1683565b34801561065c57600080fd5b5061033e610c32565b34801561067157600080fd5b5061033e600a5481565b34801561068757600080fd5b5061033e60085481565b34801561069d57600080fd5b5061033e601e81565b3480156106b257600080fd5b5061033e60095481565b6102b8610c4a565b3480156106d057600080fd5b50610312610d5b565b3480156106e557600080fd5b5061033e60105481565b3480156106fb57600080fd5b5061036c61070a3660046119ff565b610d6a565b34801561071b57600080fd5b5061033e600f5481565b34801561073157600080fd5b5061033e600681565b34801561074657600080fd5b5061033e670de0b6b3a764000081565b34801561076257600080fd5b50600b5461033e565b34801561077757600080fd5b5061036c610d78565b34801561078c57600080fd5b5061033e600c5481565b3480156107a257600080fd5b5061033e60145481565b3480156107b857600080fd5b5061033e6107c7366004611aa1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156107fe57600080fd5b5061033e60075481565b34801561081457600080fd5b5061033e66038d7ea4c6800081565b34801561082f57600080fd5b5061033e61025881565b34801561084557600080fd5b5061033e60115481565b60606003805461085e90611ad4565b80601f016020809104026020016040519081016040528092919081815260200182805461088a90611ad4565b80156108d75780601f106108ac576101008083540402835291602001916108d7565b820191906000526020600020905b8154815290600101906020018083116108ba57829003601f168201915b5050505050905090565b6000336108ef818585610d90565b60019150505b92915050565b600033610909858285610da2565b610914858585610e26565b506001949350505050565b610927610e85565b8060000361094857604051635e85ae7360e01b815260040160405180910390fd5b3360009081526020819052604090205481111561097857604051631e9acf1760e31b815260040160405180910390fd5b601054600081900361099d576040516313a8ad7d60e11b815260040160405180910390fd5b6000670de0b6b3a76400006109b28385611b24565b6109bc9190611b51565b601154909150808211156109e35760405163f74defdd60e01b815260040160405180910390fd5b8181036011556109f33385610eaf565b6014805485019055604051600090339084908381818185875af1925050503d8060008114610a3d576040519150601f19603f3d011682016040523d82523d6000602084013e610a42565b606091505b5050905080610a645760405163b12d13eb60e01b815260040160405180910390fd5b604080518681526020810185905233917f23ff0e75edf108e3d0392d92e13e8c8a868ef19001bd49f9e94876dc46dff87f910160405180910390a250505050610aad6001600555565b50565b6001600160a01b0381166000908152600e60209081526040808320815160608101835281546001600160801b03808216808452600160801b909204169482019490945260019091015460ff1615159181019190915260075483921580610b1f575081516001600160801b031681145b80610b2b575081604001515b15610b3d575060009485945092505050565b81516001600160801b039081166000908152600d6020908152604091829020825160608101845281548086168252600160801b9004909416918401919091526001015460ff161515908201819052610b9d57506000958695509350505050565b64e8d4a5100081600001516001600160801b031684602001516001600160801b0316610bc99190611b24565b610bd39190611b51565b945080602001516001600160801b03169350505050915091565b610bf5610e85565b610bfe33610ee9565b610c086001600555565b565b60006064600b54101580610c2d5750610258600a5442610c2a9190611b65565b10155b905090565b6000670de0b6b3a7640000600854610c2d9190611b51565b610c52610e85565b66038d7ea4c680003414610c7957604051636fe6a4c960e01b815260040160405180910390fd5b600754336000908152600e6020526040902080546001600160801b0316829003610cb557604051621d934160e11b815260040160405180910390fd5b80546001600160801b031615801590610cd35750600181015460ff16155b15610ce157610ce133610ee9565b600b54600a544290600060b4610cf78385611b65565b1090506000818015610d095750601e85105b90508015610d3f573360009081526020819052604090205415610d3f57604051632eefb8d760e21b815260040160405180910390fd5b610d4a8786866110e5565b50505050505050610c086001600555565b60606004805461085e90611ad4565b6000336108ef818585610e26565b600060b4600a5442610d8a9190611b65565b10905090565b610d9d83838360016112b7565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811015610e205781811015610e1157604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b610e20848484840360006112b7565b50505050565b6001600160a01b038316610e5057604051634b637e8f60e11b815260006004820152602401610e08565b6001600160a01b038216610e7a5760405163ec442f0560e01b815260006004820152602401610e08565b610d9d83838361138c565b600260055403610ea857604051633ee5aeb560e01b815260040160405180910390fd5b6002600555565b6001600160a01b038216610ed957604051634b637e8f60e11b815260006004820152602401610e08565b610ee58260008361138c565b5050565b6001600160a01b0381166000908152600e60205260409020600754600182015460ff1615610f1657505050565b81546001600160801b03161580610f36575081546001600160801b031681145b15610f4057505050565b81546001600160801b039081166000818152600d6020908152604091829020825160608101845281548087168252600160801b9004909516918501919091526001015460ff161515908301819052909190610fae57604051638cf7570760e01b815260040160405180910390fd5b8051845460009164e8d4a5100091610fd9916001600160801b0390811691600160801b900416611b24565b610fe39190611b51565b60208301516001878101805460ff191690911790559091506001600160801b031681156110145761101487836114b6565b8015611090576000876001600160a01b03168260405160006040518083038185875af1925050503d8060008114611067576040519150601f19603f3d011682016040523d82523d6000602084013e61106c565b606091505b505090508061108e5760405163b12d13eb60e01b815260040160405180910390fd5b505b60408051838152602081018390529081018590526001600160a01b038816907f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e9060600160405180910390a250505050505050565b600a54600f54600060646110fa866001611b78565b101580611112575061025861110f8486611b65565b10155b9050600081611122576001611125565b60025b60ff1690506000670de0b6b3a7640000611154336001600160a01b031660009081526020819052604090205490565b61115e9190611b51565b90506000602882116111705781611173565b60285b9050600061118282600a611b78565b61118c9085611b24565b604080516060810182526001600160801b03808e16825280841660208084019182526000848601818152338252600e909252948520935191518316600160801b029190921617825551600191909101805491151560ff19909216919091179055600c805483019055909150611201878b611b8b565b9050600081600003611221576011805466038d7ea4c6800001905561124d565b8160010361123d576012805466038d7ea4c6800001905561124d565b6013805466038d7ea4c680000190555b5060018a01600b81905560408051848152602081018390529081018d905233907f68c7202a45decf815c2b366df51351accc580243258fedf46ddc86c1c0dd5f2b9060600160405180910390a286156112a9576112a98a6114ec565b505050505050505050505050565b6001600160a01b0384166112e15760405163e602df0560e01b815260006004820152602401610e08565b6001600160a01b03831661130b57604051634a1406b160e11b815260006004820152602401610e08565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610e2057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161137e91815260200190565b60405180910390a350505050565b6001600160a01b0383166113b75780600260008282546113ac9190611b78565b909155506114299050565b6001600160a01b0383166000908152602081905260409020548181101561140a5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610e08565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661144557600280548290039055611464565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516114a991815260200190565b60405180910390a3505050565b6001600160a01b0382166114e05760405163ec442f0560e01b815260006004820152602401610e08565b610ee56000838361138c565b600b5460008190036115115760405163145e55db60e01b815260040160405180910390fd5b600754600a54600954600c54600854600061152c8589611b65565b90506000610258611545670de0b6b3a764000084611b24565b61154f9190611b51565b9050670de0b6b3a7640000811115611598576000611575670de0b6b3a764000083611b65565b9050611582600582611b51565b61159490670de0b6b3a7640000611b78565b9150505b6000670de0b6b3a76400006115ad8388611b24565b6115b79190611b51565b9050600085156115de57856115d164e8d4a5100084611b24565b6115db9190611b51565b90505b60008060508c106116675760125460006115f9600383611b51565b90506116058e82611b51565b935061161a8e6001600160801b038616611b24565b9250821561166457828203601255604080518f8152602081018590528e917f63d71f07eb936381fc294fbded2b933703b98e1387a0c92bc886c12ae4f117c2910160405180910390a25b50505b6040518060600160405280846001600160801b03168152602001836001600160801b0316815260200160011515815250600d60008d815260200190815260200160002060008201518160000160006101000a8154816001600160801b0302191690836001600160801b0316021790555060208201518160000160106101000a8154816001600160801b0302191690836001600160801b0316021790555060408201518160010160006101000a81548160ff0219169083151502179055509050508a7f106faed61001488e1a1492e3cedcf93739b6c417b40145056cb9e806a3a8df1888878760405161176c939291909283526020830191909152604082015260600190565b60405180910390a286850160085583156117b7576000670de0b6b3a764000061179c66038d7ea4c680008f611b24565b6117a69190611b24565b90506117b28582611b51565b601055505b6007805460010190556000600b819055600c55600a8d90556117d76117e6565b50505050505050505050505050565b60006117fd670de0b6b3a764000062033450611b24565b90508060085410610aad5760068054600101905560006008819055600980546002929061182b908490611b51565b90915550506006546009546040517f817dd46c9e086ff5d522e93cfaf06ec87cf8c9af5b02982f5d4a5b7f2cd3e3349261186d92908252602082015260400190565b60405180910390a1600680541015610aad576118876118a3565b61189360016006611b65565b60065403610aad576002600f5550565b601354735f1eab5dda8f3a053e65e625b7325b006c28404e81158015906118d257506001600160a01b03811615155b15610ee557600060138190556040516001600160a01b0383169084908381818185875af1925050503d8060008114611926576040519150601f19603f3d011682016040523d82523d6000602084013e61192b565b606091505b505090508061194d57604051631009b7ff60e31b815260040160405180910390fd5b816001600160a01b03167f6c86cbe8f71dda79a8558f6b509bf627b232a1577720dd7807b4eefa65bd16a58460405161198891815260200190565b60405180910390a2505050565b602081526000825180602084015260005b818110156119c357602081860181015160408684010152016119a6565b506000604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b03811681146119fa57600080fd5b919050565b60008060408385031215611a1257600080fd5b611a1b836119e3565b946020939093013593505050565b600060208284031215611a3b57600080fd5b611a44826119e3565b9392505050565b600080600060608486031215611a6057600080fd5b611a69846119e3565b9250611a77602085016119e3565b929592945050506040919091013590565b600060208284031215611a9a57600080fd5b5035919050565b60008060408385031215611ab457600080fd5b611abd836119e3565b9150611acb602084016119e3565b90509250929050565b600181811c90821680611ae857607f821691505b602082108103611b0857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108f5576108f5611b0e565b634e487b7160e01b600052601260045260246000fd5b600082611b6057611b60611b3b565b500490565b818103818111156108f5576108f5611b0e565b808201808211156108f5576108f5611b0e565b600082611b9a57611b9a611b3b565b50069056fea264697066735822122048c108b39f33df0f30f5092a02539911529dc2f278289e66d94bef4b2301f1a564736f6c634300081c0033

Verified Source Code Full Match

Compiler: v0.8.28+commit.7893614a EVM: paris Optimization: Yes (200 runs)
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
ERC20.sol 305 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both values are immutable: they can only be set once during construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /// @inheritdoc IERC20
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /// @inheritdoc IERC20
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity >=0.6.2;

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

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

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

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

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

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Context.sol 28 lines
// 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;
    }
}
ReentrancyGuard.sol 87 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

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

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}
BTCR.sol 365 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

contract BTCR is ERC20, ReentrancyGuard {
    uint256 public constant ENTRY_FEE = 0.001 ether;
    uint256 public constant DECIMALS_MULTIPLIER = 1e18;
    uint256 public constant REWARD_PRECISION = 1e12;
    uint256 public constant HALF_BLOCK_NUM = 210000;
    uint256 public constant BLOCK_TIME = 600;
    uint256 public constant NEWBEE_TIME = 180;
    uint256 public constant INITIAL_BLOCK_PROFIT = 50 * 1e18;
    uint256 public constant NEWBEE_THRESHOLD = 30;
    uint256 public constant DIVIDEND_THRESHOLD = 80;
    uint256 public constant MAX_ENTRY_COUNT = 100;
    uint256 public constant MAX_ROUND = 6;
    address public constant devAddress = 0x5f1eab5dDA8f3A053e65E625B7325b006C28404E;

    error InvalidEntryFee();
    error AlreadyJoined();
    error OnlyNewbiesAllowed();
    error AmountMustBeGreaterThanZero();
    error InsufficientBalance();
    error PriceNotSet();
    error InsufficientBurnFee();
    error ETHTransferFailed();
    error NoPlayersInBlock();
    error EpochNotFinalized();
    error DevFeeTransferFailed();

    struct EpochResult {
        uint128 tokenPerShare;
        uint128 ethPerPlayer;
        bool finalized;
    }

    struct UserInfo {
        uint128 epochId;
        uint128 share;
        bool claimed;
    }

    uint256 public round = 1;
    uint256 public currentEpochId = 1;

    uint256 public blockNum;
    uint256 public blockProfit = INITIAL_BLOCK_PROFIT;
    uint256 public lastBlockTimestamp;

    uint256 public entryCount;
    uint256 public shareSum;

    mapping(uint256 => EpochResult) public epochResults;
    mapping(address => UserInfo) public userInfo;

    uint256 public allocateNum = 3;
    uint256 public price;
    uint256 public burnFee;
    uint256 public poolFee;
    uint256 public devFee;
    uint256 public totalBurned;

    event Played(address indexed player, uint256 share, uint256 entryCount, uint256 epochId);
    event BlockMined(
        uint256 indexed epochId,
        uint256 blockNum,
        uint256 blockPercent,
        uint256 totalProfit
    );
    event DividendDistributed(uint256 indexed epochId, uint256 playerCount, uint256 totalReward);
    event Halved(uint256 newRound, uint256 newBlockProfit);
    event Burned(address indexed user, uint256 amount, uint256 ethReturned);
    event DevFeeWithdrawn(address indexed dev, uint256 amount);
    event Claimed(address indexed user, uint256 tokenAmount, uint256 ethAmount, uint256 epochId);
    event UnexpectedETHReceived(address indexed sender, uint256 amount);

    constructor() ERC20("BTC Reborn", "BTCR") {
        lastBlockTimestamp = block.timestamp;
    }

    receive() external payable {
        if (msg.value > 0) {
            unchecked {
                burnFee += msg.value;
            }
            emit UnexpectedETHReceived(msg.sender, msg.value);
        }
    }

    fallback() external payable {
        if (msg.value > 0) {
            unchecked {
                burnFee += msg.value;
            }
            emit UnexpectedETHReceived(msg.sender, msg.value);
        }
    }

    function play() external payable nonReentrant {
        if (msg.value != ENTRY_FEE) revert InvalidEntryFee();

        uint256 _currentEpochId = currentEpochId;
        UserInfo storage user = userInfo[msg.sender];

        if (user.epochId == _currentEpochId) revert AlreadyJoined();

        if (user.epochId > 0 && !user.claimed) {
            _claim(msg.sender);
        }

        uint256 _entryCount = entryCount;
        uint256 _timestamp = block.timestamp;
        uint256 _lastBlockTimestamp = lastBlockTimestamp;

        bool inNewbeePeriod = _timestamp - _lastBlockTimestamp < NEWBEE_TIME;
        bool shouldCheckNewbee = inNewbeePeriod && _entryCount < NEWBEE_THRESHOLD;

        if (shouldCheckNewbee) {
            if (balanceOf(msg.sender) != 0) revert OnlyNewbiesAllowed();
        }

        _register(_currentEpochId, _entryCount, _timestamp);
    }

    function claim() external nonReentrant {
        _claim(msg.sender);
    }

    function burn(uint256 amount) external nonReentrant {
        if (amount == 0) revert AmountMustBeGreaterThanZero();
        if (balanceOf(msg.sender) < amount) revert InsufficientBalance();

        uint256 _price = price;
        if (_price == 0) revert PriceNotSet();

        uint256 ethReturned = (amount * _price) / DECIMALS_MULTIPLIER;

        uint256 _burnFee = burnFee;
        if (ethReturned > _burnFee) revert InsufficientBurnFee();

        unchecked {
            burnFee = _burnFee - ethReturned;
        }

        _burn(msg.sender, amount);

        unchecked {
            totalBurned += amount;
        }

        (bool success, ) = msg.sender.call{ value: ethReturned }("");
        if (!success) revert ETHTransferFailed();

        emit Burned(msg.sender, amount, ethReturned);
    }

    function _claim(address player) internal {
        UserInfo storage user = userInfo[player];

        uint256 _currentEpochId = currentEpochId;

        if (user.claimed) return;
        if (user.epochId == 0 || user.epochId == _currentEpochId) return;

        uint256 userEpochId = user.epochId;
        EpochResult memory result = epochResults[userEpochId];
        if (!result.finalized) revert EpochNotFinalized();

        uint256 tokenReward = (uint256(user.share) * uint256(result.tokenPerShare)) /
            REWARD_PRECISION;
        uint256 ethReward = uint256(result.ethPerPlayer);

        user.claimed = true;

        if (tokenReward > 0) {
            _mint(player, tokenReward);
        }
        if (ethReward > 0) {
            (bool success, ) = player.call{ value: ethReward }("");
            if (!success) revert ETHTransferFailed();
        }

        emit Claimed(player, tokenReward, ethReward, userEpochId);
    }

    function _register(uint256 _currentEpochId, uint256 _entryCount, uint256 _timestamp) internal {
        uint256 _lastBlockTimestamp = lastBlockTimestamp;
        uint256 _allocateNum = allocateNum;

        bool shouldMineBlock = (_entryCount + 1 >= MAX_ENTRY_COUNT) ||
            (_timestamp - _lastBlockTimestamp >= BLOCK_TIME);

        uint256 shareMultiplier = shouldMineBlock ? 2 : 1;
        uint256 balance = balanceOf(msg.sender) / DECIMALS_MULTIPLIER;
        uint256 balanceShare = balance > 40 ? 40 : balance;
        uint256 share = shareMultiplier * (10 + balanceShare);

        userInfo[msg.sender] = UserInfo({
            epochId: uint128(_currentEpochId),
            share: uint128(share),
            claimed: false
        });

        unchecked {
            shareSum += share;
        }

        uint256 feeType = _entryCount % _allocateNum;
        uint256 newEntryCount;
        unchecked {
            if (feeType == 0) {
                burnFee += ENTRY_FEE;
            } else if (feeType == 1) {
                poolFee += ENTRY_FEE;
            } else {
                devFee += ENTRY_FEE;
            }
            newEntryCount = _entryCount + 1;
            entryCount = newEntryCount;
        }

        emit Played(msg.sender, share, newEntryCount, _currentEpochId);

        if (shouldMineBlock) {
            _mineBlock(_timestamp);
        }
    }

    function _mineBlock(uint256 _timestamp) internal {
        uint256 _entryCount = entryCount;
        if (_entryCount == 0) revert NoPlayersInBlock();

        uint256 _currentEpochId = currentEpochId;
        uint256 _lastBlockTimestamp = lastBlockTimestamp;
        uint256 _blockProfit = blockProfit;
        uint256 _shareSum = shareSum;
        uint256 _blockNum = blockNum;

        uint256 timeDiff = _timestamp - _lastBlockTimestamp;
        uint256 blockPercent = (timeDiff * DECIMALS_MULTIPLIER) / BLOCK_TIME;

        if (blockPercent > DECIMALS_MULTIPLIER) {
            uint256 excess = blockPercent - DECIMALS_MULTIPLIER;
            blockPercent = DECIMALS_MULTIPLIER + excess / 5;
        }

        uint256 totalProfit = (_blockProfit * blockPercent) / DECIMALS_MULTIPLIER;

        uint128 tokenPerShare = 0;
        if (_shareSum > 0) {
            tokenPerShare = uint128((totalProfit * REWARD_PRECISION) / _shareSum);
        }

        uint128 ethPerPlayer = 0;
        uint256 totalEthDistributed = 0;

        if (_entryCount >= DIVIDEND_THRESHOLD) {
            uint256 _poolFee = poolFee;
            uint256 totalReward = _poolFee / 3;
            ethPerPlayer = uint128(totalReward / _entryCount);
            totalEthDistributed = uint256(ethPerPlayer) * _entryCount;

            if (totalEthDistributed > 0) {
                unchecked {
                    poolFee = _poolFee - totalEthDistributed;
                }
                emit DividendDistributed(_currentEpochId, _entryCount, totalEthDistributed);
            }
        }

        epochResults[_currentEpochId] = EpochResult({
            tokenPerShare: tokenPerShare,
            ethPerPlayer: ethPerPlayer,
            finalized: true
        });

        emit BlockMined(_currentEpochId, _blockNum, blockPercent, totalProfit);

        unchecked {
            blockNum = _blockNum + blockPercent;
        }

        if (totalProfit > 0) {
            uint256 numerator = _entryCount * ENTRY_FEE * DECIMALS_MULTIPLIER;
            price = numerator / totalProfit;
        }

        unchecked {
            ++currentEpochId;
        }
        entryCount = 0;
        shareSum = 0;
        lastBlockTimestamp = _timestamp;

        _checkHalving();
    }

    function _checkHalving() internal {
        uint256 halfBlockThreshold = HALF_BLOCK_NUM * DECIMALS_MULTIPLIER;
        if (blockNum >= halfBlockThreshold) {
            unchecked {
                round++;
            }
            blockNum = 0;
            blockProfit /= 2;

            emit Halved(round, blockProfit);

            if (round < MAX_ROUND) {
                _withdrawDevFee();
                if (round == MAX_ROUND - 1) {
                    allocateNum = 2;
                }
            }
        }
    }

    function _withdrawDevFee() internal {
        uint256 _devFee = devFee;
        address _devAddress = devAddress;
        if (_devFee > 0 && _devAddress != address(0)) {
            devFee = 0;
            (bool success, ) = _devAddress.call{ value: _devFee }("");
            if (!success) revert DevFeeTransferFailed();
            emit DevFeeWithdrawn(_devAddress, _devFee);
        }
    }

    function getPlayerCount() external view returns (uint256) {
        return entryCount;
    }

    function getBlockNumValue() external view returns (uint256) {
        return blockNum / DECIMALS_MULTIPLIER;
    }

    function isNewbeeTime() external view returns (bool) {
        return block.timestamp - lastBlockTimestamp < NEWBEE_TIME;
    }

    function canMineBlock() external view returns (bool) {
        return
            (entryCount >= MAX_ENTRY_COUNT) || (block.timestamp - lastBlockTimestamp >= BLOCK_TIME);
    }

    function getPendingReward(
        address player
    ) external view returns (uint256 tokenReward, uint256 ethReward) {
        UserInfo memory user = userInfo[player];
        uint256 _currentEpochId = currentEpochId;
        if (user.epochId == 0 || user.epochId == _currentEpochId || user.claimed) {
            return (0, 0);
        }

        EpochResult memory result = epochResults[user.epochId];
        if (!result.finalized) {
            return (0, 0);
        }

        tokenReward = (uint256(user.share) * uint256(result.tokenPerShare)) / REWARD_PRECISION;
        ethReward = uint256(result.ethPerPlayer);
    }
}

Read Contract

BLOCK_TIME 0xf9301910 → uint256
DECIMALS_MULTIPLIER 0xbbdd366a → uint256
DIVIDEND_THRESHOLD 0x50fca6d0 → uint256
ENTRY_FEE 0xf6d361cc → uint256
HALF_BLOCK_NUM 0x47a523c9 → uint256
INITIAL_BLOCK_PROFIT 0x47cb7f68 → uint256
MAX_ENTRY_COUNT 0x73f65a9f → uint256
MAX_ROUND 0xb4ac62c5 → uint256
NEWBEE_THRESHOLD 0x9228b1b2 → uint256
NEWBEE_TIME 0x3120f3c7 → uint256
REWARD_PRECISION 0x3d6aa5e1 → uint256
allocateNum 0xac50c42a → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
blockNum 0x8ae63d6d → uint256
blockProfit 0x92a1f967 → uint256
burnFee 0xfce589d8 → uint256
canMineBlock 0x55170e81 → bool
currentEpochId 0xeacdc5ff → uint256
decimals 0x313ce567 → uint8
devAddress 0x3ad10ef6 → address
devFee 0x6827e764 → uint256
entryCount 0x0cbb0f83 → uint256
epochResults 0x778c7e0f → uint128, uint128, bool
getBlockNumValue 0x8265cd0c → uint256
getPendingReward 0x4df9d6ba → uint256, uint256
getPlayerCount 0xc2e52206 → uint256
isNewbeeTime 0xc70caee6 → bool
lastBlockTimestamp 0x85e63fc6 → uint256
name 0x06fdde03 → string
poolFee 0x089fe6aa → uint256
price 0xa035b1fe → uint256
round 0x146ca531 → uint256
shareSum 0xc97cb16b → uint256
symbol 0x95d89b41 → string
totalBurned 0xd89135cd → uint256
totalSupply 0x18160ddd → uint256
userInfo 0x1959a002 → uint128, uint128, bool

Write Contract 6 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address spender
uint256 value
returns: bool
burn 0x42966c68
uint256 amount
claim 0x4e71d92d
No parameters
play 0x93e84cd9
No parameters
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool

Recent Transactions

This address has 1 on-chain transactions, but only 1.5% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →