Forges
Overview of Forges
A Forge is an entity for minting Assets. An account can possess multiple forges, and as many as they deem necessary.
Accounts may want multiple forges as a way to segregate which sets of assets are supported by which games.
Creating a Forge
To create a forge, users can run the command:
await api.tx.forges.createForge().signAndSend(keypair, result => {console.log(JSON.stringify(result))})
This will create a new forge, and for the current testnet, take_copter, this will cost 100 HME to execute. The HME will be divided amongst the validators and the community pool.
The corresponding logs will also be returned.
{"events":[],"status":{"Ready":null}}
{"events":[],"status":{"Broadcast":["12D3KooWN9LGk4nEAZCMA67ioxF4yCe7au7tMq7R6uJDPVxYwBDm"]}}
{
"dispatchInfo": {
"weight": 510394471,
"class": "Normal",
"paysFee": "Yes"
},
"events": [
{
"phase": {
"ApplyExtrinsic": 1
},
"event": {
"index": "0x0003",
"data": [
"SVDhDxQbbgqUyP7ZdUunYN9KPKEUbxHFrf5UsaF1MwhR9wpQ"
]
},
"topics": [
]
},
{
"phase": {
"ApplyExtrinsic": 1
},
"event": {
"index": "0x0400",
"data": [
"SVDhDxQbbgqUyP7ZdUunYN9KPKEUbxHFrf5UsaF1MwhR9wpQ",
10000000000
]
},
"topics": [
]
},
{
"phase": {
"ApplyExtrinsic": 1
},
"event": {
"index": "0x1600",
"data": [
46,
"SY3GFws1bxSiXmS6Zn5HgiPiguBhN8r4fKxvgdMux84K1EZm"
]
},
"topics": [
]
},
{
"phase": {
"ApplyExtrinsic": 1
},
"event": {
"index": "0x0906",
"data": [
185600000
]
},
"topics": [
]
},
{
"phase": {
"ApplyExtrinsic": 1
},
"event": {
"index": "0x0000",
"data": [
{
"weight": 510394471,
"class": "Normal",
"paysFee": "Yes"
}
]
},
"topics": [
]
}
],
"status": {
"InBlock": "0x3f15607eb788372c74a37f5a4670de906017dbbb2c6ebde171359e2849cdbf74"
}
}
Assuming that you submitted using the wallet SY3GFws1bxSiXmS6Zn5HgiPiguBhN8r4fKxvgdMux84K1EZm, you can find the id of newly created forge in the logs by searching for it. In the example above, 46 is the id of the forge.
"event":
{
"index": "0x1600",
"data": [
46,
"SY3GFws1bxSiXmS6Zn5HgiPiguBhN8r4fKxvgdMux84K1EZm"
]
}
Creating AssetKinds
Before starting to create new assets, we need to create new assetKind as the template for them.
await api.tx.forges.createAssetKind(forgeId, assetKindId, ipfsHash, alternatveDataUri).signAndSend(keypair , result => {console.log(JSON.stringify(result))})
Creating Assets
Once the Forge and AssetKinds are created, assets can be created with the following command:
await api.tx.forges.createAsset(destination, forgeId, assetKindId, metadata, result => {console.log(JSON.stringify(result))})
Royalties
As a reward mechanism to forge owner, whenevenr any assets created by the forge are transferred through auction market, the forge owner will receive some of the auction price as royalty.
//#TODO: We can show the royalty section in MyForge page in future.