Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Contract Name:
RingADuck
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 "../interfaces/IGame.sol"; import "../interfaces/IUniversalCashier.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; contract RingADuck is IGame, PausableUpgradeable, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable { // References address public proxyManager; IUniversalCashier public cashier; // Game configuration uint256 public constant PLAY_COST = 1 ether; // 1 SONIC per game uint256 public constant BONUS_THRESHOLD = 3; // 3 hits for bonus round uint256 public constant MAX_RINGS = 5; // Maximum 5 rings per game uint256 public constant DEV_SHARE = 10; // 10% to dev wallet // Game state uint256 public totalGamesPlayed; uint256 public totalPaid; uint256 public totalFees; struct Game { address player; uint256[] values; // Prize values for each duck bool isBonusRound; // Whether this is a bonus round bool isComplete; // Whether game is complete uint256 totalPayout; // Total amount paid out uint256 houseFee; // Fee taken by house } mapping(uint256 => Game) public games; mapping(address => uint256) public playerGames; mapping(address => uint256) public bonusRoundsPending; // Events event GameStarted(uint256 indexed gameId, address indexed player, bool isBonusRound); event GameCompleted( uint256 indexed gameId, address indexed player, uint256[] values, bool bonusRound, uint256 totalPayout, uint256 houseFee ); event PaymentProcessed(address indexed player, uint256 amount); event PaymentFailed(address indexed player, uint256 amount, string reason); event FeeWithdrawn(uint256 amount); function initialize(address _proxyManager, address _cashier) public initializer { __Pausable_init(); __Ownable2Step_init(); __ReentrancyGuard_init(); proxyManager = _proxyManager; cashier = IUniversalCashier(_cashier); } // Start a new game function startGame() external whenNotPaused nonReentrant { require(playerGames[msg.sender] == 0, "Finish current game first"); // Calculate cost uint256 cost = PLAY_COST; // Lock the funds first cashier.lockBalance(msg.sender, cost); // Try to debit the player through cashier bool success = cashier.debitPlayer(msg.sender, cost); require(success, "Insufficient balance in cashier"); // Unlock any remaining locked balance cashier.unlockBalance(msg.sender, cost); // Create new game totalGamesPlayed++; uint256 gameId = totalGamesPlayed; // Check if player has bonus rounds bool isBonusRound = false; if (bonusRoundsPending[msg.sender] > 0) { isBonusRound = true; bonusRoundsPending[msg.sender]--; } games[gameId] = Game({ player: msg.sender, values: new uint256[](0), isBonusRound: isBonusRound, isComplete: false, totalPayout: 0, houseFee: 0 }); playerGames[msg.sender] = gameId; emit GameStarted(gameId, msg.sender, isBonusRound); emit PaymentProcessed(msg.sender, cost); } // Throw a ring at a duck function throwRing(uint256 duckIndex) external whenNotPaused nonReentrant { uint256 gameId = playerGames[msg.sender]; require(gameId > 0, "No active game"); Game storage game = games[gameId]; require(!game.isComplete, "Game is complete"); require(game.values.length < MAX_RINGS, "No rings left"); require(duckIndex < 10, "Invalid duck index"); // Generate prize value uint256 prizeValue = _generatePrizeValue( gameId, game.values.length, duckIndex, game.isBonusRound ); game.values.push(prizeValue); // Check if game is complete if (game.values.length == MAX_RINGS) { _completeGame(gameId); } } // Complete current game function completeGame() external whenNotPaused nonReentrant { uint256 gameId = playerGames[msg.sender]; require(gameId > 0, "No active game"); Game storage game = games[gameId]; require(!game.isComplete, "Game already complete"); require(game.values.length > 0, "No rings thrown"); _completeGame(gameId); } // Internal function to complete game function _completeGame(uint256 gameId) internal { Game storage game = games[gameId]; // Calculate total payout and house fee uint256 totalPayout = 0; uint256 hitCount = 0; for (uint256 i = 0; i < game.values.length; i++) { if (game.values[i] > 0) { totalPayout += game.values[i]; hitCount++; } } // Award bonus round if threshold met if (hitCount >= BONUS_THRESHOLD && !game.isBonusRound) { bonusRoundsPending[game.player]++; } // Calculate house fee uint256 houseFee = (totalPayout * DEV_SHARE) / 100; uint256 playerPayout = totalPayout - houseFee; // Process payouts through cashier if (playerPayout > 0) { cashier.creditPlayer(game.player, playerPayout); } game.isComplete = true; game.totalPayout = playerPayout; game.houseFee = houseFee; playerGames[game.player] = 0; totalPaid += playerPayout; totalFees += houseFee; emit GameCompleted( gameId, game.player, game.values, game.isBonusRound, playerPayout, houseFee ); } // Implement IGame play function function play(address player, uint256 amount) external payable override { require(msg.sender == proxyManager, "Only proxy manager"); require(amount >= PLAY_COST, "Insufficient payment"); require(playerGames[player] == 0, "Finish current game first"); // Lock the funds first cashier.lockBalance(player, amount); // Try to debit the player bool success = cashier.debitPlayer(player, amount); require(success, "Payment failed"); // Unlock any remaining locked balance cashier.unlockBalance(player, amount); // Create new game totalGamesPlayed++; uint256 gameId = totalGamesPlayed; bool isBonusRound = false; if (bonusRoundsPending[player] > 0) { isBonusRound = true; bonusRoundsPending[player]--; } games[gameId] = Game({ player: player, values: new uint256[](0), isBonusRound: isBonusRound, isComplete: false, totalPayout: 0, houseFee: 0 }); playerGames[player] = gameId; emit GameStarted(gameId, player, isBonusRound); emit PaymentProcessed(player, amount); } // Admin functions function withdrawFees() external onlyOwner { uint256 amount = totalFees; totalFees = 0; cashier.creditPlayer(owner(), amount); emit FeeWithdrawn(amount); } function setCashier(address _cashier) external onlyOwner { require(_cashier != address(0), "Invalid cashier address"); cashier = IUniversalCashier(_cashier); } // Internal functions function _generatePrizeValue( uint256 gameId, uint256 ringIndex, uint256 duckIndex, bool isBonusRound ) internal view returns (uint256) { uint256 randomNumber = uint256( keccak256( abi.encodePacked( gameId, ringIndex, duckIndex, block.prevrandao, block.timestamp ) ) ); // 40% chance of winning on regular rounds // 60% chance of winning on bonus rounds uint256 hitChance = isBonusRound ? 60 : 40; if (randomNumber % 100 < hitChance) { // Generate prize between 0.5 and 2 SONIC // Bonus rounds get 2x prizes uint256 multiplier = isBonusRound ? 2 : 1; return (((randomNumber >> 8) % 16) + 5) * multiplier * (PLAY_COST / 10); } return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./OwnableUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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 Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); function __Ownable2Step_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable2Step_init_unchained() internal onlyInitializing { } /** * @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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable { /** * @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. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _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()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } 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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IGame { function play(address player, uint256 amount) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IUniversalCashier { // Core functions function deposit() external payable; function withdraw(uint256 amount) external; function getBalance(address player) external view returns (uint256); // Game interactions function debitPlayer(address player, uint256 amount) external returns (bool); function creditPlayer(address player, uint256 amount) external; // Balance locking function lockBalance(address player, uint256 amount) external; function unlockBalance(address player, uint256 amount) external; function getLockedBalance(address player) external view returns (uint256); function getAvailableBalance(address player) external view returns (uint256); // Game authorization function authorizeGame(address game) external; function unauthorizeGame(address game) external; // Admin function setTreasury(address _treasury) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"gameId","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"},{"indexed":false,"internalType":"bool","name":"bonusRound","type":"bool"},{"indexed":false,"internalType":"uint256","name":"totalPayout","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"houseFee","type":"uint256"}],"name":"GameCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"gameId","type":"uint256"},{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"bool","name":"isBonusRound","type":"bool"}],"name":"GameStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"PaymentFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"BONUS_THRESHOLD","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_RINGS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLAY_COST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bonusRoundsPending","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cashier","outputs":[{"internalType":"contract IUniversalCashier","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"completeGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"games","outputs":[{"internalType":"address","name":"player","type":"address"},{"internalType":"bool","name":"isBonusRound","type":"bool"},{"internalType":"bool","name":"isComplete","type":"bool"},{"internalType":"uint256","name":"totalPayout","type":"uint256"},{"internalType":"uint256","name":"houseFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyManager","type":"address"},{"internalType":"address","name":"_cashier","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"player","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"play","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"playerGames","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_cashier","type":"address"}],"name":"setCashier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duckIndex","type":"uint256"}],"name":"throwRing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGamesPlayed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPaid","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":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611bb9806100206000396000f3fe6080604052600436106101665760003560e01c80637b51b4ad116100d1578063d65ab5f21161008a578063ed740e9711610064578063ed740e9714610449578063f0e10c0d14610469578063f2fde38b1461047c578063f395cd771461049c57600080fd5b8063d65ab5f214610400578063e30c397814610415578063e7b0f6661461043357600080fd5b80637b51b4ad14610348578063834906661461035d5780638da5cb5b1461037257806396b4ca70146103a4578063b02ad48f146103c4578063b216a6c6146103e457600080fd5b8063476343ee11610123578063476343ee146102ae578063485cc955146102c55780635c492129146102e55780635c975abb146102fb578063715018a61461031e57806379ba50971461033357600080fd5b80630146d28e1461016b578063029dd6ba146101ac578063117a5b90146101c157806313114a9d1461025557806322db41431461026b5780634005650514610280575b600080fd5b34801561017757600080fd5b50610199610186366004611942565b6101026020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101b857600080fd5b50610199600a81565b3480156101cd57600080fd5b5061021d6101dc366004611964565b6101006020819052600091825260409091208054600282015460038301546004909301546001600160a01b039092169360ff80831694919092049091169185565b604080516001600160a01b0390961686529315156020860152911515928401929092526060830191909152608082015260a0016101a3565b34801561026157600080fd5b5061019960ff5481565b34801561027757600080fd5b50610199600381565b34801561028c57600080fd5b5061019961029b366004611942565b6101016020526000908152604090205481565b3480156102ba57600080fd5b506102c36104bc565b005b3480156102d157600080fd5b506102c36102e036600461197d565b61058c565b3480156102f157600080fd5b5061019960fd5481565b34801561030757600080fd5b5060335460ff1660405190151581526020016101a3565b34801561032a57600080fd5b506102c36106e4565b34801561033f57600080fd5b506102c36106f8565b34801561035457600080fd5b506102c3610772565b34801561036957600080fd5b50610199600581565b34801561037e57600080fd5b506065546001600160a01b03165b6040516001600160a01b0390911681526020016101a3565b3480156103b057600080fd5b5060fb5461038c906001600160a01b031681565b3480156103d057600080fd5b506102c36103df366004611942565b61088c565b3480156103f057600080fd5b50610199670de0b6b3a764000081565b34801561040c57600080fd5b506102c361090c565b34801561042157600080fd5b506097546001600160a01b031661038c565b34801561043f57600080fd5b5061019960fe5481565b34801561045557600080fd5b5060fc5461038c906001600160a01b031681565b6102c36104773660046119b0565b610cb9565b34801561048857600080fd5b506102c3610497366004611942565b611111565b3480156104a857600080fd5b506102c36104b7366004611964565b611182565b6104c4611323565b60ff8054600090915560fc546001600160a01b0316637384ab5a6104f06065546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561053857600080fd5b505af115801561054c573d6000803e3d6000fd5b505050507fb7eeacba6b133788365610e83d3f130d07b6ef6e78877961f25b3f61fcba07528160405161058191815260200190565b60405180910390a150565b600054610100900460ff16158080156105ac5750600054600160ff909116105b806105c65750303b1580156105c6575060005460ff166001145b61062e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610651576000805461ff0019166101001790555b61065961137d565b6106616113ac565b6106696113db565b60fb80546001600160a01b038086166001600160a01b03199283161790925560fc80549285169290911691909117905580156106df576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6106ec611323565b6106f6600061140a565b565b60975433906001600160a01b031681146107665760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610625565b61076f8161140a565b50565b61077a611423565b610782611469565b3360009081526101016020526040902054806107d15760405162461bcd60e51b815260206004820152600e60248201526d4e6f206163746976652067616d6560901b6044820152606401610625565b6000818152610100602081905260409091206002810154909160ff910416156108345760405162461bcd60e51b815260206004820152601560248201527447616d6520616c726561647920636f6d706c65746560581b6044820152606401610625565b60018101546108775760405162461bcd60e51b815260206004820152600f60248201526e2737903934b733b9903a343937bbb760891b6044820152606401610625565b610880826114c2565b50506106f6600160c955565b610894611323565b6001600160a01b0381166108ea5760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206361736869657220616464726573730000000000000000006044820152606401610625565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b610914611423565b61091c611469565b3360009081526101016020526040902054156109765760405162461bcd60e51b8152602060048201526019602482015278119a5b9a5cda0818dd5c9c995b9d0819d85b5948199a5c9cdd603a1b6044820152606401610625565b60fc546040516307837e1760e41b8152336004820152670de0b6b3a764000060248201819052916001600160a01b031690637837e17090604401600060405180830381600087803b1580156109ca57600080fd5b505af11580156109de573d6000803e3d6000fd5b505060fc5460405163026ff28360e61b815233600482015260248101859052600093506001600160a01b039091169150639bfca0c0906044016020604051808303816000875af1158015610a36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5a91906119da565b905080610aa95760405162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e742062616c616e636520696e2063617368696572006044820152606401610625565b60fc54604051630426dcef60e01b8152336004820152602481018490526001600160a01b0390911690630426dcef90604401600060405180830381600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505060fd8054925090506000610b1e83611a12565b909155505060fd54336000908152610102602052604081205415610b645750336000908152610102602052604081208054600192909190610b5e83611a2b565b91905055505b6040805160c081018252338152815160008082526020808301855280840192835285151584860152606084018290526080840182905260a084018290528682526101008152939020825181546001600160a01b0319166001600160a01b039091161781559051805192939192610be092600185019201906118c6565b50604082810151600283018054606086015115156101000261ff00199315159390931661ffff19909116179190911790556080830151600383015560a090920151600490910155336000818152610101602052829020849055905183907fbc0699d39a841f5917765a96bad29ca3fc6af279e1a5d2b2dd6ac382cc11aaf090610c6e90851515815260200190565b60405180910390a360405184815233907fa5957fefb5b0f981554450d4d8dde003083cd202e3d5a2992e09c88ad1f0d7919060200160405180910390a2505050506106f6600160c955565b60fb546001600160a01b03163314610d085760405162461bcd60e51b815260206004820152601260248201527127b7363c90383937bc3c9036b0b730b3b2b960711b6044820152606401610625565b670de0b6b3a7640000811015610d575760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606401610625565b6001600160a01b0382166000908152610101602052604090205415610dba5760405162461bcd60e51b8152602060048201526019602482015278119a5b9a5cda0818dd5c9c995b9d0819d85b5948199a5c9cdd603a1b6044820152606401610625565b60fc546040516307837e1760e41b81526001600160a01b0384811660048301526024820184905290911690637837e17090604401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b505060fc5460405163026ff28360e61b81526001600160a01b03868116600483015260248201869052600094509091169150639bfca0c0906044016020604051808303816000875af1158015610e76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9a91906119da565b905080610eda5760405162461bcd60e51b815260206004820152600e60248201526d14185e5b595b9d0819985a5b195960921b6044820152606401610625565b60fc54604051630426dcef60e01b81526001600160a01b0385811660048301526024820185905290911690630426dcef90604401600060405180830381600087803b158015610f2857600080fd5b505af1158015610f3c573d6000803e3d6000fd5b505060fd8054925090506000610f5183611a12565b909155505060fd546001600160a01b0384166000908152610102602052604081205415610fa957506001600160a01b0384166000908152610102602052604081208054600192909190610fa383611a2b565b91905055505b6040805160c0810182526001600160a01b038781168252825160008082526020808301865280850192835286151585870152606085018290526080850182905260a085018290528782526101008152949020835181546001600160a01b03191693169290921782555180519293919261102892600185019201906118c6565b50604082810151600283018054606086015115156101000261ff00199315159390931661ffff19909116179190911790556080830151600383015560a0909201516004909101556001600160a01b0386166000818152610101602052829020849055905183907fbc0699d39a841f5917765a96bad29ca3fc6af279e1a5d2b2dd6ac382cc11aaf0906110bf90851515815260200190565b60405180910390a3846001600160a01b03167fa5957fefb5b0f981554450d4d8dde003083cd202e3d5a2992e09c88ad1f0d7918560405161110291815260200190565b60405180910390a25050505050565b611119611323565b609780546001600160a01b0383166001600160a01b0319909116811790915561114a6065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61118a611423565b611192611469565b3360009081526101016020526040902054806111e15760405162461bcd60e51b815260206004820152600e60248201526d4e6f206163746976652067616d6560901b6044820152606401610625565b6000818152610100602081905260409091206002810154909160ff9104161561123f5760405162461bcd60e51b815260206004820152601060248201526f47616d6520697320636f6d706c65746560801b6044820152606401610625565b60018101546005116112835760405162461bcd60e51b815260206004820152600d60248201526c139bc81c9a5b99dcc81b19599d609a1b6044820152606401610625565b600a83106112c85760405162461bcd60e51b8152602060048201526012602482015271092dcecc2d8d2c840c8eac6d640d2dcc8caf60731b6044820152606401610625565b600181015460028201546000916112e691859190879060ff1661170a565b600180840180549182018155600081815260209020909101829055549091506004190161131657611316836114c2565b50505061076f600160c955565b6065546001600160a01b031633146106f65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610625565b600054610100900460ff166113a45760405162461bcd60e51b815260040161062590611a42565b6106f66117ea565b600054610100900460ff166113d35760405162461bcd60e51b815260040161062590611a42565b6106f661181d565b600054610100900460ff166114025760405162461bcd60e51b815260040161062590611a42565b6106f661184d565b609780546001600160a01b031916905561076f81611874565b60335460ff16156106f65760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610625565b600260c954036114bb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610625565b600260c955565b6000818152610100602052604081209080805b60018401548110156115565760008460010182815481106114f8576114f8611a8d565b906000526020600020015411156115445783600101818154811061151e5761151e611a8d565b9060005260206000200154836115349190611aa3565b92508161154081611a12565b9250505b8061154e81611a12565b9150506114d5565b506003811015801561156d5750600283015460ff16155b1561159e5782546001600160a01b031660009081526101026020526040812080549161159883611a12565b91905055505b600060646115ad600a85611abc565b6115b79190611ae9565b905060006115c58285611afd565b905080156116355760fc5485546040516339c255ad60e11b81526001600160a01b03918216600482015260248101849052911690637384ab5a90604401600060405180830381600087803b15801561161c57600080fd5b505af1158015611630573d6000803e3d6000fd5b505050505b60028501805461ff001916610100179055600385018190556004850182905584546001600160a01b031660009081526101016020526040812081905560fe8054839290611683908490611aa3565b925050819055508160ff600082825461169c9190611aa3565b9091555050845460028601546040516001600160a01b039092169188917f295a47f98aa27dff43fc584330c1cc5e5a35401a0bff554c9f9b605aababfa42916116f39160018b019160ff9091169087908990611b10565b60405180910390a3505050505050565b600160c955565b6040805160208101869052908101849052606081018390524460808201524260a0820152600090819060c0016040516020818303038152906040528051906020012060001c905060008361175f576028611762565b603c5b60ff16905080611773606484611b6f565b10156117db5760008461178757600161178a565b60025b60ff1690506117a2600a670de0b6b3a7640000611ae9565b816117b26010600887901c611b6f565b6117bd906005611aa3565b6117c79190611abc565b6117d19190611abc565b93505050506117e2565b6000925050505b949350505050565b600054610100900460ff166118115760405162461bcd60e51b815260040161062590611a42565b6033805460ff19169055565b600054610100900460ff166118445760405162461bcd60e51b815260040161062590611a42565b6106f63361140a565b600054610100900460ff166117035760405162461bcd60e51b815260040161062590611a42565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054828255906000526020600020908101928215611901579160200282015b828111156119015782518255916020019190600101906118e6565b5061190d929150611911565b5090565b5b8082111561190d5760008155600101611912565b80356001600160a01b038116811461193d57600080fd5b919050565b60006020828403121561195457600080fd5b61195d82611926565b9392505050565b60006020828403121561197657600080fd5b5035919050565b6000806040838503121561199057600080fd5b61199983611926565b91506119a760208401611926565b90509250929050565b600080604083850312156119c357600080fd5b6119cc83611926565b946020939093013593505050565b6000602082840312156119ec57600080fd5b8151801515811461195d57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611a2457611a246119fc565b5060010190565b600081611a3a57611a3a6119fc565b506000190190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b80820180821115611ab657611ab66119fc565b92915050565b8082028115828204841417611ab657611ab66119fc565b634e487b7160e01b600052601260045260246000fd5b600082611af857611af8611ad3565b500490565b81810381811115611ab657611ab66119fc565b6000608082016080835280875480835260a08501915088600052602092508260002060005b82811015611b5157815484529284019260019182019101611b35565b50505095151590830152506040810192909252606090910152919050565b600082611b7e57611b7e611ad3565b50069056fea26469706673582212207d28aec39700c50d45203da2aca1f43d4efc6d1a293afacdcfd4d3e6706bc27e64736f6c63430008130033
Deployed Bytecode
0x6080604052600436106101665760003560e01c80637b51b4ad116100d1578063d65ab5f21161008a578063ed740e9711610064578063ed740e9714610449578063f0e10c0d14610469578063f2fde38b1461047c578063f395cd771461049c57600080fd5b8063d65ab5f214610400578063e30c397814610415578063e7b0f6661461043357600080fd5b80637b51b4ad14610348578063834906661461035d5780638da5cb5b1461037257806396b4ca70146103a4578063b02ad48f146103c4578063b216a6c6146103e457600080fd5b8063476343ee11610123578063476343ee146102ae578063485cc955146102c55780635c492129146102e55780635c975abb146102fb578063715018a61461031e57806379ba50971461033357600080fd5b80630146d28e1461016b578063029dd6ba146101ac578063117a5b90146101c157806313114a9d1461025557806322db41431461026b5780634005650514610280575b600080fd5b34801561017757600080fd5b50610199610186366004611942565b6101026020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156101b857600080fd5b50610199600a81565b3480156101cd57600080fd5b5061021d6101dc366004611964565b6101006020819052600091825260409091208054600282015460038301546004909301546001600160a01b039092169360ff80831694919092049091169185565b604080516001600160a01b0390961686529315156020860152911515928401929092526060830191909152608082015260a0016101a3565b34801561026157600080fd5b5061019960ff5481565b34801561027757600080fd5b50610199600381565b34801561028c57600080fd5b5061019961029b366004611942565b6101016020526000908152604090205481565b3480156102ba57600080fd5b506102c36104bc565b005b3480156102d157600080fd5b506102c36102e036600461197d565b61058c565b3480156102f157600080fd5b5061019960fd5481565b34801561030757600080fd5b5060335460ff1660405190151581526020016101a3565b34801561032a57600080fd5b506102c36106e4565b34801561033f57600080fd5b506102c36106f8565b34801561035457600080fd5b506102c3610772565b34801561036957600080fd5b50610199600581565b34801561037e57600080fd5b506065546001600160a01b03165b6040516001600160a01b0390911681526020016101a3565b3480156103b057600080fd5b5060fb5461038c906001600160a01b031681565b3480156103d057600080fd5b506102c36103df366004611942565b61088c565b3480156103f057600080fd5b50610199670de0b6b3a764000081565b34801561040c57600080fd5b506102c361090c565b34801561042157600080fd5b506097546001600160a01b031661038c565b34801561043f57600080fd5b5061019960fe5481565b34801561045557600080fd5b5060fc5461038c906001600160a01b031681565b6102c36104773660046119b0565b610cb9565b34801561048857600080fd5b506102c3610497366004611942565b611111565b3480156104a857600080fd5b506102c36104b7366004611964565b611182565b6104c4611323565b60ff8054600090915560fc546001600160a01b0316637384ab5a6104f06065546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561053857600080fd5b505af115801561054c573d6000803e3d6000fd5b505050507fb7eeacba6b133788365610e83d3f130d07b6ef6e78877961f25b3f61fcba07528160405161058191815260200190565b60405180910390a150565b600054610100900460ff16158080156105ac5750600054600160ff909116105b806105c65750303b1580156105c6575060005460ff166001145b61062e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610651576000805461ff0019166101001790555b61065961137d565b6106616113ac565b6106696113db565b60fb80546001600160a01b038086166001600160a01b03199283161790925560fc80549285169290911691909117905580156106df576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6106ec611323565b6106f6600061140a565b565b60975433906001600160a01b031681146107665760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610625565b61076f8161140a565b50565b61077a611423565b610782611469565b3360009081526101016020526040902054806107d15760405162461bcd60e51b815260206004820152600e60248201526d4e6f206163746976652067616d6560901b6044820152606401610625565b6000818152610100602081905260409091206002810154909160ff910416156108345760405162461bcd60e51b815260206004820152601560248201527447616d6520616c726561647920636f6d706c65746560581b6044820152606401610625565b60018101546108775760405162461bcd60e51b815260206004820152600f60248201526e2737903934b733b9903a343937bbb760891b6044820152606401610625565b610880826114c2565b50506106f6600160c955565b610894611323565b6001600160a01b0381166108ea5760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206361736869657220616464726573730000000000000000006044820152606401610625565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b610914611423565b61091c611469565b3360009081526101016020526040902054156109765760405162461bcd60e51b8152602060048201526019602482015278119a5b9a5cda0818dd5c9c995b9d0819d85b5948199a5c9cdd603a1b6044820152606401610625565b60fc546040516307837e1760e41b8152336004820152670de0b6b3a764000060248201819052916001600160a01b031690637837e17090604401600060405180830381600087803b1580156109ca57600080fd5b505af11580156109de573d6000803e3d6000fd5b505060fc5460405163026ff28360e61b815233600482015260248101859052600093506001600160a01b039091169150639bfca0c0906044016020604051808303816000875af1158015610a36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5a91906119da565b905080610aa95760405162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e742062616c616e636520696e2063617368696572006044820152606401610625565b60fc54604051630426dcef60e01b8152336004820152602481018490526001600160a01b0390911690630426dcef90604401600060405180830381600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505060fd8054925090506000610b1e83611a12565b909155505060fd54336000908152610102602052604081205415610b645750336000908152610102602052604081208054600192909190610b5e83611a2b565b91905055505b6040805160c081018252338152815160008082526020808301855280840192835285151584860152606084018290526080840182905260a084018290528682526101008152939020825181546001600160a01b0319166001600160a01b039091161781559051805192939192610be092600185019201906118c6565b50604082810151600283018054606086015115156101000261ff00199315159390931661ffff19909116179190911790556080830151600383015560a090920151600490910155336000818152610101602052829020849055905183907fbc0699d39a841f5917765a96bad29ca3fc6af279e1a5d2b2dd6ac382cc11aaf090610c6e90851515815260200190565b60405180910390a360405184815233907fa5957fefb5b0f981554450d4d8dde003083cd202e3d5a2992e09c88ad1f0d7919060200160405180910390a2505050506106f6600160c955565b60fb546001600160a01b03163314610d085760405162461bcd60e51b815260206004820152601260248201527127b7363c90383937bc3c9036b0b730b3b2b960711b6044820152606401610625565b670de0b6b3a7640000811015610d575760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606401610625565b6001600160a01b0382166000908152610101602052604090205415610dba5760405162461bcd60e51b8152602060048201526019602482015278119a5b9a5cda0818dd5c9c995b9d0819d85b5948199a5c9cdd603a1b6044820152606401610625565b60fc546040516307837e1760e41b81526001600160a01b0384811660048301526024820184905290911690637837e17090604401600060405180830381600087803b158015610e0857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b505060fc5460405163026ff28360e61b81526001600160a01b03868116600483015260248201869052600094509091169150639bfca0c0906044016020604051808303816000875af1158015610e76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9a91906119da565b905080610eda5760405162461bcd60e51b815260206004820152600e60248201526d14185e5b595b9d0819985a5b195960921b6044820152606401610625565b60fc54604051630426dcef60e01b81526001600160a01b0385811660048301526024820185905290911690630426dcef90604401600060405180830381600087803b158015610f2857600080fd5b505af1158015610f3c573d6000803e3d6000fd5b505060fd8054925090506000610f5183611a12565b909155505060fd546001600160a01b0384166000908152610102602052604081205415610fa957506001600160a01b0384166000908152610102602052604081208054600192909190610fa383611a2b565b91905055505b6040805160c0810182526001600160a01b038781168252825160008082526020808301865280850192835286151585870152606085018290526080850182905260a085018290528782526101008152949020835181546001600160a01b03191693169290921782555180519293919261102892600185019201906118c6565b50604082810151600283018054606086015115156101000261ff00199315159390931661ffff19909116179190911790556080830151600383015560a0909201516004909101556001600160a01b0386166000818152610101602052829020849055905183907fbc0699d39a841f5917765a96bad29ca3fc6af279e1a5d2b2dd6ac382cc11aaf0906110bf90851515815260200190565b60405180910390a3846001600160a01b03167fa5957fefb5b0f981554450d4d8dde003083cd202e3d5a2992e09c88ad1f0d7918560405161110291815260200190565b60405180910390a25050505050565b611119611323565b609780546001600160a01b0383166001600160a01b0319909116811790915561114a6065546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61118a611423565b611192611469565b3360009081526101016020526040902054806111e15760405162461bcd60e51b815260206004820152600e60248201526d4e6f206163746976652067616d6560901b6044820152606401610625565b6000818152610100602081905260409091206002810154909160ff9104161561123f5760405162461bcd60e51b815260206004820152601060248201526f47616d6520697320636f6d706c65746560801b6044820152606401610625565b60018101546005116112835760405162461bcd60e51b815260206004820152600d60248201526c139bc81c9a5b99dcc81b19599d609a1b6044820152606401610625565b600a83106112c85760405162461bcd60e51b8152602060048201526012602482015271092dcecc2d8d2c840c8eac6d640d2dcc8caf60731b6044820152606401610625565b600181015460028201546000916112e691859190879060ff1661170a565b600180840180549182018155600081815260209020909101829055549091506004190161131657611316836114c2565b50505061076f600160c955565b6065546001600160a01b031633146106f65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610625565b600054610100900460ff166113a45760405162461bcd60e51b815260040161062590611a42565b6106f66117ea565b600054610100900460ff166113d35760405162461bcd60e51b815260040161062590611a42565b6106f661181d565b600054610100900460ff166114025760405162461bcd60e51b815260040161062590611a42565b6106f661184d565b609780546001600160a01b031916905561076f81611874565b60335460ff16156106f65760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610625565b600260c954036114bb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610625565b600260c955565b6000818152610100602052604081209080805b60018401548110156115565760008460010182815481106114f8576114f8611a8d565b906000526020600020015411156115445783600101818154811061151e5761151e611a8d565b9060005260206000200154836115349190611aa3565b92508161154081611a12565b9250505b8061154e81611a12565b9150506114d5565b506003811015801561156d5750600283015460ff16155b1561159e5782546001600160a01b031660009081526101026020526040812080549161159883611a12565b91905055505b600060646115ad600a85611abc565b6115b79190611ae9565b905060006115c58285611afd565b905080156116355760fc5485546040516339c255ad60e11b81526001600160a01b03918216600482015260248101849052911690637384ab5a90604401600060405180830381600087803b15801561161c57600080fd5b505af1158015611630573d6000803e3d6000fd5b505050505b60028501805461ff001916610100179055600385018190556004850182905584546001600160a01b031660009081526101016020526040812081905560fe8054839290611683908490611aa3565b925050819055508160ff600082825461169c9190611aa3565b9091555050845460028601546040516001600160a01b039092169188917f295a47f98aa27dff43fc584330c1cc5e5a35401a0bff554c9f9b605aababfa42916116f39160018b019160ff9091169087908990611b10565b60405180910390a3505050505050565b600160c955565b6040805160208101869052908101849052606081018390524460808201524260a0820152600090819060c0016040516020818303038152906040528051906020012060001c905060008361175f576028611762565b603c5b60ff16905080611773606484611b6f565b10156117db5760008461178757600161178a565b60025b60ff1690506117a2600a670de0b6b3a7640000611ae9565b816117b26010600887901c611b6f565b6117bd906005611aa3565b6117c79190611abc565b6117d19190611abc565b93505050506117e2565b6000925050505b949350505050565b600054610100900460ff166118115760405162461bcd60e51b815260040161062590611a42565b6033805460ff19169055565b600054610100900460ff166118445760405162461bcd60e51b815260040161062590611a42565b6106f63361140a565b600054610100900460ff166117035760405162461bcd60e51b815260040161062590611a42565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054828255906000526020600020908101928215611901579160200282015b828111156119015782518255916020019190600101906118e6565b5061190d929150611911565b5090565b5b8082111561190d5760008155600101611912565b80356001600160a01b038116811461193d57600080fd5b919050565b60006020828403121561195457600080fd5b61195d82611926565b9392505050565b60006020828403121561197657600080fd5b5035919050565b6000806040838503121561199057600080fd5b61199983611926565b91506119a760208401611926565b90509250929050565b600080604083850312156119c357600080fd5b6119cc83611926565b946020939093013593505050565b6000602082840312156119ec57600080fd5b8151801515811461195d57600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611a2457611a246119fc565b5060010190565b600081611a3a57611a3a6119fc565b506000190190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b80820180821115611ab657611ab66119fc565b92915050565b8082028115828204841417611ab657611ab66119fc565b634e487b7160e01b600052601260045260246000fd5b600082611af857611af8611ad3565b500490565b81810381811115611ab657611ab66119fc565b6000608082016080835280875480835260a08501915088600052602092508260002060005b82811015611b5157815484529284019260019182019101611b35565b50505095151590830152506040810192909252606090910152919050565b600082611b7e57611b7e611ad3565b50069056fea26469706673582212207d28aec39700c50d45203da2aca1f43d4efc6d1a293afacdcfd4d3e6706bc27e64736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.