More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 354 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Batch Unstake | 17658429 | 437 days ago | IN | 0 ETH | 0.00222887 | ||||
Batch Unstake | 17658423 | 437 days ago | IN | 0 ETH | 0.00298449 | ||||
Batch Unstake | 16374595 | 617 days ago | IN | 0 ETH | 0.00226235 | ||||
Batch Unstake | 16298036 | 628 days ago | IN | 0 ETH | 0.00224468 | ||||
Batch Unstake | 16285627 | 630 days ago | IN | 0 ETH | 0.00198289 | ||||
Batch Unstake | 15827676 | 694 days ago | IN | 0 ETH | 0.00314536 | ||||
Batch Stake | 15806921 | 696 days ago | IN | 0 ETH | 0.00323026 | ||||
Batch Stake | 15806339 | 697 days ago | IN | 0 ETH | 0.0032214 | ||||
Batch Stake | 15728795 | 707 days ago | IN | 0 ETH | 0.00488131 | ||||
Batch Unstake | 15658493 | 717 days ago | IN | 0 ETH | 0.00052937 | ||||
Batch Stake | 15658063 | 717 days ago | IN | 0 ETH | 0.0012436 | ||||
Batch Unstake | 15658008 | 717 days ago | IN | 0 ETH | 0.00084317 | ||||
Batch Unstake | 15532833 | 735 days ago | IN | 0 ETH | 0.0010372 | ||||
Batch Unstake | 15527557 | 736 days ago | IN | 0 ETH | 0.00574572 | ||||
Batch Unstake | 15521119 | 737 days ago | IN | 0 ETH | 0.00310644 | ||||
Batch Unstake | 15509304 | 739 days ago | IN | 0 ETH | 0.0014151 | ||||
Batch Stake | 15479864 | 744 days ago | IN | 0 ETH | 0.00380517 | ||||
Batch Unstake | 15396215 | 757 days ago | IN | 0 ETH | 0.00102574 | ||||
Batch Stake | 15384293 | 759 days ago | IN | 0 ETH | 0.00092458 | ||||
Batch Stake | 15384283 | 759 days ago | IN | 0 ETH | 0.00119519 | ||||
Batch Unstake | 15384236 | 759 days ago | IN | 0 ETH | 0.00102877 | ||||
Batch Unstake | 15321487 | 769 days ago | IN | 0 ETH | 0.00296453 | ||||
Batch Stake | 15321409 | 769 days ago | IN | 0 ETH | 0.01161268 | ||||
Batch Unstake | 15289431 | 774 days ago | IN | 0 ETH | 0.00164805 | ||||
Batch Unstake | 15286407 | 774 days ago | IN | 0 ETH | 0.00112367 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
CyberLionzStaking
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; interface Mintable { function mint(address to, uint256 amount) external; function transferFrom(address sender, address recipient, uint256 amount) external returns(bool); } contract CyberLionzStaking is AccessControl { bytes32 public ADMIN_ROLE = keccak256("ADMIN"); using SafeMath for uint256; using Address for address; bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; uint256 constant SECONDS_PER_DAY = 24*60*60; address rewardsTokenAddress; struct CollectionInfo { address collectionAddress; uint256 rewardPerDay; uint256 totalAmountStaked; } mapping(address => mapping(address => uint[])) addressToStakedTokens; mapping(address => mapping(uint => address)) contractTokenIdToOwner; mapping(address => mapping(uint => uint)) contractTokenIdToStakedTimestamp; CollectionInfo[] public collectionInfo; constructor(address _rewardsToken) { rewardsTokenAddress = _rewardsToken; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(ADMIN_ROLE, msg.sender); } function setAdminRole(address admin) public onlyRole(DEFAULT_ADMIN_ROLE){ _setupRole(ADMIN_ROLE, admin); } function stake(uint256 _collectionID, uint256 _tokenID) external { _stake( _collectionID, _tokenID); } function _stake( uint256 _collectionID, uint256 _tokenID ) internal { CollectionInfo storage collection = collectionInfo[_collectionID]; // Track original owner of token about to be staked contractTokenIdToOwner[collection.collectionAddress][_tokenID] = msg.sender; // Track time token was staked contractTokenIdToStakedTimestamp[collection.collectionAddress][_tokenID] = block.timestamp; // Add to the list of tokens staked for this particular owner and contract addressToStakedTokens[collection.collectionAddress][msg.sender].push(_tokenID); collection.totalAmountStaked += 1; // transfer token into the custody of the contract IERC721(collection.collectionAddress).transferFrom(msg.sender, address(this), _tokenID); } function batchStake(uint256 _collectionID, uint256[] memory _tokenIDs) external { for (uint256 i = 0; i < _tokenIDs.length; ++i) { _stake(_collectionID, _tokenIDs[i]); } } function batchUnstake(uint256 _collectionID, uint256[] memory _tokenIDs) external { for (uint256 i = 0; i < _tokenIDs.length; ++i) { _unstake(_collectionID, _tokenIDs[i]); } } function unstake(uint256 _collectionID, uint256 _tokenID) external { _unstake(_collectionID, _tokenID); } function _unstake( uint256 _collectionID, uint256 _tokenID ) internal { CollectionInfo storage collection = collectionInfo[_collectionID]; require(contractTokenIdToOwner[collection.collectionAddress][_tokenID] == msg.sender, "token is not staked or sender does not own it" ); _claimReward(msg.sender, _collectionID, _tokenID); // remove token ID from list of user's staked tokens _removeElement(addressToStakedTokens[collection.collectionAddress][msg.sender], _tokenID); // remove record of NFT token owner address delete contractTokenIdToOwner[collection.collectionAddress][_tokenID]; // remove record of when the token was staked delete contractTokenIdToStakedTimestamp[collection.collectionAddress][_tokenID]; collection.totalAmountStaked -= 1; IERC721(collection.collectionAddress).transferFrom(address(this), msg.sender, _tokenID); } function totalClaimableReward(address _userAddress, uint256 _collectionID) public view returns(uint256) { uint256 payableAmount = 0; address collectionAddress = collectionInfo[_collectionID].collectionAddress; for (uint256 i; i < addressToStakedTokens[collectionAddress][_userAddress].length; i++) { uint256 _tokenId = addressToStakedTokens[collectionAddress][_userAddress][i]; payableAmount += claimableReward(_userAddress, _collectionID, _tokenId); } return payableAmount; } function claimableReward(address _userAddress, uint256 _collectionID, uint256 _tokenID) public view returns(uint256) { CollectionInfo storage collection = collectionInfo[_collectionID]; // check to see if token is currently staked if(contractTokenIdToOwner[collection.collectionAddress][_tokenID] != _userAddress) return 0; uint timeStaked = contractTokenIdToStakedTimestamp[collection.collectionAddress][_tokenID]; uint256 payableAmount = (block.timestamp - timeStaked) .div(SECONDS_PER_DAY) .mul(collection.rewardPerDay); return payableAmount; } function _claimReward(address _userAddress, uint256 _collectionID,uint256 _tokenID) internal { uint256 payableAmount = claimableReward(_userAddress, _collectionID,_tokenID); Mintable(rewardsTokenAddress).mint(msg.sender,payableAmount); } function setCollection(address _collectionAddress, uint256 _rewardPerDay) public onlyRole(ADMIN_ROLE) { collectionInfo.push( CollectionInfo({collectionAddress: _collectionAddress, rewardPerDay: _rewardPerDay, totalAmountStaked: 0}) ); } function updateCollection( uint256 _collectionID, address _collectionAddress, uint256 _rewardPerDay ) public onlyRole(ADMIN_ROLE) { CollectionInfo storage collection = collectionInfo[_collectionID]; collection.collectionAddress = _collectionAddress; collection.rewardPerDay = _rewardPerDay; } function getUserStakedTokens(address _userAddress, uint256 _collectionID) external view returns(uint256[] memory){ CollectionInfo storage collection = collectionInfo[_collectionID]; return addressToStakedTokens[collection.collectionAddress][_userAddress]; } function getTotalStakedItemsCount(uint256 _collectionID) external view returns (uint256) { CollectionInfo storage collection = collectionInfo[_collectionID]; return collection.totalAmountStaked; } function onERC721Received( address, address, uint256) public pure returns (bytes4) { return _ERC721_RECEIVED; } function _removeElement(uint256[] storage _array, uint256 _element) internal { for (uint256 i; i < _array.length; i++) { if (_array[i] == _element) { _array[i] = _array[_array.length - 1]; _array.pop(); break; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ 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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 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 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 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 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @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. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// 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 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[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/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// 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 Address { /** * @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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(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 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../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 v4.6.0) (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 IERC721Receiver { /** * @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 `IERC721Receiver.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 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collectionID","type":"uint256"},{"internalType":"uint256[]","name":"_tokenIDs","type":"uint256[]"}],"name":"batchStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collectionID","type":"uint256"},{"internalType":"uint256[]","name":"_tokenIDs","type":"uint256[]"}],"name":"batchUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_collectionID","type":"uint256"},{"internalType":"uint256","name":"_tokenID","type":"uint256"}],"name":"claimableReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"collectionInfo","outputs":[{"internalType":"address","name":"collectionAddress","type":"address"},{"internalType":"uint256","name":"rewardPerDay","type":"uint256"},{"internalType":"uint256","name":"totalAmountStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collectionID","type":"uint256"}],"name":"getTotalStakedItemsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_collectionID","type":"uint256"}],"name":"getUserStakedTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"setAdminRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_rewardPerDay","type":"uint256"}],"name":"setCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collectionID","type":"uint256"},{"internalType":"uint256","name":"_tokenID","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_userAddress","type":"address"},{"internalType":"uint256","name":"_collectionID","type":"uint256"}],"name":"totalClaimableReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collectionID","type":"uint256"},{"internalType":"uint256","name":"_tokenID","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_collectionID","type":"uint256"},{"internalType":"address","name":"_collectionAddress","type":"address"},{"internalType":"uint256","name":"_rewardPerDay","type":"uint256"}],"name":"updateCollection","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040527fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec426001553480156200003557600080fd5b506040516200160838038062001608833981016040819052620000589162000146565b600280546001600160a01b0319166001600160a01b0383161790556200008060003362000096565b6001546200008f903362000096565b5062000178565b620000a28282620000a6565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000a2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001023390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000602082840312156200015957600080fd5b81516001600160a01b03811681146200017157600080fd5b9392505050565b61148080620001886000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80634adc7cfd116100b857806391d148541161007c57806391d14854146102a85780639e2c8a5b146102bb578063a217fddf146102ce578063d547741f146102d6578063eeafbddc146102e9578063f93b03bc1461031f57600080fd5b80634adc7cfd1461025357806375b238fc146102665780637b0472f01461026f5780637b71e5db14610282578063842dd90a1461029557600080fd5b80632edb531c116100ff5780632edb531c146101f45780632f2ff15d14610207578063302f7fea1461021a57806336568abe1461022d5780633b552dbd1461024057600080fd5b80628afd4e1461013b57806301ffc9a7146101505780630fb4d2e5146101785780631bbda52b146101b0578063248a9ca3146101c3575b600080fd5b61014e610149366004610ffc565b61033f565b005b61016361015e3660046110c6565b610383565b60405190151581526020015b60405180910390f35b61018b6101863660046110f0565b6103ba565b604080516001600160a01b03909416845260208401929092529082015260600161016f565b61014e6101be366004610ffc565b6103f7565b6101e66101d13660046110f0565b60009081526020819052604090206001015490565b60405190815260200161016f565b61014e610202366004611125565b610436565b61014e61021536600461114f565b610503565b6101e661022836600461117b565b610528565b61014e61023b36600461114f565b6105e6565b6101e661024e366004611125565b610669565b61014e6102613660046111ae565b610749565b6101e660015481565b61014e61027d3660046111c9565b610760565b61014e6102903660046111eb565b61076a565b6101e66102a33660046110f0565b6107c4565b6101636102b636600461114f565b6107f5565b61014e6102c93660046111c9565b61081e565b6101e6600081565b61014e6102e436600461114f565b610828565b6103066102f7366004611220565b630a85bd0160e11b9392505050565b6040516001600160e01b0319909116815260200161016f565b61033261032d366004611125565b61084d565b60405161016f919061124c565b60005b815181101561037e5761036e8383838151811061036157610361611290565b60200260200101516108eb565b610377816112bc565b9050610342565b505050565b60006001600160e01b03198216637965db0b60e01b14806103b457506301ffc9a760e01b6001600160e01b03198316145b92915050565b600681815481106103ca57600080fd5b60009182526020909120600390910201805460018201546002909201546001600160a01b03909116925083565b60005b815181101561037e576104268383838151811061041957610419611290565b6020026020010151610aac565b61042f816112bc565b90506103fa565b60015461044281610b9f565b50604080516060810182526001600160a01b03938416815260208101928352600091810182815260068054600181018255935290517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600390930292830180546001600160a01b031916919095161790935590517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4082015590517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4190910155565b60008281526020819052604090206001015461051e81610b9f565b61037e8383610bac565b6000806006848154811061053e5761053e611290565b60009182526020808320600390920290910180546001600160a01b03908116845260048352604080852088865290935291909220549192509081169086161461058b5760009150506105df565b80546001600160a01b0316600090815260056020908152604080832086845290915281205460018301549091906105d9906105d3620151806105cd86426112d5565b90610c30565b90610c3c565b93505050505b9392505050565b6001600160a01b038116331461065b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106658282610c48565b5050565b6000806000905060006006848154811061068557610685611290565b600091825260208220600390910201546001600160a01b031691505b6001600160a01b038083166000908152600360209081526040808320938a168352929052205481101561073f576001600160a01b038083166000908152600360209081526040808320938a16835292905290812080548390811061070757610707611290565b9060005260206000200154905061071f878783610528565b61072990856112ec565b9350508080610737906112bc565b9150506106a1565b5090949350505050565b600061075481610b9f565b61066560015483610cad565b6106658282610aac565b60015461077681610b9f565b60006006858154811061078b5761078b611290565b6000918252602090912060039091020180546001600160a01b0319166001600160a01b0395909516949094178455505060019091015550565b600080600683815481106107da576107da611290565b60009182526020909120600260039092020101549392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61066582826108eb565b60008281526020819052604090206001015461084381610b9f565b61037e8383610c48565b606060006006838154811061086457610864611290565b6000918252602080832060039283020180546001600160a01b039081168552928252604080852093891685529282529282902080548351818402810184019094528084529394509192908301828280156108dd57602002820191906000526020600020905b8154815260200190600101908083116108c9575b505050505091505092915050565b60006006838154811061090057610900611290565b60009182526020808320600390920290910180546001600160a01b039081168452600483526040808520878652909352919092205491925016331461099d5760405162461bcd60e51b815260206004820152602d60248201527f746f6b656e206973206e6f74207374616b6564206f722073656e64657220646f60448201526c195cc81b9bdd081bdddb881a5d609a1b6064820152608401610652565b6109a8338484610cb7565b80546001600160a01b0316600090815260036020908152604080832033845290915290206109d69083610d2f565b80546001600160a01b039081166000908152600460209081526040808320868452825280832080546001600160a01b03191690558454909316825260058152828220858352905290812081905560028201805460019290610a389084906112d5565b909155505080546040516323b872dd60e01b8152306004820152336024820152604481018490526001600160a01b03909116906323b872dd906064015b600060405180830381600087803b158015610a8f57600080fd5b505af1158015610aa3573d6000803e3d6000fd5b50505050505050565b600060068381548110610ac157610ac1611290565b6000918252602080832060039283020180546001600160a01b039081168552600483526040808620888752845280862080546001600160a01b0319163390811790915583548316875260058552818720898852855281872042905583549092168652938352838520908552825291832080546001818101835591855291842090910185905560028201805492945090929091610b5e9084906112ec565b909155505080546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401610a75565b610ba98133610de6565b50565b610bb682826107f5565b610665576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610bec3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006105df8284611304565b60006105df8284611326565b610c5282826107f5565b15610665576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6106658282610bac565b6000610cc4848484610528565b6002546040516340c10f1960e01b8152336004820152602481018390529192506001600160a01b0316906340c10f1990604401600060405180830381600087803b158015610d1157600080fd5b505af1158015610d25573d6000803e3d6000fd5b5050505050505050565b60005b825481101561037e5781838281548110610d4e57610d4e611290565b906000526020600020015403610dd45782548390610d6e906001906112d5565b81548110610d7e57610d7e611290565b9060005260206000200154838281548110610d9b57610d9b611290565b906000526020600020018190555082805480610db957610db9611345565b60019003818190600052602060002001600090559055505050565b80610dde816112bc565b915050610d32565b610df082826107f5565b61066557610e08816001600160a01b03166014610e4a565b610e13836020610e4a565b604051602001610e2492919061138b565b60408051601f198184030181529082905262461bcd60e51b825261065291600401611400565b60606000610e59836002611326565b610e649060026112ec565b67ffffffffffffffff811115610e7c57610e7c610fe6565b6040519080825280601f01601f191660200182016040528015610ea6576020820181803683370190505b509050600360fc1b81600081518110610ec157610ec1611290565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610ef057610ef0611290565b60200101906001600160f81b031916908160001a9053506000610f14846002611326565b610f1f9060016112ec565b90505b6001811115610f97576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610f5357610f53611290565b1a60f81b828281518110610f6957610f69611290565b60200101906001600160f81b031916908160001a90535060049490941c93610f9081611433565b9050610f22565b5083156105df5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610652565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561100f57600080fd5b8235915060208084013567ffffffffffffffff8082111561102f57600080fd5b818601915086601f83011261104357600080fd5b81358181111561105557611055610fe6565b8060051b604051601f19603f8301168101818110858211171561107a5761107a610fe6565b60405291825284820192508381018501918983111561109857600080fd5b938501935b828510156110b65784358452938501939285019261109d565b8096505050505050509250929050565b6000602082840312156110d857600080fd5b81356001600160e01b0319811681146105df57600080fd5b60006020828403121561110257600080fd5b5035919050565b80356001600160a01b038116811461112057600080fd5b919050565b6000806040838503121561113857600080fd5b61114183611109565b946020939093013593505050565b6000806040838503121561116257600080fd5b8235915061117260208401611109565b90509250929050565b60008060006060848603121561119057600080fd5b61119984611109565b95602085013595506040909401359392505050565b6000602082840312156111c057600080fd5b6105df82611109565b600080604083850312156111dc57600080fd5b50508035926020909101359150565b60008060006060848603121561120057600080fd5b8335925061121060208501611109565b9150604084013590509250925092565b60008060006060848603121561123557600080fd5b61123e84611109565b925061121060208501611109565b6020808252825182820181905260009190848201906040850190845b8181101561128457835183529284019291840191600101611268565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016112ce576112ce6112a6565b5060010190565b6000828210156112e7576112e76112a6565b500390565b600082198211156112ff576112ff6112a6565b500190565b60008261132157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611340576113406112a6565b500290565b634e487b7160e01b600052603160045260246000fd5b60005b8381101561137657818101518382015260200161135e565b83811115611385576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516113c381601785016020880161135b565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516113f481602884016020880161135b565b01602801949350505050565b602081526000825180602084015261141f81604085016020870161135b565b601f01601f19169190910160400192915050565b600081611442576114426112a6565b50600019019056fea264697066735822122074f79ca7a638dd2822a0a151e5bfe5e601fad76d2aff3fb1f756b7072ed4196464736f6c634300080d00330000000000000000000000009948eaa3d985040c877e28739f5e61902ddf6aff
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101365760003560e01c80634adc7cfd116100b857806391d148541161007c57806391d14854146102a85780639e2c8a5b146102bb578063a217fddf146102ce578063d547741f146102d6578063eeafbddc146102e9578063f93b03bc1461031f57600080fd5b80634adc7cfd1461025357806375b238fc146102665780637b0472f01461026f5780637b71e5db14610282578063842dd90a1461029557600080fd5b80632edb531c116100ff5780632edb531c146101f45780632f2ff15d14610207578063302f7fea1461021a57806336568abe1461022d5780633b552dbd1461024057600080fd5b80628afd4e1461013b57806301ffc9a7146101505780630fb4d2e5146101785780631bbda52b146101b0578063248a9ca3146101c3575b600080fd5b61014e610149366004610ffc565b61033f565b005b61016361015e3660046110c6565b610383565b60405190151581526020015b60405180910390f35b61018b6101863660046110f0565b6103ba565b604080516001600160a01b03909416845260208401929092529082015260600161016f565b61014e6101be366004610ffc565b6103f7565b6101e66101d13660046110f0565b60009081526020819052604090206001015490565b60405190815260200161016f565b61014e610202366004611125565b610436565b61014e61021536600461114f565b610503565b6101e661022836600461117b565b610528565b61014e61023b36600461114f565b6105e6565b6101e661024e366004611125565b610669565b61014e6102613660046111ae565b610749565b6101e660015481565b61014e61027d3660046111c9565b610760565b61014e6102903660046111eb565b61076a565b6101e66102a33660046110f0565b6107c4565b6101636102b636600461114f565b6107f5565b61014e6102c93660046111c9565b61081e565b6101e6600081565b61014e6102e436600461114f565b610828565b6103066102f7366004611220565b630a85bd0160e11b9392505050565b6040516001600160e01b0319909116815260200161016f565b61033261032d366004611125565b61084d565b60405161016f919061124c565b60005b815181101561037e5761036e8383838151811061036157610361611290565b60200260200101516108eb565b610377816112bc565b9050610342565b505050565b60006001600160e01b03198216637965db0b60e01b14806103b457506301ffc9a760e01b6001600160e01b03198316145b92915050565b600681815481106103ca57600080fd5b60009182526020909120600390910201805460018201546002909201546001600160a01b03909116925083565b60005b815181101561037e576104268383838151811061041957610419611290565b6020026020010151610aac565b61042f816112bc565b90506103fa565b60015461044281610b9f565b50604080516060810182526001600160a01b03938416815260208101928352600091810182815260068054600181018255935290517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f600390930292830180546001600160a01b031916919095161790935590517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4082015590517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4190910155565b60008281526020819052604090206001015461051e81610b9f565b61037e8383610bac565b6000806006848154811061053e5761053e611290565b60009182526020808320600390920290910180546001600160a01b03908116845260048352604080852088865290935291909220549192509081169086161461058b5760009150506105df565b80546001600160a01b0316600090815260056020908152604080832086845290915281205460018301549091906105d9906105d3620151806105cd86426112d5565b90610c30565b90610c3c565b93505050505b9392505050565b6001600160a01b038116331461065b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106658282610c48565b5050565b6000806000905060006006848154811061068557610685611290565b600091825260208220600390910201546001600160a01b031691505b6001600160a01b038083166000908152600360209081526040808320938a168352929052205481101561073f576001600160a01b038083166000908152600360209081526040808320938a16835292905290812080548390811061070757610707611290565b9060005260206000200154905061071f878783610528565b61072990856112ec565b9350508080610737906112bc565b9150506106a1565b5090949350505050565b600061075481610b9f565b61066560015483610cad565b6106658282610aac565b60015461077681610b9f565b60006006858154811061078b5761078b611290565b6000918252602090912060039091020180546001600160a01b0319166001600160a01b0395909516949094178455505060019091015550565b600080600683815481106107da576107da611290565b60009182526020909120600260039092020101549392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61066582826108eb565b60008281526020819052604090206001015461084381610b9f565b61037e8383610c48565b606060006006838154811061086457610864611290565b6000918252602080832060039283020180546001600160a01b039081168552928252604080852093891685529282529282902080548351818402810184019094528084529394509192908301828280156108dd57602002820191906000526020600020905b8154815260200190600101908083116108c9575b505050505091505092915050565b60006006838154811061090057610900611290565b60009182526020808320600390920290910180546001600160a01b039081168452600483526040808520878652909352919092205491925016331461099d5760405162461bcd60e51b815260206004820152602d60248201527f746f6b656e206973206e6f74207374616b6564206f722073656e64657220646f60448201526c195cc81b9bdd081bdddb881a5d609a1b6064820152608401610652565b6109a8338484610cb7565b80546001600160a01b0316600090815260036020908152604080832033845290915290206109d69083610d2f565b80546001600160a01b039081166000908152600460209081526040808320868452825280832080546001600160a01b03191690558454909316825260058152828220858352905290812081905560028201805460019290610a389084906112d5565b909155505080546040516323b872dd60e01b8152306004820152336024820152604481018490526001600160a01b03909116906323b872dd906064015b600060405180830381600087803b158015610a8f57600080fd5b505af1158015610aa3573d6000803e3d6000fd5b50505050505050565b600060068381548110610ac157610ac1611290565b6000918252602080832060039283020180546001600160a01b039081168552600483526040808620888752845280862080546001600160a01b0319163390811790915583548316875260058552818720898852855281872042905583549092168652938352838520908552825291832080546001818101835591855291842090910185905560028201805492945090929091610b5e9084906112ec565b909155505080546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401610a75565b610ba98133610de6565b50565b610bb682826107f5565b610665576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610bec3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006105df8284611304565b60006105df8284611326565b610c5282826107f5565b15610665576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6106658282610bac565b6000610cc4848484610528565b6002546040516340c10f1960e01b8152336004820152602481018390529192506001600160a01b0316906340c10f1990604401600060405180830381600087803b158015610d1157600080fd5b505af1158015610d25573d6000803e3d6000fd5b5050505050505050565b60005b825481101561037e5781838281548110610d4e57610d4e611290565b906000526020600020015403610dd45782548390610d6e906001906112d5565b81548110610d7e57610d7e611290565b9060005260206000200154838281548110610d9b57610d9b611290565b906000526020600020018190555082805480610db957610db9611345565b60019003818190600052602060002001600090559055505050565b80610dde816112bc565b915050610d32565b610df082826107f5565b61066557610e08816001600160a01b03166014610e4a565b610e13836020610e4a565b604051602001610e2492919061138b565b60408051601f198184030181529082905262461bcd60e51b825261065291600401611400565b60606000610e59836002611326565b610e649060026112ec565b67ffffffffffffffff811115610e7c57610e7c610fe6565b6040519080825280601f01601f191660200182016040528015610ea6576020820181803683370190505b509050600360fc1b81600081518110610ec157610ec1611290565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610ef057610ef0611290565b60200101906001600160f81b031916908160001a9053506000610f14846002611326565b610f1f9060016112ec565b90505b6001811115610f97576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610f5357610f53611290565b1a60f81b828281518110610f6957610f69611290565b60200101906001600160f81b031916908160001a90535060049490941c93610f9081611433565b9050610f22565b5083156105df5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610652565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561100f57600080fd5b8235915060208084013567ffffffffffffffff8082111561102f57600080fd5b818601915086601f83011261104357600080fd5b81358181111561105557611055610fe6565b8060051b604051601f19603f8301168101818110858211171561107a5761107a610fe6565b60405291825284820192508381018501918983111561109857600080fd5b938501935b828510156110b65784358452938501939285019261109d565b8096505050505050509250929050565b6000602082840312156110d857600080fd5b81356001600160e01b0319811681146105df57600080fd5b60006020828403121561110257600080fd5b5035919050565b80356001600160a01b038116811461112057600080fd5b919050565b6000806040838503121561113857600080fd5b61114183611109565b946020939093013593505050565b6000806040838503121561116257600080fd5b8235915061117260208401611109565b90509250929050565b60008060006060848603121561119057600080fd5b61119984611109565b95602085013595506040909401359392505050565b6000602082840312156111c057600080fd5b6105df82611109565b600080604083850312156111dc57600080fd5b50508035926020909101359150565b60008060006060848603121561120057600080fd5b8335925061121060208501611109565b9150604084013590509250925092565b60008060006060848603121561123557600080fd5b61123e84611109565b925061121060208501611109565b6020808252825182820181905260009190848201906040850190845b8181101561128457835183529284019291840191600101611268565b50909695505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016112ce576112ce6112a6565b5060010190565b6000828210156112e7576112e76112a6565b500390565b600082198211156112ff576112ff6112a6565b500190565b60008261132157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611340576113406112a6565b500290565b634e487b7160e01b600052603160045260246000fd5b60005b8381101561137657818101518382015260200161135e565b83811115611385576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516113c381601785016020880161135b565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516113f481602884016020880161135b565b01602801949350505050565b602081526000825180602084015261141f81604085016020870161135b565b601f01601f19169190910160400192915050565b600081611442576114426112a6565b50600019019056fea264697066735822122074f79ca7a638dd2822a0a151e5bfe5e601fad76d2aff3fb1f756b7072ed4196464736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009948eaa3d985040c877e28739f5e61902ddf6aff
-----Decoded View---------------
Arg [0] : _rewardsToken (address): 0x9948eAA3d985040C877e28739F5e61902Ddf6aFf
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009948eaa3d985040c877e28739f5e61902ddf6aff
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.