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
Name | Type | Description |
---|---|---|
amount | uint256 | the new asset's totalSupply |
newUri | string | metadata uri of the asset |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 new asset's tokenId |
setUri
function setUri(uint256 id, string newUri) public
update token's metadata uri
Name | Type | Description |
---|---|---|
id | uint256 | tokenId |
newUri | string | new 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
Name | Type | Description |
---|---|---|
id | uint256 | token's id |
Name | Type | Description |
---|---|---|
[0] | string | uri metadata uri |
setContractURI
function setContractURI(string newContractURI) public
set contract-level MetaData
Name | Type | Description |
---|---|---|
newContractURI | string | new Contract-level metadata uri |
_setUri
function _setUri(uint256 id, string newUri) private
set token metadata uri
Name | Type | Description |
---|---|---|
id | uint256 | token id |
newUri | string | metadata uri |