Source Code
Latest 25 from a total of 6,728 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Stake Rusk | 82035274 | 18 hrs ago | IN | 0 POL | 0.02218747 | ||||
| Stake Alchemist | 82033854 | 19 hrs ago | IN | 0 POL | 0.27368609 | ||||
| Stake Alchemist | 82031046 | 21 hrs ago | IN | 0 POL | 0.13391023 | ||||
| Unstake Alchemis... | 82027993 | 22 hrs ago | IN | 0 POL | 0.0713791 | ||||
| Stake Alchemist | 82019476 | 27 hrs ago | IN | 0 POL | 0.1080038 | ||||
| Stake Alchemist | 82019147 | 27 hrs ago | IN | 0 POL | 0.12839437 | ||||
| Stake Alchemist | 82019020 | 27 hrs ago | IN | 0 POL | 0.15525154 | ||||
| Stake Alchemist | 82018529 | 28 hrs ago | IN | 0 POL | 0.15252195 | ||||
| Stake Alchemist | 81996176 | 40 hrs ago | IN | 0 POL | 0.0928403 | ||||
| Unstake Alchemis... | 81996116 | 40 hrs ago | IN | 0 POL | 0.03800673 | ||||
| Unstake Rusk | 81996107 | 40 hrs ago | IN | 0 POL | 0.01340332 | ||||
| Stake Alchemist | 81992874 | 42 hrs ago | IN | 0 POL | 0.08008522 | ||||
| Stake Rusk | 81962117 | 2 days ago | IN | 0 POL | 0.02665238 | ||||
| Stake Rusk | 81953538 | 2 days ago | IN | 0 POL | 0.02038908 | ||||
| Stake Rusk | 81940302 | 2 days ago | IN | 0 POL | 0.00542748 | ||||
| Stake Rusk | 81939958 | 2 days ago | IN | 0 POL | 0.00596264 | ||||
| Stake Alchemist | 81939853 | 2 days ago | IN | 0 POL | 0.02373216 | ||||
| Stake Alchemist | 81922269 | 3 days ago | IN | 0 POL | 0.10668622 | ||||
| Stake Rusk | 81905644 | 3 days ago | IN | 0 POL | 0.02979136 | ||||
| Stake Alchemist | 81905347 | 3 days ago | IN | 0 POL | 0.13637831 | ||||
| Stake Alchemist | 81905323 | 3 days ago | IN | 0 POL | 0.15936261 | ||||
| Unstake Alchemis... | 81905318 | 3 days ago | IN | 0 POL | 0.05822165 | ||||
| Stake Rusk | 81904833 | 3 days ago | IN | 0 POL | 0.02472222 | ||||
| Stake Alchemist | 81904624 | 3 days ago | IN | 0 POL | 0.10142213 | ||||
| Stake Rusk | 81894079 | 4 days ago | IN | 0 POL | 0.00523778 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MagicAlchemyAlchemistRooms
Compiler Version
v0.8.30+commit.73712a01
Optimization Enabled:
Yes with 10000000 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
import {IMagicAlchemyERC721WithRarity} from "./interface/IMagicAlchemyERC721WithRarity.sol";
import {MagicAlchemyRarity as Rarity} from "./utils/MagicAlchemyRarity.sol";
contract MagicAlchemyAlchemistRooms is Ownable, Pausable, ReentrancyGuardTransient {
/* -------------------------------------------------------------------------- */
/* USINGS */
/* -------------------------------------------------------------------------- */
using SafeERC20 for IERC20;
using EnumerableSet for EnumerableSet.UintSet;
/* -------------------------------------------------------------------------- */
/* STRUCTS */
/* -------------------------------------------------------------------------- */
struct AlchemistStake {
address owner;
uint256 roomId;
Rarity rarity;
}
struct OwnerAlchemistStakes {
EnumerableSet.UintSet stakedAlchemistIds;
mapping(uint256 roomId => bool occupied) occupiedRoomIds;
}
/* -------------------------------------------------------------------------- */
/* EVENTS */
/* -------------------------------------------------------------------------- */
event AlchemistStaked(
uint256 indexed roomId, address indexed owner, uint256 indexed alchemistId, Rarity rarity, string alchemistUri
);
event AlchemistUnstaked(uint256 indexed roomId, address indexed owner, uint256 indexed alchemistId, Rarity rarity);
event RuskStaked(address indexed owner, uint256 amount);
event RuskUnstaked(address indexed owner, uint256 amount);
event RewardWeightUpdated(uint256 indexed roomId, uint256 weight);
/* -------------------------------------------------------------------------- */
/* ERRORS */
/* -------------------------------------------------------------------------- */
error InvalidRoomId(uint256 roomId);
error InvalidRuskAmount(uint256 amount);
error RoomIsOccupied(uint256 roomId);
error NotStakeOwner(address sender, address owner, uint256 alchemistId);
error StakeNotFound(uint256 alchemistId);
error OutOfBoundsIndex(uint256 index, uint256 length);
error InsufficientRuskStake(uint256 requestedAmount, uint256 ownedAmount);
/* -------------------------------------------------------------------------- */
/* STATE VARIABLES */
/* -------------------------------------------------------------------------- */
IMagicAlchemyERC721WithRarity private immutable _alchemistContract;
IERC20 private immutable _ruskContract;
mapping(address owner => OwnerAlchemistStakes) private _alchemistOwnerStakes;
mapping(uint256 alchemistId => AlchemistStake) private _alchemistStakeByAlchemistId;
mapping(address owner => uint256 amount) private _ruskStakeOfOwner;
mapping(uint256 roomId => uint256 weight) private _rewardWeightByRoomId;
/* -------------------------------------------------------------------------- */
/* CONSTRUCTOR */
/* -------------------------------------------------------------------------- */
constructor(IMagicAlchemyERC721WithRarity alchemistContract_, IERC20 ruskContract_, address initialOwner)
Ownable(initialOwner)
{
_pause();
_alchemistContract = alchemistContract_;
_ruskContract = ruskContract_;
}
/* -------------------------------------------------------------------------- */
/* VIEW FUNCTIONS */
/* -------------------------------------------------------------------------- */
function alchemistContract() external view returns (address) {
return address(_alchemistContract);
}
function ruskContract() external view returns (address) {
return address(_ruskContract);
}
function alchemistStakeCountOfOwner(address alchemistOwner) external view returns (uint256) {
return _alchemistOwnerStakes[alchemistOwner].stakedAlchemistIds.length();
}
function alchemistStakeByIndex(address owner, uint256 index)
external
view
returns (uint256 roomId, uint256 alchemistId)
{
OwnerAlchemistStakes storage alchemistOwnerInfo = _alchemistOwnerStakes[owner];
uint256 count = alchemistOwnerInfo.stakedAlchemistIds.length();
if (index >= count) {
revert OutOfBoundsIndex(index, count);
}
alchemistId = alchemistOwnerInfo.stakedAlchemistIds.at(index);
roomId = _alchemistStakeByAlchemistId[alchemistId].roomId;
}
function alchemistStakeOfToken(uint256 alchemistId) external view returns (uint256 roomId, address owner) {
AlchemistStake storage alchemistInfo = _alchemistStakeByAlchemistId[alchemistId];
owner = alchemistInfo.owner;
roomId = alchemistInfo.roomId;
}
function ruskStakeOfOwner(address owner) external view returns (uint256) {
return _ruskStakeOfOwner[owner];
}
function rewardWeight(uint256 roomId) external view returns (uint256) {
return _rewardWeightByRoomId[roomId];
}
/* -------------------------------------------------------------------------- */
/* STATE CHANGING FUNCTIONS */
/* -------------------------------------------------------------------------- */
function stakeAlchemist(uint256 alchemistId, uint256 roomId) external nonReentrant whenNotPaused {
if (roomId == 0) {
revert InvalidRoomId(roomId);
}
address alchemistOwner = _msgSender();
OwnerAlchemistStakes storage ownerInfo = _alchemistOwnerStakes[alchemistOwner];
if (ownerInfo.occupiedRoomIds[roomId]) {
revert RoomIsOccupied(roomId);
}
ownerInfo.occupiedRoomIds[roomId] = true;
ownerInfo.stakedAlchemistIds.add(alchemistId);
AlchemistStake storage alchemistInfo = _alchemistStakeByAlchemistId[alchemistId];
alchemistInfo.owner = alchemistOwner;
alchemistInfo.roomId = roomId;
alchemistInfo.rarity = _alchemistContract.rarityOf(alchemistId);
string memory alchemistUri = _alchemistContract.tokenURI(alchemistId);
_alchemistContract.transferFrom(alchemistOwner, address(this), alchemistId);
emit AlchemistStaked(roomId, alchemistOwner, alchemistId, alchemistInfo.rarity, alchemistUri);
}
function unstakeAlchemist(uint256 alchemistId) external nonReentrant {
address sender = _msgSender();
AlchemistStake storage alchemistInfo = _alchemistStakeByAlchemistId[alchemistId];
address alchemistOwner = alchemistInfo.owner;
if (alchemistOwner == address(0)) {
revert StakeNotFound(alchemistId);
}
if (sender != alchemistOwner) {
revert NotStakeOwner(sender, alchemistOwner, alchemistId);
}
uint256 roomId = alchemistInfo.roomId;
Rarity alchemistRarity = alchemistInfo.rarity;
delete _alchemistStakeByAlchemistId[alchemistId];
OwnerAlchemistStakes storage alchemistOwnerInfo = _alchemistOwnerStakes[alchemistOwner];
alchemistOwnerInfo.stakedAlchemistIds.remove(alchemistId);
delete alchemistOwnerInfo.occupiedRoomIds[roomId];
_alchemistContract.transferFrom(address(this), alchemistOwner, alchemistId);
emit AlchemistUnstaked(roomId, alchemistOwner, alchemistId, alchemistRarity);
}
function stakeRusk(uint256 amount) external nonReentrant whenNotPaused {
if (amount == 0) {
revert InvalidRuskAmount(amount);
}
address ruskOwner = _msgSender();
_ruskStakeOfOwner[ruskOwner] += amount;
_ruskContract.safeTransferFrom(ruskOwner, address(this), amount);
emit RuskStaked(ruskOwner, amount);
}
function unstakeRusk(uint256 amount) external nonReentrant {
if (amount == 0) {
revert InvalidRuskAmount(amount);
}
address ruskOwner = _msgSender();
uint256 ownedAmount = _ruskStakeOfOwner[ruskOwner];
if (amount > ownedAmount) {
revert InsufficientRuskStake(amount, ownedAmount);
}
_ruskStakeOfOwner[ruskOwner] -= amount;
_ruskContract.safeTransfer(ruskOwner, amount);
emit RuskUnstaked(ruskOwner, amount);
}
/* -------------------------------------------------------------------------- */
/* OWNER-RESTRICTED FUNCTIONS */
/* -------------------------------------------------------------------------- */
function setRewardWeight(uint256 roomId, uint256 weight) external onlyOwner {
if (roomId == 0) {
revert InvalidRoomId(roomId);
}
if (_rewardWeightByRoomId[roomId] == weight) {
return;
}
_rewardWeightByRoomId[roomId] = weight;
emit RewardWeightUpdated(roomId, weight);
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @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.
*
* ```solidity
* 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.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// 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 is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @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._positions[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 cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 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 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[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._positions[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) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
// 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 ("memory-safe") {
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 in 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 ("memory-safe") {
result := store
}
return result;
}
}// 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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @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);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuardTransient.sol)
pragma solidity ^0.8.24;
import {TransientSlot} from "./TransientSlot.sol";
/**
* @dev Variant of {ReentrancyGuard} that uses transient storage.
*
* NOTE: This variant only works on networks where EIP-1153 is available.
*
* _Available since v5.1._
*/
abstract contract ReentrancyGuardTransient {
using TransientSlot for *;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true);
}
function _nonReentrantAfter() private {
REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false);
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return REENTRANCY_GUARD_STORAGE.asBoolean().tload();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
import {IERC721Metadata} from "@openzeppelin/contracts/interfaces/IERC721Metadata.sol";
import {MagicAlchemyRarity as Rarity} from "../utils/MagicAlchemyRarity.sol";
interface IMagicAlchemyERC721WithRarity is IERC721Metadata {
function rarityOf(uint256 tokenId) external view returns (Rarity);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;
/**
* @dev Enumeration of rarity levels used throughout the Magic Alchemy contracts.
* Defines four distinct tiers—Common, Rare, Epic, and Legendary—and
* a None value for cases where rarity is undefined.
*/
enum MagicAlchemyRarity {
Common,
Rare,
Epic,
Legendary,
None
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}// 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;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/TransientSlot.sol)
// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.
pragma solidity ^0.8.24;
/**
* @dev Library for reading and writing value-types to specific transient storage slots.
*
* Transient slots are often used to store temporary values that are removed after the current transaction.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* * Example reading and writing values using transient storage:
* ```solidity
* contract Lock {
* using TransientSlot for *;
*
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;
*
* modifier locked() {
* require(!_LOCK_SLOT.asBoolean().tload());
*
* _LOCK_SLOT.asBoolean().tstore(true);
* _;
* _LOCK_SLOT.asBoolean().tstore(false);
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library TransientSlot {
/**
* @dev UDVT that represent a slot holding a address.
*/
type AddressSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a AddressSlot.
*/
function asAddress(bytes32 slot) internal pure returns (AddressSlot) {
return AddressSlot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a bool.
*/
type BooleanSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a BooleanSlot.
*/
function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {
return BooleanSlot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a bytes32.
*/
type Bytes32Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Bytes32Slot.
*/
function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {
return Bytes32Slot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a uint256.
*/
type Uint256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Uint256Slot.
*/
function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {
return Uint256Slot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a int256.
*/
type Int256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Int256Slot.
*/
function asInt256(bytes32 slot) internal pure returns (Int256Slot) {
return Int256Slot.wrap(slot);
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(AddressSlot slot) internal view returns (address value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(AddressSlot slot, address value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(BooleanSlot slot) internal view returns (bool value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(BooleanSlot slot, bool value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Bytes32Slot slot) internal view returns (bytes32 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Bytes32Slot slot, bytes32 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Uint256Slot slot) internal view returns (uint256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Uint256Slot slot, uint256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Int256Slot slot) internal view returns (int256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Int256Slot slot, int256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721Metadata.sol)
pragma solidity ^0.8.20;
import {IERC721Metadata} from "../token/ERC721/extensions/IERC721Metadata.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.20;
import {IERC721} from "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @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[ERC 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 (last updated v5.1.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @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`.
*
* 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;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC-721 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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* 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 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 address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}{
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"chainlink/=lib/chainlink/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 10000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IMagicAlchemyERC721WithRarity","name":"alchemistContract_","type":"address"},{"internalType":"contract IERC20","name":"ruskContract_","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"uint256","name":"requestedAmount","type":"uint256"},{"internalType":"uint256","name":"ownedAmount","type":"uint256"}],"name":"InsufficientRuskStake","type":"error"},{"inputs":[{"internalType":"uint256","name":"roomId","type":"uint256"}],"name":"InvalidRoomId","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"InvalidRuskAmount","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"alchemistId","type":"uint256"}],"name":"NotStakeOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"OutOfBoundsIndex","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"roomId","type":"uint256"}],"name":"RoomIsOccupied","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"alchemistId","type":"uint256"}],"name":"StakeNotFound","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roomId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"alchemistId","type":"uint256"},{"indexed":false,"internalType":"enum MagicAlchemyRarity","name":"rarity","type":"uint8"},{"indexed":false,"internalType":"string","name":"alchemistUri","type":"string"}],"name":"AlchemistStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roomId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"alchemistId","type":"uint256"},{"indexed":false,"internalType":"enum MagicAlchemyRarity","name":"rarity","type":"uint8"}],"name":"AlchemistUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roomId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"RewardWeightUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RuskStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RuskUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"alchemistContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"alchemistStakeByIndex","outputs":[{"internalType":"uint256","name":"roomId","type":"uint256"},{"internalType":"uint256","name":"alchemistId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"alchemistOwner","type":"address"}],"name":"alchemistStakeCountOfOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"alchemistId","type":"uint256"}],"name":"alchemistStakeOfToken","outputs":[{"internalType":"uint256","name":"roomId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roomId","type":"uint256"}],"name":"rewardWeight","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ruskContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ruskStakeOfOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roomId","type":"uint256"},{"internalType":"uint256","name":"weight","type":"uint256"}],"name":"setRewardWeight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"alchemistId","type":"uint256"},{"internalType":"uint256","name":"roomId","type":"uint256"}],"name":"stakeAlchemist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeRusk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"alchemistId","type":"uint256"}],"name":"unstakeAlchemist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakeRusk","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c060405234801561000f575f5ffd5b50604051611a98380380611a9883398101604081905261002e91610189565b806001600160a01b03811661005c57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61006581610092565b505f805460ff60a01b1916905561007a6100e1565b506001600160a01b039182166080521660a0526101d3565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6100e9610140565b5f805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586101233390565b6040516001600160a01b03909116815260200160405180910390a1565b6101525f54600160a01b900460ff1690565b156101705760405163d93c066560e01b815260040160405180910390fd5b565b6001600160a01b0381168114610186575f5ffd5b50565b5f5f5f6060848603121561019b575f5ffd5b83516101a681610172565b60208501519093506101b781610172565b60408501519092506101c881610172565b809150509250925092565b60805160a05161187a61021e5f395f81816102d001528181610a220152610b3001525f81816102290152818161053e015281816106190152818161070c0152610e2d015261187a5ff3fe608060405234801561000f575f5ffd5b506004361061012f575f3560e01c80638456cb59116100ad578063bd62f01a1161007d578063fa82c73911610063578063fa82c7391461031a578063fc930ab01461032d578063fd54535614610362575f5ffd5b8063bd62f01a146102f4578063f2fde38b14610307575f5ffd5b80638456cb59146102965780638da5cb5b1461029e578063a0a4028b146102bb578063b63dea42146102ce575f5ffd5b80636b84bc091161010257806374568718116100e8578063745687181461021457806374a4a992146102275780637e5dd10a1461026e575f5ffd5b80636b84bc09146101a3578063715018a61461020c575f5ffd5b80633f4ba83a14610133578063594562351461013d5780635c975abb14610163578063637d9eb614610190575b5f5ffd5b61013b610381565b005b61015061014b36600461150f565b610393565b6040519081526020015b60405180910390f35b5f5474010000000000000000000000000000000000000000900460ff16604051901515815260200161015a565b61013b61019e366004611528565b6103c6565b6101e26101b1366004611548565b5f90815260026020526040902080546001909101549173ffffffffffffffffffffffffffffffffffffffff90911690565b6040805192835273ffffffffffffffffffffffffffffffffffffffff90911660208301520161015a565b61013b6107d2565b61013b610222366004611528565b6107e3565b7f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161015a565b61028161027c36600461155f565b61088b565b6040805192835260208301919091520161015a565b61013b610927565b5f5473ffffffffffffffffffffffffffffffffffffffff16610249565b61013b6102c9366004611548565b610937565b7f0000000000000000000000000000000000000000000000000000000000000000610249565b61013b610302366004611548565b610aa6565b61013b61031536600461150f565b610bb1565b61013b610328366004611548565b610c11565b61015061033b36600461150f565b73ffffffffffffffffffffffffffffffffffffffff165f9081526003602052604090205490565b610150610370366004611548565b5f9081526004602052604090205490565b610389610ee2565b610391610f34565b565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526001602052604081206103c090610fb0565b92915050565b6103ce610fb9565b6103d661103f565b805f03610417576040517f50b02fb3000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b335f818152600160209081526040808320858452600281019092529091205460ff1615610473576040517faf4c23390000000000000000000000000000000000000000000000000000000081526004810184905260240161040e565b5f838152600282016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556104b58185611093565b505f848152600260205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8581169190911782556001820186905591517fdd3b5f9a0000000000000000000000000000000000000000000000000000000081526004810187905290917f0000000000000000000000000000000000000000000000000000000000000000169063dd3b5f9a90602401602060405180830381865afa158015610583573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105a79190611587565b6002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018360048111156105e3576105e36115a5565b02179055506040517fc87b56dd000000000000000000000000000000000000000000000000000000008152600481018690525f907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063c87b56dd906024015f60405180830381865afa158015610672573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526106b791908101906115ff565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152306024830152604482018990529192507f0000000000000000000000000000000000000000000000000000000000000000909116906323b872dd906064015f604051808303815f87803b15801561074f575f5ffd5b505af1158015610761573d5f5f3e3d5ffd5b505050506002820154604051879173ffffffffffffffffffffffffffffffffffffffff87169188917fef000c99594776dcb0c8cac44a82a88208bce9f0d0146d35b04e53ad4c57f3b8916107ba9160ff16908790611728565b60405180910390a4505050506107ce6110a5565b5050565b6107da610ee2565b6103915f6110cf565b6107eb610ee2565b815f03610827576040517f50b02fb30000000000000000000000000000000000000000000000000000000081526004810183905260240161040e565b5f8281526004602052604090205481146107ce575f82815260046020526040908190208290555182907fcfd12c69f579206dd153436a0556961d5453669ba685ac36535f5d2bd7eb85079061087f9084815260200190565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526001602052604081208190816108bb82610fb0565b9050808510610900576040517f4e44554e000000000000000000000000000000000000000000000000000000008152600481018690526024810182905260440161040e565b61090a8286611143565b5f8181526002602052604090206001015497909650945050505050565b61092f610ee2565b61039161114e565b61093f610fb9565b805f0361097b576040517fec848b9f0000000000000000000000000000000000000000000000000000000081526004810182905260240161040e565b335f81815260036020526040902054808311156109ce576040517f1027b9ad000000000000000000000000000000000000000000000000000000008152600481018490526024810182905260440161040e565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526003602052604081208054859290610a029084906117b6565b90915550610a49905073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001683856111bc565b8173ffffffffffffffffffffffffffffffffffffffff167ff2e701e4c21ee8b1891237618ffb9c8af50e06bb14898914072033563e9d248e84604051610a9191815260200190565b60405180910390a25050610aa36110a5565b50565b610aae610fb9565b610ab661103f565b805f03610af2576040517fec848b9f0000000000000000000000000000000000000000000000000000000081526004810182905260240161040e565b335f8181526003602052604081208054849290610b109084906117c9565b90915550610b58905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016823085611242565b8073ffffffffffffffffffffffffffffffffffffffff167f699b80a477027b206db1d4c28c9aba68cef2f7dbc302256e3cd2470811039e3783604051610ba091815260200190565b60405180910390a250610aa36110a5565b610bb9610ee2565b73ffffffffffffffffffffffffffffffffffffffff8116610c08576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f600482015260240161040e565b610aa3816110cf565b610c19610fb9565b5f818152600260205260409020805433919073ffffffffffffffffffffffffffffffffffffffff1680610c7b576040517f51651db90000000000000000000000000000000000000000000000000000000081526004810185905260240161040e565b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610d07576040517fc0fc9bf200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8085166004830152821660248201526044810185905260640161040e565b6001808301546002808501545f8881526020838152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016815580880184905590940180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905573ffffffffffffffffffffffffffffffffffffffff87168252949094529220909160ff1690610da5818861128e565b505f8381526002820160205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8581166024830152604482018990527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b158015610e6e575f5ffd5b505af1158015610e80573d5f5f3e3d5ffd5b50505050868473ffffffffffffffffffffffffffffffffffffffff16847f63b37ff333b42cc66085802646c2fc599548e9d9d922eb85fc7dc05527fa083985604051610ecc91906117dc565b60405180910390a4505050505050610aa36110a5565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610391576040517f118cdaa700000000000000000000000000000000000000000000000000000000815233600482015260240161040e565b610f3c611299565b5f80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b5f6103c0825490565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c15611012576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61039160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b906112ec565b5f5474010000000000000000000000000000000000000000900460ff1615610391576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61109e83836112f3565b9392505050565b6103915f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00611039565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f61109e838361133f565b61115661103f565b5f80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f863390565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261123d91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611365565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526112889186918216906323b872dd906084016111f6565b50505050565b5f61109e8383611404565b5f5474010000000000000000000000000000000000000000900460ff16610391576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80825d5050565b5f81815260018301602052604081205461133857508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556103c0565b505f6103c0565b5f825f018281548110611354576113546117ea565b905f5260205f200154905092915050565b5f5f60205f8451602086015f885af180611384576040513d5f823e3d81fd5b50505f513d9150811561139b5780600114156113b5565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15611288576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161040e565b5f81815260018301602052604081205480156114de575f6114266001836117b6565b85549091505f90611439906001906117b6565b9050808214611498575f865f018281548110611457576114576117ea565b905f5260205f200154905080875f018481548110611477576114776117ea565b5f918252602080832090910192909255918252600188019052604090208390555b85548690806114a9576114a9611817565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506103c0565b5f9150506103c0565b803573ffffffffffffffffffffffffffffffffffffffff8116811461150a575f5ffd5b919050565b5f6020828403121561151f575f5ffd5b61109e826114e7565b5f5f60408385031215611539575f5ffd5b50508035926020909101359150565b5f60208284031215611558575f5ffd5b5035919050565b5f5f60408385031215611570575f5ffd5b611579836114e7565b946020939093013593505050565b5f60208284031215611597575f5ffd5b81516005811061109e575f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f6020828403121561160f575f5ffd5b815167ffffffffffffffff811115611625575f5ffd5b8201601f81018413611635575f5ffd5b805167ffffffffffffffff81111561164f5761164f6115d2565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff821117156116bb576116bb6115d2565b6040528181528282016020018610156116d2575f5ffd5b8160208401602083015e5f91810160200191909152949350505050565b60058110611724577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b9052565b61173281846116ef565b604060208201525f82518060408401528060208501606085015e5f6060828501015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168401019150509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b818103818111156103c0576103c0611789565b808201808211156103c0576103c0611789565b602081016103c082846116ef565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffdfea264697066735822122086eb685ac901d4c2fc9fd8c8ba73de20df3d872d3714c890a583734dc30baad564736f6c634300081e003300000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a000000000000000000000000231878d973c09fbcc0ca2239fffb717795402cb400000000000000000000000029c9613590b3adac1007c9f399a2cafa12ab8389
Deployed Bytecode
0x608060405234801561000f575f5ffd5b506004361061012f575f3560e01c80638456cb59116100ad578063bd62f01a1161007d578063fa82c73911610063578063fa82c7391461031a578063fc930ab01461032d578063fd54535614610362575f5ffd5b8063bd62f01a146102f4578063f2fde38b14610307575f5ffd5b80638456cb59146102965780638da5cb5b1461029e578063a0a4028b146102bb578063b63dea42146102ce575f5ffd5b80636b84bc091161010257806374568718116100e8578063745687181461021457806374a4a992146102275780637e5dd10a1461026e575f5ffd5b80636b84bc09146101a3578063715018a61461020c575f5ffd5b80633f4ba83a14610133578063594562351461013d5780635c975abb14610163578063637d9eb614610190575b5f5ffd5b61013b610381565b005b61015061014b36600461150f565b610393565b6040519081526020015b60405180910390f35b5f5474010000000000000000000000000000000000000000900460ff16604051901515815260200161015a565b61013b61019e366004611528565b6103c6565b6101e26101b1366004611548565b5f90815260026020526040902080546001909101549173ffffffffffffffffffffffffffffffffffffffff90911690565b6040805192835273ffffffffffffffffffffffffffffffffffffffff90911660208301520161015a565b61013b6107d2565b61013b610222366004611528565b6107e3565b7f00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a5b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161015a565b61028161027c36600461155f565b61088b565b6040805192835260208301919091520161015a565b61013b610927565b5f5473ffffffffffffffffffffffffffffffffffffffff16610249565b61013b6102c9366004611548565b610937565b7f000000000000000000000000231878d973c09fbcc0ca2239fffb717795402cb4610249565b61013b610302366004611548565b610aa6565b61013b61031536600461150f565b610bb1565b61013b610328366004611548565b610c11565b61015061033b36600461150f565b73ffffffffffffffffffffffffffffffffffffffff165f9081526003602052604090205490565b610150610370366004611548565b5f9081526004602052604090205490565b610389610ee2565b610391610f34565b565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526001602052604081206103c090610fb0565b92915050565b6103ce610fb9565b6103d661103f565b805f03610417576040517f50b02fb3000000000000000000000000000000000000000000000000000000008152600481018290526024015b60405180910390fd5b335f818152600160209081526040808320858452600281019092529091205460ff1615610473576040517faf4c23390000000000000000000000000000000000000000000000000000000081526004810184905260240161040e565b5f838152600282016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556104b58185611093565b505f848152600260205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8581169190911782556001820186905591517fdd3b5f9a0000000000000000000000000000000000000000000000000000000081526004810187905290917f00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a169063dd3b5f9a90602401602060405180830381865afa158015610583573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105a79190611587565b6002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018360048111156105e3576105e36115a5565b02179055506040517fc87b56dd000000000000000000000000000000000000000000000000000000008152600481018690525f907f00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a73ffffffffffffffffffffffffffffffffffffffff169063c87b56dd906024015f60405180830381865afa158015610672573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526106b791908101906115ff565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152306024830152604482018990529192507f00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a909116906323b872dd906064015f604051808303815f87803b15801561074f575f5ffd5b505af1158015610761573d5f5f3e3d5ffd5b505050506002820154604051879173ffffffffffffffffffffffffffffffffffffffff87169188917fef000c99594776dcb0c8cac44a82a88208bce9f0d0146d35b04e53ad4c57f3b8916107ba9160ff16908790611728565b60405180910390a4505050506107ce6110a5565b5050565b6107da610ee2565b6103915f6110cf565b6107eb610ee2565b815f03610827576040517f50b02fb30000000000000000000000000000000000000000000000000000000081526004810183905260240161040e565b5f8281526004602052604090205481146107ce575f82815260046020526040908190208290555182907fcfd12c69f579206dd153436a0556961d5453669ba685ac36535f5d2bd7eb85079061087f9084815260200190565b60405180910390a25050565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526001602052604081208190816108bb82610fb0565b9050808510610900576040517f4e44554e000000000000000000000000000000000000000000000000000000008152600481018690526024810182905260440161040e565b61090a8286611143565b5f8181526002602052604090206001015497909650945050505050565b61092f610ee2565b61039161114e565b61093f610fb9565b805f0361097b576040517fec848b9f0000000000000000000000000000000000000000000000000000000081526004810182905260240161040e565b335f81815260036020526040902054808311156109ce576040517f1027b9ad000000000000000000000000000000000000000000000000000000008152600481018490526024810182905260440161040e565b73ffffffffffffffffffffffffffffffffffffffff82165f9081526003602052604081208054859290610a029084906117b6565b90915550610a49905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000231878d973c09fbcc0ca2239fffb717795402cb41683856111bc565b8173ffffffffffffffffffffffffffffffffffffffff167ff2e701e4c21ee8b1891237618ffb9c8af50e06bb14898914072033563e9d248e84604051610a9191815260200190565b60405180910390a25050610aa36110a5565b50565b610aae610fb9565b610ab661103f565b805f03610af2576040517fec848b9f0000000000000000000000000000000000000000000000000000000081526004810182905260240161040e565b335f8181526003602052604081208054849290610b109084906117c9565b90915550610b58905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000231878d973c09fbcc0ca2239fffb717795402cb416823085611242565b8073ffffffffffffffffffffffffffffffffffffffff167f699b80a477027b206db1d4c28c9aba68cef2f7dbc302256e3cd2470811039e3783604051610ba091815260200190565b60405180910390a250610aa36110a5565b610bb9610ee2565b73ffffffffffffffffffffffffffffffffffffffff8116610c08576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f600482015260240161040e565b610aa3816110cf565b610c19610fb9565b5f818152600260205260409020805433919073ffffffffffffffffffffffffffffffffffffffff1680610c7b576040517f51651db90000000000000000000000000000000000000000000000000000000081526004810185905260240161040e565b8073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610d07576040517fc0fc9bf200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8085166004830152821660248201526044810185905260640161040e565b6001808301546002808501545f8881526020838152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016815580880184905590940180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905573ffffffffffffffffffffffffffffffffffffffff87168252949094529220909160ff1690610da5818861128e565b505f8381526002820160205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8581166024830152604482018990527f00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a16906323b872dd906064015f604051808303815f87803b158015610e6e575f5ffd5b505af1158015610e80573d5f5f3e3d5ffd5b50505050868473ffffffffffffffffffffffffffffffffffffffff16847f63b37ff333b42cc66085802646c2fc599548e9d9d922eb85fc7dc05527fa083985604051610ecc91906117dc565b60405180910390a4505050505050610aa36110a5565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610391576040517f118cdaa700000000000000000000000000000000000000000000000000000000815233600482015260240161040e565b610f3c611299565b5f80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b5f6103c0825490565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c15611012576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61039160017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b906112ec565b5f5474010000000000000000000000000000000000000000900460ff1615610391576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61109e83836112f3565b9392505050565b6103915f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00611039565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f61109e838361133f565b61115661103f565b5f80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f863390565b60405173ffffffffffffffffffffffffffffffffffffffff83811660248301526044820183905261123d91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611365565b505050565b60405173ffffffffffffffffffffffffffffffffffffffff84811660248301528381166044830152606482018390526112889186918216906323b872dd906084016111f6565b50505050565b5f61109e8383611404565b5f5474010000000000000000000000000000000000000000900460ff16610391576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80825d5050565b5f81815260018301602052604081205461133857508154600181810184555f8481526020808220909301849055845484825282860190935260409020919091556103c0565b505f6103c0565b5f825f018281548110611354576113546117ea565b905f5260205f200154905092915050565b5f5f60205f8451602086015f885af180611384576040513d5f823e3d81fd5b50505f513d9150811561139b5780600114156113b5565b73ffffffffffffffffffffffffffffffffffffffff84163b155b15611288576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161040e565b5f81815260018301602052604081205480156114de575f6114266001836117b6565b85549091505f90611439906001906117b6565b9050808214611498575f865f018281548110611457576114576117ea565b905f5260205f200154905080875f018481548110611477576114776117ea565b5f918252602080832090910192909255918252600188019052604090208390555b85548690806114a9576114a9611817565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f9055600193505050506103c0565b5f9150506103c0565b803573ffffffffffffffffffffffffffffffffffffffff8116811461150a575f5ffd5b919050565b5f6020828403121561151f575f5ffd5b61109e826114e7565b5f5f60408385031215611539575f5ffd5b50508035926020909101359150565b5f60208284031215611558575f5ffd5b5035919050565b5f5f60408385031215611570575f5ffd5b611579836114e7565b946020939093013593505050565b5f60208284031215611597575f5ffd5b81516005811061109e575f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f6020828403121561160f575f5ffd5b815167ffffffffffffffff811115611625575f5ffd5b8201601f81018413611635575f5ffd5b805167ffffffffffffffff81111561164f5761164f6115d2565b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501160116810181811067ffffffffffffffff821117156116bb576116bb6115d2565b6040528181528282016020018610156116d2575f5ffd5b8160208401602083015e5f91810160200191909152949350505050565b60058110611724577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b9052565b61173281846116ef565b604060208201525f82518060408401528060208501606085015e5f6060828501015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168401019150509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b818103818111156103c0576103c0611789565b808201808211156103c0576103c0611789565b602081016103c082846116ef565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffdfea264697066735822122086eb685ac901d4c2fc9fd8c8ba73de20df3d872d3714c890a583734dc30baad564736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a000000000000000000000000231878d973c09fbcc0ca2239fffb717795402cb400000000000000000000000029c9613590b3adac1007c9f399a2cafa12ab8389
-----Decoded View---------------
Arg [0] : alchemistContract_ (address): 0x05638C8D7135F21d355ef2DFbb013D110603C92A
Arg [1] : ruskContract_ (address): 0x231878d973C09fBCc0CA2239fFfb717795402cB4
Arg [2] : initialOwner (address): 0x29c9613590b3aDaC1007c9F399a2cafA12aB8389
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000005638c8d7135f21d355ef2dfbb013d110603c92a
Arg [1] : 000000000000000000000000231878d973c09fbcc0ca2239fffb717795402cb4
Arg [2] : 00000000000000000000000029c9613590b3adac1007c9f399a2cafa12ab8389
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in POL
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.