Skip to main content

P12Asset

P12Asset

contractURI

string contractURI

contract-level metadata uri, refer to https://docs.opensea.io/docs/contract-level-metadata

supply

mapping(uint256 => uint256) supply

current supply, how many a id are minted not.

maxSupply

mapping(uint256 => uint256) maxSupply

max supply, a token id has a max supply cap

idx

uint256 idx

token id index, which will increase one by one

_uris

mapping(uint256 => string) _uris

constructor

constructor(address owner_, string contractURI_) public

create

function create(uint256 amount, string newUri) public returns (uint256)

developer create an new asset

NameTypeDescription
amountuint256the new asset's totalSupply
newUristringmetadata uri of the asset
NameTypeDescription
[0]uint256uint256 new asset's tokenId

setUri

function setUri(uint256 id, string newUri) public

update token's metadata uri

NameTypeDescription
iduint256tokenId
newUristringnew uri

mint

function mint(address to, uint256 id, uint256 amount, bytes data) public

See {_mint}.

uri

function uri(uint256 id) public view virtual returns (string)

return token metadata uri

NameTypeDescription
iduint256token's id
NameTypeDescription
[0]stringuri metadata uri

setContractURI

function setContractURI(string newContractURI) public

set contract-level MetaData

NameTypeDescription
newContractURIstringnew Contract-level metadata uri

_setUri

function _setUri(uint256 id, string newUri) private

set token metadata uri

NameTypeDescription
iduint256token id
newUristringmetadata uri