Character

Git Source

Inherits: ICharacter, ERC721Votes, ERC721URIStorage

State Variables

portal

CharacterPortal public immutable portal;

item

IItem public immutable item;

bank

IBank public immutable bank;

military

address public immutable military;

boss

address public immutable boss;

_charInfos

mapping(uint256 => CharInfo) public _charInfos;

Functions

constructor

constructor(IBank bank_, IItem item_, address lzEndpoint_, address military_, address boss_)
    ERC721("Character", "CHAR")
    EIP712("Character", "1");

onlyCharOwner

modifier onlyCharOwner(uint256 charId_);

onlyPortal

modifier onlyPortal();

onlyBoss

modifier onlyBoss();

_mint

function _mint(address to_, uint256 charId_, string memory tokenURI_) internal;

equipItems

function equipItems(uint256 charId_, uint256[] calldata itemIds_) external override onlyCharOwner(charId_);

carryGold

function carryGold(uint256 charId_, uint256 goldAmount_) external override onlyCharOwner(charId_);

dropGold

function dropGold(uint256 charId_, uint256 goldAmount_) external override onlyCharOwner(charId_);

sendFrom

function sendFrom(address from_, uint16 dstChainId_, address toAddress_, uint256 charId_, bytes memory adapterParams_)
    external
    payable
    override;

sendBatchFrom

function sendBatchFrom(
    address from_,
    uint16 dstChainId_,
    address toAddress_,
    uint256[] calldata charIds_,
    bytes memory adapterParams_
) external payable override;

creditTo

function creditTo(address toAddress_, uint256 tokenId_, bytes memory data_) external override onlyPortal;

getCharInfo

function getCharInfo(uint256 charId_) external view override returns (CharInfo memory, address);

supportsInterface

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC721, IERC165, ERC721URIStorage)
    returns (bool);

levelUp

function levelUp(uint256 charId_) external override onlyBoss;

_validateCharOwner

function _validateCharOwner(uint256 charId_) internal view;

_deleteCharInfo

function _deleteCharInfo(uint256 charId_) internal;

_afterTokenTransfer

function _afterTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)
    internal
    override(ERC721Votes, ERC721);

_burn

function _burn(uint256 tokenId) internal override(ERC721URIStorage, ERC721);

tokenURI

function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory);