Address: 0x870Ac77727d53Ca5F3EB304e8cd29eF39969bf5A
Balance (XRP): 0 XRP
Bytecode: 0x608060405234801561000f575f80fd5b50600436106100a6575f3560e01c8063715018a61161006e578063715018a6146101345780638da5cb5b1461013e5780638f6eb47114610158578063bc073cc61461016b578063da6d47281461018a578063f2fde38b1461019d575f80fd5b80630c2463ba146100aa5780631284a3e7146100dc5780633b28d9db146100ef5780634aa13e9c146101025780636664189c14610115575b5f80fd5b6100c96100b83660046105ab565b60016020525f908152604090205481565b6040519081526020015b60405180910390f35b6100c96100ea3660046105d8565b6101b0565b6100c96100fd3660046105d8565b61022c565b6100c96101103660046105d8565b61029d565b6100c96101233660046105ab565b60026020525f908152604090205481565b61013c610366565b005b5f546040516001600160a01b0390911681526020016100d3565b6100c96101663660046105d8565b610379565b6100c96101793660046105ab565b60036020525f908152604090205481565b6100c96101983660046105d8565b610436565b61013c6101ab3660046105ab565b6104f3565b335f90815260036020526040812054816101ca8483610603565b335f818152600360209081526040918290208490558151868152908101849052600191810191909152919250907fe2f35f74adf10d31dfb6fca6f8952ad49e6255c3adcc81d8f0139922c3529593906060015b60405180910390a29392505050565b335f90815260026020526040812054816102468483610603565b335f818152600260209081526040918290208490558151868152908101849052600191810191909152919250907f0e639f45b1d305d9102910f55732dedcc2ebb54effcfe46ee1b2f481a00d201e9060600161021d565b335f908152600160205260408120548083116103145760405162461bcd60e51b815260206004820152602b60248201527f4e6577207374616765206d75737420626520686967686572207468616e20637560448201526a7272656e7420737461676560a81b60648201526084015b60405180910390fd5b335f8181526001602090815260409182902086905581518481529081018690527f8ac44aa24401e42623195ec866c3decf300e6f73bbb436f3cc3874ebf0148796910160405180910390a25090919050565b61036e610530565b6103775f61055c565b565b335f90815260036020526040812054828110156103d85760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e742067656d2062616c616e63650000000000000000604482015260640161030b565b5f6103e3848361061c565b335f8181526003602090815260408083208590558051878152918201859052810191909152919250907fe2f35f74adf10d31dfb6fca6f8952ad49e6255c3adcc81d8f0139922c35295939060600161021d565b335f90815260026020526040812054828110156104955760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e7420676f6c642062616c616e636500000000000000604482015260640161030b565b5f6104a0848361061c565b335f8181526002602090815260408083208590558051878152918201859052810191909152919250907f0e639f45b1d305d9102910f55732dedcc2ebb54effcfe46ee1b2f481a00d201e9060600161021d565b6104fb610530565b6001600160a01b03811661052457604051631e4fbdf760e01b81525f600482015260240161030b565b61052d8161055c565b50565b5f546001600160a01b031633146103775760405163118cdaa760e01b815233600482015260240161030b565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156105bb575f80fd5b81356001600160a01b03811681146105d1575f80fd5b9392505050565b5f602082840312156105e8575f80fd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610616576106166105ef565b92915050565b81810381811115610616576106166105ef56fea26469706673582212205696e1972c5cb906a5a74dfeb599be046303189ee1159a3f5f353ecec711e9fe64736f6c63430008140033
Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
IdleArenaContract.sol
// SPDX-License-Identifier: MIT // Compatible with OpenZeppelin Contracts ^5.0.0 pragma solidity ^0.8.20; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract IdleArenaContract is Ownable { // Mapping to store campaign stage ID for each user mapping(address => uint256) public userCampaignStage; // Mapping to store gold balance for each user mapping(address => uint256) public userGold; // Mapping to store gem balance for each user mapping(address => uint256) public userGems; // Events event GoldChanged( address indexed user, uint256 oldAmount, uint256 newAmount, bool isReceived ); event GemsChanged( address indexed user, uint256 oldAmount, uint256 newAmount, bool isReceived ); event CampaignStageUpdated( address indexed user, uint256 oldStage, uint256 newStage ); constructor(address initialOwner) Ownable(initialOwner) {} /** * @dev Updates the current campaign stage for the caller * @param stageId The ID of the campaign stage * @return The new campaign stage ID */ function updateCampaignStage(uint256 stageId) external returns (uint256) { uint256 oldStage = userCampaignStage[msg.sender]; require( stageId > oldStage, "New stage must be higher than current stage" ); userCampaignStage[msg.sender] = stageId; emit CampaignStageUpdated(msg.sender, oldStage, stageId); return stageId; } /** * @dev Adds gold to the user's balance * @param amount The amount of gold to add * @return The new gold balance */ function receiveGold(uint256 amount) external returns (uint256) { uint256 oldAmount = userGold[msg.sender]; uint256 newAmount = oldAmount + amount; userGold[msg.sender] = newAmount; emit GoldChanged(msg.sender, oldAmount, newAmount, true); return newAmount; } /** * @dev Subtracts gold from the user's balance * @param amount The amount of gold to subtract * @return The new gold balance */ function consumeGold(uint256 amount) external returns (uint256) { uint256 oldAmount = userGold[msg.sender]; require(oldAmount >= amount, "Insufficient gold balance"); uint256 newAmount = oldAmount - amount; userGold[msg.sender] = newAmount; emit GoldChanged(msg.sender, oldAmount, newAmount, false); return newAmount; } /** * @dev Adds gems to the user's balance * @param amount The amount of gems to add * @return The new gem balance */ function receiveGems(uint256 amount) external returns (uint256) { uint256 oldAmount = userGems[msg.sender]; uint256 newAmount = oldAmount + amount; userGems[msg.sender] = newAmount; emit GemsChanged(msg.sender, oldAmount, newAmount, true); return newAmount; } /** * @dev Subtracts gems from the user's balance * @param amount The amount of gems to subtract * @return The new gem balance */ function consumeGems(uint256 amount) external returns (uint256) { uint256 oldAmount = userGems[msg.sender]; require(oldAmount >= amount, "Insufficient gem balance"); uint256 newAmount = oldAmount - amount; userGems[msg.sender] = newAmount; emit GemsChanged(msg.sender, oldAmount, newAmount, false); return newAmount; } }
Gas Token: