Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 10413481 | 1380 days ago | 0 ETH | ||||
| 10413481 | 1380 days ago | 0 ETH | ||||
| 10413403 | 1380 days ago | 0 ETH | ||||
| 10413403 | 1380 days ago | 0 ETH | ||||
| 10413040 | 1380 days ago | 0 ETH | ||||
| 10413040 | 1380 days ago | 0 ETH | ||||
| 10413040 | 1380 days ago | 0 ETH | ||||
| 10412842 | 1380 days ago | 0 ETH | ||||
| 10412842 | 1380 days ago | 0 ETH | ||||
| 10412631 | 1380 days ago | 0 ETH | ||||
| 10412631 | 1380 days ago | 0 ETH | ||||
| 10412631 | 1380 days ago | 0 ETH | ||||
| 10412631 | 1380 days ago | 0 ETH | ||||
| 10412236 | 1380 days ago | 0 ETH | ||||
| 10412236 | 1380 days ago | 0 ETH | ||||
| 10411815 | 1380 days ago | 0 ETH | ||||
| 10411815 | 1380 days ago | 0 ETH | ||||
| 10411811 | 1380 days ago | 0 ETH | ||||
| 10411811 | 1380 days ago | 0 ETH | ||||
| 10411769 | 1380 days ago | 0 ETH | ||||
| 10411592 | 1380 days ago | 0 ETH | ||||
| 10411592 | 1380 days ago | 0 ETH | ||||
| 10411479 | 1380 days ago | 0 ETH | ||||
| 10411309 | 1380 days ago | 0 ETH | ||||
| 10411296 | 1380 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
World
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./WorldContracts.sol";
contract World is Initializable, WorldContracts {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
function initialize() external initializer {
WorldContracts.__WorldContracts_init();
}
function transferToadzToHuntingGrounds(
uint256[] calldata _tokenIds)
external
whenNotPaused
contractsAreSet
onlyEOA
nonZeroLength(_tokenIds)
{
for(uint256 i = 0; i < _tokenIds.length; i++) {
uint256 _tokenId = _tokenIds[i];
_requireValidToadAndLocation(_tokenId, Location.HUNTING_GROUNDS);
// From
_transferFromLocation(_tokenId);
// To
huntingGrounds.startHunting(_tokenId);
// Finalize
tokenIdToInfo[_tokenId].location = Location.HUNTING_GROUNDS;
}
emit ToadLocationChanged(_tokenIds, msg.sender, Location.HUNTING_GROUNDS);
}
function transferToadzToWorld(
uint256[] calldata _tokenIds)
external
whenNotPaused
contractsAreSet
onlyEOA
nonZeroLength(_tokenIds)
{
for(uint256 i = 0; i < _tokenIds.length; i++) {
uint256 _tokenId = _tokenIds[i];
_requireValidToadAndLocation(_tokenId, Location.WORLD);
// From
_transferFromLocation(_tokenId);
// To
// Nothing needed for world
// Finalize
tokenIdToInfo[_tokenId].location = Location.WORLD;
}
emit ToadLocationChanged(_tokenIds, msg.sender, Location.WORLD);
}
function transferToadzOutOfWorld(
uint256[] calldata _tokenIds)
external
whenNotPaused
contractsAreSet
onlyEOA
nonZeroLength(_tokenIds)
{
for(uint256 i = 0; i < _tokenIds.length; i++) {
uint256 _tokenId = _tokenIds[i];
_requireValidToadAndLocation(_tokenId, Location.NOT_STAKED);
// From
_transferFromLocation(_tokenId);
// To
// Unstake the toad.
ownerToStakedTokens[msg.sender].remove(_tokenId);
delete tokenIdToInfo[_tokenId];
toadz.adminSafeTransferFrom(address(this), msg.sender, _tokenId);
// Finalize
tokenIdToInfo[_tokenId].location = Location.NOT_STAKED;
}
emit ToadLocationChanged(_tokenIds, msg.sender, Location.NOT_STAKED);
}
function transferToadzToAdventure(
uint256[] calldata _tokenIds,
string calldata _adventureName,
uint256[][] calldata _itemInputIds)
external
whenNotPaused
contractsAreSet
onlyEOA
nonZeroLength(_tokenIds)
{
require(_tokenIds.length == _itemInputIds.length, "World: Bad adventure array lengths");
for(uint256 i = 0; i < _tokenIds.length; i++) {
uint256 _tokenId = _tokenIds[i];
_requireValidToadAndLocation(_tokenId, Location.ADVENTURE);
// From
_transferFromLocation(_tokenId);
// To
adventure.startAdventure(msg.sender, _tokenId, _adventureName, _itemInputIds[i]);
// Finalize
tokenIdToInfo[_tokenId].location = Location.ADVENTURE;
}
emit ToadLocationChanged(_tokenIds, msg.sender, Location.ADVENTURE);
}
function _transferFromLocation(uint256 _tokenId) private {
Location _oldLocation = tokenIdToInfo[_tokenId].location;
if(_oldLocation == Location.WORLD) {
// Nothing to do here.
} else if(_oldLocation == Location.HUNTING_GROUNDS) {
huntingGrounds.stopHunting(_tokenId, msg.sender);
} else if(_oldLocation == Location.ADVENTURE) {
adventure.finishAdventure(msg.sender, _tokenId);
} else if(_oldLocation == Location.NOT_STAKED) {
tokenIdToInfo[_tokenId].owner = msg.sender;
ownerToStakedTokens[msg.sender].add(_tokenId);
// Will revert if user doesn't own token.
toadz.adminSafeTransferFrom(msg.sender, address(this), _tokenId);
} else {
revert("World: Unknown from location");
}
}
function _requireValidToadAndLocation(uint256 _tokenId, Location _newLocation) private view {
Location _oldLocation = tokenIdToInfo[_tokenId].location;
// If the location is NOT_STAKED, the toad is not in the world yet, so checking the owner wouldn't make sense.
//
if(_oldLocation != Location.NOT_STAKED) {
require(ownerToStakedTokens[msg.sender].contains(_tokenId), "World: User does not own toad");
}
require(_oldLocation != _newLocation, "World: Location must be different for toad");
}
function toadzStakedForOwner(address _owner) external view returns(uint256[] memory) {
return ownerToStakedTokens[_owner].values();
}
function ownerForStakedToad(uint256 _tokenId) public view override returns(address) {
address _owner = tokenIdToInfo[_tokenId].owner;
require(_owner != address(0), "World: Toad is not staked");
return _owner;
}
function locationForStakedToad(uint256 _tokenId) public view override returns(Location) {
return tokenIdToInfo[_tokenId].location;
}
function isToadStaked(uint256 _tokenId) public view returns(bool) {
return tokenIdToInfo[_tokenId].owner != address(0);
}
function infoForToad(uint256 _tokenId) external view returns(TokenInfo memory) {
require(isToadStaked(_tokenId), "World: Toad is not staked");
return tokenIdToInfo[_tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../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 Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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.5.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0;
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.
*
* 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 initialize the implementation contract, you can either invoke the
* initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() initializer {}
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
// If the contract is initializing we ignore whether _initialized is set in order to support multiple
// inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
// contract may have been reentered.
require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} modifier, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
function _isConstructor() private view returns (bool) {
return !AddressUpgradeable.isContract(address(this));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../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 Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
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 v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721ReceiverUpgradeable {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
import "../IERC721ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
function __ERC721Holder_init() internal onlyInitializing {
}
function __ERC721Holder_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address,
address,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
/**
* @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
// OpenZeppelin Contracts (last updated v4.5.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
* ====
*
* [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason 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 {
// 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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../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;
}
/**
* @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
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSetUpgradeable {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./UtilitiesUpgradeable.sol";
// Do not add state to this contract.
//
contract AdminableUpgradeable is UtilitiesUpgradeable {
mapping(address => bool) private admins;
function __Adminable_init() internal initializer {
UtilitiesUpgradeable.__Utilities__init();
}
function addAdmin(address _address) external onlyOwner {
admins[_address] = true;
}
function addAdmins(address[] calldata _addresses) external onlyOwner {
for(uint256 i = 0; i < _addresses.length; i++) {
admins[_addresses[i]] = true;
}
}
function removeAdmin(address _address) external onlyOwner {
admins[_address] = false;
}
function removeAdmins(address[] calldata _addresses) external onlyOwner {
for(uint256 i = 0; i < _addresses.length; i++) {
admins[_addresses[i]] = false;
}
}
function setPause(bool _shouldPause) external onlyAdminOrOwner {
if(_shouldPause) {
_pause();
} else {
_unpause();
}
}
function isAdmin(address _address) public view returns(bool) {
return admins[_address];
}
modifier onlyAdmin() {
require(admins[msg.sender], "Not admin");
_;
}
modifier onlyAdminOrOwner() {
require(admins[msg.sender] || isOwner(), "Not admin or owner");
_;
}
uint256[50] private __gap;
}//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract UtilitiesUpgradeable is Initializable, OwnableUpgradeable, PausableUpgradeable {
function __Utilities__init() internal initializer {
OwnableUpgradeable.__Ownable_init();
PausableUpgradeable.__Pausable_init();
_pause();
}
modifier nonZeroAddress(address _address) {
require(address(0) != _address, "0 address");
_;
}
modifier nonZeroLength(uint[] memory _array) {
require(_array.length > 0, "Empty array");
_;
}
modifier lengthsAreEqual(uint[] memory _array1, uint[] memory _array2) {
require(_array1.length == _array2.length, "Unequal lengths");
_;
}
modifier onlyEOA() {
/* solhint-disable avoid-tx-origin */
require(msg.sender == tx.origin, "No contracts");
_;
}
function isOwner() internal view returns(bool) {
return owner() == msg.sender;
}
function compareStrings(string memory a, string memory b) internal pure returns (bool) {
return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IAdventure {
function startAdventure(address _owner, uint256 _tokenId, string calldata _adventureName, uint256[] calldata _itemInputIds) external;
function finishAdventure(address _owner, uint256 _tokenId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IHuntingGrounds {
function startHunting(uint256 _tokenId) external;
function stopHunting(uint256 _tokenId, address _owner) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library ToadTraitConstants {
string constant public SVG_HEADER = '<svg id="toad" width="100%" height="100%" version="1.1" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">';
string constant public SVG_FOOTER = '<style>#toad{shape-rendering: crispedges; image-rendering: -webkit-crisp-edges; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges; image-rendering: pixelated; -ms-interpolation-mode: nearest-neighbor;}</style></svg>';
string constant public RARITY = "Rarity";
string constant public BACKGROUND = "Background";
string constant public MUSHROOM = "Mushroom";
string constant public SKIN = "Skin";
string constant public CLOTHES = "Clothes";
string constant public MOUTH = "Mouth";
string constant public EYES = "Eyes";
string constant public ITEM = "Item";
string constant public HEAD = "Head";
string constant public ACCESSORY = "Accessory";
string constant public RARITY_COMMON = "Common";
string constant public RARITY_1_OF_1 = "1 of 1";
}
enum ToadRarity {
COMMON,
ONE_OF_ONE
}
enum ToadBackground {
GREY,
PURPLE,
GREEN,
BROWN,
YELLOW,
PINK,
SKY_BLUE,
MINT,
ORANGE,
RED,
SKY,
SUNRISE,
SPRING,
WATERMELON,
SPACE,
CLOUDS,
SWAMP,
GOLDEN,
DARK_PURPLE
}
enum ToadMushroom {
COMMON,
ORANGE,
BROWN,
RED_SPOTS,
GREEN,
BLUE,
YELLOW,
GREY,
PINK,
ICE,
GOLDEN,
RADIOACTIVE,
CRYSTAL,
ROBOT
}
enum ToadSkin {
OG_GREEN,
BROWN,
DARK_GREEN,
ORANGE,
GREY,
BLUE,
PURPLE,
PINK,
RAINBOW,
GOLDEN,
RADIOACTIVE,
CRYSTAL,
SKELETON,
ROBOT,
SKIN
}
enum ToadClothes {
NONE,
TURTLENECK_BLUE,
TURTLENECK_GREY,
T_SHIRT_ROCKET_GREY,
T_SHIRT_ROCKET_BLUE,
T_SHIRT_FLY_GREY,
T_SHIRT_FLY_BLUE,
T_SHIRT_FLY_RED,
T_SHIRT_HEART_BLACK,
T_SHIRT_HEART_PINK,
T_SHIRT_RAINBOW,
T_SHIRT_SKULL,
HOODIE_GREY,
HOODIE_PINK,
HOODIE_LIGHT_BLUE,
HOODIE_DARK_BLUE,
HOODIE_WHITE,
T_SHIRT_CAMO,
HOODIE_CAMO,
CONVICT,
ASTRONAUT,
FARMER,
RED_OVERALLS,
GREEN_OVERALLS,
ZOMBIE,
SAMURI,
SAIAN,
HAWAIIAN_SHIRT,
SUIT_BLACK,
SUIT_RED,
ROCKSTAR,
PIRATE,
ASTRONAUT_SUIT,
CHICKEN_COSTUME,
DINOSAUR_COSTUME,
SMOL,
STRAW_HAT,
TRACKSUIT
}
enum ToadMouth {
SMILE,
O,
GASP,
SMALL_GASP,
LAUGH,
LAUGH_TEETH,
SMILE_BIG,
TONGUE,
RAINBOW_VOM,
PIPE,
CIGARETTE,
BLUNT,
MEH,
GUM,
FIRE,
NONE
}
enum ToadEyes {
RIGHT_UP,
RIGHT_DOWN,
TIRED,
EYE_ROLL,
WIDE_UP,
CONTENTFUL,
LASERS,
CROAKED,
SUSPICIOUS,
WIDE_DOWN,
BORED,
STONED,
HEARTS,
WINK,
VR_HEADSET,
GLASSES_HEART,
GLASSES_3D,
GLASSES_SUN,
EYE_PATCH_LEFT,
EYE_PATCH_RIGHT,
EYE_PATCH_BORED_LEFT,
EYE_PATCH_BORED_RIGHT,
EXCITED,
NONE
}
enum ToadItem {
NONE,
LIGHTSABER_RED,
LIGHTSABER_GREEN,
LIGHTSABER_BLUE,
SWORD,
WAND_LEFT,
WAND_RIGHT,
FIRE_SWORD,
ICE_SWORD,
AXE_LEFT,
AXE_RIGHT
}
enum ToadHead {
NONE,
CAP_BROWN,
CAP_BLACK,
CAP_RED,
CAP_PINK,
CAP_MUSHROOM,
STRAW_HAT,
SAILOR_HAT,
PIRATE_HAT,
WIZARD_PURPLE_HAT,
WIZARD_BROWN_HAT,
CAP_KIDS,
TOP_HAT,
PARTY_HAT,
CROWN,
BRAIN,
MOHAWK_PURPLE,
MOHAWK_GREEN,
MOHAWK_PINK,
AFRO,
BACK_CAP_WHITE,
BACK_CAP_RED,
BACK_CAP_BLUE,
BANDANA_PURPLE,
BANDANA_RED,
BANDANA_BLUE,
BEANIE_GREY,
BEANIE_BLUE,
BEANIE_YELLOW,
HALO,
COOL_CAT_HEAD,
FIRE
}
enum ToadAccessory {
NONE,
FLIES,
GOLD_CHAIN,
NECKTIE_RED,
NECKTIE_BLUE,
NECKTIE_PINK
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "../libraries/ToadTraitConstants.sol";
import "../toadzmetadata/IToadzMetadata.sol";
interface IToadz is IERC721Upgradeable {
function mint(address _to, ToadTraits calldata _traits) external;
function adminSafeTransferFrom(address _from, address _to, uint256 _tokenId) external;
function burn(uint256 _tokenId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../libraries/ToadTraitConstants.sol";
interface IToadzMetadata {
function tokenURI(uint256 _tokenId) external view returns(string memory);
function setMetadataForToad(uint256 _tokenId, ToadTraits calldata _traits) external;
}
// Immutable Traits.
// Do not change.
struct ToadTraits {
ToadRarity rarity;
ToadBackground background;
ToadMushroom mushroom;
ToadSkin skin;
ToadClothes clothes;
ToadMouth mouth;
ToadEyes eyes;
ToadItem item;
ToadHead head;
ToadAccessory accessory;
}
struct ToadTraitStrings {
string rarity;
string background;
string mushroom;
string skin;
string clothes;
string mouth;
string eyes;
string item;
string head;
string accessory;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IWorld {
function ownerForStakedToad(uint256 _tokenId) external view returns(address);
function locationForStakedToad(uint256 _tokenId) external view returns(Location);
}
enum Location {
NOT_STAKED,
WORLD,
HUNTING_GROUNDS,
ADVENTURE
}//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./WorldState.sol";
abstract contract WorldContracts is Initializable, WorldState {
function __WorldContracts_init() internal initializer {
WorldState.__WorldState_init();
}
function setContracts(
address _toadzAddress,
address _huntingGroundsAddress,
address _adventureAddress)
external onlyAdminOrOwner
{
toadz = IToadz(_toadzAddress);
huntingGrounds = IHuntingGrounds(_huntingGroundsAddress);
adventure = IAdventure(_adventureAddress);
}
modifier contractsAreSet() {
require(areContractsSet(), "World: Contracts aren't set");
_;
}
function areContractsSet() public view returns(bool) {
return address(toadz) != address(0)
&& address(huntingGrounds) != address(0)
&& address(adventure) != address(0);
}
}//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "../toadz/IToadz.sol";
import "./IWorld.sol";
import "../../shared/AdminableUpgradeable.sol";
import "../huntinggrounds/IHuntingGrounds.sol";
import "../adventure/IAdventure.sol";
abstract contract WorldState is Initializable, IWorld, ERC721HolderUpgradeable, AdminableUpgradeable {
event ToadLocationChanged(uint256[] _tokenIds, address _owner, Location _newLocation);
IToadz public toadz;
IHuntingGrounds public huntingGrounds;
IAdventure public adventure;
mapping(uint256 => TokenInfo) internal tokenIdToInfo;
mapping(address => EnumerableSetUpgradeable.UintSet) internal ownerToStakedTokens;
function __WorldState_init() internal initializer {
AdminableUpgradeable.__Adminable_init();
ERC721HolderUpgradeable.__ERC721Holder_init();
}
}
// Be careful of changing as this is stored in storage.
struct TokenInfo {
address owner;
Location location;
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"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":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"enum Location","name":"_newLocation","type":"uint8"}],"name":"ToadLocationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"addAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adventure","outputs":[{"internalType":"contract IAdventure","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"areContractsSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"huntingGrounds","outputs":[{"internalType":"contract IHuntingGrounds","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"infoForToad","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"enum Location","name":"location","type":"uint8"}],"internalType":"struct TokenInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isToadStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"locationForStakedToad","outputs":[{"internalType":"enum Location","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerForStakedToad","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"removeAdmins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_toadzAddress","type":"address"},{"internalType":"address","name":"_huntingGroundsAddress","type":"address"},{"internalType":"address","name":"_adventureAddress","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_shouldPause","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toadz","outputs":[{"internalType":"contract IToadz","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"toadzStakedForOwner","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":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"transferToadzOutOfWorld","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"string","name":"_adventureName","type":"string"},{"internalType":"uint256[][]","name":"_itemInputIds","type":"uint256[][]"}],"name":"transferToadzToAdventure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"transferToadzToHuntingGrounds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"transferToadzToWorld","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b5061211e806100206000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80638cdcc4b4116100de578063b3066d4911610097578063bedb86fb11610071578063bedb86fb146103cd578063c37e2218146103e0578063f0ba31d8146103f3578063f2fde38b1461040657600080fd5b8063b3066d4914610387578063b960ce741461039a578063be3d6781146103ba57600080fd5b80638cdcc4b4146103155780638da5cb5b1461031d5780638f3a40f31461032e5780639c54df6414610341578063a7e7feca14610354578063a98d67831461036757600080fd5b8063377e11e01161014b578063704802751161012557806370480275146102ba578063715018a6146102cd57806372e9b78e146102d55780638129fc1c1461030d57600080fd5b8063377e11e01461028957806356555ea71461029c5780635c975abb146102af57600080fd5b80630bdd03f11461019357806312643536146101c3578063150b7a02146101d85780631785f53c1461020f57806324d7806c146102225780632c95dc791461025e575b600080fd5b60fc546101a6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d66101d1366004611a5d565b610419565b005b6101f66101e6366004611ad1565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016101ba565b6101d661021d366004611bad565b6105da565b61024e610230366004611bad565b6001600160a01b0316600090815260c9602052604090205460ff1690565b60405190151581526020016101ba565b61024e61026c366004611bc8565b600090815260ff60205260409020546001600160a01b0316151590565b6101d6610297366004611a5d565b610625565b6101d66102aa366004611be1565b6106c6565b60975460ff1661024e565b6101d66102c8366004611bad565b61090a565b6101d6610958565b6103006102e3366004611bc8565b600090815260ff6020819052604090912054600160a01b90041690565b6040516101ba9190611ce1565b6101d661098e565b61024e610a08565b6065546001600160a01b03166101a6565b60fd546101a6906001600160a01b031681565b6101d661034f366004611a5d565b610a4a565b6101d6610362366004611a5d565b610ae6565b61037a610375366004611bc8565b610ccf565b6040516101ba9190611cef565b6101d6610395366004611d13565b610da5565b6103ad6103a8366004611bad565b610e46565b6040516101ba9190611d56565b60fe546101a6906001600160a01b031681565b6101d66103db366004611d9a565b610e71565b6101a66103ee366004611bc8565b610ee9565b6101d6610401366004611a5d565b610f4a565b6101d6610414366004611bad565b611097565b60975460ff16156104455760405162461bcd60e51b815260040161043c90611dbc565b60405180910390fd5b61044d610a08565b6104695760405162461bcd60e51b815260040161043c90611de6565b3332146104885760405162461bcd60e51b815260040161043c90611e1d565b818180806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251151591506104dd90505760405162461bcd60e51b815260040161043c90611e43565b60005b828110156105a85760008484838181106104fc576104fc611e68565b90506020020135905061051081600261112f565b6105198161124b565b60fd5460405163c604158360e01b8152600481018390526001600160a01b039091169063c604158390602401600060405180830381600087803b15801561055f57600080fd5b505af1158015610573573d6000803e3d6000fd5b50505060009182525060ff60205260409020805460ff60a01b1916600160a11b179055806105a081611e94565b9150506104e0565b506000805160206120c983398151915283833360026040516105cd9493929190611ee5565b60405180910390a1505050565b6065546001600160a01b031633146106045760405162461bcd60e51b815260040161043c90611f20565b6001600160a01b0316600090815260c960205260409020805460ff19169055565b6065546001600160a01b0316331461064f5760405162461bcd60e51b815260040161043c90611f20565b60005b818110156106c157600060c9600085858581811061067257610672611e68565b90506020020160208101906106879190611bad565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806106b981611e94565b915050610652565b505050565b60975460ff16156106e95760405162461bcd60e51b815260040161043c90611dbc565b6106f1610a08565b61070d5760405162461bcd60e51b815260040161043c90611de6565b33321461072c5760405162461bcd60e51b815260040161043c90611e1d565b8585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061078190505760405162461bcd60e51b815260040161043c90611e43565b8582146107db5760405162461bcd60e51b815260206004820152602260248201527f576f726c643a2042616420616476656e74757265206172726179206c656e6774604482015261687360f01b606482015260840161043c565b60005b868110156108d45760008888838181106107fa576107fa611e68565b90506020020135905061080e81600361112f565b6108178161124b565b60fe546001600160a01b031663f499a73e33838a8a8a8a8981811061083e5761083e611e68565b90506020028101906108509190611f55565b6040518763ffffffff1660e01b815260040161087196959493929190611f9f565b600060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b50505060009182525060ff60205260409020805460ff60a01b1916600360a01b179055806108cc81611e94565b9150506107de565b506000805160206120c983398151915287873360036040516108f99493929190611ee5565b60405180910390a150505050505050565b6065546001600160a01b031633146109345760405162461bcd60e51b815260040161043c90611f20565b6001600160a01b0316600090815260c960205260409020805460ff19166001179055565b6065546001600160a01b031633146109825760405162461bcd60e51b815260040161043c90611f20565b61098c600061142f565b565b600054610100900460ff166109a95760005460ff16156109ad565b303b155b6109c95760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff161580156109eb576000805461ffff19166101011790555b6109f3611481565b8015610a05576000805461ff00191690555b50565b60fc546000906001600160a01b031615801590610a2f575060fd546001600160a01b031615155b8015610a45575060fe546001600160a01b031615155b905090565b6065546001600160a01b03163314610a745760405162461bcd60e51b815260040161043c90611f20565b60005b818110156106c157600160c96000858585818110610a9757610a97611e68565b9050602002016020810190610aac9190611bad565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610ade81611e94565b915050610a77565b60975460ff1615610b095760405162461bcd60e51b815260040161043c90611dbc565b610b11610a08565b610b2d5760405162461bcd60e51b815260040161043c90611de6565b333214610b4c5760405162461bcd60e51b815260040161043c90611e1d565b81818080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150610ba190505760405162461bcd60e51b815260040161043c90611e43565b60005b82811015610caa576000848483818110610bc057610bc0611e68565b905060200201359050610bd481600061112f565b610bdd8161124b565b33600090815261010060205260409020610bf790826114e6565b50600081815260ff60205260409081902080546001600160a81b031916905560fc5490516383291f8760e01b8152306004820152336024820152604481018390526001600160a01b03909116906383291f8790606401600060405180830381600087803b158015610c6757600080fd5b505af1158015610c7b573d6000803e3d6000fd5b50505060009182525060ff60205260409020805460ff60a01b1916905580610ca281611e94565b915050610ba4565b506000805160206120c983398151915283833360006040516105cd9493929190611ee5565b6040805180820190915260008082526020820152600082815260ff60205260409020546001600160a01b0316610d435760405162461bcd60e51b815260206004820152601960248201527815dbdc9b190e88151bd859081a5cc81b9bdd081cdd185ad959603a1b604482015260640161043c565b600082815260ff6020818152604092839020835180850190945280546001600160a01b0381168552909291840191600160a01b909104166003811115610d8b57610d8b611ca9565b6003811115610d9c57610d9c611ca9565b90525092915050565b33600090815260c9602052604090205460ff1680610dc65750610dc66114f9565b610e075760405162461bcd60e51b81526020600482015260126024820152712737ba1030b236b4b71037b91037bbb732b960711b604482015260640161043c565b60fc80546001600160a01b039485166001600160a01b03199182161790915560fd80549385169382169390931790925560fe8054919093169116179055565b6001600160a01b038116600090815261010060205260409020606090610e6b9061151d565b92915050565b33600090815260c9602052604090205460ff1680610e925750610e926114f9565b610ed35760405162461bcd60e51b81526020600482015260126024820152712737ba1030b236b4b71037b91037bbb732b960711b604482015260640161043c565b8015610ee157610a0561152a565b610a0561159f565b600081815260ff60205260408120546001600160a01b031680610e6b5760405162461bcd60e51b815260206004820152601960248201527815dbdc9b190e88151bd859081a5cc81b9bdd081cdd185ad959603a1b604482015260640161043c565b60975460ff1615610f6d5760405162461bcd60e51b815260040161043c90611dbc565b610f75610a08565b610f915760405162461bcd60e51b815260040161043c90611de6565b333214610fb05760405162461bcd60e51b815260040161043c90611e1d565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061100590505760405162461bcd60e51b815260040161043c90611e43565b60005b8281101561107257600084848381811061102457611024611e68565b90506020020135905061103881600161112f565b6110418161124b565b600090815260ff60205260409020805460ff60a01b1916600160a01b1790558061106a81611e94565b915050611008565b506000805160206120c983398151915283833360016040516105cd9493929190611ee5565b6065546001600160a01b031633146110c15760405162461bcd60e51b815260040161043c90611f20565b6001600160a01b0381166111265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043c565b610a058161142f565b600082815260ff60208190526040822054600160a01b9004169081600381111561115b5761115b611ca9565b146111c6573360009081526101006020526040902061117a9084611619565b6111c65760405162461bcd60e51b815260206004820152601d60248201527f576f726c643a205573657220646f6573206e6f74206f776e20746f6164000000604482015260640161043c565b8160038111156111d8576111d8611ca9565b8160038111156111ea576111ea611ca9565b14156106c15760405162461bcd60e51b815260206004820152602a60248201527f576f726c643a204c6f636174696f6e206d75737420626520646966666572656e6044820152691d08199bdc881d1bd85960b21b606482015260840161043c565b600081815260ff6020819052604090912054600160a01b900416600181600381111561127957611279611ca9565b1415611283575050565b600281600381111561129757611297611ca9565b14156113065760fd54604051630856a86560e41b8152600481018490523360248201526001600160a01b039091169063856a8650906044015b600060405180830381600087803b1580156112ea57600080fd5b505af11580156112fe573d6000803e3d6000fd5b505050505050565b600381600381111561131a5761131a611ca9565b14156113575760fe546040516306ebe3af60e21b8152336004820152602481018490526001600160a01b0390911690631baf8ebc906044016112d0565b600081600381111561136b5761136b611ca9565b14156113e757600082815260ff6020908152604080832080546001600160a01b03191633908117909155835261010090915290206113a99083611631565b5060fc546040516383291f8760e01b8152336004820152306024820152604481018490526001600160a01b03909116906383291f87906064016112d0565b60405162461bcd60e51b815260206004820152601c60248201527f576f726c643a20556e6b6e6f776e2066726f6d206c6f636174696f6e00000000604482015260640161043c565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661149c5760005460ff16156114a0565b303b155b6114bc5760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff161580156114de576000805461ffff19166101011790555b6109f361163d565b60006114f283836116aa565b9392505050565b60003361150e6065546001600160a01b031690565b6001600160a01b031614905090565b606060006114f2836117a4565b60975460ff161561154d5760405162461bcd60e51b815260040161043c90611dbc565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115823390565b6040516001600160a01b03909116815260200160405180910390a1565b60975460ff166115e85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161043c565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611582565b600081815260018301602052604081205415156114f2565b60006114f28383611800565b600054610100900460ff166116585760005460ff161561165c565b303b155b6116785760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff1615801561169a576000805461ffff19166101011790555b6116a261184f565b6109f36118b4565b600081815260018301602052604081205480156117935760006116ce600183612050565b85549091506000906116e290600190612050565b905081811461174757600086600001828154811061170257611702611e68565b906000526020600020015490508087600001848154811061172557611725611e68565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061175857611758612067565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e6b565b6000915050610e6b565b5092915050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156117f457602002820191906000526020600020905b8154815260200190600101908083116117e0575b50505050509050919050565b600081815260018301602052604081205461184757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e6b565b506000610e6b565b600054610100900460ff1661186a5760005460ff161561186e565b303b155b61188a5760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff161580156118ac576000805461ffff19166101011790555b6109f36118db565b600054610100900460ff1661098c5760405162461bcd60e51b815260040161043c9061207d565b600054610100900460ff166118f65760005460ff16156118fa565b303b155b6119165760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff16158015611938576000805461ffff19166101011790555b611940611950565b61194861197f565b6109f361152a565b600054610100900460ff166119775760405162461bcd60e51b815260040161043c9061207d565b61098c6119ae565b600054610100900460ff166119a65760405162461bcd60e51b815260040161043c9061207d565b61098c6119de565b600054610100900460ff166119d55760405162461bcd60e51b815260040161043c9061207d565b61098c3361142f565b600054610100900460ff16611a055760405162461bcd60e51b815260040161043c9061207d565b6097805460ff19169055565b60008083601f840112611a2357600080fd5b50813567ffffffffffffffff811115611a3b57600080fd5b6020830191508360208260051b8501011115611a5657600080fd5b9250929050565b60008060208385031215611a7057600080fd5b823567ffffffffffffffff811115611a8757600080fd5b611a9385828601611a11565b90969095509350505050565b80356001600160a01b0381168114611ab657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611ae757600080fd5b611af085611a9f565b9350611afe60208601611a9f565b925060408501359150606085013567ffffffffffffffff80821115611b2257600080fd5b818701915087601f830112611b3657600080fd5b813581811115611b4857611b48611abb565b604051601f8201601f19908116603f01168101908382118183101715611b7057611b70611abb565b816040528281528a6020848701011115611b8957600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600060208284031215611bbf57600080fd5b6114f282611a9f565b600060208284031215611bda57600080fd5b5035919050565b60008060008060008060608789031215611bfa57600080fd5b863567ffffffffffffffff80821115611c1257600080fd5b611c1e8a838b01611a11565b90985096506020890135915080821115611c3757600080fd5b818901915089601f830112611c4b57600080fd5b813581811115611c5a57600080fd5b8a6020828501011115611c6c57600080fd5b602083019650809550506040890135915080821115611c8a57600080fd5b50611c9789828a01611a11565b979a9699509497509295939492505050565b634e487b7160e01b600052602160045260246000fd5b60048110611cdd57634e487b7160e01b600052602160045260246000fd5b9052565b60208101610e6b8284611cbf565b81516001600160a01b03168152602080830151604083019161179d90840182611cbf565b600080600060608486031215611d2857600080fd5b611d3184611a9f565b9250611d3f60208501611a9f565b9150611d4d60408501611a9f565b90509250925092565b6020808252825182820181905260009190848201906040850190845b81811015611d8e57835183529284019291840191600101611d72565b50909695505050505050565b600060208284031215611dac57600080fd5b813580151581146114f257600080fd5b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601b908201527f576f726c643a20436f6e747261637473206172656e2774207365740000000000604082015260600190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b6020808252600b908201526a456d70747920617272617960a81b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ea857611ea8611e7e565b5060010190565b81835260006001600160fb1b03831115611ec857600080fd5b8260051b8083602087013760009401602001938452509192915050565b606081526000611ef9606083018688611eaf565b6001600160a01b03851660208401529050611f176040830184611cbf565b95945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000808335601e19843603018112611f6c57600080fd5b83018035915067ffffffffffffffff821115611f8757600080fd5b6020019150600581901b3603821315611a5657600080fd5b6001600160a01b0387168152602081018690526080604082018190528101849052838560a0830137600060a085830101526000601f19601f860116820160a0838203016060840152611ff560a082018587611eaf565b9998505050505050505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008282101561206257612062611e7e565b500390565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fec28aa8b9e9810f2c865b07155a5621c650c4c3a2b82760f61de64a999657c837a26469706673582212206e77c892c6b704117aaf2dabf42e2886f9d213fd07f29618ba886e5e12e2d9ae64736f6c63430008090033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80638cdcc4b4116100de578063b3066d4911610097578063bedb86fb11610071578063bedb86fb146103cd578063c37e2218146103e0578063f0ba31d8146103f3578063f2fde38b1461040657600080fd5b8063b3066d4914610387578063b960ce741461039a578063be3d6781146103ba57600080fd5b80638cdcc4b4146103155780638da5cb5b1461031d5780638f3a40f31461032e5780639c54df6414610341578063a7e7feca14610354578063a98d67831461036757600080fd5b8063377e11e01161014b578063704802751161012557806370480275146102ba578063715018a6146102cd57806372e9b78e146102d55780638129fc1c1461030d57600080fd5b8063377e11e01461028957806356555ea71461029c5780635c975abb146102af57600080fd5b80630bdd03f11461019357806312643536146101c3578063150b7a02146101d85780631785f53c1461020f57806324d7806c146102225780632c95dc791461025e575b600080fd5b60fc546101a6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101d66101d1366004611a5d565b610419565b005b6101f66101e6366004611ad1565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016101ba565b6101d661021d366004611bad565b6105da565b61024e610230366004611bad565b6001600160a01b0316600090815260c9602052604090205460ff1690565b60405190151581526020016101ba565b61024e61026c366004611bc8565b600090815260ff60205260409020546001600160a01b0316151590565b6101d6610297366004611a5d565b610625565b6101d66102aa366004611be1565b6106c6565b60975460ff1661024e565b6101d66102c8366004611bad565b61090a565b6101d6610958565b6103006102e3366004611bc8565b600090815260ff6020819052604090912054600160a01b90041690565b6040516101ba9190611ce1565b6101d661098e565b61024e610a08565b6065546001600160a01b03166101a6565b60fd546101a6906001600160a01b031681565b6101d661034f366004611a5d565b610a4a565b6101d6610362366004611a5d565b610ae6565b61037a610375366004611bc8565b610ccf565b6040516101ba9190611cef565b6101d6610395366004611d13565b610da5565b6103ad6103a8366004611bad565b610e46565b6040516101ba9190611d56565b60fe546101a6906001600160a01b031681565b6101d66103db366004611d9a565b610e71565b6101a66103ee366004611bc8565b610ee9565b6101d6610401366004611a5d565b610f4a565b6101d6610414366004611bad565b611097565b60975460ff16156104455760405162461bcd60e51b815260040161043c90611dbc565b60405180910390fd5b61044d610a08565b6104695760405162461bcd60e51b815260040161043c90611de6565b3332146104885760405162461bcd60e51b815260040161043c90611e1d565b818180806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251151591506104dd90505760405162461bcd60e51b815260040161043c90611e43565b60005b828110156105a85760008484838181106104fc576104fc611e68565b90506020020135905061051081600261112f565b6105198161124b565b60fd5460405163c604158360e01b8152600481018390526001600160a01b039091169063c604158390602401600060405180830381600087803b15801561055f57600080fd5b505af1158015610573573d6000803e3d6000fd5b50505060009182525060ff60205260409020805460ff60a01b1916600160a11b179055806105a081611e94565b9150506104e0565b506000805160206120c983398151915283833360026040516105cd9493929190611ee5565b60405180910390a1505050565b6065546001600160a01b031633146106045760405162461bcd60e51b815260040161043c90611f20565b6001600160a01b0316600090815260c960205260409020805460ff19169055565b6065546001600160a01b0316331461064f5760405162461bcd60e51b815260040161043c90611f20565b60005b818110156106c157600060c9600085858581811061067257610672611e68565b90506020020160208101906106879190611bad565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806106b981611e94565b915050610652565b505050565b60975460ff16156106e95760405162461bcd60e51b815260040161043c90611dbc565b6106f1610a08565b61070d5760405162461bcd60e51b815260040161043c90611de6565b33321461072c5760405162461bcd60e51b815260040161043c90611e1d565b8585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061078190505760405162461bcd60e51b815260040161043c90611e43565b8582146107db5760405162461bcd60e51b815260206004820152602260248201527f576f726c643a2042616420616476656e74757265206172726179206c656e6774604482015261687360f01b606482015260840161043c565b60005b868110156108d45760008888838181106107fa576107fa611e68565b90506020020135905061080e81600361112f565b6108178161124b565b60fe546001600160a01b031663f499a73e33838a8a8a8a8981811061083e5761083e611e68565b90506020028101906108509190611f55565b6040518763ffffffff1660e01b815260040161087196959493929190611f9f565b600060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b50505060009182525060ff60205260409020805460ff60a01b1916600360a01b179055806108cc81611e94565b9150506107de565b506000805160206120c983398151915287873360036040516108f99493929190611ee5565b60405180910390a150505050505050565b6065546001600160a01b031633146109345760405162461bcd60e51b815260040161043c90611f20565b6001600160a01b0316600090815260c960205260409020805460ff19166001179055565b6065546001600160a01b031633146109825760405162461bcd60e51b815260040161043c90611f20565b61098c600061142f565b565b600054610100900460ff166109a95760005460ff16156109ad565b303b155b6109c95760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff161580156109eb576000805461ffff19166101011790555b6109f3611481565b8015610a05576000805461ff00191690555b50565b60fc546000906001600160a01b031615801590610a2f575060fd546001600160a01b031615155b8015610a45575060fe546001600160a01b031615155b905090565b6065546001600160a01b03163314610a745760405162461bcd60e51b815260040161043c90611f20565b60005b818110156106c157600160c96000858585818110610a9757610a97611e68565b9050602002016020810190610aac9190611bad565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610ade81611e94565b915050610a77565b60975460ff1615610b095760405162461bcd60e51b815260040161043c90611dbc565b610b11610a08565b610b2d5760405162461bcd60e51b815260040161043c90611de6565b333214610b4c5760405162461bcd60e51b815260040161043c90611e1d565b81818080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050825115159150610ba190505760405162461bcd60e51b815260040161043c90611e43565b60005b82811015610caa576000848483818110610bc057610bc0611e68565b905060200201359050610bd481600061112f565b610bdd8161124b565b33600090815261010060205260409020610bf790826114e6565b50600081815260ff60205260409081902080546001600160a81b031916905560fc5490516383291f8760e01b8152306004820152336024820152604481018390526001600160a01b03909116906383291f8790606401600060405180830381600087803b158015610c6757600080fd5b505af1158015610c7b573d6000803e3d6000fd5b50505060009182525060ff60205260409020805460ff60a01b1916905580610ca281611e94565b915050610ba4565b506000805160206120c983398151915283833360006040516105cd9493929190611ee5565b6040805180820190915260008082526020820152600082815260ff60205260409020546001600160a01b0316610d435760405162461bcd60e51b815260206004820152601960248201527815dbdc9b190e88151bd859081a5cc81b9bdd081cdd185ad959603a1b604482015260640161043c565b600082815260ff6020818152604092839020835180850190945280546001600160a01b0381168552909291840191600160a01b909104166003811115610d8b57610d8b611ca9565b6003811115610d9c57610d9c611ca9565b90525092915050565b33600090815260c9602052604090205460ff1680610dc65750610dc66114f9565b610e075760405162461bcd60e51b81526020600482015260126024820152712737ba1030b236b4b71037b91037bbb732b960711b604482015260640161043c565b60fc80546001600160a01b039485166001600160a01b03199182161790915560fd80549385169382169390931790925560fe8054919093169116179055565b6001600160a01b038116600090815261010060205260409020606090610e6b9061151d565b92915050565b33600090815260c9602052604090205460ff1680610e925750610e926114f9565b610ed35760405162461bcd60e51b81526020600482015260126024820152712737ba1030b236b4b71037b91037bbb732b960711b604482015260640161043c565b8015610ee157610a0561152a565b610a0561159f565b600081815260ff60205260408120546001600160a01b031680610e6b5760405162461bcd60e51b815260206004820152601960248201527815dbdc9b190e88151bd859081a5cc81b9bdd081cdd185ad959603a1b604482015260640161043c565b60975460ff1615610f6d5760405162461bcd60e51b815260040161043c90611dbc565b610f75610a08565b610f915760405162461bcd60e51b815260040161043c90611de6565b333214610fb05760405162461bcd60e51b815260040161043c90611e1d565b8181808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505082511515915061100590505760405162461bcd60e51b815260040161043c90611e43565b60005b8281101561107257600084848381811061102457611024611e68565b90506020020135905061103881600161112f565b6110418161124b565b600090815260ff60205260409020805460ff60a01b1916600160a01b1790558061106a81611e94565b915050611008565b506000805160206120c983398151915283833360016040516105cd9493929190611ee5565b6065546001600160a01b031633146110c15760405162461bcd60e51b815260040161043c90611f20565b6001600160a01b0381166111265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043c565b610a058161142f565b600082815260ff60208190526040822054600160a01b9004169081600381111561115b5761115b611ca9565b146111c6573360009081526101006020526040902061117a9084611619565b6111c65760405162461bcd60e51b815260206004820152601d60248201527f576f726c643a205573657220646f6573206e6f74206f776e20746f6164000000604482015260640161043c565b8160038111156111d8576111d8611ca9565b8160038111156111ea576111ea611ca9565b14156106c15760405162461bcd60e51b815260206004820152602a60248201527f576f726c643a204c6f636174696f6e206d75737420626520646966666572656e6044820152691d08199bdc881d1bd85960b21b606482015260840161043c565b600081815260ff6020819052604090912054600160a01b900416600181600381111561127957611279611ca9565b1415611283575050565b600281600381111561129757611297611ca9565b14156113065760fd54604051630856a86560e41b8152600481018490523360248201526001600160a01b039091169063856a8650906044015b600060405180830381600087803b1580156112ea57600080fd5b505af11580156112fe573d6000803e3d6000fd5b505050505050565b600381600381111561131a5761131a611ca9565b14156113575760fe546040516306ebe3af60e21b8152336004820152602481018490526001600160a01b0390911690631baf8ebc906044016112d0565b600081600381111561136b5761136b611ca9565b14156113e757600082815260ff6020908152604080832080546001600160a01b03191633908117909155835261010090915290206113a99083611631565b5060fc546040516383291f8760e01b8152336004820152306024820152604481018490526001600160a01b03909116906383291f87906064016112d0565b60405162461bcd60e51b815260206004820152601c60248201527f576f726c643a20556e6b6e6f776e2066726f6d206c6f636174696f6e00000000604482015260640161043c565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661149c5760005460ff16156114a0565b303b155b6114bc5760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff161580156114de576000805461ffff19166101011790555b6109f361163d565b60006114f283836116aa565b9392505050565b60003361150e6065546001600160a01b031690565b6001600160a01b031614905090565b606060006114f2836117a4565b60975460ff161561154d5760405162461bcd60e51b815260040161043c90611dbc565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115823390565b6040516001600160a01b03909116815260200160405180910390a1565b60975460ff166115e85760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161043c565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611582565b600081815260018301602052604081205415156114f2565b60006114f28383611800565b600054610100900460ff166116585760005460ff161561165c565b303b155b6116785760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff1615801561169a576000805461ffff19166101011790555b6116a261184f565b6109f36118b4565b600081815260018301602052604081205480156117935760006116ce600183612050565b85549091506000906116e290600190612050565b905081811461174757600086600001828154811061170257611702611e68565b906000526020600020015490508087600001848154811061172557611725611e68565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061175857611758612067565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e6b565b6000915050610e6b565b5092915050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156117f457602002820191906000526020600020905b8154815260200190600101908083116117e0575b50505050509050919050565b600081815260018301602052604081205461184757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e6b565b506000610e6b565b600054610100900460ff1661186a5760005460ff161561186e565b303b155b61188a5760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff161580156118ac576000805461ffff19166101011790555b6109f36118db565b600054610100900460ff1661098c5760405162461bcd60e51b815260040161043c9061207d565b600054610100900460ff166118f65760005460ff16156118fa565b303b155b6119165760405162461bcd60e51b815260040161043c90612002565b600054610100900460ff16158015611938576000805461ffff19166101011790555b611940611950565b61194861197f565b6109f361152a565b600054610100900460ff166119775760405162461bcd60e51b815260040161043c9061207d565b61098c6119ae565b600054610100900460ff166119a65760405162461bcd60e51b815260040161043c9061207d565b61098c6119de565b600054610100900460ff166119d55760405162461bcd60e51b815260040161043c9061207d565b61098c3361142f565b600054610100900460ff16611a055760405162461bcd60e51b815260040161043c9061207d565b6097805460ff19169055565b60008083601f840112611a2357600080fd5b50813567ffffffffffffffff811115611a3b57600080fd5b6020830191508360208260051b8501011115611a5657600080fd5b9250929050565b60008060208385031215611a7057600080fd5b823567ffffffffffffffff811115611a8757600080fd5b611a9385828601611a11565b90969095509350505050565b80356001600160a01b0381168114611ab657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611ae757600080fd5b611af085611a9f565b9350611afe60208601611a9f565b925060408501359150606085013567ffffffffffffffff80821115611b2257600080fd5b818701915087601f830112611b3657600080fd5b813581811115611b4857611b48611abb565b604051601f8201601f19908116603f01168101908382118183101715611b7057611b70611abb565b816040528281528a6020848701011115611b8957600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600060208284031215611bbf57600080fd5b6114f282611a9f565b600060208284031215611bda57600080fd5b5035919050565b60008060008060008060608789031215611bfa57600080fd5b863567ffffffffffffffff80821115611c1257600080fd5b611c1e8a838b01611a11565b90985096506020890135915080821115611c3757600080fd5b818901915089601f830112611c4b57600080fd5b813581811115611c5a57600080fd5b8a6020828501011115611c6c57600080fd5b602083019650809550506040890135915080821115611c8a57600080fd5b50611c9789828a01611a11565b979a9699509497509295939492505050565b634e487b7160e01b600052602160045260246000fd5b60048110611cdd57634e487b7160e01b600052602160045260246000fd5b9052565b60208101610e6b8284611cbf565b81516001600160a01b03168152602080830151604083019161179d90840182611cbf565b600080600060608486031215611d2857600080fd5b611d3184611a9f565b9250611d3f60208501611a9f565b9150611d4d60408501611a9f565b90509250925092565b6020808252825182820181905260009190848201906040850190845b81811015611d8e57835183529284019291840191600101611d72565b50909695505050505050565b600060208284031215611dac57600080fd5b813580151581146114f257600080fd5b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601b908201527f576f726c643a20436f6e747261637473206172656e2774207365740000000000604082015260600190565b6020808252600c908201526b4e6f20636f6e74726163747360a01b604082015260600190565b6020808252600b908201526a456d70747920617272617960a81b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ea857611ea8611e7e565b5060010190565b81835260006001600160fb1b03831115611ec857600080fd5b8260051b8083602087013760009401602001938452509192915050565b606081526000611ef9606083018688611eaf565b6001600160a01b03851660208401529050611f176040830184611cbf565b95945050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000808335601e19843603018112611f6c57600080fd5b83018035915067ffffffffffffffff821115611f8757600080fd5b6020019150600581901b3603821315611a5657600080fd5b6001600160a01b0387168152602081018690526080604082018190528101849052838560a0830137600060a085830101526000601f19601f860116820160a0838203016060840152611ff560a082018587611eaf565b9998505050505050505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60008282101561206257612062611e7e565b500390565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fec28aa8b9e9810f2c865b07155a5621c650c4c3a2b82760f61de64a999657c837a26469706673582212206e77c892c6b704117aaf2dabf42e2886f9d213fd07f29618ba886e5e12e2d9ae64736f6c63430008090033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.