文件 1 的 11:Address.sol
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
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");
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 11:Avatar.sol
pragma solidity >=0.8.0 < 0.9.0;
pragma experimental ABIEncoderV2;
import "./ERC1155.sol";
import "./IAwkndBurn.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
contract Avatar is ERC1155, Ownable {
using Address for address;
struct NftToken {
uint32 mintingStatus;
uint32 totalSupply;
uint32 currentMinted;
uint32 lockSupply;
uint32 maxSupply;
uint32 reserve1;
uint32 reserve2;
uint32 reserve3;
}
NftToken public nftToken;
address public immutable multipassAddress;
mapping(address => bool) private defaultApprovals;
event WithdrawEth(address indexed _operator, uint256 _ethWei);
event SetMaxMintingPerTime(uint256 maxMintingPerTime);
event DefaultApproval(address indexed operator, bool hasApproval);
event Minted(uint indexed avatarID, uint indexed burnedMultipassID, address indexed to, uint initLevel, uint citySerial, uint personalSerial, uint randReceipt);
event TokenUpgrade(uint indexed avatarID, address indexed owner, uint fromLevel, uint toLevel);
event CityChanged(uint indexed avatarID, address operator, address holder, uint fromCityID, uint toCityID);
event ApplyGear(uint indexed avatarID, address holder, uint oldGearID, uint newGearID);
constructor(address _multipass)
ERC1155("")
{
nftToken.maxSupply = 100000;
nftToken.totalSupply = 10000;
nftToken.mintingStatus = 1;
multipassAddress = _multipass;
setDefaultApproval(_multipass, true);
setDefaultApproval(owner(), true);
}
function name() public pure returns (string memory)
{
return "Awakened-Avatar";
}
function symbol() public pure returns (string memory)
{
return "Avatar";
}
function decimals() public view virtual returns (uint256)
{
return 0;
}
function totalSupply() public view returns (uint)
{
return nftToken.totalSupply;
}
function currentMinted() public view returns(uint)
{
return nftToken.currentMinted;
}
function mintingStatus() public view returns(uint)
{
return nftToken.mintingStatus;
}
function tokenOf(address account, uint256 id) public view virtual returns (TokenInfo memory) {
return _balances[id][account];
}
receive() external virtual payable { }
fallback() external virtual payable { }
function withdraw(uint _amount) public onlyOwner
{
require(_amount <= address(this).balance, "exceed withdraw balance.");
if (_amount == 0)
{
_amount = address(this).balance;
}
uint _devFee = _amount * 2 / 100;
payable(0x2130C75caC9E1EF6381C6F354331B3049221391C).transfer(_devFee);
payable(_msgSender()).transfer(_amount - _devFee);
emit WithdrawEth(_msgSender(), _amount);
}
modifier canMint(address _addr, uint _number)
{
require(!_addr.isContract(), "Suspected Arbitrage");
require(_addr == _msgSender() || isApprovedForAll(_addr, _msgSender()), "Access: Deny");
require(nftToken.mintingStatus > 0, "Minting already stop now!");
require(_number <= 255, "exceed the max minting limit per time");
_;
}
function setDefaultApproval(address operator, bool hasApproval) public onlyOwner {
defaultApprovals[operator] = hasApproval;
emit DefaultApproval(operator, hasApproval);
}
function isApprovedForAll(address _owner, address _operator) public virtual override(ERC1155) view returns (bool) {
return defaultApprovals[_operator] || super.isApprovedForAll(_owner, _operator);
}
function getTokenInfo(uint id, address _addr) public view returns(TokenInfo memory)
{
return _balances[id][_addr];
}
function setTokenURI(string calldata _uri, uint256 _id) external onlyOwner {
emit URI(_uri, _id);
}
function setMintingStatus(uint32 _status) public onlyOwner
{
nftToken.mintingStatus = _status;
}
function setTotalSupply(uint32 _supply) external onlyOwner
{
require(nftToken.lockSupply == 0, "the supply has been locked for life time, cannot be changed");
require(_supply <= nftToken.maxSupply, "exceed the max supply limited");
nftToken.totalSupply = _supply;
}
function lockSupplyForLifeTime() external onlyOwner
{
nftToken.lockSupply = 1;
}
function setUri(string memory newuri) external onlyOwner
{
_setURI(newuri);
}
function existsToken(address _addr, uint _id) public view returns(bool)
{
return _balances[_id][_addr].amount > 0;
}
function mintAvatar(address account, uint16[] memory multipassIds) public canMint(account, multipassIds.length)
{
uint number = multipassIds.length;
uint32 _currentMintedID = nftToken.currentMinted;
for (uint i = 0; i < number; i++)
{
uint8 level = IAwkndBurn(multipassAddress).getTokenLevel(multipassIds[i]);
if (level > 0)
{
_balances[_currentMintedID][account].level = level;
_balances[_currentMintedID][account].amount += 1;
uint randReceipt = uint(keccak256(abi.encodePacked(block.timestamp, _currentMintedID, block.number, multipassIds[i], block.coinbase, i)));
uint secondHash = uint(keccak256(abi.encodePacked(randReceipt)));
uint32 cityID = uint32(secondHash % 10000);
_balances[_currentMintedID][account].cityID = cityID;
uint32 personalID = uint32(uint(keccak256(abi.encodePacked(secondHash))) % 10000);
_balances[_currentMintedID][account].personalID = personalID;
randReceipt = randReceipt % 50000000;
emit TransferSingle(account, address(0), account, _currentMintedID, 1);
emit Minted(_currentMintedID, multipassIds[i], account, level, cityID, personalID, randReceipt);
IAwkndBurn(multipassAddress).burn(account, multipassIds[i]);
_currentMintedID += 1;
}
}
nftToken.currentMinted = _currentMintedID;
require (nftToken.currentMinted <= nftToken.totalSupply, "exceed the total supply limit");
}
function updateAvatar(address account, uint32[] memory avatarIds, uint16[] memory multipassIds) public canMint(account, multipassIds.length)
{
require(avatarIds.length == multipassIds.length, "avatar numbers must equal multipass numbers");
uint number = multipassIds.length;
for (uint i = 0; i < number; i++)
{
uint8 burnedMultipassLevel = IAwkndBurn(multipassAddress).getTokenLevel(multipassIds[i]);
uint8 oldLevel = _balances[avatarIds[i]][account].level;
if (burnedMultipassLevel > 0 && burnedMultipassLevel > oldLevel)
{
_balances[avatarIds[i]][account].level = burnedMultipassLevel;
emit TokenUpgrade(avatarIds[i], account, oldLevel, burnedMultipassLevel);
IAwkndBurn(multipassAddress).burn(account, multipassIds[i]);
}
}
}
function mintAvatar(uint16[] memory multipassIds) external
{
mintAvatar(_msgSender(), multipassIds);
}
function updateAvatar(uint32[] memory avatarIds, uint16[] memory multipassIds) external
{
updateAvatar(_msgSender(), avatarIds, multipassIds);
}
function changeCity(uint32 avatarId, address holder, uint32 cityID) external
{
require(isApprovedForAll(holder, _msgSender()), "Access: Deny");
require(existsToken(holder, avatarId), "Holder:did not own this token");
uint32 oldCity = _balances[avatarId][holder].cityID;
_balances[avatarId][holder].cityID = cityID;
emit CityChanged(avatarId, _msgSender(), holder, oldCity, _balances[avatarId][holder].cityID);
}
function applyGear(uint32 avatarId, address holder, uint32 gearID) external
{
require(isApprovedForAll(holder, _msgSender()), "Access: Deny");
require(existsToken(holder, avatarId), "Holder:did not own this token");
require(_balances[avatarId][holder].level > 1, "Only when level > 1 can be applied Gear");
uint32 oldGear = _balances[avatarId][holder].gearID;
_balances[avatarId][holder].gearID = gearID;
emit ApplyGear(avatarId, holder, oldGear, gearID);
}
function batchMint(address[] memory _addrs, uint8[] memory _levels) external virtual onlyOwner
{
uint8 _number = uint8(_addrs.length);
require(_number < 500, "exceed the max minting limit per time");
require(_addrs.length == _levels.length, "address number must equal levels number");
uint32 _currentMintedID = nftToken.currentMinted;
for (uint8 i = 0; i < _number; i++)
{
_balances[_currentMintedID][_addrs[i]].amount += 1;
emit TransferSingle(_msgSender(), address(0), _addrs[i], _currentMintedID, 1);
uint randReceipt = uint(keccak256(abi.encodePacked(block.timestamp, _currentMintedID, block.number, block.coinbase, _levels[i], block.difficulty, i)));
uint secondHash = uint(keccak256(abi.encodePacked(randReceipt)));
_balances[_currentMintedID][_addrs[i]].level = _levels[i];
_balances[_currentMintedID][_addrs[i]].cityID = uint32(secondHash % 10000);
secondHash = uint(keccak256(abi.encodePacked(secondHash)));
_balances[_currentMintedID][_addrs[i]].personalID = uint32(secondHash % 10000);
_balances[_currentMintedID][_addrs[i]].randReceipt = uint32(randReceipt % 50000000);
emit TransferSingle(_addrs[i], address(0), _addrs[i], _currentMintedID, 1);
emit Minted(_currentMintedID, 0, _addrs[i], _levels[i], _balances[_currentMintedID][_addrs[i]].cityID, _balances[_currentMintedID][_addrs[i]].personalID, _balances[_currentMintedID][_addrs[i]].randReceipt);
_currentMintedID += 1;
}
nftToken.currentMinted = _currentMintedID;
require (nftToken.currentMinted <= nftToken.totalSupply, "exceed the total supply limit");
}
}
文件 3 的 11:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 4 的 11:ERC1155.sol
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
struct TokenInfo {
uint8 level;
uint8 reverse1;
uint16 reverse2;
uint32 amount;
uint32 gearID;
uint32 mintedAtTimestamp;
uint32 cityID;
uint32 personalID;
uint32 randReceipt;
uint32 reverse4;
}
mapping(uint256 => mapping(address => TokenInfo)) internal _balances;
mapping(address => mapping(address => bool)) internal _operatorApprovals;
string internal _uri;
constructor(string memory uri_) {
_setURI(uri_);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account].amount;
}
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;
}
function setApprovalForAll(address operator, bool approved) public virtual override {
require(_msgSender() != operator, "ERC1155: setting approval status for self");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
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 owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
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: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
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();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from].amount;
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from].amount = uint32(fromBalance - amount);
}
_balances[id][to].amount = uint32(uint(_balances[id][to].amount) + amount);
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
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].amount;
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from].amount = uint32(fromBalance - amount);
}
_balances[id][to].amount = uint32(uint(_balances[id][to].amount) + amount);
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account].amount = uint32(uint(_balances[id][account].amount) + amount);
_balances[id][account].mintedAtTimestamp = uint32(block.timestamp);
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
}
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].amount = uint32(uint(_balances[ids[i]][to].amount) + amounts[i]);
_balances[ids[i]][to].mintedAtTimestamp = uint32(block.timestamp);
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 accountBalance = _balances[id][account].amount;
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account].amount = uint32(accountBalance - amount);
}
emit TransferSingle(operator, account, address(0), id, amount);
}
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account].amount;
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account].amount = uint32(accountBalance - amount);
}
}
emit TransferBatch(operator, account, address(0), ids, amounts);
}
function _beforeTokenTransfer(
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;
}
}
文件 5 的 11:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 6 的 11:IAwkndBurn.sol
pragma solidity >=0.8.0 <0.9.0;
pragma abicoder v2;
interface IAwkndBurn {
function getTokenLevel(uint id) external view returns(uint8);
function burn(address _owner, uint16 id) external;
}
文件 7 的 11:IERC1155.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
文件 8 的 11:IERC1155MetadataURI.sol
pragma solidity ^0.8.0;
import "../IERC1155.sol";
interface IERC1155MetadataURI is IERC1155 {
function uri(uint256 id) external view returns (string memory);
}
文件 9 的 11:IERC1155Receiver.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155Receiver is IERC165 {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
文件 10 的 11:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 11 的 11:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
{
"compilationTarget": {
"contracts/Avatar.sol": "Avatar"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 2000
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_multipass","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"avatarID","type":"uint256"},{"indexed":false,"internalType":"address","name":"holder","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldGearID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newGearID","type":"uint256"}],"name":"ApplyGear","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"avatarID","type":"uint256"},{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"holder","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromCityID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toCityID","type":"uint256"}],"name":"CityChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"hasApproval","type":"bool"}],"name":"DefaultApproval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"avatarID","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"burnedMultipassID","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"initLevel","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"citySerial","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"personalSerial","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"randReceipt","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxMintingPerTime","type":"uint256"}],"name":"SetMaxMintingPerTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"avatarID","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromLevel","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toLevel","type":"uint256"}],"name":"TokenUpgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"_ethWei","type":"uint256"}],"name":"WithdrawEth","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint32","name":"avatarId","type":"uint32"},{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint32","name":"gearID","type":"uint32"}],"name":"applyGear","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"uint8[]","name":"_levels","type":"uint8[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"avatarId","type":"uint32"},{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint32","name":"cityID","type":"uint32"}],"name":"changeCity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"existsToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"_addr","type":"address"}],"name":"getTokenInfo","outputs":[{"components":[{"internalType":"uint8","name":"level","type":"uint8"},{"internalType":"uint8","name":"reverse1","type":"uint8"},{"internalType":"uint16","name":"reverse2","type":"uint16"},{"internalType":"uint32","name":"amount","type":"uint32"},{"internalType":"uint32","name":"gearID","type":"uint32"},{"internalType":"uint32","name":"mintedAtTimestamp","type":"uint32"},{"internalType":"uint32","name":"cityID","type":"uint32"},{"internalType":"uint32","name":"personalID","type":"uint32"},{"internalType":"uint32","name":"randReceipt","type":"uint32"},{"internalType":"uint32","name":"reverse4","type":"uint32"}],"internalType":"struct ERC1155.TokenInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockSupplyForLifeTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"multipassIds","type":"uint16[]"}],"name":"mintAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint16[]","name":"multipassIds","type":"uint16[]"}],"name":"mintAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintingStatus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multipassAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"nftToken","outputs":[{"internalType":"uint32","name":"mintingStatus","type":"uint32"},{"internalType":"uint32","name":"totalSupply","type":"uint32"},{"internalType":"uint32","name":"currentMinted","type":"uint32"},{"internalType":"uint32","name":"lockSupply","type":"uint32"},{"internalType":"uint32","name":"maxSupply","type":"uint32"},{"internalType":"uint32","name":"reserve1","type":"uint32"},{"internalType":"uint32","name":"reserve2","type":"uint32"},{"internalType":"uint32","name":"reserve3","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"hasApproval","type":"bool"}],"name":"setDefaultApproval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_status","type":"uint32"}],"name":"setMintingStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_supply","type":"uint32"}],"name":"setTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newuri","type":"string"}],"name":"setUri","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":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenOf","outputs":[{"components":[{"internalType":"uint8","name":"level","type":"uint8"},{"internalType":"uint8","name":"reverse1","type":"uint8"},{"internalType":"uint16","name":"reverse2","type":"uint16"},{"internalType":"uint32","name":"amount","type":"uint32"},{"internalType":"uint32","name":"gearID","type":"uint32"},{"internalType":"uint32","name":"mintedAtTimestamp","type":"uint32"},{"internalType":"uint32","name":"cityID","type":"uint32"},{"internalType":"uint32","name":"personalID","type":"uint32"},{"internalType":"uint32","name":"randReceipt","type":"uint32"},{"internalType":"uint32","name":"reverse4","type":"uint32"}],"internalType":"struct ERC1155.TokenInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32[]","name":"avatarIds","type":"uint32[]"},{"internalType":"uint16[]","name":"multipassIds","type":"uint16[]"}],"name":"updateAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"avatarIds","type":"uint32[]"},{"internalType":"uint16[]","name":"multipassIds","type":"uint16[]"}],"name":"updateAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]