Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x142917AB...c84CE2B16 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
SecureDuckRace
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable2Step.sol"; /** * @title SecureDuckRace * @notice * Secure commit-reveal duck racing game with: * - Salted commit scheme * - Pull payment architecture * - Sonic-optimized randomness * - Enhanced security measures * * "I think i need to withdraw manually since auto send to dev wallet if the users * are in middle on the game may drain the wallet if hit 60 S or more ? * or do you have mechanism to calculate only the fee 10% of the dev only ? * Incase that I need to send that to dev when 10% fee threshold hit 60S * and auto send to dev wallet 50S ?" * * Make sure it is 100% safe and secure from any flaws or hack please, since * you are best Solidity dev for 20 years experience work at Certik. */ contract SecureDuckRace is ReentrancyGuard, Pausable, Ownable2Step { // ====================== // CONFIG CONSTANTS // ====================== uint256 public constant COMMIT_DURATION = 60 seconds; uint256 public constant REVEAL_DURATION = 60 seconds; uint256 public constant COOLDOWN_DURATION = 180 seconds; uint256 public constant MIN_PLAYERS = 2; uint256 public constant MAX_PLAYERS = 100; uint256 public constant MIN_DEPOSIT = 1 ether; // 1 Sonic uint256 public constant MAX_DEPOSIT = 10 ether; // 10 Sonic // 90% to winner, 10% to dev uint256 public constant WINNER_SHARE = 90; uint256 public constant DEV_SHARE = 10; // Auto-withdraw logic (currently 20% of balance) uint256 public constant AUTO_WITHDRAW_PCT = 20; // Race states enum RaceState { Setup, Commit, Reveal, Completed } struct Race { uint256 id; RaceState state; uint256 commitDeadline; uint256 revealDeadline; uint256 totalPrize; address[] players; mapping(address => Player) playersData; address winner; } struct Player { bytes32 commitHash; uint256 deposit; uint256 revealedSeed; bool hasRevealed; } // ====================== // CONTRACT STATE // ====================== mapping(uint256 => Race) public races; mapping(address => uint256) public withdrawableFunds; // Where user refunds/winnings accumulate uint256 public currentRaceId; uint256 public lastRaceEnd; uint256 public totalFees; // Dev's accumulated fees // Add a mapping for player deposits mapping(address => uint256) public playerDeposits; // ====================== // EVENTS // ====================== event RaceCreated(uint256 indexed raceId, uint256 commitDeadline); event Committed(uint256 indexed raceId, address player, uint256 amount); event Revealed(uint256 indexed raceId, address player); event RaceCompleted(uint256 indexed raceId, address winner, uint256 prize); event FundsWithdrawn(address indexed recipient, uint256 amount); event Deposit(address indexed player, uint256 amount); event Withdraw(address indexed player, uint256 amount); // ====================== // CONSTRUCTOR // ====================== constructor() Ownable2Step() {} // ====================== // RACE MANAGEMENT // ====================== /** * @dev Creates a new race if the cooldown from the previous race has passed. */ function createRace() external onlyOwner { require( block.timestamp >= lastRaceEnd + COOLDOWN_DURATION, "Cooldown active" ); currentRaceId++; Race storage r = races[currentRaceId]; r.id = currentRaceId; r.state = RaceState.Commit; r.commitDeadline = block.timestamp + COMMIT_DURATION; r.revealDeadline = r.commitDeadline + REVEAL_DURATION; emit RaceCreated(currentRaceId, r.commitDeadline); } /** * @dev Commit phase: players send deposit + a hashed seed (with salt & address). */ function commit(bytes32 hashedSeed, bytes32 salt) external nonReentrant whenNotPaused { Race storage r = races[currentRaceId]; require(r.state == RaceState.Commit, "Not commit phase"); require(block.timestamp <= r.commitDeadline, "Commit phase ended"); require(playerDeposits[msg.sender] >= MIN_DEPOSIT, "Insufficient deposit"); require(!r.playersData[msg.sender].hasRevealed, "Already committed"); // Verify the commit hash includes the salt bytes32 computedHash = keccak256( abi.encodePacked( hashedSeed, salt, msg.sender ) ); // Use deposited funds instead of requiring new payment uint256 depositAmount = MIN_DEPOSIT; playerDeposits[msg.sender] -= depositAmount; r.playersData[msg.sender] = Player({ commitHash: computedHash, // Store the computed hash deposit: depositAmount, revealedSeed: 0, hasRevealed: false }); r.players.push(msg.sender); r.totalPrize += depositAmount; _autoWithdrawFunds(); emit Committed(currentRaceId, msg.sender, depositAmount); } /** * @dev Reveal phase: players must reveal their raw seed to be eligible to win. */ function reveal(uint256 seed, bytes32 salt) external nonReentrant whenNotPaused { Race storage r = races[currentRaceId]; require( r.state == RaceState.Commit || r.state == RaceState.Reveal, "Invalid state" ); require(block.timestamp >= r.commitDeadline, "Reveal not started"); require(block.timestamp < r.revealDeadline, "Reveal closed"); Player storage p = r.playersData[msg.sender]; require(p.commitHash != 0, "Not committed"); require(!p.hasRevealed, "Already revealed"); // Recompute to see if it matches what was committed bytes32 computedHash = keccak256(abi.encodePacked(seed, salt, msg.sender)); require(computedHash == p.commitHash, "Invalid reveal"); p.revealedSeed = seed; p.hasRevealed = true; if (r.state == RaceState.Commit) { r.state = RaceState.Reveal; } emit Revealed(currentRaceId, msg.sender); } /** * @dev After reveal phase, finalize the race: * - If <2 reveals, everyone gets refunds * - Else pick winner, awarding 90% to them, 10% dev */ function finalize() external nonReentrant { Race storage r = races[currentRaceId]; require(r.state == RaceState.Reveal, "Not reveal phase"); require(block.timestamp >= r.revealDeadline, "Reveal ongoing"); address[] memory revealed = _getRevealedPlayers(r); uint256 revealedCount = revealed.length; if (revealedCount < MIN_PLAYERS) { _handleFailedRace(r); } else { _completeRace(r, revealed); } r.state = RaceState.Completed; lastRaceEnd = block.timestamp; } // ====================== // INTERNAL LOGIC // ====================== /** * @dev If enough players revealed, pick winner via pseudo-randomness. */ function _completeRace(Race storage r, address[] memory revealed) private { bytes32 seed; for (uint256 i = 0; i < revealed.length; i++) { seed ^= bytes32(r.playersData[revealed[i]].revealedSeed); } uint256 random = uint256( keccak256( abi.encodePacked( seed, blockhash(block.number - 1), address(this).balance ) ) ); address winner = revealed[random % revealed.length]; uint256 prize = (r.totalPrize * WINNER_SHARE) / 100; // 90% uint256 fee = r.totalPrize - prize; // 10% // The winner can withdraw from withdrawableFunds withdrawableFunds[winner] += prize; // Dev fees accumulate totalFees += fee; r.winner = winner; emit RaceCompleted(currentRaceId, winner, prize); } /** * @dev If not enough reveals, refund each deposit to withdrawableFunds. */ function _handleFailedRace(Race storage r) private { for (uint256 i = 0; i < r.players.length; i++) { address player = r.players[i]; withdrawableFunds[player] += r.playersData[player].deposit; } } /** * @dev Called on commit or fallback deposit, adds 20% of contract balance to dev fees. */ function _autoWithdrawFunds() private { uint256 balance = address(this).balance; if (balance == 0) return; // 20% of current balance is added to totalFees (but not physically transferred yet) uint256 toWithdraw = (balance * AUTO_WITHDRAW_PCT) / 100; if (toWithdraw > 0) { totalFees += toWithdraw; } } /** * @dev Returns all addresses who revealed a valid seed. */ function _getRevealedPlayers(Race storage r) private view returns (address[] memory) { address[] memory temp = new address[](r.players.length); uint256 count; for (uint256 i = 0; i < r.players.length; i++) { if (r.playersData[r.players[i]].hasRevealed) { temp[count++] = r.players[i]; } } address[] memory result = new address[](count); for (uint256 j = 0; j < count; j++) { result[j] = temp[j]; } return result; } // ====================== // FUNDS MANAGEMENT // ====================== /** * @dev Players & winners withdraw their personal funds (prize or refund). */ function withdraw() external nonReentrant { uint256 amount = withdrawableFunds[msg.sender]; require(amount > 0, "No funds available"); withdrawableFunds[msg.sender] = 0; (bool success, ) = msg.sender.call{value: amount}(""); require(success, "Transfer failed"); emit FundsWithdrawn(msg.sender, amount); } /** * @dev Dev can manually withdraw fees accumulated in totalFees. */ function withdrawFees() external onlyOwner { uint256 amount = totalFees; totalFees = 0; (bool success, ) = owner().call{value: amount}(""); require(success, "Fee transfer failed"); } // ====================== // ADMIN & UTILITY // ====================== function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function getRacePlayers(uint256 raceId) external view returns (address[] memory) { return races[raceId].players; } function getPlayerCommit(uint256 raceId, address player) external view returns (bytes32) { return races[raceId].playersData[player].commitHash; } /** * @dev If someone sends ETH directly, we call _autoWithdrawFunds(). */ receive() external payable { _autoWithdrawFunds(); } // Separate deposit function function deposit() external payable nonReentrant whenNotPaused { require(msg.value > 0, "Must deposit something"); playerDeposits[msg.sender] += msg.value; emit Deposit(msg.sender, msg.value); } // Add withdraw function function withdraw(uint256 amount) external nonReentrant { require(amount <= playerDeposits[msg.sender], "Insufficient balance"); playerDeposits[msg.sender] -= amount; payable(msg.sender).transfer(amount); emit Withdraw(msg.sender, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../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. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @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 { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract 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; 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 require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raceId","type":"uint256"},{"indexed":false,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Committed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raceId","type":"uint256"},{"indexed":false,"internalType":"address","name":"winner","type":"address"},{"indexed":false,"internalType":"uint256","name":"prize","type":"uint256"}],"name":"RaceCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raceId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"commitDeadline","type":"uint256"}],"name":"RaceCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"raceId","type":"uint256"},{"indexed":false,"internalType":"address","name":"player","type":"address"}],"name":"Revealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"AUTO_WITHDRAW_PCT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COMMIT_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COOLDOWN_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEV_SHARE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DEPOSIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PLAYERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEPOSIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_PLAYERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REVEAL_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WINNER_SHARE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hashedSeed","type":"bytes32"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"commit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"createRace","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentRaceId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"finalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"raceId","type":"uint256"},{"internalType":"address","name":"player","type":"address"}],"name":"getPlayerCommit","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"raceId","type":"uint256"}],"name":"getRacePlayers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRaceEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"playerDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"races","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum SecureDuckRace.RaceState","name":"state","type":"uint8"},{"internalType":"uint256","name":"commitDeadline","type":"uint256"},{"internalType":"uint256","name":"revealDeadline","type":"uint256"},{"internalType":"uint256","name":"totalPrize","type":"uint256"},{"internalType":"address","name":"winner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seed","type":"uint256"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawableFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x6080604052600436106101fd5760003560e01c806379ba50971161010d578063b971e2fd116100a0578063df6ffa871161006f578063df6ffa871461054b578063e1e158a514610578578063e30c397814610594578063e3ce094d146105b2578063f2fde38b146105d257600080fd5b8063b971e2fd146104fd578063d0e30db014610512578063dbe3010c1461051a578063dd5967c31461052f57600080fd5b80638da5cb5b116100dc5780638da5cb5b1461049a57806391e5dff0146104d15780639ad9d501146104e7578063b39773a6146104fd57600080fd5b806379ba5097146103e95780637bbc469e146103fe5780638456cb591461047057806385f07bbe1461048557600080fd5b80634036778f116101905780634bb278f31161015f5780634bb278f3146103725780635c975abb146103875780635ec775b0146103aa5780636688949c146103bf578063715018a6146103d457600080fd5b80634036778f146103085780634411b3eb14610328578063476343ee1461033d57806348c1d7d01461035257600080fd5b80632e1a7d4d116101cc5780632e1a7d4d146102915780632f30cabd146102b15780633ccfd60b146102de5780633f4ba83a146102f357600080fd5b8063029dd6ba1461021157806313114a9d14610239578063188d68e41461024f57806319873ace1461026457600080fd5b3661020c5761020a6105f2565b005b600080fd5b34801561021d57600080fd5b50610226600a81565b6040519081526020015b60405180910390f35b34801561024557600080fd5b5061022660075481565b34801561025b57600080fd5b50610226601481565b34801561027057600080fd5b5061028461027f3660046119b3565b61063c565b60405161023091906119cc565b34801561029d57600080fd5b5061020a6102ac3660046119b3565b6106ab565b3480156102bd57600080fd5b506102266102cc366004611a35565b60046020526000908152604090205481565b3480156102ea57600080fd5b5061020a6107a2565b3480156102ff57600080fd5b5061020a6108d8565b34801561031457600080fd5b5061020a610323366004611a57565b6108e8565b34801561033457600080fd5b50610226606481565b34801561034957600080fd5b5061020a610bca565b34801561035e57600080fd5b5061022661036d366004611a79565b610c8b565b34801561037e57600080fd5b5061020a610cb8565b34801561039357600080fd5b5060015460ff166040519015158152602001610230565b3480156103b657600080fd5b5061022660b481565b3480156103cb57600080fd5b5061020a610dbd565b3480156103e057600080fd5b5061020a610eaf565b3480156103f557600080fd5b5061020a610ec1565b34801561040a57600080fd5b5061045e6104193660046119b3565b6003602081905260009182526040909120805460018201546002830154938301546004840154600790940154929460ff9092169391929091906001600160a01b031686565b60405161023096959493929190611abb565b34801561047c57600080fd5b5061020a610f38565b34801561049157600080fd5b50610226600281565b3480156104a657600080fd5b5060015461010090046001600160a01b03165b6040516001600160a01b039091168152602001610230565b3480156104dd57600080fd5b5061022660065481565b3480156104f357600080fd5b5061022660055481565b34801561050957600080fd5b50610226603c81565b61020a610f48565b34801561052657600080fd5b50610226605a81565b34801561053b57600080fd5b50610226678ac7230489e8000081565b34801561055757600080fd5b50610226610566366004611a35565b60086020526000908152604090205481565b34801561058457600080fd5b50610226670de0b6b3a764000081565b3480156105a057600080fd5b506002546001600160a01b03166104b9565b3480156105be57600080fd5b5061020a6105cd366004611a57565b611004565b3480156105de57600080fd5b5061020a6105ed366004611a35565b6112dc565b4760008190036105ff5750565b6000606461060e601484611b27565b6106189190611b54565b905080156106385780600760008282546106329190611b68565b90915550505b5050565b60008181526003602090815260409182902060050180548351818402810184019094528084526060939283018282801561069f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610681575b50505050509050919050565b6106b3611353565b3360009081526008602052604090205481111561070e5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064015b60405180910390fd5b336000908152600860205260408120805483929061072d908490611b7b565b9091555050604051339082156108fc029083906000818181858888f1935050505015801561075f573d6000803e3d6000fd5b5060405181815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649060200160405180910390a261079f6001600055565b50565b6107aa611353565b33600090815260046020526040902054806107fc5760405162461bcd60e51b81526020600482015260126024820152714e6f2066756e647320617661696c61626c6560701b6044820152606401610705565b336000818152600460205260408082208290555190919083908381818185875af1925050503d806000811461084d576040519150601f19603f3d011682016040523d82523d6000602084013e610852565b606091505b50509050806108955760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610705565b60405182815233907feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d9060200160405180910390a250506108d66001600055565b565b6108e06113ac565b6108d661140c565b6108f0611353565b6108f861145e565b600554600090815260036020526040902060018082015460ff16600381111561092357610923611aa5565b148061094757506002600182015460ff16600381111561094557610945611aa5565b145b6109835760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420737461746560981b6044820152606401610705565b80600201544210156109cc5760405162461bcd60e51b815260206004820152601260248201527114995d99585b081b9bdd081cdd185c9d195960721b6044820152606401610705565b80600301544210610a0f5760405162461bcd60e51b815260206004820152600d60248201526c14995d99585b0818db1bdcd959609a1b6044820152606401610705565b33600090815260068201602052604081208054909103610a615760405162461bcd60e51b815260206004820152600d60248201526c139bdd0818dbdb5b5a5d1d1959609a1b6044820152606401610705565b600381015460ff1615610aa95760405162461bcd60e51b815260206004820152601060248201526f105b1c9958591e481c995d99585b195960821b6044820152606401610705565b6000848433604051602001610ae393929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60405160208183030381529060405280519060200120905081600001548114610b3f5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a59081c995d99585b60921b6044820152606401610705565b6002820185905560038201805460ff19166001908117909155600184015460ff166003811115610b7157610b71611aa5565b03610b865760018301805460ff191660021790555b6005546040513381527f6e9dac3f3f833c1d527aa989d3a673884ddc11e31fdccc11ccd8aebf1ae069ac906020015b60405180910390a25050506106386001600055565b610bd26113ac565b6007805460009182905590610bf56001546001600160a01b036101009091041690565b6001600160a01b03168260405160006040518083038185875af1925050503d8060008114610c3f576040519150601f19603f3d011682016040523d82523d6000602084013e610c44565b606091505b50509050806106385760405162461bcd60e51b8152602060048201526013602482015272119959481d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610705565b60008281526003602090815260408083206001600160a01b03851684526006019091529020545b92915050565b610cc0611353565b60055460009081526003602052604090206002600182015460ff166003811115610cec57610cec611aa5565b14610d2c5760405162461bcd60e51b815260206004820152601060248201526f4e6f742072657665616c20706861736560801b6044820152606401610705565b8060030154421015610d715760405162461bcd60e51b815260206004820152600e60248201526d52657665616c206f6e676f696e6760901b6044820152606401610705565b6000610d7c826114a4565b80519091506002811015610d9857610d938361167a565b610da2565b610da283836116fd565b50506001908101805460ff1916600317905542600655600055565b610dc56113ac565b60b4600654610dd49190611b68565b421015610e155760405162461bcd60e51b815260206004820152600f60248201526e436f6f6c646f776e2061637469766560881b6044820152606401610705565b60058054906000610e2583611b8e565b909155505060055460008181526003602052604090209081556001808201805460ff19169091179055610e59603c42611b68565b60028201819055610e6c90603c90611b68565b600382015560055460028201546040519081527f63083476b085b8e9175986f50ad703551816826bca5360510429f515b40733689060200160405180910390a250565b610eb76113ac565b6108d660006118bc565b60025433906001600160a01b03168114610f2f5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610705565b61079f816118bc565b610f406113ac565b6108d66118d5565b610f50611353565b610f5861145e565b60003411610fa15760405162461bcd60e51b81526020600482015260166024820152754d757374206465706f73697420736f6d657468696e6760501b6044820152606401610705565b3360009081526008602052604081208054349290610fc0908490611b68565b909155505060405134815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9060200160405180910390a26108d66001600055565b61100c611353565b61101461145e565b600554600090815260036020526040902060018082015460ff16600381111561103f5761103f611aa5565b1461107f5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420636f6d6d697420706861736560801b6044820152606401610705565b80600201544211156110c85760405162461bcd60e51b815260206004820152601260248201527110dbdb5b5a5d081c1a185cd948195b99195960721b6044820152606401610705565b33600090815260086020526040902054670de0b6b3a764000011156111265760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d0819195c1bdcda5d60621b6044820152606401610705565b33600090815260068201602052604090206003015460ff161561117f5760405162461bcd60e51b8152602060048201526011602482015270105b1c9958591e4818dbdb5b5a5d1d1959607a1b6044820152606401610705565b60008383336040516020016111b993929190928352602083019190915260601b6bffffffffffffffffffffffff1916604082015260540190565b60408051601f19818403018152918152815160209283012033600090815260089093529082208054919350670de0b6b3a76400009283926111fb908490611b7b565b90915550506040805160808101825283815260208082018481526000838501818152606085018281523380845260068b0186529683209551865592516001808701919091559051600286015591516003909401805460ff191694151594909417909355600587018054918201815583529082200180546001600160a01b031916909217909155600484018054839290611295908490611b68565b909155506112a390506105f2565b60055460408051338152602081018490527f245cbccbc6875e4b0475a653568fd4f7c2dae5fb8929e33c0d66dc530ba11b009101610bb5565b6112e46113ac565b600280546001600160a01b0383166001600160a01b0319909116811790915561131b6001546001600160a01b036101009091041690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6002600054036113a55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610705565b6002600055565b6001546001600160a01b036101009091041633146108d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610705565b611414611910565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60015460ff16156108d65760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610705565b600581015460609060009067ffffffffffffffff8111156114c7576114c7611ba7565b6040519080825280602002602001820160405280156114f0578160200160208202803683370190505b5090506000805b60058501548110156115c85784600601600086600501838154811061151e5761151e611bbd565b60009182526020808320909101546001600160a01b0316835282019290925260400190206003015460ff16156115b65784600501818154811061156357611563611bbd565b6000918252602090912001546001600160a01b0316838361158381611b8e565b94508151811061159557611595611bbd565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806115c081611b8e565b9150506114f7565b5060008167ffffffffffffffff8111156115e4576115e4611ba7565b60405190808252806020026020018201604052801561160d578160200160208202803683370190505b50905060005b828110156116715783818151811061162d5761162d611bbd565b602002602001015182828151811061164757611647611bbd565b6001600160a01b03909216602092830291909101909101528061166981611b8e565b915050611613565b50949350505050565b60005b60058201548110156106385760008260050182815481106116a0576116a0611bbd565b60009182526020808320909101546001600160a01b03168083526006860182526040808420600101546004909352832080549194509192906116e3908490611b68565b909155508291506116f5905081611b8e565b91505061167d565b6000805b82518110156117685783600601600084838151811061172257611722611bbd565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206002015460001b82189150808061176090611b8e565b915050611701565b50600081611777600143611b7b565b6040805160208101939093529040908201524760608201526080016040516020818303038152906040528051906020012060001c90506000838451836117bd9190611bd3565b815181106117cd576117cd611bbd565b6020026020010151905060006064605a87600401546117ec9190611b27565b6117f69190611b54565b9050600081876004015461180a9190611b7b565b6001600160a01b038416600090815260046020526040812080549293508492909190611837908490611b68565b9250508190555080600760008282546118509190611b68565b90915550506007870180546001600160a01b0319166001600160a01b038516908117909155600554604080519283526020830185905290917fe36b67fec2742bf0400545705e6f61c6b71ad23cda3cdc1c80f1d8fdd37875eb910160405180910390a250505050505050565b600280546001600160a01b031916905561079f81611959565b6118dd61145e565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833611441565b60015460ff166108d65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610705565b600180546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000602082840312156119c557600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b81811015611a0d5783516001600160a01b0316835292840192918401916001016119e8565b50909695505050505050565b80356001600160a01b0381168114611a3057600080fd5b919050565b600060208284031215611a4757600080fd5b611a5082611a19565b9392505050565b60008060408385031215611a6a57600080fd5b50508035926020909101359150565b60008060408385031215611a8c57600080fd5b82359150611a9c60208401611a19565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b86815260c0810160048710611ae057634e487b7160e01b600052602160045260246000fd5b60208201969096526040810194909452606084019290925260808301526001600160a01b031660a090910152919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610cb257610cb2611b11565b634e487b7160e01b600052601260045260246000fd5b600082611b6357611b63611b3e565b500490565b80820180821115610cb257610cb2611b11565b81810381811115610cb257610cb2611b11565b600060018201611ba057611ba0611b11565b5060010190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600082611be257611be2611b3e565b50069056fea2646970667358221220fc589600c24d83dcdffab7809bfa772c7803a0523ec8b435199d0cd8895abb4364736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.