Skip to content

Commit

Permalink
Erc1155 dapp interaction (#212)
Browse files Browse the repository at this point in the history
* Add ERC1155 contract example

* Add ERC1155 bytecode and abi.

* Add ERC1155 frontend interactions.

* Add ERC1155 undisable condition for deployed contracts.

* Add setURI public method to chang default uri.
  • Loading branch information
tmashuang authored Feb 22, 2023
1 parent 9a91811 commit 8a07fee
Show file tree
Hide file tree
Showing 4 changed files with 655 additions and 2 deletions.
26 changes: 26 additions & 0 deletions contracts/ERC1155Example.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract ERC1155Example is ERC1155, Ownable {
string public constant name = "ERC1155";

constructor() ERC1155("ipfs://bafybeidxfmwycgzcp4v2togflpqh2gnibuexjy4m4qqwxp7nh3jx5zlh4y/") {
}

function uri(uint256 _tokenid) override public view returns (string memory) {
return string(abi.encodePacked(super.uri(_tokenid), Strings.toString(_tokenid), ".json"));
}


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

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

0 comments on commit 8a07fee

Please sign in to comment.