Using Truffle
Last updated
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract TEP1155NFT is ERC1155, Ownable {
constructor(address initialOwner) ERC1155("") Ownable(initialOwner) {}
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);
}
}truffle compileconst TEP1155NFT = artifacts.require("TEP1155NFT");
module.exports = function(deployer) {
deployer.deploy(TEP1155NFT);
};npm install truffle-hdwallet-provider dotenv// In .env file
YOUR_PRIVATE_KEY = "YOUR_PRIVATE_KEY"
const HDWalletProvider = require("truffle-hdwallet-provider");
require("dotenv").config();
const mnemonic = process.env.YOUR_PRIVATE_KEY;
module.exports = {
networks: {
taral: {
provider: () => new HDWalletProvider(mnemonic,"devnet-rpc1.tanledger.com"),
network_id: 4442,
chainId:4442
}
},
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
version: "0.8.20", // Fetch exact version from solc-bin (default: truffle's version)
}
},
};truffle migrate --network tan