Overview
MNT Balance
MNT Value
$0.00Latest 25 from a total of 76,540 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw Assets | 73019624 | 406 days ago | IN | 0 MNT | 0.00296596 | ||||
| Admin Mint | 69057712 | 497 days ago | IN | 0 MNT | 0.47543175 | ||||
| Admin Mint | 68841508 | 502 days ago | IN | 0 MNT | 0.46970937 | ||||
| Admin Mint | 68836944 | 502 days ago | IN | 0 MNT | 0.47049697 | ||||
| Admin Mint | 68805540 | 503 days ago | IN | 0 MNT | 0.47334423 | ||||
| Withdraw Assets | 68638118 | 507 days ago | IN | 0 MNT | 0.00288565 | ||||
| Update Token Min... | 68635769 | 507 days ago | IN | 0 MNT | 0.00399694 | ||||
| Admin Mint | 68633852 | 507 days ago | IN | 0 MNT | 0.4726326 | ||||
| Admin Mint | 68624319 | 507 days ago | IN | 0 MNT | 0.47377045 | ||||
| Unpause | 68623938 | 507 days ago | IN | 0 MNT | 0.00242602 | ||||
| Pause | 68621850 | 507 days ago | IN | 0 MNT | 0.0047842 | ||||
| Admin Mint | 68621232 | 507 days ago | IN | 0 MNT | 0.47545467 | ||||
| Admin Mint | 68621229 | 507 days ago | IN | 0 MNT | 0.47544185 | ||||
| Admin Mint | 68621227 | 507 days ago | IN | 0 MNT | 0.47544182 | ||||
| Admin Mint | 68621225 | 507 days ago | IN | 0 MNT | 0.47544182 | ||||
| Admin Mint | 68621223 | 507 days ago | IN | 0 MNT | 0.47535853 | ||||
| Admin Mint | 68621221 | 507 days ago | IN | 0 MNT | 0.47535964 | ||||
| Admin Mint | 68621218 | 507 days ago | IN | 0 MNT | 0.47535964 | ||||
| Admin Mint | 68621215 | 507 days ago | IN | 0 MNT | 0.47535964 | ||||
| Admin Mint | 68621213 | 507 days ago | IN | 0 MNT | 0.47536523 | ||||
| Admin Mint | 68621211 | 507 days ago | IN | 0 MNT | 0.47538445 | ||||
| Admin Mint | 68621209 | 507 days ago | IN | 0 MNT | 0.47538445 | ||||
| Admin Mint | 68621207 | 507 days ago | IN | 0 MNT | 0.47538937 | ||||
| Admin Mint | 68621205 | 507 days ago | IN | 0 MNT | 0.47533812 | ||||
| Admin Mint | 68621203 | 507 days ago | IN | 0 MNT | 0.47533796 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 73019624 | 406 days ago | 46,628.44999999 MNT | ||||
| 69057712 | 497 days ago | 200 MNT | ||||
| 68841508 | 502 days ago | 200 MNT | ||||
| 68836944 | 502 days ago | 200 MNT | ||||
| 68805540 | 503 days ago | 200 MNT | ||||
| 68638118 | 507 days ago | 63,067.04 MNT | ||||
| 68633852 | 507 days ago | 200 MNT | ||||
| 68624319 | 507 days ago | 2.14 MNT | ||||
| 68621232 | 507 days ago | 2.14 MNT | ||||
| 68621229 | 507 days ago | 2.14 MNT | ||||
| 68621227 | 507 days ago | 2.14 MNT | ||||
| 68621225 | 507 days ago | 2.14 MNT | ||||
| 68621223 | 507 days ago | 2.14 MNT | ||||
| 68621221 | 507 days ago | 2.14 MNT | ||||
| 68621218 | 507 days ago | 2.14 MNT | ||||
| 68621215 | 507 days ago | 2.14 MNT | ||||
| 68621213 | 507 days ago | 2.14 MNT | ||||
| 68621211 | 507 days ago | 2.14 MNT | ||||
| 68621209 | 507 days ago | 2.14 MNT | ||||
| 68621207 | 507 days ago | 2.14 MNT | ||||
| 68621205 | 507 days ago | 2.14 MNT | ||||
| 68621203 | 507 days ago | 2.14 MNT | ||||
| 68621201 | 507 days ago | 2.14 MNT | ||||
| 68621198 | 507 days ago | 2.14 MNT | ||||
| 68621196 | 507 days ago | 2.14 MNT |
Cross-Chain Transactions
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;
/**
* Author: Omar <ogarciarevett>(https://github.com/ogarciarevett)
* Co-Authors: Max <vasinl124>(https://github.com/vasinl124)
*/
// MMMMNkc. .,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MWXd,. .cONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// Wx' .cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// x. ;KMMMMMMMMMMMMWKxlcclxKWMMMMMMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkccxWMWKdccccccccccccoKMM0l:l0MMMMMMMMMWkc:dXMMMXkoc::::::clxKW
// ' lNMMMMMMMMMMNd. .. .dNMMMMMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .''''''''';OMMX: ,0MMMMMMMWk. oNMWk' ........ .o
// . :XMMMMMMMMMWd. .o00l. .dWMMMMWx. .o0KKXKKXXXXNMMM0' oNWWWWWWWk. .kMMN: :NMNc .kNNNNNNNNNNWMMM0, :XMMMMMM0, cXMMO. c0KKKKXK0o.
// , .lkxo. ;dkx, oWMMMMMMMMWk. oNMMNo. .kWMMMWl ;KMMMMMMMMMMMMMM0' .',',,,,,. .kMMN: :NMNc ,:;;;;;;dXMMMMMMO. lNMMMMK: ;KMMMd. .OMMMMMMMMX;
// : :KWX: .xMWx. .kMMMMMMMMM0' cXMMMMXc ,0MMMWl ;KMMMMMMMMMMMMMM0' .',,'',,,. .kMMN: :NMNc ',,;;,;;oXMMMMMMWx. .dWMMNc 'OMMMMd. .OMMMMMMMMX;
// l ,0WO:oXWd. .OMMMMMMMMK; ;KMMMMMMK; :KMMWd. .o0KKXXKKKXXNMMM0' oNWWWWWWWx. .kMMN: :XMNc .kNNNNNNNNWWWMMMMMNo. .dK0l. .xWMMMMO. .c0KKKXXK0o.
// o dWMWWMK, '0MMMMMMMXc 'OMMMMMMMMO' cNMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .,,,,,,,,,:0MMMMMMNo. .. 'xWMMMMMWx' ....... .o
// O' :XMMMMk. cXMMMMMMMKo:cOWMMMMMMMMWOc:oKMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkc:xWMWKoc:::::::::::lKMMMMMMMWKdlcclxXWMMMMMMMMXkoc::::::clxKW
// WO; 'OMMMWl .oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMNx'.dWMMK;.:0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMM0cdNMM0cdNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
import { ERC1155 } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import { IERC1155 } from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ERC1155Burnable } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import { ERC1155Supply } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import { ERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";
import { ERC721Holder } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Pausable } from "@openzeppelin/contracts/security/Pausable.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { AdminERC1155Soulbound } from "../soulbounds/AdminERC1155Soulbound.sol";
import { ERCWhitelistSignature } from "../ercs/ERCWhitelistSignature.sol";
import { LibItems } from "../libraries/LibItems.sol";
error AddressIsZero();
error InvalidTokenId();
error InvalidAmount();
error ExceedMaxSupply();
error InvalidLength();
error TokenNotExist();
error InvalidInput();
error InsufficientBalance();
error TransferFailed();
error MintPaused();
error ClaimRewardPaused();
error DupTokenId();
contract LootDrop is
ERCWhitelistSignature,
AccessControl,
Pausable,
ReentrancyGuard,
Initializable,
ERC1155Receiver,
ERC721Holder
{
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
bytes32 public constant DEV_CONFIG_ROLE = keccak256("DEV_CONFIG_ROLE");
using Strings for uint256;
AdminERC1155Soulbound private rewardTokenContract;
uint256[] public itemIds;
mapping(uint256 => bool) private tokenExists;
mapping(uint256 => LibItems.RewardToken) public tokenRewards;
mapping(uint256 => bool) public isTokenMintPaused; // tokenId => bool - default is false
mapping(uint256 => bool) public isClaimRewardPaused; // tokenId => bool - default is false
mapping(uint256 => mapping(uint256 => uint256)) private erc721RewardCurrentIndex; // rewardTokenId => rewardIndex => erc721RewardCurrentIndex
mapping(uint256 => uint256) public currentRewardSupply; // rewardTokenId => currentRewardSupply
event TokenAdded(uint256 indexed tokenId);
event Minted(address indexed to, uint256 indexed tokenId, uint256 amount, bool soulbound);
event Claimed(address indexed to, uint256 indexed tokenId, uint256 amount);
constructor(address devWallet) {
if (devWallet == address(0)) {
revert AddressIsZero();
}
_grantRole(DEFAULT_ADMIN_ROLE, devWallet);
}
function initialize(
address _devWallet,
address _managerWallet,
address _minterWallet,
address _rewardTokenAddress
) external initializer onlyRole(DEFAULT_ADMIN_ROLE) {
if (
_devWallet == address(0) ||
_managerWallet == address(0) ||
_minterWallet == address(0) ||
_rewardTokenAddress == address(0)
) {
revert AddressIsZero();
}
rewardTokenContract = AdminERC1155Soulbound(_rewardTokenAddress);
_grantRole(DEFAULT_ADMIN_ROLE, _devWallet);
_grantRole(DEV_CONFIG_ROLE, _devWallet);
_grantRole(MANAGER_ROLE, _managerWallet);
_grantRole(MINTER_ROLE, _minterWallet);
_addWhitelistSigner(_devWallet);
}
function updateRewardTokenContract(address _rewardTokenAddress) external onlyRole(DEV_CONFIG_ROLE) {
if (_rewardTokenAddress == address(0)) {
revert AddressIsZero();
}
rewardTokenContract = AdminERC1155Soulbound(_rewardTokenAddress);
}
function isTokenExist(uint256 _tokenId) public view returns (bool) {
if (!tokenExists[_tokenId]) {
return false;
}
return true;
}
function decodeData(
bytes calldata _data
) public view onlyRole(DEV_CONFIG_ROLE) returns (address, uint256, uint256[] memory) {
return _decodeData(_data);
}
function _decodeData(bytes calldata _data) private view returns (address, uint256, uint256[] memory) {
(address contractAddress, uint256 chainId, uint256[] memory _itemIds) = abi.decode(
_data,
(address, uint256, uint256[])
);
return (contractAddress, chainId, _itemIds);
}
function pause() external onlyRole(MANAGER_ROLE) {
_pause();
}
function unpause() external onlyRole(MANAGER_ROLE) {
_unpause();
}
function _validateTokenInputs(LibItems.RewardToken calldata _token) private view {
if (_token.maxSupply == 0) {
revert InvalidAmount();
}
if (bytes(_token.tokenUri).length == 0 || _token.rewards.length == 0 || _token.tokenId == 0) {
revert InvalidInput();
}
if (isTokenExist(_token.tokenId)) {
revert DupTokenId();
}
for (uint256 i = 0; i < _token.rewards.length; i++) {
LibItems.Reward memory reward = _token.rewards[i];
if (reward.rewardType != LibItems.RewardType.ETHER) {
if (reward.rewardTokenAddress == address(0)) {
revert AddressIsZero();
}
}
if (reward.rewardType == LibItems.RewardType.ERC721) {
if (
reward.rewardTokenIds.length == 0 ||
reward.rewardTokenIds.length != reward.rewardAmount * _token.maxSupply
) {
revert InvalidInput();
}
}
if (reward.rewardType != LibItems.RewardType.ERC721 && reward.rewardAmount == 0) {
revert InvalidAmount();
}
}
}
function _calculateETHRequiredForToken(LibItems.RewardToken calldata _token) private pure returns (uint256) {
uint256 totalETHRequired;
for (uint256 i = 0; i < _token.rewards.length; i++) {
LibItems.Reward memory reward = _token.rewards[i];
if (reward.rewardType == LibItems.RewardType.ETHER) {
totalETHRequired += reward.rewardAmount;
}
}
return totalETHRequired * _token.maxSupply;
}
function _createTokenAndDepositRewards(LibItems.RewardToken calldata _token) private {
// have to approve all the assets first
// Validate token inputs
_validateTokenInputs(_token);
tokenRewards[_token.tokenId] = _token;
tokenExists[_token.tokenId] = true;
itemIds.push(_token.tokenId);
rewardTokenContract.addNewToken(_token.tokenId);
// Transfer rewards
address _from = _msgSender();
address _to = address(this);
for (uint256 i = 0; i < _token.rewards.length; i++) {
LibItems.Reward memory reward = _token.rewards[i];
if (reward.rewardType == LibItems.RewardType.ERC20) {
IERC20 token = IERC20(reward.rewardTokenAddress);
SafeERC20.safeTransferFrom(token, _from, _to, reward.rewardAmount * _token.maxSupply);
} else if (reward.rewardType == LibItems.RewardType.ERC721) {
IERC721 token = IERC721(reward.rewardTokenAddress);
for (uint256 j = 0; j < reward.rewardTokenIds.length; j++) {
_transferERC721(token, _from, _to, reward.rewardTokenIds[j]);
}
} else if (reward.rewardType == LibItems.RewardType.ERC1155) {
IERC1155 token = IERC1155(reward.rewardTokenAddress);
_transferERC1155(token, _from, _to, reward.rewardTokenId, reward.rewardAmount * _token.maxSupply);
}
}
emit TokenAdded(_token.tokenId);
}
function createTokenAndDepositRewards(LibItems.RewardToken calldata _token) public payable onlyRole(MANAGER_ROLE) {
uint256 _ethRequired = _calculateETHRequiredForToken(_token);
if (msg.value < _ethRequired) {
revert InsufficientBalance();
}
_createTokenAndDepositRewards(_token);
}
function createMultipleTokensAndDepositRewards(
LibItems.RewardToken[] calldata _tokens
) external payable onlyRole(MANAGER_ROLE) {
uint256 totalETHRequired;
// Calculate the total ETH required for all tokens
for (uint256 i = 0; i < _tokens.length; i++) {
totalETHRequired += _calculateETHRequiredForToken(_tokens[i]);
}
// Check if the provided ETH is enough
if (msg.value < totalETHRequired) {
revert InsufficientBalance();
}
// Create tokens and deposit rewards
for (uint256 i = 0; i < _tokens.length; i++) {
_createTokenAndDepositRewards(_tokens[i]);
}
}
function updateTokenMintPaused(uint256 _tokenId, bool _isTokenMintPaused) public onlyRole(MANAGER_ROLE) {
isTokenMintPaused[_tokenId] = _isTokenMintPaused;
}
function updateClaimRewardPaused(uint256 _tokenId, bool _isClaimRewardPaused) public onlyRole(MANAGER_ROLE) {
isClaimRewardPaused[_tokenId] = _isClaimRewardPaused;
}
/**
* @dev Allows the contract owner to withdraw all available assets from the contract.
* @param _rewardType The type of reward to withdraw.
* @param _to The address to send the assets to.
* @param _tokenAddress The address of the token to withdraw. (required for ERC20, ERC721, and ERC1155 tokens)
* @param _tokenIds The token IDs to withdraw. (required for ERC721 and ERC1155 tokens)
* @param _amounts The amounts to withdraw. (required for ETHER, ERC20, and ERC1155 tokens)
*/
function withdrawAssets(
LibItems.RewardType _rewardType,
address _to,
address _tokenAddress, // required for ERC20, ERC721, and ERC1155
uint256[] calldata _tokenIds, // required for ERC721 and ERC1155
uint256[] calldata _amounts // required for ETHER, ERC20, and ERC1155
) external onlyRole(MANAGER_ROLE) {
if (_to == address(0)) {
revert AddressIsZero();
}
address _from = address(this);
if (_rewardType == LibItems.RewardType.ETHER) {
_transferEther(payable(_to), _amounts[0]);
} else if (_rewardType == LibItems.RewardType.ERC20) {
_transferERC20(IERC20(_tokenAddress), _to, _amounts[0]);
} else if (_rewardType == LibItems.RewardType.ERC721) {
IERC721 token = IERC721(_tokenAddress);
for (uint256 i = 0; i < _tokenIds.length; i++) {
_transferERC721(token, _from, _to, _tokenIds[i]);
}
} else if (_rewardType == LibItems.RewardType.ERC1155) {
if (_tokenIds.length != _amounts.length) {
revert InvalidLength();
}
for (uint256 i = 0; i < _tokenIds.length; i++) {
_transferERC1155(IERC1155(_tokenAddress), _from, _to, _tokenIds[i], _amounts[i]);
}
}
}
function _transferEther(address payable _to, uint256 _amount) private {
if (address(this).balance < _amount) {
revert InsufficientBalance();
}
(bool success, ) = _to.call{ value: _amount }("");
if (!success) {
revert TransferFailed();
}
}
function _transferERC20(IERC20 _token, address _to, uint256 _amount) private {
uint256 balanceInContract = _token.balanceOf(address(this));
if (balanceInContract < _amount) {
revert InsufficientBalance();
}
SafeERC20.safeTransfer(_token, _to, _amount);
}
function _transferERC721(IERC721 _token, address _from, address _to, uint256 _tokenId) private {
_token.safeTransferFrom(_from, _to, _tokenId);
}
function _transferERC1155(IERC1155 _token, address _from, address _to, uint256 _tokenId, uint256 _amount) private {
_token.safeTransferFrom(_from, _to, _tokenId, _amount, "");
}
function claimReward(uint256 _tokenId) external nonReentrant whenNotPaused {
_claimReward(_msgSender(), _tokenId);
}
function claimRewards(uint256[] calldata _tokenIds) external nonReentrant whenNotPaused {
for (uint256 i = 0; i < _tokenIds.length; i++) {
_claimReward(_msgSender(), _tokenIds[i]);
}
}
function adminClaimReward(address _to, uint256[] calldata _tokenIds) external onlyRole(MANAGER_ROLE) whenNotPaused {
for (uint256 i = 0; i < _tokenIds.length; i++) {
_claimReward(_to, _tokenIds[i]);
}
}
function _claimReward(address _to, uint256 _rewardTokenId) private {
if (isClaimRewardPaused[_rewardTokenId]) {
revert ClaimRewardPaused();
}
if (_to == address(0)) {
revert AddressIsZero();
}
// check if the user has the reward token to redeem or not
if (rewardTokenContract.balanceOf(_to, _rewardTokenId) == 0) {
revert InsufficientBalance();
}
// then burn the reward token
rewardTokenContract.whitelistBurn(_to, _rewardTokenId, 1);
_distributeReward(_to, _rewardTokenId);
}
function _distributeReward(address _to, uint256 _rewardTokenId) private {
LibItems.RewardToken memory _rewardToken = tokenRewards[_rewardTokenId];
LibItems.Reward[] memory rewards = _rewardToken.rewards;
for (uint256 i = 0; i < rewards.length; i++) {
LibItems.Reward memory reward = rewards[i];
address _from = address(this);
if (reward.rewardType == LibItems.RewardType.ETHER) {
_transferEther(payable(_to), reward.rewardAmount);
} else if (reward.rewardType == LibItems.RewardType.ERC20) {
_transferERC20(IERC20(reward.rewardTokenAddress), _to, reward.rewardAmount);
} else if (reward.rewardType == LibItems.RewardType.ERC721) {
uint256 currentIndex = erc721RewardCurrentIndex[_rewardTokenId][i];
uint256[] memory tokenIds = reward.rewardTokenIds;
for (uint256 j = 0; j < reward.rewardAmount; j++) {
if (currentIndex >= tokenIds.length) {
revert InsufficientBalance();
}
_transferERC721(IERC721(reward.rewardTokenAddress), _from, _to, tokenIds[currentIndex + j]);
}
erc721RewardCurrentIndex[_rewardTokenId][i] += reward.rewardAmount;
} else if (reward.rewardType == LibItems.RewardType.ERC1155) {
_transferERC1155(
IERC1155(reward.rewardTokenAddress),
_from,
_to,
reward.rewardTokenId,
reward.rewardAmount
);
}
}
emit Claimed(_to, _rewardTokenId, 1);
}
function _mintAndClaimRewardTokenBatch(
address to,
uint256[] memory _tokenIds,
uint256 _amount,
bool soulbound,
bool isClaimReward
) private {
for (uint256 i = 0; i < _tokenIds.length; i++) {
_mintAndClaimRewardToken(to, _tokenIds[i], _amount, soulbound, isClaimReward);
}
}
function _mintAndClaimRewardToken(
address to,
uint256 _tokenId,
uint256 _amount,
bool soulbound,
bool isClaimReward
) private {
if (to == address(0)) {
revert AddressIsZero();
}
if (!isTokenExist(_tokenId)) {
revert TokenNotExist();
}
if (isTokenMintPaused[_tokenId]) {
revert MintPaused();
}
if (_amount == 0) {
revert InvalidAmount();
}
uint256 currentSupply = currentRewardSupply[_tokenId] + _amount;
currentRewardSupply[_tokenId] += _amount;
if (currentSupply > tokenRewards[_tokenId].maxSupply) {
revert ExceedMaxSupply();
}
// claim the reward
if (isClaimReward) {
for (uint256 i = 0; i < _amount; i++) {
_distributeReward(to, _tokenId);
}
} else {
// mint reward token
rewardTokenContract.adminMintId(to, _tokenId, _amount, soulbound);
emit Minted(to, _tokenId, _amount, soulbound);
}
}
function _verifyContractChainIdAndDecode(bytes calldata data) private view returns (uint256[] memory) {
uint256 currentChainId = getChainID();
(address contractAddress, uint256 chainId, uint256[] memory tokenIds) = _decodeData(data);
if (chainId != currentChainId || contractAddress != address(this)) {
revert InvalidInput();
}
return tokenIds;
}
function getTokenDetails(
uint256 tokenId
)
public
view
returns (
string memory tokenUri,
uint256 maxSupply,
LibItems.RewardType[] memory rewardTypes,
uint256[] memory rewardAmounts,
address[] memory rewardTokenAddresses,
uint256[][] memory rewardTokenIds,
uint256[] memory rewardTokenId
)
{
tokenUri = tokenRewards[tokenId].tokenUri;
maxSupply = tokenRewards[tokenId].maxSupply;
LibItems.Reward[] memory rewards = tokenRewards[tokenId].rewards;
rewardTypes = new LibItems.RewardType[](rewards.length);
rewardAmounts = new uint256[](rewards.length);
rewardTokenAddresses = new address[](rewards.length);
rewardTokenIds = new uint256[][](rewards.length);
rewardTokenId = new uint256[](rewards.length);
for (uint i = 0; i < rewards.length; i++) {
rewardTypes[i] = rewards[i].rewardType;
rewardAmounts[i] = rewards[i].rewardAmount;
rewardTokenAddresses[i] = rewards[i].rewardTokenAddress;
rewardTokenIds[i] = rewards[i].rewardTokenIds;
rewardTokenId[i] = rewards[i].rewardTokenId;
}
}
function mint(
bytes calldata data,
bool isSoulbound,
uint256 nonce,
bytes calldata signature,
bool isClaimReward
) external nonReentrant signatureCheck(_msgSender(), nonce, data, signature) whenNotPaused {
uint256[] memory _tokenIds = _verifyContractChainIdAndDecode(data);
_mintAndClaimRewardTokenBatch(_msgSender(), _tokenIds, 1, isSoulbound, isClaimReward);
}
function adminMint(
address to,
bytes calldata data,
bool isSoulbound,
bool isClaimReward
) external onlyRole(MINTER_ROLE) whenNotPaused {
uint256[] memory _tokenIds = _verifyContractChainIdAndDecode(data);
_mintAndClaimRewardTokenBatch(to, _tokenIds, 1, isSoulbound, isClaimReward);
}
function adminMintById(
address toAddress,
uint256 _tokenId,
uint256 _amount,
bool isSoulbound
) public onlyRole(MINTER_ROLE) whenNotPaused {
_mintAndClaimRewardToken(toAddress, _tokenId, _amount, isSoulbound, false);
}
function adminBatchMintById(
address[] calldata toAddresses,
uint256 _tokenId,
uint256[] calldata _amounts,
bool isSoulbound
) public onlyRole(MINTER_ROLE) whenNotPaused {
if (toAddresses.length != _amounts.length) {
revert InvalidLength();
}
for (uint256 i = 0; i < toAddresses.length; i++) {
_mintAndClaimRewardToken(toAddresses[i], _tokenId, _amounts[i], isSoulbound, false);
}
}
function supportsInterface(bytes4 interfaceId) public view override(AccessControl, ERC1155Receiver) returns (bool) {
return super.supportsInterface(interfaceId);
}
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) public pure override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) public pure override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
// Function to receive Ether. msg.data must be empty
receive() external payable {}
// Fallback function is called when msg.data is not empty
fallback() external payable {}
function adminVerifySignature(
address to,
uint256 nonce,
bytes calldata data,
bytes calldata signature
) public onlyRole(DEV_CONFIG_ROLE) returns (bool) {
return _verifySignature(to, nonce, data, signature);
}
function addWhitelistSigner(address _signer) external onlyRole(DEV_CONFIG_ROLE) {
_addWhitelistSigner(_signer);
}
function removeWhitelistSigner(address signer) external onlyRole(DEV_CONFIG_ROLE) {
_removeWhitelistSigner(signer);
}
function getChainID() public view returns (uint256) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
}// 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
pragma solidity 0.8.17;
/*
* Author: Omar ogarciarevett(https://github.com/ogarciarevett)
* Co-Authors: Max vasinl124(https://github.com/vasinl124)
*/
// MMMMNkc. .,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MWXd,. .cONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// Wx' .cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// x. ;KMMMMMMMMMMMMWKxlcclxKWMMMMMMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkccxWMWKdccccccccccccoKMM0l:l0MMMMMMMMMWkc:dXMMMXkoc::::::clxKW
// ' lNMMMMMMMMMMNd. .. .dNMMMMMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .''''''''';OMMX: ,0MMMMMMMWk. oNMWk' ........ .o
// . :XMMMMMMMMMWd. .o00l. .dWMMMMWx. .o0KKXKKXXXXNMMM0' oNWWWWWWWk. .kMMN: :NMNc .kNNNNNNNNNNWMMM0, :XMMMMMM0, cXMMO. c0KKKKXK0o.
// , .lkxo. ;dkx, oWMMMMMMMMWk. oNMMNo. .kWMMMWl ;KMMMMMMMMMMMMMM0' .',',,,,,. .kMMN: :NMNc ,:;;;;;;dXMMMMMMO. lNMMMMK: ;KMMMd. .OMMMMMMMMX;
// : :KWX: .xMWx. .kMMMMMMMMM0' cXMMMMXc ,0MMMWl ;KMMMMMMMMMMMMMM0' .',,'',,,. .kMMN: :NMNc ',,;;,;;oXMMMMMMWx. .dWMMNc 'OMMMMd. .OMMMMMMMMX;
// l ,0WO:oXWd. .OMMMMMMMMK; ;KMMMMMMK; :KMMWd. .o0KKXXKKKXXNMMM0' oNWWWWWWWx. .kMMN: :XMNc .kNNNNNNNNWWWMMMMMNo. .dK0l. .xWMMMMO. .c0KKKXXK0o.
// o dWMWWMK, '0MMMMMMMXc 'OMMMMMMMMO' cNMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .,,,,,,,,,:0MMMMMMNo. .. 'xWMMMMMWx' ....... .o
// O' :XMMMMk. cXMMMMMMMKo:cOWMMMMMMMMWOc:oKMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkc:xWMWKoc:::::::::::lKMMMMMMMWKdlcclxXWMMMMMMMMXkoc::::::clxKW
// WO; 'OMMMWl .oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMNx'.dWMMK;.:0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMM0cdNMM0cdNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
contract Achievo1155Soulbound {
mapping(address => bool) internal _soulboundAddresses; // mid gas usage
mapping(address => mapping(uint256 => uint256)) internal _soulbounds; // high gas usage
mapping(address => bool) internal whitelistAddresses;
event SoulboundAddress(address indexed to);
event Soulbound(address indexed to, uint256 indexed tokenId, uint256 amount);
event SoulboundBatch(address indexed to, uint256[] indexed tokenIds, uint256[] indexed amounts);
modifier soulboundCheckAndSync(
address from,
address to,
uint256 tokenId,
uint256 amount,
uint256 totalAmount
) {
_checkMultipleAmounts(from, to, tokenId, amount, totalAmount);
_syncSoulbound(from, to, tokenId, amount, totalAmount);
_;
}
modifier soulboundCheckAndSyncBatch(
address from,
address to,
uint256[] memory tokenIds,
uint256[] memory amounts,
uint256[] memory totalAmounts
) {
require(amounts.length == totalAmounts.length, "Achievo1155Soulbound: tokenIds and amounts length mismatch");
for (uint256 i = 0; i < tokenIds.length; i++) {
_checkMultipleAmounts(from, to, tokenIds[i], amounts[i], totalAmounts[i]);
_syncSoulbound(from, to, tokenIds[i], amounts[i], totalAmounts[i]);
}
_;
}
modifier revertOperation() {
revert("Achievo1155Soulbound: Operation denied, soulbounded");
_;
}
/**
* @dev Returns if a `tokenId` is soulbound
*
*/
function soulboundBalance(address to, uint256 tokenId) external view virtual returns (uint256) {
return _soulbounds[to][tokenId];
}
/**
* @dev Returns if a `address` is soulbound
*
*/
function isSoulboundAddress(address to) public view virtual returns (bool) {
return _soulboundAddresses[to];
}
function _getWhitelistAddress(address _address) internal view returns (bool) {
return whitelistAddresses[_address];
}
function _updateWhitelistAddress(address _address, bool _isWhitelisted) internal {
whitelistAddresses[_address] = _isWhitelisted;
}
function _checkMultipleAmounts(
address from,
address to,
uint256 tokenId,
uint256 amount,
uint256 totalAmount
) private view {
require(amount > 0, "Achievo1155Soulbound: can't be zero amount");
// check if from or to whitelist addresses let it through
if (whitelistAddresses[from] || whitelistAddresses[to] || whitelistAddresses[msg.sender]) {
return;
}
if (totalAmount - _soulbounds[from][tokenId] < amount) {
revert(
"Achievo1155Soulbound: The amount of soulbounded tokens is more than the amount of tokens to be transferred"
);
}
}
function _syncSoulbound(address from, address to, uint256 tokenId, uint256 amount, uint256 totalAmount) private {
if (_soulbounds[from][tokenId] > 0) {
uint256 nonSoulboundAmount = totalAmount - _soulbounds[from][tokenId];
if (nonSoulboundAmount < amount) {
uint256 soulboundDiffAmount = amount - nonSoulboundAmount;
_soulbounds[from][tokenId] -= soulboundDiffAmount;
if (to != address(0)) {
_soulbounds[to][tokenId] += soulboundDiffAmount;
}
}
}
}
/**
* @dev Soulbound `tokenId` - ERC1155 use cases
*
* Emits a {Soulbound} event.
*
*/
function _soulbound(address to, uint256 tokenId, uint256 amount) internal virtual {
_soulbounds[to][tokenId] += amount;
emit Soulbound(to, tokenId, amount);
}
/**
* @dev Soulbound `tokenIds` - ERC1155 use cases
*
* Emits a {SoulboundBatch} event.
*
*/
function _soulboundBatch(address to, uint256[] memory tokenIds, uint256[] memory amounts) internal virtual {
require(tokenIds.length == amounts.length, "Achievo1155Soulbound: tokenIds and amounts length mismatch");
for (uint256 i = 0; i < tokenIds.length; i++) {
_soulbounds[to][tokenIds[i]] += amounts[i];
}
emit SoulboundBatch(to, tokenIds, amounts);
}
/**
* @dev Soulbound `address` to save that address - Custom use cases
*
* Emits a {SoulboundAddress} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _soulboundAddress(address to) internal virtual {
require(to != address(0), "Achievo1155Soulbound: Bound to the zero address not allowed");
_soulboundAddresses[to] = true;
emit SoulboundAddress(to);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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:
*
* ```solidity
* 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}:
*
* ```solidity
* 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. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
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(account),
" 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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
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`.
*
* May emit a {RoleRevoked} event.
*/
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.
*
* May emit a {RoleGranted} event.
*
* [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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
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.9.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, "\x19\x01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
data := keccak256(ptr, 0x42)
}
}
/**
* @dev Returns an Ethereum Signed Data with intended validator, created from a
* `validator` and `data` according to the version 0 of EIP-191.
*
* See {recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x00", validator, data));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view virtual override returns (uint256[] memory) {
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner or approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner or approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(address from, uint256 id, uint256 amount) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `ids` and `amounts` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non-ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non-ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/Address.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 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 ERC721
* 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 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/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 (last updated v4.9.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
if (to == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 supply = _totalSupply[id];
require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
unchecked {
_totalSupply[id] = supply - amount;
}
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 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 {
using Address for address;
/**
* @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @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.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @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 silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../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 {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
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 {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/**
* Author: Omar <ogarciarevett>(https://github.com/ogarciarevett)
* Co-Authors: Max <vasinl124>(https://github.com/vasinl124)
*/
// MMMMNkc. .,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MWXd,. .cONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// Wx' .cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// x. ;KMMMMMMMMMMMMWKxlcclxKWMMMMMMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkccxWMWKdccccccccccccoKMM0l:l0MMMMMMMMMWkc:dXMMMXkoc::::::clxKW
// ' lNMMMMMMMMMMNd. .. .dNMMMMMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .''''''''';OMMX: ,0MMMMMMMWk. oNMWk' ........ .o
// . :XMMMMMMMMMWd. .o00l. .dWMMMMWx. .o0KKXKKXXXXNMMM0' oNWWWWWWWk. .kMMN: :NMNc .kNNNNNNNNNNWMMM0, :XMMMMMM0, cXMMO. c0KKKKXK0o.
// , .lkxo. ;dkx, oWMMMMMMMMWk. oNMMNo. .kWMMMWl ;KMMMMMMMMMMMMMM0' .',',,,,,. .kMMN: :NMNc ,:;;;;;;dXMMMMMMO. lNMMMMK: ;KMMMd. .OMMMMMMMMX;
// : :KWX: .xMWx. .kMMMMMMMMM0' cXMMMMXc ,0MMMWl ;KMMMMMMMMMMMMMM0' .',,'',,,. .kMMN: :NMNc ',,;;,;;oXMMMMMMWx. .dWMMNc 'OMMMMd. .OMMMMMMMMX;
// l ,0WO:oXWd. .OMMMMMMMMK; ;KMMMMMMK; :KMMWd. .o0KKXXKKKXXNMMM0' oNWWWWWWWx. .kMMN: :XMNc .kNNNNNNNNWWWMMMMMNo. .dK0l. .xWMMMMO. .c0KKKXXK0o.
// o dWMWWMK, '0MMMMMMMXc 'OMMMMMMMMO' cNMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .,,,,,,,,,:0MMMMMMNo. .. 'xWMMMMMWx' ....... .o
// O' :XMMMMk. cXMMMMMMMKo:cOWMMMMMMMMWOc:oKMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkc:xWMWKoc:::::::::::lKMMMMMMMWKdlcclxXWMMMMMMMMXkoc::::::clxKW
// WO; 'OMMMWl .oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMNx'.dWMMK;.:0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMM0cdNMM0cdNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract ERCWhitelistSignature {
mapping(address => bool) public whitelistSigners;
mapping(bytes => bool) private usedSignatures;
event WhitelistSignerAdded(address indexed signer);
event WhitelistSignerRemoved(address indexed signer);
modifier signatureCheck(
address wallet,
uint256 nonce,
bytes calldata data,
bytes calldata signature
) {
if (!_verifySignature(wallet, nonce, data, signature)) {
revert("InvalidSignature");
}
_;
}
function _addWhitelistSigner(address _signer) internal virtual {
require(_signer != address(0), "ERCWhitelistSignature: signer is the zero address");
whitelistSigners[_signer] = true;
emit WhitelistSignerAdded(_signer);
}
function _removeWhitelistSigner(address _signer) internal virtual {
require(_signer != address(0), "ERCWhitelistSignature: signer is the zero address");
whitelistSigners[_signer] = false;
emit WhitelistSignerRemoved(_signer);
}
function _recoverAddress(
address to,
uint256 nonce,
bytes calldata data,
bytes calldata signature
) internal pure virtual returns (address) {
bytes32 message = keccak256(abi.encodePacked(to, data, nonce));
bytes32 hash = ECDSA.toEthSignedMessageHash(message);
address signer = ECDSA.recover(hash, signature);
return signer;
}
function _verifySignature(
address to,
uint256 nonce,
bytes calldata data,
bytes calldata signature
) internal virtual returns (bool) {
if (usedSignatures[signature]) revert("AlreadyUsedSignature");
address signer = _recoverAddress(to, nonce, data, signature);
if (whitelistSigners[signer]) {
usedSignatures[signature] = true;
return true;
} else {
return false;
}
}
function _decodeStringData(bytes calldata _data) internal virtual returns (string[] memory) {
string[] memory values = abi.decode(_data, (string[]));
return values;
}
function _decodeUintData(bytes calldata _data) internal virtual returns (uint256[] memory) {
uint256[] memory values = abi.decode(_data, (uint256[]));
return values;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library 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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
// MMMMNkc. .,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MWXd,. .cONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// Wx' .cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// x. ;KMMMMMMMMMMMMWKxlcclxKWMMMMMMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkccxWMWKdccccccccccccoKMM0l:l0MMMMMMMMMWkc:dXMMMXkoc::::::clxKW
// ' lNMMMMMMMMMMNd. .. .dNMMMMMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .''''''''';OMMX: ,0MMMMMMMWk. oNMWk' ........ .o
// . :XMMMMMMMMMWd. .o00l. .dWMMMMWx. .o0KKXKKXXXXNMMM0' oNWWWWWWWk. .kMMN: :NMNc .kNNNNNNNNNNWMMM0, :XMMMMMM0, cXMMO. c0KKKKXK0o.
// , .lkxo. ;dkx, oWMMMMMMMMWk. oNMMNo. .kWMMMWl ;KMMMMMMMMMMMMMM0' .',',,,,,. .kMMN: :NMNc ,:;;;;;;dXMMMMMMO. lNMMMMK: ;KMMMd. .OMMMMMMMMX;
// : :KWX: .xMWx. .kMMMMMMMMM0' cXMMMMXc ,0MMMWl ;KMMMMMMMMMMMMMM0' .',,'',,,. .kMMN: :NMNc ',,;;,;;oXMMMMMMWx. .dWMMNc 'OMMMMd. .OMMMMMMMMX;
// l ,0WO:oXWd. .OMMMMMMMMK; ;KMMMMMMK; :KMMWd. .o0KKXXKKKXXNMMM0' oNWWWWWWWx. .kMMN: :XMNc .kNNNNNNNNWWWMMMMMNo. .dK0l. .xWMMMMO. .c0KKKXXK0o.
// o dWMWWMK, '0MMMMMMMXc 'OMMMMMMMMO' cNMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .,,,,,,,,,:0MMMMMMNo. .. 'xWMMMMMWx' ....... .o
// O' :XMMMMk. cXMMMMMMMKo:cOWMMMMMMMMWOc:oKMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkc:xWMWKoc:::::::::::lKMMMMMMMWKdlcclxXWMMMMMMMMXkoc::::::clxKW
// WO; 'OMMMWl .oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMNx'.dWMMK;.:0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMM0cdNMM0cdNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
library LibItems {
struct Tier {
uint256 tierId;
string tierName;
}
struct TokenCreate {
uint256 tokenId;
string tokenUri;
}
enum RewardType {
ETHER,
ERC20,
ERC721,
ERC1155
}
struct RewardTokenOld {
uint256 tokenId;
string tokenUri;
uint256 rewardAmount; // depending of the erc20 token decimal
address rewardERC20; // USDC, USDT, DAI, etc
bool isEther;
}
struct Reward {
RewardType rewardType; // 4 = ether 1 = erc20, 2 = erc721, 3 = erc1155, 4 = erc404
uint256 rewardAmount; // depending of the erc20 token decimal
address rewardTokenAddress; // ether is 0x0, USDC, USDT, DAI, NFT, etc
uint256[] rewardTokenIds; // erc721
uint256 rewardTokenId; // erc1155
}
struct RewardToken {
uint256 tokenId;
string tokenUri;
Reward[] rewards;
uint256 maxSupply; // 0 mean unlimited
}
struct TokenCreateWithRoyalty {
uint256 tokenId;
string tokenUri;
address receiver;
uint256 feeBasisPoints;
}
struct TokenReturn {
uint256 tokenId;
string tokenUri;
uint256 amount;
}
}
library TestLibItems {
enum Tier {
NONE,
COMMON,
UNCOMMON,
RARE,
LEGENDARY,
MYTHICAL
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
import "../IERC721Receiver.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of {ERC1155} that allows token holders to destroy both their
* own tokens and those that they have been approved to use.
*
* _Available since v3.1._
*/
abstract contract ERC1155Burnable is ERC1155 {
function burn(address account, uint256 id, uint256 value) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not token owner or approved"
);
_burn(account, id, value);
}
function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not token owner or approved"
);
_burnBatch(account, ids, values);
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;
/**
* Author: Max vasinl124(https://github.com/vasinl124)
* Co-Authors: Omar ogarciarevett(https://github.com/ogarciarevett)
*/
// MMMMNkc. .,oKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MWXd,. .cONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// Wx' .cKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// x. ;KMMMMMMMMMMMMWKxlcclxKWMMMMMMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkccxWMWKdccccccccccccoKMM0l:l0MMMMMMMMMWkc:dXMMMXkoc::::::clxKW
// ' lNMMMMMMMMMMNd. .. .dNMMMMMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .''''''''';OMMX: ,0MMMMMMMWk. oNMWk' ........ .o
// . :XMMMMMMMMMWd. .o00l. .dWMMMMWx. .o0KKXKKXXXXNMMM0' oNWWWWWWWk. .kMMN: :NMNc .kNNNNNNNNNNWMMM0, :XMMMMMM0, cXMMO. c0KKKKXK0o.
// , .lkxo. ;dkx, oWMMMMMMMMWk. oNMMNo. .kWMMMWl ;KMMMMMMMMMMMMMM0' .',',,,,,. .kMMN: :NMNc ,:;;;;;;dXMMMMMMO. lNMMMMK: ;KMMMd. .OMMMMMMMMX;
// : :KWX: .xMWx. .kMMMMMMMMM0' cXMMMMXc ,0MMMWl ;KMMMMMMMMMMMMMM0' .',,'',,,. .kMMN: :NMNc ',,;;,;;oXMMMMMMWx. .dWMMNc 'OMMMMd. .OMMMMMMMMX;
// l ,0WO:oXWd. .OMMMMMMMMK; ;KMMMMMMK; :KMMWd. .o0KKXXKKKXXNMMM0' oNWWWWWWWx. .kMMN: :XMNc .kNNNNNNNNWWWMMMMMNo. .dK0l. .xWMMMMO. .c0KKKXXK0o.
// o dWMWWMK, '0MMMMMMMXc 'OMMMMMMMMO' cNMMNd. ..........oWMM0' oWMMMMMMMk. .kMMN: :XMNl .,,,,,,,,,:0MMMMMMNo. .. 'xWMMMMMWx' ....... .o
// O' :XMMMMk. cXMMMMMMMKo:cOWMMMMMMMMWOc:oKMMMWKxlc::::::::ckWMMXd:cOMMMMMMMMKo:oKMMWkc:xWMWKoc:::::::::::lKMMMMMMMWKdlcclxXWMMMMMMMMXkoc::::::clxKW
// WO; 'OMMMWl .oXMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMNx'.dWMMK;.:0WMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
// MMMM0cdNMM0cdNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
import { ERC1155 } from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import { ERC1155Burnable } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import { ERC1155Supply } from "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { ERC2981 } from "@openzeppelin/contracts/token/common/ERC2981.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { Achievo1155Soulbound } from "../ercs/extensions/Achievo1155Soulbound.sol";
import { LibItems } from "../libraries/LibItems.sol";
error AddressIsZero();
error NotOwnerOrApproved();
contract AdminERC1155Soulbound is
ERC1155Burnable,
ERC1155Supply,
Achievo1155Soulbound,
AccessControl,
ERC2981,
ReentrancyGuard,
Initializable
{
event ContractURIChanged(string indexed uri);
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
bytes32 public constant DEV_CONFIG_ROLE = keccak256("DEV_CONFIG_ROLE");
string public name;
string public symbol;
string public defaultTokenURI;
string public contractURI;
using Strings for uint256;
mapping(uint256 => bool) private tokenExists;
uint256[] public itemIds;
mapping(address => mapping(uint256 => bool)) private tokenIdProcessed;
event Minted(address indexed to, uint256[] tokenIds, uint256 amount, bool soulbound);
event MintedId(address indexed to, uint256 indexed tokenId, uint256 amount, bool soulbound);
event TokenAdded(uint256 indexed tokenId);
constructor(address devWallet) ERC1155("") {
if (devWallet == address(0)) {
revert AddressIsZero();
}
_grantRole(DEFAULT_ADMIN_ROLE, devWallet);
}
function initialize(
string memory _name,
string memory _symbol,
string memory _defaultTokenURI,
string memory _contractURI,
address devWallet,
address lootDropAddress
) external initializer onlyRole(DEFAULT_ADMIN_ROLE) {
if (devWallet == address(0) || lootDropAddress == address(0)) {
revert AddressIsZero();
}
_grantRole(DEFAULT_ADMIN_ROLE, devWallet);
_grantRole(MANAGER_ROLE, devWallet);
_grantRole(DEV_CONFIG_ROLE, devWallet);
_grantRole(DEV_CONFIG_ROLE, lootDropAddress);
_grantRole(MINTER_ROLE, lootDropAddress);
_updateWhitelistAddress(lootDropAddress, true);
name = _name;
symbol = _symbol;
defaultTokenURI = _defaultTokenURI;
contractURI = _contractURI;
}
function getAllItemsAdmin(
address _owner
) public view onlyRole(MINTER_ROLE) returns (LibItems.TokenReturn[] memory) {
uint256 totalTokens = itemIds.length;
LibItems.TokenReturn[] memory tokenReturns = new LibItems.TokenReturn[](totalTokens);
uint index;
for (uint i = 0; i < totalTokens; i++) {
uint256 tokenId = itemIds[i];
uint256 amount = balanceOf(_owner, tokenId);
LibItems.TokenReturn memory tokenReturn = LibItems.TokenReturn({
tokenId: tokenId,
tokenUri: uri(tokenId),
amount: amount
});
tokenReturns[index] = tokenReturn;
index++;
}
// truncate the array
LibItems.TokenReturn[] memory returnsTruncated = new LibItems.TokenReturn[](index);
for (uint i = 0; i < index; i++) {
returnsTruncated[i] = tokenReturns[i];
}
return returnsTruncated;
}
function isTokenExist(uint256 _tokenId) public view returns (bool) {
if (!tokenExists[_tokenId]) {
revert("TokenNotExist");
}
return true;
}
function addNewToken(uint256 _tokenId) public onlyRole(DEV_CONFIG_ROLE) {
tokenExists[_tokenId] = true;
itemIds.push(_tokenId);
emit TokenAdded(_tokenId);
}
function adminMintId(address to, uint256 id, uint256 amount, bool isSoulbound) public onlyRole(MINTER_ROLE) {
isTokenExist(id);
if (isSoulbound) {
_soulbound(to, id, amount);
}
_mint(to, id, amount, "");
emit MintedId(to, id, amount, isSoulbound);
}
function adminBatchMintId(
address[] calldata toAddresses,
uint256 _tokenId,
uint256[] calldata _amounts,
bool isSoulbound
) external onlyRole(MINTER_ROLE) {
for (uint256 i = 0; i < toAddresses.length; i++) {
adminMintId(toAddresses[i], _tokenId, _amounts[i], isSoulbound);
}
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override(ERC1155, ERC1155Supply) {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
function safeTransferFrom(
address _from,
address _to,
uint256 _id,
uint256 _amount,
bytes memory _data
) public virtual override soulboundCheckAndSync(_from, _to, _id, _amount, balanceOf(_from, _id)) {
super.safeTransferFrom(_from, _to, _id, _amount, _data);
}
function safeBatchTransferFrom(
address _from,
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
)
public
virtual
override
soulboundCheckAndSyncBatch(_from, _to, _ids, _amounts, balanceOfBatchOneAccount(_from, _ids))
{
for (uint256 i = 0; i < _ids.length; i++) {
uint256 id = _ids[i];
if (tokenIdProcessed[_from][id]) {
revert("ERC1155: duplicate ID");
}
tokenIdProcessed[_from][id] = true;
}
super.safeBatchTransferFrom(_from, _to, _ids, _amounts, _data);
// Reset processed status after the transfer is completed
for (uint256 i = 0; i < _ids.length; i++) {
uint256 id = _ids[i];
tokenIdProcessed[_from][id] = false;
}
}
function balanceOfBatchOneAccount(
address account,
uint256[] memory ids
) public view virtual returns (uint256[] memory) {
uint256[] memory batchBalances = new uint256[](ids.length);
for (uint256 i = 0; i < ids.length; ++i) {
batchBalances[i] = balanceOf(account, ids[i]);
}
return batchBalances;
}
function whitelistBurn(
address to,
uint256 tokenId,
uint256 amount
) public nonReentrant soulboundCheckAndSync(to, address(0), tokenId, amount, balanceOf(to, tokenId)) {
if (!_getWhitelistAddress(_msgSender())) {
revert();
}
_burn(to, tokenId, amount);
}
function burn(
address to,
uint256 tokenId,
uint256 amount
)
public
virtual
override
nonReentrant
soulboundCheckAndSync(to, address(0), tokenId, amount, balanceOf(to, tokenId))
{
ERC1155Burnable.burn(to, tokenId, amount);
}
function burnBatch(
address to,
uint256[] memory tokenIds,
uint256[] memory amounts
)
public
virtual
override
nonReentrant
soulboundCheckAndSyncBatch(to, address(0), tokenIds, amounts, balanceOfBatchOneAccount(to, tokenIds))
{
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 id = tokenIds[i];
if (tokenIdProcessed[to][id]) {
revert("ERC1155: duplicate ID");
}
tokenIdProcessed[to][id] = true;
}
ERC1155Burnable.burnBatch(to, tokenIds, amounts);
// Reset processed status after the transfer is completed
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 id = tokenIds[i];
tokenIdProcessed[to][id] = false;
}
}
function supportsInterface(
bytes4 interfaceId
) public view override(ERC1155, ERC2981, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
function uri(uint256 tokenId) public view override returns (string memory) {
isTokenExist(tokenId);
return defaultTokenURI;
}
function updateDefaultTokenURI(string memory _defaultTokenURI) external onlyRole(DEV_CONFIG_ROLE) {
defaultTokenURI = _defaultTokenURI;
}
function updateWhitelistAddress(address _address, bool _isWhitelisted) external onlyRole(DEV_CONFIG_ROLE) {
_updateWhitelistAddress(_address, _isWhitelisted);
}
function setRoyaltyInfo(address receiver, uint96 feeBasisPoints) external onlyRole(MANAGER_ROLE) {
_setDefaultRoyalty(receiver, feeBasisPoints);
}
function setTokenRoyalty(
uint256 tokenId,
address receiver,
uint256 feeBasisPoints
) external onlyRole(MANAGER_ROLE) {
_setTokenRoyalty(tokenId, receiver, uint96(feeBasisPoints));
}
function resetTokenRoyalty(uint256 tokenId) external onlyRole(MANAGER_ROLE) {
_resetTokenRoyalty(tokenId);
}
function setContractURI(string memory _contractURI) public onlyRole(DEV_CONFIG_ROLE) {
contractURI = _contractURI;
emit ContractURIChanged(_contractURI);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}// 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 (last updated v4.9.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 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;
}{
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 1
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"devWallet","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressIsZero","type":"error"},{"inputs":[],"name":"ClaimRewardPaused","type":"error"},{"inputs":[],"name":"DupTokenId","type":"error"},{"inputs":[],"name":"ExceedMaxSupply","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidInput","type":"error"},{"inputs":[],"name":"InvalidLength","type":"error"},{"inputs":[],"name":"MintPaused","type":"error"},{"inputs":[],"name":"TokenNotExist","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"soulbound","type":"bool"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"}],"name":"WhitelistSignerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"}],"name":"WhitelistSignerRemoved","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEV_CONFIG_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"addWhitelistSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"toAddresses","type":"address[]"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"name":"adminBatchMintById","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"adminClaimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"isSoulbound","type":"bool"},{"internalType":"bool","name":"isClaimReward","type":"bool"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"name":"adminMintById","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"adminVerifySignature","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenUri","type":"string"},{"components":[{"internalType":"enum LibItems.RewardType","name":"rewardType","type":"uint8"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"address","name":"rewardTokenAddress","type":"address"},{"internalType":"uint256[]","name":"rewardTokenIds","type":"uint256[]"},{"internalType":"uint256","name":"rewardTokenId","type":"uint256"}],"internalType":"struct LibItems.Reward[]","name":"rewards","type":"tuple[]"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"internalType":"struct LibItems.RewardToken[]","name":"_tokens","type":"tuple[]"}],"name":"createMultipleTokensAndDepositRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenUri","type":"string"},{"components":[{"internalType":"enum LibItems.RewardType","name":"rewardType","type":"uint8"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"address","name":"rewardTokenAddress","type":"address"},{"internalType":"uint256[]","name":"rewardTokenIds","type":"uint256[]"},{"internalType":"uint256","name":"rewardTokenId","type":"uint256"}],"internalType":"struct LibItems.Reward[]","name":"rewards","type":"tuple[]"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"internalType":"struct LibItems.RewardToken","name":"_token","type":"tuple"}],"name":"createTokenAndDepositRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currentRewardSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"decodeData","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainID","outputs":[{"internalType":"uint256","name":"","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":"tokenId","type":"uint256"}],"name":"getTokenDetails","outputs":[{"internalType":"string","name":"tokenUri","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"enum LibItems.RewardType[]","name":"rewardTypes","type":"uint8[]"},{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"},{"internalType":"address[]","name":"rewardTokenAddresses","type":"address[]"},{"internalType":"uint256[][]","name":"rewardTokenIds","type":"uint256[][]"},{"internalType":"uint256[]","name":"rewardTokenId","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":"_devWallet","type":"address"},{"internalType":"address","name":"_managerWallet","type":"address"},{"internalType":"address","name":"_minterWallet","type":"address"},{"internalType":"address","name":"_rewardTokenAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isClaimRewardPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isTokenExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isTokenMintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"isSoulbound","type":"bool"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"isClaimReward","type":"bool"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"removeWhitelistSigner","outputs":[],"stateMutability":"nonpayable","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":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenRewards","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenUri","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isClaimRewardPaused","type":"bool"}],"name":"updateClaimRewardPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardTokenAddress","type":"address"}],"name":"updateRewardTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isTokenMintPaused","type":"bool"}],"name":"updateTokenMintPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistSigners","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum LibItems.RewardType","name":"_rewardType","type":"uint8"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"withdrawAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080346200010057601f62003fc338819003918201601f191683019291906001600160401b03841183851017620001055781602092849260409687528339810103126200010057516001600160a01b03811690819003620001005760ff1990816003541660035560016004558015620000ef57600091828052600260205283832082845260205260ff848420541615620000a3575b8351613ea790816200011c8239f35b828052600260205283832082845260205260018484209182541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a438808062000094565b825163867915ab60e01b8152600490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe608080604052600436101561001a575b50361561001857005b005b60003560e01c90816301ffc9a71461197057508063097ca482146119475780630dc0534a1461185a57806310eee73414611800578063150b7a021461179a578063248a9ca31461176b5780632f2ff15d146116ca57806336568abe146116385780633f4ba83a146115a4578063447a06f5146115375780634dd2f3461461150b57806354af8891146114c6578063564b81ef146114ab5780635c5245f7146114825780635c975abb1461145f5780635eac6239146113ef578063797c3635146113aa5780637a01c45c146112445780637b488727146111eb5780638456cb5914611191578063859ab73a146111525780638ce1f3911461112157806391d14854146110d45780639344b885146110135780639760750b14610f7957806399b20e0914610ee557806399b71c3d14610eb45780639a6674e514610e48578063a217fddf14610e2c578063ae169a5014610df8578063b3dc00fe14610db9578063b9afbc3414610d58578063bc197c8114610ccd578063c1e03728146109aa578063c32127c714610968578063c62e7f13146108ef578063ce4754c01461087d578063d539139314610854578063d547741f14610815578063e26882d5146107ed578063ec87621c146107c4578063f23a6e611461076e5763f8c8765e14610200573861000f565b3461076957608036600319011261076957610219611bb7565b610221611bcd565b610229611be3565b906064356001600160a01b03811690036107695760059283549260ff8460081c16159384809561075c575b8015610745575b156106e95760ff1981166001178655846106d8575b50336000908152600080516020613df2833981519152602052604090205460ff161561054e576001600160a01b038216928315801561053d575b801561052c575b8015610519575b61050757855462010000600160b01b03191660643560101b62010000600160b01b03161786556000848152600080516020613df283398151915260205260409020546103c7949060ff16156104c6575b6000818152600080516020613dd28339815191526020526040902054600080516020613db2833981519152919060ff1615610485575b50506001600160a01b03166000818152600080516020613d728339815191526020526040902054600080516020613e12833981519152919060ff1615610444575b50506001600160a01b03166000818152600080516020613d128339815191526020526040902054600080516020613e32833981519152919060ff1615610403575b505061235b565b6103cd57005b61ff001981541690557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a438806103c0565b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a4388061037f565b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a4388061033e565b6000818152600080516020613df283398151915260205260408120805460ff1916600117905533908290600080516020613cf28339815191528180a4610308565b60405163867915ab60e01b8152600490fd5b506064356001600160a01b0316156102b8565b506001600160a01b038216156102b1565b506001600160a01b038116156102aa565b6105573361222b565b60405190600061056683611a8b565b60428352602083019060603683378351156106c257603082538351600110156106c2576078602185015360415b6001811161066a5750610638576048610605926106149261063495604051958693600080516020613d9283398151915260208601526105dc815180926020603789019101611b6f565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611b6f565b01036028810184520182611aa6565b60405162461bcd60e51b8152602060048201529182916024830190611b92565b0390fd5b606460405162461bcd60e51b81526020600482015260206024820152600080516020613d328339815191526044820152fd5b90600f811660108110156106c2576f181899199a1a9b1b9c1cb0b131b232b360811b901a610698838761221a565b5360041c9080156106ac5760001901610593565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b61ffff191661010117855538610270565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b15801561025b5750600160ff82161461025b565b50600160ff821610610254565b600080fd5b346107695760a036600319011261076957610787611bb7565b50610790611bcd565b506084356001600160401b038111610769576107b09036906004016119dd565b505060405163f23a6e6160e01b8152602090f35b34610769576000366003190112610769576020604051600080516020613e128339815191528152f35b3461076957602036600319011261076957602061080b6004356123af565b6040519015158152f35b3461076957604036600319011261076957610018600435610834611bcd565b9080600052600260205261084f600160406000200154612085565b612184565b34610769576000366003190112610769576020604051600080516020613e328339815191528152f35b3461076957602036600319011261076957610896611bb7565b61089e611e5b565b6001600160a01b03166108b28115156122f5565b806000526000602052604060002060ff1981541690557fd03b7c074f2eae133be52f3724fb8f9864346d73a003157e313ca60b0ac9d76d600080a2005b3461076957604036600319011261076957610908611bb7565b6024356001600160401b03811161076957610927903690600401611c7f565b9190610931611caf565b610939612491565b60005b83811061094557005b8061095e610957610963938786613066565b3585613280565b6124d5565b61093c565b3461076957608036600319011261076957610018610984611bb7565b61098c611a19565b90610995611f70565b61099d612491565b6044359060243590613ba8565b34610769576020366003190112610769576004358060005260086020526109d76001604060002001611ac9565b9060005260086020526003604060002001546109f960026040600020016133cf565b918251610a05816123cf565b90610a136040519283611aa6565b808252610a22601f19916123cf565b01366020830137610a33845161370f565b8451610a3e816123cf565b90610a4c6040519283611aa6565b808252610a5b601f19916123cf565b01366020830137855190610a87610a71836123cf565b92610a7f6040519485611aa6565b8084526123cf565b60005b601f1982018110610cbc575050610aa1875161370f565b9460005b8851811015610b7657610ab8818a6126c3565b5151906004821015610b6057610ada610b5b92610ad5838a6126c3565b6133c3565b6020610ae6828c6126c3565b510151610af382886126c3565b526001600160a01b036040610b08838d6126c3565b51015116610b1682866126c3565b526060610b23828c6126c3565b510151610b3082876126c3565b52610b3b81866126c3565b506080610b48828c6126c3565b510151610b55828a6126c3565b526124d5565b610aa5565b634e487b7160e01b600052602160045260246000fd5b50919092610b959486918860405197889660e0885260e0880190611b92565b9060208701528581036040870152602080845192838152019301906000905b808210610c895750505090610bd0918582036060870152611c4b565b83810360808501526020808651928381520195019060005b818110610c675750505082840360a0840152815180855260208501946020808360051b8301019401956000915b838310610c34578680610c30888883820360c0850152611c4b565b0390f35b919395509193602080610c53600193601f198682030187528a51611c4b565b980193019301909287959396949296610c15565b82516001600160a01b0316875260209687019688965090920191600101610be8565b91809597509795979390929351906004821015610b60576020816001938293520195019201889694939291979597610bb4565b806060602080938701015201610a8a565b346107695760a036600319011261076957610ce6611bb7565b50610cef611bcd565b506001600160401b0360443581811161076957610d10903690600401611c7f565b505060643581811161076957610d2a903690600401611c7f565b505060843590811161076957610d449036906004016119dd565b505060405163bc197c8160e01b8152602090f35b60031960203682011261076957600435906001600160401b0382116107695760809082600401923603011261076957610d8f611caf565b610d98816125cc565b3410610da757610018906126d7565b604051631e9acf1760e31b8152600490fd5b3461076957602036600319011261076957600435600654811015610769576006600052600080516020613e528339815191520154604051908152602090f35b3461076957602036600319011261076957610e1161322a565b610e19612491565b610e2560043533613280565b6001600455005b3461076957600036600319011261076957602060405160008152f35b3461076957608036600319011261076957610e61611bb7565b6001600160401b0360443581811161076957610e819036906004016119dd565b9260643592831161076957602093610ea061080b9436906004016119dd565b939092610eab611e5b565b60243590613741565b3461076957602036600319011261076957600435600052600a602052602060ff604060002054166040519015158152f35b3461076957608036600319011261076957610efe611bb7565b6024356001600160401b03811161076957610f1d9036906004016119dd565b9060443591821515830361076957610f4d90610f37611a19565b92610f40611f70565b610f48612491565b613cbe565b9060005b8251811015610018578061095e8386610f6d610f7495886126c3565b5189613a2e565b610f51565b6020366003190112610769576004356001600160401b03811161076957610fa4903690600401611c7f565b90610fad611caf565b6000805b838110610fe757503410610da75760005b828110610fcb57005b8061095e610fdd610fe2938686613044565b6126d7565b610fc2565b9061100861100e91611002610ffd858888613044565b6125cc565b9061220d565b916124d5565b610fb1565b34610769576080366003190112610769576001600160401b0360043581811161076957611044903690600401611c7f565b916024359060443590811161076957611061903690600401611c7f565b919061106b611a19565b91611074611f70565b61107c612491565b8386036110c25760005b86811061108f57005b8061095e856110aa6110a56110bd958c8c613066565b6126af565b856110b6858b8a613066565b3591613ba8565b611086565b60405163251f56a160e21b8152600490fd5b34610769576040366003190112610769576110ed611bcd565b600435600052600260205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b34610769576020366003190112610769576004356000526009602052602060ff604060002054166040519015158152f35b34610769576020366003190112610769576001600160a01b03611173611bb7565b166000526000602052602060ff604060002054166040519015158152f35b34610769576000366003190112610769576111aa611caf565b6111b2612491565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b3461076957602036600319011261076957611204611bb7565b61120c611e5b565b6001600160a01b03811615610507576005805462010000600160b01b03191660109290921b62010000600160b01b0316919091179055005b346107695760a036600319011261076957600435600481101561076957611269611bcd565b90611272611be3565b6001600160401b039060643582811161076957611293903690600401611c7f565b949092608435908111610769576112ae903690600401611c7f565b9390956112b9611caf565b6001600160a01b0383811696909290871561050757806112e957505050505050156106c257610018913590613076565b9091929496506001819694961460001461131157505050156106c257610018933592166130b3565b6002819892969794939814600014611353575050501660005b84811061133357005b8061095e61134561134e938887613066565b35863086613172565b61132a565b60039097949193969295971461136557005b8484036110c25760009593959316925b85811015610018578061095e61138f6113a593898b613066565b3561139b838988613066565b35908530896131c5565b611375565b34610769576040366003190112610769576100186113c6611a0a565b6113ce611caf565b600435600052600a60205260406000209060ff801983541691151516179055565b34610769576020366003190112610769576004356001600160401b0381116107695761141f903690600401611c7f565b9061142861322a565b611430612491565b60005b828110611441576001600455005b8061095e61145361145a938686613066565b3533613280565b611433565b3461076957600036600319011261076957602060ff600354166040519015158152f35b346107695760203660031901126107695761001861149e611bb7565b6114a6611e5b565b61235b565b34610769576000366003190112610769576020604051468152f35b34610769576040366003190112610769576100186114e2611a0a565b6114ea611caf565b600435600052600960205260406000209060ff801983541691151516179055565b3461076957602036600319011261076957600435600052600c6020526020604060002054604051908152f35b34610769576020366003190112610769576004356001600160401b0381116107695761157b61156d610c309236906004016119dd565b90611576611e5b565b612444565b60409391935193849360018060a01b031684526020840152606060408401526060830190611c4b565b34610769576000366003190112610769576115bd611caf565b60035460ff8116156115fc5760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b3461076957604036600319011261076957611651611bcd565b336001600160a01b0382160361166d5761001890600435612184565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b34610769576040366003190112610769576004356116e6611bcd565b816000526002602052611700600160406000200154612085565b81600052600260205260406000209060018060a01b0316908160005260205260ff604060002054161561172f57005b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a4005b346107695760203660031901126107695760043560005260026020526020600160406000200154604051908152f35b34610769576080366003190112610769576117b3611bb7565b506117bc611bcd565b506064356001600160401b0381116107695736602382011215610769576117ed903690602481600401359101611c14565b50604051630a85bd0160e11b8152602090f35b3461076957602036600319011261076957600435600052600860205260406000208054600361183160018401611ac9565b9201546118506040519384938452606060208501526060840190611b92565b9060408301520390f35b346107695760a0366003190112610769576001600160401b036004358181116107695761188b9036906004016119dd565b90611894611a0a565b92606435908111610769576118ad9036906004016119dd565b9290608435938415158503610769576118d3916118c861322a565b838560443533613741565b1561190f576118e491610f48612491565b60005b8151811015610e25578061095e848661190361190a95876126c3565b5133613a2e565b6118e7565b60405162461bcd60e51b815260206004820152601060248201526f496e76616c69645369676e617475726560801b6044820152606490fd5b34610769576000366003190112610769576020604051600080516020613db28339815191528152f35b34610769576020366003190112610769576004359063ffffffff60e01b821680920361076957602091630271189760e51b81149081156119b2575b5015158152f35b637965db0b60e01b8114915081156119cc575b50836119ab565b6301ffc9a760e01b149050836119c5565b9181601f84011215610769578235916001600160401b038311610769576020838186019501011161076957565b60243590811515820361076957565b60643590811515820361076957565b90600182811c92168015611a58575b6020831014611a4257565b634e487b7160e01b600052602260045260246000fd5b91607f1691611a37565b6001600160401b038111611a7557604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b03821117611a7557604052565b601f909101601f19168101906001600160401b03821190821017611a7557604052565b9060405191826000825492611add84611a28565b908184526001948581169081600014611b4c5750600114611b09575b5050611b0792500383611aa6565b565b9093915060005260209081600020936000915b818310611b34575050611b0793508201013880611af9565b85548884018501529485019487945091830191611b1c565b915050611b0794506020925060ff191682840152151560051b8201013880611af9565b60005b838110611b825750506000910152565b8181015183820152602001611b72565b90602091611bab81518092818552858086019101611b6f565b601f01601f1916010190565b600435906001600160a01b038216820361076957565b602435906001600160a01b038216820361076957565b604435906001600160a01b038216820361076957565b6001600160401b038111611a7557601f01601f191660200190565b929192611c2082611bf9565b91611c2e6040519384611aa6565b829481845281830111610769578281602093846000960137010152565b90815180825260208080930193019160005b828110611c6b575050505090565b835185529381019392810192600101611c5d565b9181601f84011215610769578235916001600160401b038311610769576020808501948460051b01011161076957565b336000908152600080516020613d7283398151915260209081526040808320549092600080516020613e128339815191529160ff1615611cef5750505050565b611cf83361222b565b91845190611d0582611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b818311611dd957505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b01036028810187520185611aa6565b5192839262461bcd60e51b845260048401526024830190611b92565b60648486519062461bcd60e51b82528060048301526024820152600080516020613d328339815191526044820152fd5b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a611e09858761221a565b5360041c928015611e1f57600019019190611d36565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b336000908152600080516020613dd283398151915260209081526040808320549092600080516020613db28339815191529160ff1615611e9b5750505050565b611ea43361222b565b91845190611eb182611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b818311611f2a57505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a611f5a858761221a565b5360041c928015611e1f57600019019190611ee2565b336000908152600080516020613d1283398151915260209081526040808320549092600080516020613e328339815191529160ff1615611fb05750505050565b611fb93361222b565b91845190611fc682611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b81831161203f57505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a61206f858761221a565b5360041c928015611e1f57600019019190611ff7565b60009080825260209060028252604092838120338252835260ff8482205416156120af5750505050565b6120b83361222b565b918451906120c582611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b81831161213e57505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a61216e858761221a565b5360041c928015611e1f576000190191906120f6565b906000918083526002602052604083209160018060a01b03169182845260205260ff6040842054166121b557505050565b8083526002602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b818102929181159184041417156106ac57565b919082018092116106ac57565b9081518110156106c2570160200190565b60405190606082016001600160401b03811183821017611a7557604052602a82526020820160403682378251156106c2576030905381516001908110156106c257607860218401536029905b8082116122875750506106385790565b9091600f811660108110156122e0576f181899199a1a9b1b9c1cb0b131b232b360811b901a6122b6848661221a565b5360041c9180156122cb576000190190612277565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b156122fc57565b60405162461bcd60e51b815260206004820152603160248201527f45524357686974656c6973745369676e61747572653a207369676e657220697360448201527020746865207a65726f206164647265737360781b6064820152608490fd5b6001600160a01b031661236f8115156122f5565b8060005260006020526040600020600160ff198254161790557fa5d501ce281a3d4bc9e42f4423f9f117dcd0ea4d09ebcd151b60fb5daeab8fd0600080a2565b600052600760205260ff60406000205416156123ca57600190565b600090565b6001600160401b038111611a755760051b60200190565b81601f82011215610769578035916123fd836123cf565b9261240b6040519485611aa6565b808452602092838086019260051b820101928311610769578301905b828210612435575050505090565b81358152908301908301612427565b91908201906060838303126107695782356001600160a01b03811692908390036107695760408401356001600160401b038111610769576020916124899186016123e6565b929301359190565b60ff6003541661249d57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b60001981146106ac5760010190565b903590601e198136030182121561076957018035906001600160401b03821161076957602001918160051b3603831361076957565b903590609e1981360301821215610769570190565b908210156106c2576125459160051b810190612519565b90565b60a08136031261076957604051906001600160401b039060a0830182811184821017611a7557604052803560048110156107695783526020818101359084015260408101356001600160a01b03811681036107695760408401526060810135918211610769576125bd608092369083016123e6565b60608401520135608082015290565b600091825b604083016125df81856124e4565b9050821015612655576125ff826125f961260493876124e4565b9061252e565b612548565b8051600480821015612640575015612626575b50612621906124d5565b6125d1565b612621919460206126399201519061220d565b9390612617565b602190634e487b7160e01b6000525260246000fd5b5050916060612545920135906121fa565b903590601e198136030182121561076957018035906001600160401b0382116107695760200191813603831361076957565b8181106126a3575050565b60008155600101612698565b356001600160a01b03811681036107695790565b80518210156106c25760209160051b010190565b600091606082013515612e385760208201916126f38382612666565b9050158015612e22575b8015612e19575b612e075761271281356123af565b612df557835b604080830161272781856124e4565b9050831015612831576125ff836125f961274193876124e4565b90815191600492838110156127ff57612812575b8051838110156127ff5760028091146127be575b8151848110156127ab571415908161279e575b5061279157505061278c906124d5565b612718565b5163162908e360e11b8152fd5b602091500151153861277c565b634e487b7160e01b8a526021855260248afd5b60608201515180159081156127e3575b50156127695750505163b4fa3fb360e01b8152fd5b90506127f7606088013560208501516121fa565b1415386127ce565b634e487b7160e01b895260218452602489fd5b808201516001600160a01b031661275557505163867915ab60e01b8152fd5b5050509091813584526008602052604084209082358255612856600183019184612666565b906001600160401b038211612de15781906128718454611a28565b601f8111612da6575b508790601f8311600114612d40578892612d35575b50508160011b916000199060031b1c19161790555b6128b160408301836124e4565b90600160401b8211612d21576002830154826002850155808310612c88575b50600283018652602086208691805b848410612b7557505050505060608201356003919091015580358352600760205260408320805460ff19166001179055600654600160401b811015612b61576001810180600655811015612b4d57600684528135600080516020613e5283398151915290910155600554839060101c6001600160a01b0316803b15612b495781906024604051809481936338dc2d1b60e11b8352873560048401525af18015612b3e57612b2b575b50825b61299760408301836124e4565b9050811015612aff576129b46125ff826125f960408601866124e4565b80516004811015612aeb57600103612a2a579061095e612a12612a2593612a206129f460018060a01b0360408401511692602060608a01359101516121fa565b6040516323b872dd60e01b6020820152938491303360248501612e4a565b03601f198101845283611aa6565b612e6c565b61298a565b909181516004811015612aeb57600203612a905760408201516001600160a01b03169460609092019391805b85518051821015612a80579061095e612a7282612a7b946126c3565b5130338b613172565b612a56565b5050945091612a259193506124d5565b919080516004811015612aeb57906003612a25939214612ab1575b506124d5565b612ae59060018060a01b0360408201511690612adb608082015191602060608901359101516121fa565b91309033906131c5565b38612aab565b634e487b7160e01b86526021600452602486fd5b507fa67ce50963791bd746b56c6ccce13fdae9c9577f368a62d5a60a8157d3cfe33f90929192359180a2565b612b3790939193611a62565b9138612987565b6040513d86823e3d90fd5b5080fd5b634e487b7160e01b84526032600452602484fd5b634e487b7160e01b84526041600452602484fd5b612b7f8183612519565b600481351015612c8457835460ff191660ff82351617845560208101356001850155600284016001600160a01b03612bb9604084016126af565b82546001600160a01b0319169116179055612bd760608201826124e4565b906001600160401b038211612c7057600160401b8211612c70578b600387015483600389015583818110612c51575b505050600386018c5260208c208c5b838110612c3d57505050506020600192608060059301356004870155019301930192916128df565b600190602084359401938184015501612c15565b6020612c689360038b018152209182019101612698565b8b3883612c06565b634e487b7160e01b8c52604160045260248cfd5b8980fd5b6005818102048103612d0d576005838102048303612d0d57600284018752602087208360050281015b8260050282018110612cc45750506128d0565b8089600592558960018201558960028201556003810180548b825580612cf3575b505089600482015501612cb1565b612d06918c5260208c2090810190612698565b3880612ce5565b634e487b7160e01b87526011600452602487fd5b634e487b7160e01b86526041600452602486fd5b01359050388061288f565b84895260208920925090601f198416895b818110612d8e5750908460019594939210612d74575b505050811b0190556128a4565b0135600019600384901b60f8161c19169055388080612d67565b91936020600181928787013581550195019201612d51565b612dd190858a5260208a20601f850160051c81019160208610612dd7575b601f0160051c0190612698565b3861287a565b9091508190612dc4565b634e487b7160e01b87526041600452602487fd5b604051635ccf76fb60e11b8152600490fd5b60405163b4fa3fb360e01b8152600490fd5b50803515612704565b50612e3060408201826124e4565b9050156126fd565b60405163162908e360e11b8152600490fd5b6001600160a01b03918216815291166020820152604081019190915260600190565b604080516001600160a01b03929092169291908101906001600160401b03821181831017611a7557612ee2916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1612edc612f7b565b91612fab565b805191821591848315612f54575b505050905015612efd5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312612b4957820151908115158203612f78575080388084612ef0565b80fd5b3d15612fa6573d90612f8c82611bf9565b91612f9a6040519384611aa6565b82523d6000602084013e565b606090565b9192901561300d5750815115612fbf575090565b3b15612fc85790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156130205750805190602001fd5b60405162461bcd60e51b815260206004820152908190610634906024830190611b92565b91908110156106c25760051b81013590607e1981360301821215610769570190565b91908110156106c25760051b0190565b814710610da7576000918291829182916001600160a01b03165af1613099612f7b565b50156130a157565b6040516312171d8360e31b8152600490fd5b6040516370a0823160e01b81523060048201529192916020816024816001600160a01b0386165afa801561314b578391600091613117575b5010610da757612a20611b0793612a1260405194859263a9059cbb60e01b602085015260248401613157565b91506020823d8211613143575b8161313160209383611aa6565b81010312612f785750829051386130eb565b3d9150613124565b6040513d6000823e3d90fd5b6001600160a01b039091168152602081019190915260400190565b919290916001600160a01b0316803b15610769576131ab936000809460405196879586948593632142170760e11b855260048501612e4a565b03925af1801561314b576131bc5750565b611b0790611a62565b91936001600160a01b0392831693909190843b156107695760009460c493869286604051998a988997637921219560e11b89521660048801521660248601526044850152606484015260a060848401528160a48401525af1801561314b576131bc5750565b60026004541461323b576002600455565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b9190600092818452600a602052604060ff81862054166133b3576001600160a01b038281169081156133a25760055460101c168251627eeac760e11b8152602081806132d0898960048401613157565b0381855afa908115613398578891613363575b50156133525790818793923b1561334e5760648492845195869384926338a0be9360e21b84526004840152896024840152600160448401525af19081156133455750611b07949550613336575b506134c8565b61333f90611a62565b38613330565b513d87823e3d90fd5b8380fd5b8251631e9acf1760e31b8152600490fd5b90506020813d8211613390575b8161337d60209383611aa6565b8101031261338c5751386132e3565b8780fd5b3d9150613370565b84513d8a823e3d90fd5b825163867915ab60e01b8152600490fd5b51633e89440d60e21b8152600490fd5b6004821015610b605752565b9081546133db816123cf565b906040916133eb83519182611aa6565b818152809460208092019360009182528282209180955b8587106134125750505050505050565b825160a081016001600160401b03811182821017612b6157908691855261343d60ff875416826133c3565b6001868101548284015260028701546001600160a01b0316868301528551600388018054808352908752848720919283860192918891905b8083106134b15750505050918161349460019693600596950382611aa6565b606082015260048801546080820152815201940196019592613402565b835485528c97909401939281019291810191613475565b919080600052600860205260408060002091815190608080830183811060018060401b03821117611a755784528454835261350560018601611ac9565b6020840152600294600361351a8783016133cf565b918287870152015460608095015260005b81518110156136d15761353e81836126c3565b5180516004811015610b605761356f576020015161356a919061095e906001600160a01b038c16613076565b61352b565b80516004811015610b60576001036135a5578681015160209091015161356a929161095e91908c906001600160a01b03166130b3565b9391909294969784999699516004811015610b605789036136845782600052600b98896020528a600020856000526020528a6000205498808701519760005b60208901518110156136455789518c1015613634578061095e8f8d8f918e6136208f9761362f986136269460018060a01b03910151169561220d565b906126c3565b51913090613172565b6135e4565b8d51631e9acf1760e31b8152600490fd5b5095929a9199509650602061356a9394969b989b01519086600052602052876000208260005260205261367d8860002091825461220d565b90556124d5565b979694928491929499969951916004831015610b6057600361356a93146136ab57506124d5565b8781015185820151602090920151612ae59290918d9030906001600160a01b03166131c5565b505050939492505060207f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a9151926001845260018060a01b031692a3565b90613719826123cf565b6137266040519182611aa6565b8281528092613737601f19916123cf565b0190602036910137565b92919060ff60405187878237602081898101600181520301902054166138365761379e9160549184604051958693602085019860018060601b03199060601b16895260348501378201906034820152036034810184520182611aa6565b5190206000907b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b8252601c526137ec6137e4603c83206137de368787611c14565b90613971565b919091613872565b6001600160a01b031681526020819052604081205460ff1615613830575060209082604051938492833781016001815203019020600160ff19825416179055600190565b91505090565b60405162461bcd60e51b8152602060048201526014602482015273416c7265616479557365645369676e617475726560601b6044820152606490fd5b6005811015610b6057806138835750565b600181036138cb5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606490fd5b600281036139185760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461392157565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b90604181511460001461399f5761399b916020820151906060604084015193015160001a906139a9565b9091565b5050600090600290565b9291906fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311613a225791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15613a155781516001600160a01b03811615613a0f579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b90916001600160a01b0380831690811561050757613a4b856123af565b15613b9657600092858452600960205260409160ff8386205416613b8557868552600c6020528285205497600198898101809111612d0d57888752600c6020528487208054908b8201809211613b71575588875260086020526003858820015410613b605715613ada57505050505b838110613ac75750505050565b613ad59061095e84846134c8565b613aba565b8498979395506005949192945460101c1691823b15612b49578190608486518094819363d690ccc560e01b83528a60048401528b60248401528860448401521515968760648401525af1801561339857600080516020613d528339815191529596979850613b51575b5082519182526020820152a3565b613b5a90611a62565b38613b43565b8351630f0c37b960e11b8152600490fd5b634e487b7160e01b89526011600452602489fd5b8251636be9245d60e11b8152600490fd5b60405163224a1b1160e11b8152600490fd5b92939290916001600160a01b039182169190821561050757613bc9846123af565b15613b9657600095848752600960205260409260ff8489205416613cad578215613c9c57858852600c602052613c0283858a205461220d565b868952600c602052848920613c1885825461220d565b905586895260086020526003858a20015410613b6057879060055460101c1691823b15612b49578190608486518094819363d690ccc560e01b83528a60048401528b60248401528860448401521515968760648401525af1801561339857600080516020613d528339815191529596979850613b51575082519182526020820152a3565b835163162908e360e11b8152600490fd5b8351636be9245d60e11b8152600490fd5b90613cc891612444565b9190461490811591613cdd575b50612e075790565b6001600160a01b0316301415905038613cd556fe2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0de92eadb4de1de763eeedd9ccebd7087c81985f684bbab225db3364a6dfaedc53537472696e67733a20686578206c656e67746820696e73756666696369656e7469dff97591dfad68d690a0deccd16ef2aaf0b65205732bf647a9e5b129b7709994996c563abb815835b318c981fa050298066bd55a6db8b3a8c1aff30a38e7ef416363657373436f6e74726f6c3a206163636f756e74200000000000000000003b359cf0b4471a5de84269135285268e64ac56f52d3161392213003a780ad63be54362ebc35a09a11f005bffa399776ca5dcded14c79d46019659f1f227b6176ac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b089f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3fa2646970667358221220dfc9c8fb8fd21dafb395cbd5ece601c3efa062ab2d8a3fe3f62f513063f9a08f64736f6c6343000811003300000000000000000000000085f56764f58f595d08252b98942554bfb5eea390
Deployed Bytecode
0x608080604052600436101561001a575b50361561001857005b005b60003560e01c90816301ffc9a71461197057508063097ca482146119475780630dc0534a1461185a57806310eee73414611800578063150b7a021461179a578063248a9ca31461176b5780632f2ff15d146116ca57806336568abe146116385780633f4ba83a146115a4578063447a06f5146115375780634dd2f3461461150b57806354af8891146114c6578063564b81ef146114ab5780635c5245f7146114825780635c975abb1461145f5780635eac6239146113ef578063797c3635146113aa5780637a01c45c146112445780637b488727146111eb5780638456cb5914611191578063859ab73a146111525780638ce1f3911461112157806391d14854146110d45780639344b885146110135780639760750b14610f7957806399b20e0914610ee557806399b71c3d14610eb45780639a6674e514610e48578063a217fddf14610e2c578063ae169a5014610df8578063b3dc00fe14610db9578063b9afbc3414610d58578063bc197c8114610ccd578063c1e03728146109aa578063c32127c714610968578063c62e7f13146108ef578063ce4754c01461087d578063d539139314610854578063d547741f14610815578063e26882d5146107ed578063ec87621c146107c4578063f23a6e611461076e5763f8c8765e14610200573861000f565b3461076957608036600319011261076957610219611bb7565b610221611bcd565b610229611be3565b906064356001600160a01b03811690036107695760059283549260ff8460081c16159384809561075c575b8015610745575b156106e95760ff1981166001178655846106d8575b50336000908152600080516020613df2833981519152602052604090205460ff161561054e576001600160a01b038216928315801561053d575b801561052c575b8015610519575b61050757855462010000600160b01b03191660643560101b62010000600160b01b03161786556000848152600080516020613df283398151915260205260409020546103c7949060ff16156104c6575b6000818152600080516020613dd28339815191526020526040902054600080516020613db2833981519152919060ff1615610485575b50506001600160a01b03166000818152600080516020613d728339815191526020526040902054600080516020613e12833981519152919060ff1615610444575b50506001600160a01b03166000818152600080516020613d128339815191526020526040902054600080516020613e32833981519152919060ff1615610403575b505061235b565b6103cd57005b61ff001981541690557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1005b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a438806103c0565b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a4388061037f565b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a4388061033e565b6000818152600080516020613df283398151915260205260408120805460ff1916600117905533908290600080516020613cf28339815191528180a4610308565b60405163867915ab60e01b8152600490fd5b506064356001600160a01b0316156102b8565b506001600160a01b038216156102b1565b506001600160a01b038116156102aa565b6105573361222b565b60405190600061056683611a8b565b60428352602083019060603683378351156106c257603082538351600110156106c2576078602185015360415b6001811161066a5750610638576048610605926106149261063495604051958693600080516020613d9283398151915260208601526105dc815180926020603789019101611b6f565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611b6f565b01036028810184520182611aa6565b60405162461bcd60e51b8152602060048201529182916024830190611b92565b0390fd5b606460405162461bcd60e51b81526020600482015260206024820152600080516020613d328339815191526044820152fd5b90600f811660108110156106c2576f181899199a1a9b1b9c1cb0b131b232b360811b901a610698838761221a565b5360041c9080156106ac5760001901610593565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b61ffff191661010117855538610270565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b15801561025b5750600160ff82161461025b565b50600160ff821610610254565b600080fd5b346107695760a036600319011261076957610787611bb7565b50610790611bcd565b506084356001600160401b038111610769576107b09036906004016119dd565b505060405163f23a6e6160e01b8152602090f35b34610769576000366003190112610769576020604051600080516020613e128339815191528152f35b3461076957602036600319011261076957602061080b6004356123af565b6040519015158152f35b3461076957604036600319011261076957610018600435610834611bcd565b9080600052600260205261084f600160406000200154612085565b612184565b34610769576000366003190112610769576020604051600080516020613e328339815191528152f35b3461076957602036600319011261076957610896611bb7565b61089e611e5b565b6001600160a01b03166108b28115156122f5565b806000526000602052604060002060ff1981541690557fd03b7c074f2eae133be52f3724fb8f9864346d73a003157e313ca60b0ac9d76d600080a2005b3461076957604036600319011261076957610908611bb7565b6024356001600160401b03811161076957610927903690600401611c7f565b9190610931611caf565b610939612491565b60005b83811061094557005b8061095e610957610963938786613066565b3585613280565b6124d5565b61093c565b3461076957608036600319011261076957610018610984611bb7565b61098c611a19565b90610995611f70565b61099d612491565b6044359060243590613ba8565b34610769576020366003190112610769576004358060005260086020526109d76001604060002001611ac9565b9060005260086020526003604060002001546109f960026040600020016133cf565b918251610a05816123cf565b90610a136040519283611aa6565b808252610a22601f19916123cf565b01366020830137610a33845161370f565b8451610a3e816123cf565b90610a4c6040519283611aa6565b808252610a5b601f19916123cf565b01366020830137855190610a87610a71836123cf565b92610a7f6040519485611aa6565b8084526123cf565b60005b601f1982018110610cbc575050610aa1875161370f565b9460005b8851811015610b7657610ab8818a6126c3565b5151906004821015610b6057610ada610b5b92610ad5838a6126c3565b6133c3565b6020610ae6828c6126c3565b510151610af382886126c3565b526001600160a01b036040610b08838d6126c3565b51015116610b1682866126c3565b526060610b23828c6126c3565b510151610b3082876126c3565b52610b3b81866126c3565b506080610b48828c6126c3565b510151610b55828a6126c3565b526124d5565b610aa5565b634e487b7160e01b600052602160045260246000fd5b50919092610b959486918860405197889660e0885260e0880190611b92565b9060208701528581036040870152602080845192838152019301906000905b808210610c895750505090610bd0918582036060870152611c4b565b83810360808501526020808651928381520195019060005b818110610c675750505082840360a0840152815180855260208501946020808360051b8301019401956000915b838310610c34578680610c30888883820360c0850152611c4b565b0390f35b919395509193602080610c53600193601f198682030187528a51611c4b565b980193019301909287959396949296610c15565b82516001600160a01b0316875260209687019688965090920191600101610be8565b91809597509795979390929351906004821015610b60576020816001938293520195019201889694939291979597610bb4565b806060602080938701015201610a8a565b346107695760a036600319011261076957610ce6611bb7565b50610cef611bcd565b506001600160401b0360443581811161076957610d10903690600401611c7f565b505060643581811161076957610d2a903690600401611c7f565b505060843590811161076957610d449036906004016119dd565b505060405163bc197c8160e01b8152602090f35b60031960203682011261076957600435906001600160401b0382116107695760809082600401923603011261076957610d8f611caf565b610d98816125cc565b3410610da757610018906126d7565b604051631e9acf1760e31b8152600490fd5b3461076957602036600319011261076957600435600654811015610769576006600052600080516020613e528339815191520154604051908152602090f35b3461076957602036600319011261076957610e1161322a565b610e19612491565b610e2560043533613280565b6001600455005b3461076957600036600319011261076957602060405160008152f35b3461076957608036600319011261076957610e61611bb7565b6001600160401b0360443581811161076957610e819036906004016119dd565b9260643592831161076957602093610ea061080b9436906004016119dd565b939092610eab611e5b565b60243590613741565b3461076957602036600319011261076957600435600052600a602052602060ff604060002054166040519015158152f35b3461076957608036600319011261076957610efe611bb7565b6024356001600160401b03811161076957610f1d9036906004016119dd565b9060443591821515830361076957610f4d90610f37611a19565b92610f40611f70565b610f48612491565b613cbe565b9060005b8251811015610018578061095e8386610f6d610f7495886126c3565b5189613a2e565b610f51565b6020366003190112610769576004356001600160401b03811161076957610fa4903690600401611c7f565b90610fad611caf565b6000805b838110610fe757503410610da75760005b828110610fcb57005b8061095e610fdd610fe2938686613044565b6126d7565b610fc2565b9061100861100e91611002610ffd858888613044565b6125cc565b9061220d565b916124d5565b610fb1565b34610769576080366003190112610769576001600160401b0360043581811161076957611044903690600401611c7f565b916024359060443590811161076957611061903690600401611c7f565b919061106b611a19565b91611074611f70565b61107c612491565b8386036110c25760005b86811061108f57005b8061095e856110aa6110a56110bd958c8c613066565b6126af565b856110b6858b8a613066565b3591613ba8565b611086565b60405163251f56a160e21b8152600490fd5b34610769576040366003190112610769576110ed611bcd565b600435600052600260205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b34610769576020366003190112610769576004356000526009602052602060ff604060002054166040519015158152f35b34610769576020366003190112610769576001600160a01b03611173611bb7565b166000526000602052602060ff604060002054166040519015158152f35b34610769576000366003190112610769576111aa611caf565b6111b2612491565b600160ff1960035416176003557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b3461076957602036600319011261076957611204611bb7565b61120c611e5b565b6001600160a01b03811615610507576005805462010000600160b01b03191660109290921b62010000600160b01b0316919091179055005b346107695760a036600319011261076957600435600481101561076957611269611bcd565b90611272611be3565b6001600160401b039060643582811161076957611293903690600401611c7f565b949092608435908111610769576112ae903690600401611c7f565b9390956112b9611caf565b6001600160a01b0383811696909290871561050757806112e957505050505050156106c257610018913590613076565b9091929496506001819694961460001461131157505050156106c257610018933592166130b3565b6002819892969794939814600014611353575050501660005b84811061133357005b8061095e61134561134e938887613066565b35863086613172565b61132a565b60039097949193969295971461136557005b8484036110c25760009593959316925b85811015610018578061095e61138f6113a593898b613066565b3561139b838988613066565b35908530896131c5565b611375565b34610769576040366003190112610769576100186113c6611a0a565b6113ce611caf565b600435600052600a60205260406000209060ff801983541691151516179055565b34610769576020366003190112610769576004356001600160401b0381116107695761141f903690600401611c7f565b9061142861322a565b611430612491565b60005b828110611441576001600455005b8061095e61145361145a938686613066565b3533613280565b611433565b3461076957600036600319011261076957602060ff600354166040519015158152f35b346107695760203660031901126107695761001861149e611bb7565b6114a6611e5b565b61235b565b34610769576000366003190112610769576020604051468152f35b34610769576040366003190112610769576100186114e2611a0a565b6114ea611caf565b600435600052600960205260406000209060ff801983541691151516179055565b3461076957602036600319011261076957600435600052600c6020526020604060002054604051908152f35b34610769576020366003190112610769576004356001600160401b0381116107695761157b61156d610c309236906004016119dd565b90611576611e5b565b612444565b60409391935193849360018060a01b031684526020840152606060408401526060830190611c4b565b34610769576000366003190112610769576115bd611caf565b60035460ff8116156115fc5760ff19166003557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b3461076957604036600319011261076957611651611bcd565b336001600160a01b0382160361166d5761001890600435612184565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b34610769576040366003190112610769576004356116e6611bcd565b816000526002602052611700600160406000200154612085565b81600052600260205260406000209060018060a01b0316908160005260205260ff604060002054161561172f57005b8160005260026020526040600020816000526020526040600020600160ff198254161790553391600080516020613cf2833981519152600080a4005b346107695760203660031901126107695760043560005260026020526020600160406000200154604051908152f35b34610769576080366003190112610769576117b3611bb7565b506117bc611bcd565b506064356001600160401b0381116107695736602382011215610769576117ed903690602481600401359101611c14565b50604051630a85bd0160e11b8152602090f35b3461076957602036600319011261076957600435600052600860205260406000208054600361183160018401611ac9565b9201546118506040519384938452606060208501526060840190611b92565b9060408301520390f35b346107695760a0366003190112610769576001600160401b036004358181116107695761188b9036906004016119dd565b90611894611a0a565b92606435908111610769576118ad9036906004016119dd565b9290608435938415158503610769576118d3916118c861322a565b838560443533613741565b1561190f576118e491610f48612491565b60005b8151811015610e25578061095e848661190361190a95876126c3565b5133613a2e565b6118e7565b60405162461bcd60e51b815260206004820152601060248201526f496e76616c69645369676e617475726560801b6044820152606490fd5b34610769576000366003190112610769576020604051600080516020613db28339815191528152f35b34610769576020366003190112610769576004359063ffffffff60e01b821680920361076957602091630271189760e51b81149081156119b2575b5015158152f35b637965db0b60e01b8114915081156119cc575b50836119ab565b6301ffc9a760e01b149050836119c5565b9181601f84011215610769578235916001600160401b038311610769576020838186019501011161076957565b60243590811515820361076957565b60643590811515820361076957565b90600182811c92168015611a58575b6020831014611a4257565b634e487b7160e01b600052602260045260246000fd5b91607f1691611a37565b6001600160401b038111611a7557604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b03821117611a7557604052565b601f909101601f19168101906001600160401b03821190821017611a7557604052565b9060405191826000825492611add84611a28565b908184526001948581169081600014611b4c5750600114611b09575b5050611b0792500383611aa6565b565b9093915060005260209081600020936000915b818310611b34575050611b0793508201013880611af9565b85548884018501529485019487945091830191611b1c565b915050611b0794506020925060ff191682840152151560051b8201013880611af9565b60005b838110611b825750506000910152565b8181015183820152602001611b72565b90602091611bab81518092818552858086019101611b6f565b601f01601f1916010190565b600435906001600160a01b038216820361076957565b602435906001600160a01b038216820361076957565b604435906001600160a01b038216820361076957565b6001600160401b038111611a7557601f01601f191660200190565b929192611c2082611bf9565b91611c2e6040519384611aa6565b829481845281830111610769578281602093846000960137010152565b90815180825260208080930193019160005b828110611c6b575050505090565b835185529381019392810192600101611c5d565b9181601f84011215610769578235916001600160401b038311610769576020808501948460051b01011161076957565b336000908152600080516020613d7283398151915260209081526040808320549092600080516020613e128339815191529160ff1615611cef5750505050565b611cf83361222b565b91845190611d0582611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b818311611dd957505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b01036028810187520185611aa6565b5192839262461bcd60e51b845260048401526024830190611b92565b60648486519062461bcd60e51b82528060048301526024820152600080516020613d328339815191526044820152fd5b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a611e09858761221a565b5360041c928015611e1f57600019019190611d36565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b336000908152600080516020613dd283398151915260209081526040808320549092600080516020613db28339815191529160ff1615611e9b5750505050565b611ea43361222b565b91845190611eb182611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b818311611f2a57505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a611f5a858761221a565b5360041c928015611e1f57600019019190611ee2565b336000908152600080516020613d1283398151915260209081526040808320549092600080516020613e328339815191529160ff1615611fb05750505050565b611fb93361222b565b91845190611fc682611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b81831161203f57505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a61206f858761221a565b5360041c928015611e1f57600019019190611ff7565b60009080825260209060028252604092838120338252835260ff8482205416156120af5750505050565b6120b83361222b565b918451906120c582611a8b565b60428252848201926060368537825115611e475760308453825190600191821015611e475790607860218501536041915b81831161213e57505050611da9576048610634938693611d8d93611d7e9851988993600080516020613d928339815191528a8601526105dc815180928c603789019101611b6f565b909192600f81166010811015611e33576f181899199a1a9b1b9c1cb0b131b232b360811b901a61216e858761221a565b5360041c928015611e1f576000190191906120f6565b906000918083526002602052604083209160018060a01b03169182845260205260ff6040842054166121b557505050565b8083526002602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b818102929181159184041417156106ac57565b919082018092116106ac57565b9081518110156106c2570160200190565b60405190606082016001600160401b03811183821017611a7557604052602a82526020820160403682378251156106c2576030905381516001908110156106c257607860218401536029905b8082116122875750506106385790565b9091600f811660108110156122e0576f181899199a1a9b1b9c1cb0b131b232b360811b901a6122b6848661221a565b5360041c9180156122cb576000190190612277565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b156122fc57565b60405162461bcd60e51b815260206004820152603160248201527f45524357686974656c6973745369676e61747572653a207369676e657220697360448201527020746865207a65726f206164647265737360781b6064820152608490fd5b6001600160a01b031661236f8115156122f5565b8060005260006020526040600020600160ff198254161790557fa5d501ce281a3d4bc9e42f4423f9f117dcd0ea4d09ebcd151b60fb5daeab8fd0600080a2565b600052600760205260ff60406000205416156123ca57600190565b600090565b6001600160401b038111611a755760051b60200190565b81601f82011215610769578035916123fd836123cf565b9261240b6040519485611aa6565b808452602092838086019260051b820101928311610769578301905b828210612435575050505090565b81358152908301908301612427565b91908201906060838303126107695782356001600160a01b03811692908390036107695760408401356001600160401b038111610769576020916124899186016123e6565b929301359190565b60ff6003541661249d57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b60001981146106ac5760010190565b903590601e198136030182121561076957018035906001600160401b03821161076957602001918160051b3603831361076957565b903590609e1981360301821215610769570190565b908210156106c2576125459160051b810190612519565b90565b60a08136031261076957604051906001600160401b039060a0830182811184821017611a7557604052803560048110156107695783526020818101359084015260408101356001600160a01b03811681036107695760408401526060810135918211610769576125bd608092369083016123e6565b60608401520135608082015290565b600091825b604083016125df81856124e4565b9050821015612655576125ff826125f961260493876124e4565b9061252e565b612548565b8051600480821015612640575015612626575b50612621906124d5565b6125d1565b612621919460206126399201519061220d565b9390612617565b602190634e487b7160e01b6000525260246000fd5b5050916060612545920135906121fa565b903590601e198136030182121561076957018035906001600160401b0382116107695760200191813603831361076957565b8181106126a3575050565b60008155600101612698565b356001600160a01b03811681036107695790565b80518210156106c25760209160051b010190565b600091606082013515612e385760208201916126f38382612666565b9050158015612e22575b8015612e19575b612e075761271281356123af565b612df557835b604080830161272781856124e4565b9050831015612831576125ff836125f961274193876124e4565b90815191600492838110156127ff57612812575b8051838110156127ff5760028091146127be575b8151848110156127ab571415908161279e575b5061279157505061278c906124d5565b612718565b5163162908e360e11b8152fd5b602091500151153861277c565b634e487b7160e01b8a526021855260248afd5b60608201515180159081156127e3575b50156127695750505163b4fa3fb360e01b8152fd5b90506127f7606088013560208501516121fa565b1415386127ce565b634e487b7160e01b895260218452602489fd5b808201516001600160a01b031661275557505163867915ab60e01b8152fd5b5050509091813584526008602052604084209082358255612856600183019184612666565b906001600160401b038211612de15781906128718454611a28565b601f8111612da6575b508790601f8311600114612d40578892612d35575b50508160011b916000199060031b1c19161790555b6128b160408301836124e4565b90600160401b8211612d21576002830154826002850155808310612c88575b50600283018652602086208691805b848410612b7557505050505060608201356003919091015580358352600760205260408320805460ff19166001179055600654600160401b811015612b61576001810180600655811015612b4d57600684528135600080516020613e5283398151915290910155600554839060101c6001600160a01b0316803b15612b495781906024604051809481936338dc2d1b60e11b8352873560048401525af18015612b3e57612b2b575b50825b61299760408301836124e4565b9050811015612aff576129b46125ff826125f960408601866124e4565b80516004811015612aeb57600103612a2a579061095e612a12612a2593612a206129f460018060a01b0360408401511692602060608a01359101516121fa565b6040516323b872dd60e01b6020820152938491303360248501612e4a565b03601f198101845283611aa6565b612e6c565b61298a565b909181516004811015612aeb57600203612a905760408201516001600160a01b03169460609092019391805b85518051821015612a80579061095e612a7282612a7b946126c3565b5130338b613172565b612a56565b5050945091612a259193506124d5565b919080516004811015612aeb57906003612a25939214612ab1575b506124d5565b612ae59060018060a01b0360408201511690612adb608082015191602060608901359101516121fa565b91309033906131c5565b38612aab565b634e487b7160e01b86526021600452602486fd5b507fa67ce50963791bd746b56c6ccce13fdae9c9577f368a62d5a60a8157d3cfe33f90929192359180a2565b612b3790939193611a62565b9138612987565b6040513d86823e3d90fd5b5080fd5b634e487b7160e01b84526032600452602484fd5b634e487b7160e01b84526041600452602484fd5b612b7f8183612519565b600481351015612c8457835460ff191660ff82351617845560208101356001850155600284016001600160a01b03612bb9604084016126af565b82546001600160a01b0319169116179055612bd760608201826124e4565b906001600160401b038211612c7057600160401b8211612c70578b600387015483600389015583818110612c51575b505050600386018c5260208c208c5b838110612c3d57505050506020600192608060059301356004870155019301930192916128df565b600190602084359401938184015501612c15565b6020612c689360038b018152209182019101612698565b8b3883612c06565b634e487b7160e01b8c52604160045260248cfd5b8980fd5b6005818102048103612d0d576005838102048303612d0d57600284018752602087208360050281015b8260050282018110612cc45750506128d0565b8089600592558960018201558960028201556003810180548b825580612cf3575b505089600482015501612cb1565b612d06918c5260208c2090810190612698565b3880612ce5565b634e487b7160e01b87526011600452602487fd5b634e487b7160e01b86526041600452602486fd5b01359050388061288f565b84895260208920925090601f198416895b818110612d8e5750908460019594939210612d74575b505050811b0190556128a4565b0135600019600384901b60f8161c19169055388080612d67565b91936020600181928787013581550195019201612d51565b612dd190858a5260208a20601f850160051c81019160208610612dd7575b601f0160051c0190612698565b3861287a565b9091508190612dc4565b634e487b7160e01b87526041600452602487fd5b604051635ccf76fb60e11b8152600490fd5b60405163b4fa3fb360e01b8152600490fd5b50803515612704565b50612e3060408201826124e4565b9050156126fd565b60405163162908e360e11b8152600490fd5b6001600160a01b03918216815291166020820152604081019190915260600190565b604080516001600160a01b03929092169291908101906001600160401b03821181831017611a7557612ee2916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1612edc612f7b565b91612fab565b805191821591848315612f54575b505050905015612efd5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b919381809450010312612b4957820151908115158203612f78575080388084612ef0565b80fd5b3d15612fa6573d90612f8c82611bf9565b91612f9a6040519384611aa6565b82523d6000602084013e565b606090565b9192901561300d5750815115612fbf575090565b3b15612fc85790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156130205750805190602001fd5b60405162461bcd60e51b815260206004820152908190610634906024830190611b92565b91908110156106c25760051b81013590607e1981360301821215610769570190565b91908110156106c25760051b0190565b814710610da7576000918291829182916001600160a01b03165af1613099612f7b565b50156130a157565b6040516312171d8360e31b8152600490fd5b6040516370a0823160e01b81523060048201529192916020816024816001600160a01b0386165afa801561314b578391600091613117575b5010610da757612a20611b0793612a1260405194859263a9059cbb60e01b602085015260248401613157565b91506020823d8211613143575b8161313160209383611aa6565b81010312612f785750829051386130eb565b3d9150613124565b6040513d6000823e3d90fd5b6001600160a01b039091168152602081019190915260400190565b919290916001600160a01b0316803b15610769576131ab936000809460405196879586948593632142170760e11b855260048501612e4a565b03925af1801561314b576131bc5750565b611b0790611a62565b91936001600160a01b0392831693909190843b156107695760009460c493869286604051998a988997637921219560e11b89521660048801521660248601526044850152606484015260a060848401528160a48401525af1801561314b576131bc5750565b60026004541461323b576002600455565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b9190600092818452600a602052604060ff81862054166133b3576001600160a01b038281169081156133a25760055460101c168251627eeac760e11b8152602081806132d0898960048401613157565b0381855afa908115613398578891613363575b50156133525790818793923b1561334e5760648492845195869384926338a0be9360e21b84526004840152896024840152600160448401525af19081156133455750611b07949550613336575b506134c8565b61333f90611a62565b38613330565b513d87823e3d90fd5b8380fd5b8251631e9acf1760e31b8152600490fd5b90506020813d8211613390575b8161337d60209383611aa6565b8101031261338c5751386132e3565b8780fd5b3d9150613370565b84513d8a823e3d90fd5b825163867915ab60e01b8152600490fd5b51633e89440d60e21b8152600490fd5b6004821015610b605752565b9081546133db816123cf565b906040916133eb83519182611aa6565b818152809460208092019360009182528282209180955b8587106134125750505050505050565b825160a081016001600160401b03811182821017612b6157908691855261343d60ff875416826133c3565b6001868101548284015260028701546001600160a01b0316868301528551600388018054808352908752848720919283860192918891905b8083106134b15750505050918161349460019693600596950382611aa6565b606082015260048801546080820152815201940196019592613402565b835485528c97909401939281019291810191613475565b919080600052600860205260408060002091815190608080830183811060018060401b03821117611a755784528454835261350560018601611ac9565b6020840152600294600361351a8783016133cf565b918287870152015460608095015260005b81518110156136d15761353e81836126c3565b5180516004811015610b605761356f576020015161356a919061095e906001600160a01b038c16613076565b61352b565b80516004811015610b60576001036135a5578681015160209091015161356a929161095e91908c906001600160a01b03166130b3565b9391909294969784999699516004811015610b605789036136845782600052600b98896020528a600020856000526020528a6000205498808701519760005b60208901518110156136455789518c1015613634578061095e8f8d8f918e6136208f9761362f986136269460018060a01b03910151169561220d565b906126c3565b51913090613172565b6135e4565b8d51631e9acf1760e31b8152600490fd5b5095929a9199509650602061356a9394969b989b01519086600052602052876000208260005260205261367d8860002091825461220d565b90556124d5565b979694928491929499969951916004831015610b6057600361356a93146136ab57506124d5565b8781015185820151602090920151612ae59290918d9030906001600160a01b03166131c5565b505050939492505060207f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a9151926001845260018060a01b031692a3565b90613719826123cf565b6137266040519182611aa6565b8281528092613737601f19916123cf565b0190602036910137565b92919060ff60405187878237602081898101600181520301902054166138365761379e9160549184604051958693602085019860018060601b03199060601b16895260348501378201906034820152036034810184520182611aa6565b5190206000907b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b8252601c526137ec6137e4603c83206137de368787611c14565b90613971565b919091613872565b6001600160a01b031681526020819052604081205460ff1615613830575060209082604051938492833781016001815203019020600160ff19825416179055600190565b91505090565b60405162461bcd60e51b8152602060048201526014602482015273416c7265616479557365645369676e617475726560601b6044820152606490fd5b6005811015610b6057806138835750565b600181036138cb5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606490fd5b600281036139185760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b60031461392157565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b90604181511460001461399f5761399b916020820151906060604084015193015160001a906139a9565b9091565b5050600090600290565b9291906fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311613a225791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa15613a155781516001600160a01b03811615613a0f579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b90916001600160a01b0380831690811561050757613a4b856123af565b15613b9657600092858452600960205260409160ff8386205416613b8557868552600c6020528285205497600198898101809111612d0d57888752600c6020528487208054908b8201809211613b71575588875260086020526003858820015410613b605715613ada57505050505b838110613ac75750505050565b613ad59061095e84846134c8565b613aba565b8498979395506005949192945460101c1691823b15612b49578190608486518094819363d690ccc560e01b83528a60048401528b60248401528860448401521515968760648401525af1801561339857600080516020613d528339815191529596979850613b51575b5082519182526020820152a3565b613b5a90611a62565b38613b43565b8351630f0c37b960e11b8152600490fd5b634e487b7160e01b89526011600452602489fd5b8251636be9245d60e11b8152600490fd5b60405163224a1b1160e11b8152600490fd5b92939290916001600160a01b039182169190821561050757613bc9846123af565b15613b9657600095848752600960205260409260ff8489205416613cad578215613c9c57858852600c602052613c0283858a205461220d565b868952600c602052848920613c1885825461220d565b905586895260086020526003858a20015410613b6057879060055460101c1691823b15612b49578190608486518094819363d690ccc560e01b83528a60048401528b60248401528860448401521515968760648401525af1801561339857600080516020613d528339815191529596979850613b51575082519182526020820152a3565b835163162908e360e11b8152600490fd5b8351636be9245d60e11b8152600490fd5b90613cc891612444565b9190461490811591613cdd575b50612e075790565b6001600160a01b0316301415905038613cd556fe2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0de92eadb4de1de763eeedd9ccebd7087c81985f684bbab225db3364a6dfaedc53537472696e67733a20686578206c656e67746820696e73756666696369656e7469dff97591dfad68d690a0deccd16ef2aaf0b65205732bf647a9e5b129b7709994996c563abb815835b318c981fa050298066bd55a6db8b3a8c1aff30a38e7ef416363657373436f6e74726f6c3a206163636f756e74200000000000000000003b359cf0b4471a5de84269135285268e64ac56f52d3161392213003a780ad63be54362ebc35a09a11f005bffa399776ca5dcded14c79d46019659f1f227b6176ac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b089f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3fa2646970667358221220dfc9c8fb8fd21dafb395cbd5ece601c3efa062ab2d8a3fe3f62f513063f9a08f64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000085f56764f58f595d08252b98942554bfb5eea390
-----Decoded View---------------
Arg [0] : devWallet (address): 0x85f56764F58F595D08252b98942554bFB5Eea390
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000085f56764f58f595d08252b98942554bfb5eea390
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.