Blockchain / Global / Address
Contract
0x89121e9e8C69ea746cA01eA651f4C80072eaB0a3
- Balance
- 0 SOMI
- Transactions sent
- 1
- Type
- Contract · 9,728 bytes of code
HandsGame Verified
- Compiler
- solc 0.8.22+commit.4fc1097e
- Language
- Solidity
- Optimization
- Yes, 200 runs
- EVM version
- shanghai
- License
- —
- Verified
- 2026-10-12
src/HandsGame.sol
and 8 more files
Solidity
// SPDX-License-Identifier: MIT
///////////|\\\\\\\\\\\
// . ' , \\
// _________ \\
// _ /_|_____|_\ _ \\
// '. \ / .' \\
// '.\ /.' \\
// '.' \\
///////////|\\\\\\\\\\\
pragma solidity ^0.8.22;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {Hand} from "./types/Hand.sol";
import {Pool} from "./types/Pool.sol";
import {RequestStatus} from "./types/RequestStatus.sol";
import {IRandomNumberGenerator} from "./interfaces/IRandomNumberGenerator.sol";
import {IWhitelistVerifier} from "./interfaces/IWhitelistVerifier.sol";
contract HandsGame is Ownable, ReentrancyGuard {
error AlreadyLeveling(uint256 tokenId);
error LevelCapReached(uint256 tokenId);
error NotTokenOwner(uint256 tokenId);
error NotHolder(address caller);
error NotRandomGenerator(address caller);
error NotOwner(address owner);
error Migrated(uint256 handId);
error AlreadyMigrated(uint256 handId);
error Blocklisted(address account);
error SupplyCapReached();
error WhitelistOverflow();
error PublicMintOverflow();
error InvalidParameter();
error InvalidPercentage();
error InvalidProof();
error WhitelistSaleNotActive();
error PublicSaleNotActive();
error InsufficientFunds();
error InsufficientFee();
error CooldownActive();
error UnclaimedRewards();
error OnlyDiamondhand();
error MigrateCountExceeded();
error EmergencyVoteNotActive();
error AlreadyVoted();
error TransferFailed();
event Mint(address indexed minter, uint256[] tokenIds, bool isWhitelist);
event LevelUpCompleted(
uint256 indexed tokenId,
uint256 newLevel,
bool isSuccess
);
event SaleStatusChanged(bool isWhitelist, bool newStatus);
event Claim(address indexed claimer, uint256 qty, uint256 amount);
event Migrate(uint256 indexed tokenId, address indexed owner);
event WithdrawRewards(address indexed claimer, uint256 amount);
event PoolDeposit(address indexed depositor, uint8 poolId, uint256 amount);
IRandomNumberGenerator private _randomNumberGenerator;
IWhitelistVerifier private _whitelistVerifier;
uint256 private _nextTokenId;
uint8[4] private _poolDistributionRates;
uint256[4] private _levelUpDurations;
mapping(address => uint256) private _rewardBalances;
mapping(address => bool) private _blocklisted;
mapping(address => uint256) private _ownedHandsCount;
mapping(address => mapping(uint256 => uint256)) private _ownedHands;
mapping(uint256 => uint256) private _ownedHandsIndex;
mapping(uint256 => address) private _handOwners;
mapping(uint256 => Hand) private _hands;
mapping(uint256 => uint256) private _migratedHands;
mapping(address => bool) private _emergencyVoters;
address private _levelUpFeeReceiver;
uint256 private _levelUpFeeAmount;
uint8 public constant MAX_LEVEL = 4;
uint256 public immutable MAX_SUPPLY;
uint256 public immutable MAX_WHITELIST_MINT;
uint256 public immutable MAX_PUBLIC_MINT;
uint256 public immutable WHITELIST_PRICE;
uint256 public immutable PUBLIC_PRICE;
mapping(address => uint256) public whitelistClaims;
mapping(address => uint256) public publicClaims;
mapping(uint8 => Pool) public pools;
uint256 public teamPercentage;
uint256 public teamBalance;
uint256 public migrateCount;
uint256 public maxMigrateCount;
bool public whitelistSaleStatus;
bool public publicSaleStatus;
uint256 public startedTimestamp;
uint256 public withdrawReadyAt;
bool public isEmergencyVoteActive;
uint256 public totalEmergencyVotes;
constructor(
address _initialOwner,
uint256 _maxSupply,
uint256 _maxWhitelistMint,
uint256 _maxPublicMint,
uint256 _whitelistPrice,
uint256 _publicPrice,
uint256 _levelUpFee,
address[] memory _externalContracts,
uint8[] memory _distributionPercentages,
uint256[] memory _durations,
uint256[] memory _rewardPerTimestamps
) Ownable(_initialOwner) {
_randomNumberGenerator = IRandomNumberGenerator(_externalContracts[0]);
_whitelistVerifier = IWhitelistVerifier(_externalContracts[1]);
_levelUpFeeReceiver = _externalContracts[0];
_levelUpFeeAmount = _levelUpFee;
MAX_SUPPLY = _maxSupply;
MAX_WHITELIST_MINT = _maxWhitelistMint;
MAX_PUBLIC_MINT = _maxPublicMint;
WHITELIST_PRICE = _whitelistPrice;
PUBLIC_PRICE = _publicPrice;
teamPercentage = 20;
maxMigrateCount = 100;
for (uint8 i = 0; i < 4; i++) {
_poolDistributionRates[i] = _distributionPercentages[i];
_levelUpDurations[i] = _durations[i];
pools[i + 1] = Pool({
totalPlayers: 0,
totalRewards: 0,
distrubutedRewards: 0,
rewardsPerTimestamp: _rewardPerTimestamps[i]
});
withdrawReadyAt += _durations[i];
}
}
function _requireOwned(uint256 _tokenId) internal view returns (address) {
address owner = _handOwners[_tokenId];
if (owner == address(0)) {
revert NotTokenOwner(_tokenId);
}
return owner;
}
function _mint(address _to) internal returns (uint256) {
uint256 tokenId = _nextTokenId;
unchecked {
_nextTokenId++;
}
if (tokenId >= MAX_SUPPLY) {
revert SupplyCapReached();
}
uint256 activityTimestamp;
if (startedTimestamp > block.timestamp) {
activityTimestamp = startedTimestamp;
} else {
activityTimestamp = block.timestamp;
}
_hands[tokenId] = Hand({
level: 1,
lastActionTimestamp: activityTimestamp,
isEligibleForLevelUp: false,
isLevelingUp: false,
isMigrated: false
});
uint256 ownedIndex = _ownedHandsCount[_to];
_ownedHands[_to][ownedIndex] = tokenId;
_ownedHandsIndex[tokenId] = ownedIndex;
_ownedHandsCount[_to]++;
_handOwners[tokenId] = _to;
pools[1].totalPlayers++;
return tokenId;
}
function _calculate(
uint256 _tokenLevel,
uint256 _randomNumber
) internal pure returns (bool) {
uint256 num = _randomNumber % 100;
if (_tokenLevel == 1) {
return num < 80;
} else if (_tokenLevel == 2) {
return num < 50;
} else {
return num < 30;
}
}
function _deposit(uint8 _poolId, uint256 _amount) internal {
unchecked {
pools[_poolId].totalRewards += _amount;
}
}
function _distributeAmount(uint256 _amount) internal {
uint256 teamAmount = (_amount * teamPercentage) / 100;
if (teamAmount > 0) {
unchecked {
teamBalance += teamAmount;
}
}
for (uint256 i = 0; i < _poolDistributionRates.length; i++) {
uint256 poolAmount = (_amount * _poolDistributionRates[i]) / 100;
if (poolAmount > 0) {
_deposit(uint8(i + 1), poolAmount);
}
}
}
function _remainingPoolRewards(
uint8 _poolId
) internal view returns (uint256) {
return pools[_poolId].totalRewards - pools[_poolId].distrubutedRewards;
}
function totalSupply() external view returns (uint256) {
return _nextTokenId;
}
function balanceOf(address _owner) external view returns (uint256) {
if (_owner == address(0)) {
revert NotOwner(_owner);
}
return _ownedHandsCount[_owner];
}
function rewardBalanceOf(address _owner) external view returns (uint256) {
return _rewardBalances[_owner];
}
function ownerOf(uint256 _tokenId) external view returns (address) {
return _requireOwned(_tokenId);
}
function handOfOwnerByIndex(
address _owner,
uint256 _index
) external view returns (uint256) {
if (_owner == address(0)) {
revert NotOwner(_owner);
}
return _ownedHands[_owner][_index];
}
function getHand(uint256 _tokenId) external view returns (Hand memory) {
_requireOwned(_tokenId);
return _hands[_tokenId];
}
function getRandomNumberGeneratorAddress() external view returns (address) {
return address(_randomNumberGenerator);
}
function getWhitelistVerifierAddress() external view returns (address) {
return address(_whitelistVerifier);
}
function getLevelUpFeeReceiver() external view returns (address) {
return _levelUpFeeReceiver;
}
function getLevelUpFeeAmount() external view returns (uint256) {
return _levelUpFeeAmount;
}
function getPoolDistributionRates()
external
view
returns (uint8[4] memory)
{
return _poolDistributionRates;
}
function getLevelUpDurations() external view returns (uint256[4] memory) {
return _levelUpDurations;
}
function getVoterStatus(address _voter) external view returns (bool) {
return _emergencyVoters[_voter];
}
function isBlocklisted(address _account) external view returns (bool) {
return _blocklisted[_account];
}
function whitelistMint(
bytes32[] calldata _merkleProof,
uint256 _qty
) external payable nonReentrant {
if (_qty == 0) {
revert InvalidParameter();
}
if (whitelistSaleStatus == false) {
revert WhitelistSaleNotActive();
}
if (msg.value != WHITELIST_PRICE * _qty) {
revert InsufficientFunds();
}
if (_qty > (MAX_WHITELIST_MINT - whitelistClaims[msg.sender])) {
revert WhitelistOverflow();
}
if (
!_whitelistVerifier.verifyWhitelist(
address(this),
msg.sender,
_merkleProof
)
) {
revert InvalidProof();
}
uint256[] memory tokenIds = new uint256[](_qty);
for (uint256 i = 0; i < _qty; i++) {
uint256 tokenId = _mint(msg.sender);
tokenIds[i] = tokenId;
}
_distributeAmount(msg.value);
whitelistClaims[msg.sender] += _qty;
emit Mint(msg.sender, tokenIds, true);
}
function publicMint(uint256 _qty) external payable nonReentrant {
if (_qty == 0) {
revert InvalidParameter();
}
if (publicSaleStatus == false) {
revert PublicSaleNotActive();
}
if (msg.value != PUBLIC_PRICE * _qty) {
revert InsufficientFunds();
}
if (publicClaims[msg.sender] + _qty > MAX_PUBLIC_MINT) {
revert PublicMintOverflow();
}
uint256[] memory tokenIds = new uint256[](_qty);
for (uint256 i = 0; i < _qty; i++) {
uint256 tokenId = _mint(msg.sender);
tokenIds[i] = tokenId;
}
_distributeAmount(msg.value);
publicClaims[msg.sender] += _qty;
emit Mint(msg.sender, tokenIds, false);
}
function claim(uint256[] calldata _tokenIds) external nonReentrant {
if (_blocklisted[msg.sender]) {
revert Blocklisted(msg.sender);
}
uint256 totalAmount = 0;
for (uint256 i = 0; i < _tokenIds.length; i++) {
uint256 tokenId = _tokenIds[i];
address owner = _requireOwned(tokenId);
if (owner != msg.sender) {
revert NotHolder(msg.sender);
}
Hand storage hand = _hands[tokenId];
if (hand.isMigrated) {
revert Migrated(tokenId);
}
uint256 requiredTimestamp = hand.lastActionTimestamp +
_levelUpDurations[(hand.level - 1)];
if (requiredTimestamp > block.timestamp) {
revert CooldownActive();
}
uint256 rewardAmount;
uint256 reward = pools[hand.level].rewardsPerTimestamp *
_levelUpDurations[(hand.level - 1)];
uint256 remainingPoolRewards = _remainingPoolRewards(hand.level);
if (remainingPoolRewards > reward) {
rewardAmount = reward;
} else {
rewardAmount = remainingPoolRewards;
}
unchecked {
totalAmount += rewardAmount;
pools[hand.level].distrubutedRewards += rewardAmount;
}
hand.lastActionTimestamp = block.timestamp;
hand.isEligibleForLevelUp = true;
}
if (totalAmount > 0) {
_rewardBalances[msg.sender] += totalAmount;
}
emit Claim(msg.sender, _tokenIds.length, totalAmount);
}
function levelUp(uint256 _tokenId) external payable {
address owner = _requireOwned(_tokenId);
if (owner != msg.sender) {
revert NotHolder(msg.sender);
}
Hand storage hand = _hands[_tokenId];
if (hand.isMigrated) {
revert Migrated(_tokenId);
}
if (hand.isLevelingUp) {
revert AlreadyLeveling(_tokenId);
}
if (hand.level == MAX_LEVEL) {
revert LevelCapReached(_tokenId);
}
if (hand.isEligibleForLevelUp == false) {
revert UnclaimedRewards();
}
if (msg.value != _levelUpFeeAmount) {
revert InsufficientFee();
}
hand.lastActionTimestamp = block.timestamp;
hand.isLevelingUp = true;
(bool sent, ) = _levelUpFeeReceiver.call{value: _levelUpFeeAmount}("");
if (!sent) {
revert TransferFailed();
}
_randomNumberGenerator.requestRandomNumber(_tokenId);
}
function migrate(uint256 _tokenId) external {
if (migrateCount >= maxMigrateCount) {
revert MigrateCountExceeded();
}
Hand storage hand = _hands[_tokenId];
if (hand.isMigrated) {
revert AlreadyMigrated(_tokenId);
}
if (hand.level != 4) {
revert OnlyDiamondhand();
}
hand.isMigrated = true;
_migratedHands[migrateCount] = _tokenId;
migrateCount++;
emit Migrate(_tokenId, msg.sender);
}
function withdrawRewards() external nonReentrant {
if (_blocklisted[msg.sender]) {
revert Blocklisted(msg.sender);
}
if (block.timestamp < (startedTimestamp + withdrawReadyAt + 7200)) {
revert CooldownActive();
}
uint256 amount = _rewardBalances[msg.sender];
if (amount == 0) {
revert InsufficientFunds();
}
_rewardBalances[msg.sender] = 0;
(bool sent, ) = msg.sender.call{value: amount}("");
if (!sent) {
revert TransferFailed();
}
emit WithdrawRewards(msg.sender, amount);
}
function fulfillLevelUp(uint256 _tokenId, uint256 _randomNumber) external {
if (msg.sender != address(_randomNumberGenerator)) {
revert NotRandomGenerator(msg.sender);
}
Hand storage hand = _hands[_tokenId];
hand.isEligibleForLevelUp = false;
hand.isLevelingUp = false;
bool isSuccess = _calculate(hand.level, _randomNumber);
if (isSuccess) {
pools[hand.level].totalPlayers--;
hand.level++;
pools[hand.level].totalPlayers++;
}
emit LevelUpCompleted(_tokenId, hand.level, isSuccess);
}
function deposit(uint8 _poolId) external payable nonReentrant {
if (_poolId < 1 || _poolId > 4) {
revert InvalidParameter();
}
if (msg.value == 0) {
revert InsufficientFunds();
}
_deposit(_poolId, msg.value);
emit PoolDeposit(msg.sender, _poolId, msg.value);
}
function voteEmergency() external {
if (isEmergencyVoteActive == false) {
revert EmergencyVoteNotActive();
}
if (_emergencyVoters[msg.sender]) {
revert AlreadyVoted();
}
uint256 ownerBalance = _ownedHandsCount[msg.sender];
if (ownerBalance == 0) {
revert NotHolder(msg.sender);
}
totalEmergencyVotes += ownerBalance;
_emergencyVoters[msg.sender] = true;
}
function setRandomNumberGenerator(
address _randomNumberGeneratorAddress
) external onlyOwner {
_randomNumberGenerator = IRandomNumberGenerator(
_randomNumberGeneratorAddress
);
}
function setWhitelistVerifier(
address _whitelistVerifierAddress
) external onlyOwner {
_whitelistVerifier = IWhitelistVerifier(_whitelistVerifierAddress);
}
function setLevelUpFeeReceiver(
address _levelUpFeeReceiverAddress
) external onlyOwner {
_levelUpFeeReceiver = _levelUpFeeReceiverAddress;
}
function setLevelUpFeeAmount(uint256 _levelUpFee) external onlyOwner {
_levelUpFeeAmount = _levelUpFee;
}
function setMaxMigrateCount(uint256 _maxMigrateCount) external onlyOwner {
maxMigrateCount = _maxMigrateCount;
}
function setWhitelistSaleStatus(bool _status) external onlyOwner {
if (startedTimestamp == 0) {
startedTimestamp = block.timestamp + 7200;
}
whitelistSaleStatus = _status;
emit SaleStatusChanged(true, _status);
}
function setPublicSaleStatus(bool _status) external onlyOwner {
if (startedTimestamp == 0) {
startedTimestamp = block.timestamp + 7200;
}
publicSaleStatus = _status;
emit SaleStatusChanged(false, _status);
}
function setTeamPercentage(uint256 _teamPercentage) external onlyOwner {
if (_teamPercentage > 30) {
revert InvalidPercentage();
}
teamPercentage = _teamPercentage;
}
function setEmergencyVoteStatus(
bool _isEmergencyVoteActive
) external onlyOwner {
isEmergencyVoteActive = _isEmergencyVoteActive;
}
function setBlocklistStatus(
address _account,
bool _status
) external onlyOwner {
_blocklisted[_account] = _status;
}
function withdrawTeamBalance() external onlyOwner {
(bool sent, ) = msg.sender.call{value: teamBalance}("");
if (!sent) {
revert TransferFailed();
}
teamBalance = 0;
}
function withdraw() external onlyOwner {
if (
(block.timestamp >
startedTimestamp + (_levelUpDurations[3] * MAX_LEVEL)) ||
(totalEmergencyVotes > (_nextTokenId / 2))
) {
(bool sent, ) = msg.sender.call{value: address(this).balance}("");
if (!sent) {
revert TransferFailed();
}
} else {
revert CooldownActive();
}
}
// Function to receive Ether. msg.data must be empty
receive() external payable {}
// Fallback function is called when msg.data is not empty
fallback() external payable {}
}
Other files
lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/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); } }lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/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; } }lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol
// 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; } }src/interfaces/IRandomNumberGenerator.sol
// SPDX-License-Identifier: MIT ///////////|\\\\\\\\\\\ // . ' , \\ // _________ \\ // _ /_|_____|_\ _ \\ // '. \ / .' \\ // '.\ /.' \\ // '.' \\ ///////////|\\\\\\\\\\\ pragma solidity 0.8.22; import {RequestStatus} from "../types/RequestStatus.sol"; interface IRandomNumberGenerator { function requestRandomNumber(uint256 _tokenId) external; }src/interfaces/IWhitelistVerifier.sol
// SPDX-License-Identifier: MIT ///////////|\\\\\\\\\\\ // . ' , \\ // _________ \\ // _ /_|_____|_\ _ \\ // '. \ / .' \\ // '.\ /.' \\ // '.' \\ ///////////|\\\\\\\\\\\ pragma solidity 0.8.22; interface IWhitelistVerifier { function verifyWhitelist( address _contractAddress, address _caller, bytes32[] calldata _merkleProof ) external view returns (bool); }src/types/Hand.sol
// SPDX-License-Identifier: MIT ///////////|\\\\\\\\\\\ // . ' , \\ // _________ \\ // _ /_|_____|_\ _ \\ // '. \ / .' \\ // '.\ /.' \\ // '.' \\ ///////////|\\\\\\\\\\\ pragma solidity ^0.8.22; struct Hand { uint8 level; uint256 lastActionTimestamp; bool isEligibleForLevelUp; bool isLevelingUp; bool isMigrated; }src/types/Pool.sol
// SPDX-License-Identifier: MIT // Compatible with OpenZeppelin Contracts ^5.0.0 ///////////|\\\\\\\\\\\ // . ' , \\ // _________ \\ // _ /_|_____|_\ _ \\ // '. \ / .' \\ // '.\ /.' \\ // '.' \\ ///////////|\\\\\\\\\\\ pragma solidity ^0.8.22; struct Pool { uint256 totalPlayers; uint256 totalRewards; uint256 distrubutedRewards; uint256 rewardsPerTimestamp; }src/types/RequestStatus.sol
// SPDX-License-Identifier: MIT // Compatible with OpenZeppelin Contracts ^5.0.0 ///////////|\\\\\\\\\\\ // . ' , \\ // _________ \\ // _ /_|_____|_\ _ \\ // '. \ / .' \\ // '.\ /.' \\ // '.' \\ ///////////|\\\\\\\\\\\ pragma solidity ^0.8.22; struct RequestStatus { bool fulfilled; bool exists; address contractAddress; uint256 tokenId; uint256 randomNumber; uint256 requestTime; }
ABI · 97 entries
json
[
{
"type": "constructor",
"inputs": [
{
"name": "_initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "_maxSupply",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_maxWhitelistMint",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_maxPublicMint",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_whitelistPrice",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_publicPrice",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_levelUpFee",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_externalContracts",
"type": "address[]",
"internalType": "address[]"
},
{
"name": "_distributionPercentages",
"type": "uint8[]",
"internalType": "uint8[]"
},
{
"name": "_durations",
"type": "uint256[]",
"internalType": "uint256[]"
},
{
"name": "_rewardPerTimestamps",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"stateMutability": "nonpayable"
},
{
"name": "AlreadyLeveling",
"type": "error",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "AlreadyMigrated",
"type": "error",
"inputs": [
{
"name": "handId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "AlreadyVoted",
"type": "error",
"inputs": []
},
{
"name": "Blocklisted",
"type": "error",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "CooldownActive",
"type": "error",
"inputs": []
},
{
"name": "EmergencyVoteNotActive",
"type": "error",
"inputs": []
},
{
"name": "InsufficientFee",
"type": "error",
"inputs": []
},
{
"name": "InsufficientFunds",
"type": "error",
"inputs": []
},
{
"name": "InvalidParameter",
"type": "error",
"inputs": []
},
{
"name": "InvalidPercentage",
"type": "error",
"inputs": []
},
{
"name": "InvalidProof",
"type": "error",
"inputs": []
},
{
"name": "LevelCapReached",
"type": "error",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "MigrateCountExceeded",
"type": "error",
"inputs": []
},
{
"name": "Migrated",
"type": "error",
"inputs": [
{
"name": "handId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "NotHolder",
"type": "error",
"inputs": [
{
"name": "caller",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "NotOwner",
"type": "error",
"inputs": [
{
"name": "owner",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "NotRandomGenerator",
"type": "error",
"inputs": [
{
"name": "caller",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "NotTokenOwner",
"type": "error",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "OnlyDiamondhand",
"type": "error",
"inputs": []
},
{
"name": "OwnableInvalidOwner",
"type": "error",
"inputs": [
{
"name": "owner",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "OwnableUnauthorizedAccount",
"type": "error",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "PublicMintOverflow",
"type": "error",
"inputs": []
},
{
"name": "PublicSaleNotActive",
"type": "error",
"inputs": []
},
{
"name": "ReentrancyGuardReentrantCall",
"type": "error",
"inputs": []
},
{
"name": "SupplyCapReached",
"type": "error",
"inputs": []
},
{
"name": "TransferFailed",
"type": "error",
"inputs": []
},
{
"name": "UnclaimedRewards",
"type": "error",
"inputs": []
},
{
"name": "WhitelistOverflow",
"type": "error",
"inputs": []
},
{
"name": "WhitelistSaleNotActive",
"type": "error",
"inputs": []
},
{
"name": "Claim",
"type": "event",
"inputs": [
{
"name": "claimer",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "qty",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "amount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"name": "LevelUpCompleted",
"type": "event",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"indexed": true,
"internalType": "uint256"
},
{
"name": "newLevel",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "isSuccess",
"type": "bool",
"indexed": false,
"internalType": "bool"
}
],
"anonymous": false
},
{
"name": "Migrate",
"type": "event",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"indexed": true,
"internalType": "uint256"
},
{
"name": "owner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "Mint",
"type": "event",
"inputs": [
{
"name": "minter",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "tokenIds",
"type": "uint256[]",
"indexed": false,
"internalType": "uint256[]"
},
{
"name": "isWhitelist",
"type": "bool",
"indexed": false,
"internalType": "bool"
}
],
"anonymous": false
},
{
"name": "OwnershipTransferred",
"type": "event",
"inputs": [
{
"name": "previousOwner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newOwner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "PoolDeposit",
"type": "event",
"inputs": [
{
"name": "depositor",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "poolId",
"type": "uint8",
"indexed": false,
"internalType": "uint8"
},
{
"name": "amount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"name": "SaleStatusChanged",
"type": "event",
"inputs": [
{
"name": "isWhitelist",
"type": "bool",
"indexed": false,
"internalType": "bool"
},
{
"name": "newStatus",
"type": "bool",
"indexed": false,
"internalType": "bool"
}
],
"anonymous": false
},
{
"name": "WithdrawRewards",
"type": "event",
"inputs": [
{
"name": "claimer",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "fallback",
"stateMutability": "payable"
},
{
"name": "MAX_LEVEL",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"name": "MAX_PUBLIC_MINT",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "MAX_SUPPLY",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "MAX_WHITELIST_MINT",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "PUBLIC_PRICE",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "WHITELIST_PRICE",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "balanceOf",
"type": "function",
"inputs": [
{
"name": "_owner",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "claim",
"type": "function",
"inputs": [
{
"name": "_tokenIds",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "deposit",
"type": "function",
"inputs": [
{
"name": "_poolId",
"type": "uint8",
"internalType": "uint8"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"name": "fulfillLevelUp",
"type": "function",
"inputs": [
{
"name": "_tokenId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_randomNumber",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "getHand",
"type": "function",
"inputs": [
{
"name": "_tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "tuple",
"components": [
{
"name": "level",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "lastActionTimestamp",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "isEligibleForLevelUp",
"type": "bool",
"internalType": "bool"
},
{
"name": "isLevelingUp",
"type": "bool",
"internalType": "bool"
},
{
"name": "isMigrated",
"type": "bool",
"internalType": "bool"
}
],
"internalType": "struct Hand"
}
],
"stateMutability": "view"
},
{
"name": "getLevelUpDurations",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256[4]",
"internalType": "uint256[4]"
}
],
"stateMutability": "view"
},
{
"name": "getLevelUpFeeAmount",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "getLevelUpFeeReceiver",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "getPoolDistributionRates",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8[4]",
"internalType": "uint8[4]"
}
],
"stateMutability": "view"
},
{
"name": "getRandomNumberGeneratorAddress",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "getVoterStatus",
"type": "function",
"inputs": [
{
"name": "_voter",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "getWhitelistVerifierAddress",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "handOfOwnerByIndex",
"type": "function",
"inputs": [
{
"name": "_owner",
"type": "address",
"internalType": "address"
},
{
"name": "_index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "isBlocklisted",
"type": "function",
"inputs": [
{
"name": "_account",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "isEmergencyVoteActive",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "levelUp",
"type": "function",
"inputs": [
{
"name": "_tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"name": "maxMigrateCount",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "migrate",
"type": "function",
"inputs": [
{
"name": "_tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "migrateCount",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "owner",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "ownerOf",
"type": "function",
"inputs": [
{
"name": "_tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "pools",
"type": "function",
"inputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"outputs": [
{
"name": "totalPlayers",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "totalRewards",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "distrubutedRewards",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "rewardsPerTimestamp",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "publicClaims",
"type": "function",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "publicMint",
"type": "function",
"inputs": [
{
"name": "_qty",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"name": "publicSaleStatus",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "renounceOwnership",
"type": "function",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "rewardBalanceOf",
"type": "function",
"inputs": [
{
"name": "_owner",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "setBlocklistStatus",
"type": "function",
"inputs": [
{
"name": "_account",
"type": "address",
"internalType": "address"
},
{
"name": "_status",
"type": "bool",
"internalType": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setEmergencyVoteStatus",
"type": "function",
"inputs": [
{
"name": "_isEmergencyVoteActive",
"type": "bool",
"internalType": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setLevelUpFeeAmount",
"type": "function",
"inputs": [
{
"name": "_levelUpFee",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setLevelUpFeeReceiver",
"type": "function",
"inputs": [
{
"name": "_levelUpFeeReceiverAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setMaxMigrateCount",
"type": "function",
"inputs": [
{
"name": "_maxMigrateCount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setPublicSaleStatus",
"type": "function",
"inputs": [
{
"name": "_status",
"type": "bool",
"internalType": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setRandomNumberGenerator",
"type": "function",
"inputs": [
{
"name": "_randomNumberGeneratorAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setTeamPercentage",
"type": "function",
"inputs": [
{
"name": "_teamPercentage",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setWhitelistSaleStatus",
"type": "function",
"inputs": [
{
"name": "_status",
"type": "bool",
"internalType": "bool"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "setWhitelistVerifier",
"type": "function",
"inputs": [
{
"name": "_whitelistVerifierAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "startedTimestamp",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "teamBalance",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "teamPercentage",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "totalEmergencyVotes",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "totalSupply",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "transferOwnership",
"type": "function",
"inputs": [
{
"name": "newOwner",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "voteEmergency",
"type": "function",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "whitelistClaims",
"type": "function",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "whitelistMint",
"type": "function",
"inputs": [
{
"name": "_merkleProof",
"type": "bytes32[]",
"internalType": "bytes32[]"
},
{
"name": "_qty",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"name": "whitelistSaleStatus",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "withdraw",
"type": "function",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "withdrawReadyAt",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "withdrawRewards",
"type": "function",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "withdrawTeamBalance",
"type": "function",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "receive",
"stateMutability": "payable"
}
]