0

我正在尝试创建标准 ERC1155 合约,如下所示:

contract Bbum is ERC1155, Ownable {
    uint256 public constant GOLD = 0;
    uint256 public constant THORS_HAMMER = 1;
    uint256 tokenCounter = 0;
    mapping(uint256 => string) private _uris;

//root uri with the specific for each token id
constructor()
    ERC1155(
        "https://gateway.pinata.cloud/ipfs/QmWAcb89p9kiELQQ36px9PSErVE97FVqSTBNpCWtB5WzxB/{id}.json"
    )
{
    _mint(msg.sender, GOLD, 5, "");
    _mint(msg.sender, THORS_HAMMER, 3, "");
    tokenCounter = 1;
}

function setURI(string memory newuri) public onlyOwner {
    _setURI(newuri);
}

function mint(
    address account,
    uint256 id,
    uint256 amount,
    bytes memory data
) public onlyOwner {
    _mint(account, id, amount, data);
}

function mintBatch(
    address to,
    uint256[] memory ids,
    uint256[] memory amounts,
    bytes memory data
) public onlyOwner {
    _mintBatch(to, ids, amounts, data);
}

}

在我使用元数据部署它后,出现错误。我知道可能需要覆盖 uri 函数或类似的东西。

两个令牌的元数据:

{
"name": "Backgammon",
"description": "An Amazing Backgammon board!",
"image": "ipfs://QmTh7fEL3iMfBfBwCTwsJzy9HodcNrxqBtWoSDkuMpHcFG?filename=Backgammon.png",
"attributes": [
    {
        "trait_type": "kind",
        "value": 100
    }
]

}

第二个

{
"name": "Spades",
"description": "An Amazing cards game!",
"image": "https://ipfs.io/ipfs/QmWfUiKjJYPs67jAycxYq8c8cJSPq31v1wLRhMcNbvaqDe?filename=spade.png",
"attributes": [
    {
        "trait_type": "card rarity",
        "value": 1
    }
]

}

4

0 回答 0