Using Hardhat
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);
}
}async function main() {
const [deployer] = await ethers.getSigners();
console.log("Deploying the contracts with the account:",await deployer.getAddress());
console.log("Account balance:", (await deployer.getBalance()).toString());
const TEP1155NFT = await ethers.getContractFactory("TEP1155NFT");
const token = await TEP1155NFT.deploy();
await token.deployed({ gasLimit: 6000000 });
console.log("TEP1155NFT address:", token.address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});npm install --save-dev @nomiclabs/hardhat-ethers@^2.2.3 @nomiclabs/hardhat-waffle@^2.0.6 @openzeppelin/contracts@^5.0.2 @uniswap/v3-periphery@^1.0.1 bignumber.js@^9.1.2 dotenv@^16.4.5 ethereum-waffle@^4.0.10 [email protected] hardhat@^2.22.4// In .env file
YOUR_PRIVATE_KEY = "YOUR_PRIVATE_KEY"require("@nomiclabs/hardhat-waffle");
/** @type import('hardhat/config').HardhatUserConfig */
const privateKey = process.env.YOUR_PRIVATE_KEY;;
module.exports = {
solidity: {
version: "0.8.20",
settings: {
optimizer:{
enabled:true,
runs:1000,
details:{yul:false},
}
}
},
networks: {
taral: {
chainId: 4442,
url: "https://devnet-rpc1.tanledger.coms",
accounts: [privateKey],
},
},
};npx hardhat run scripts/deploy.js --network tan