npx hardhat compile
npx hardhat --network rinkeby run scripts/deploy.js
node scripts/mint.js
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract SFFContract is ERC721, ERC721URIStorage, ERC721Burnable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("SFF NFT", "SFFNFT") {}
function safeMint(address to, string memory uri) public onlyOwner {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}
// The following functions are overrides required by Solidity.
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
}
...
const tx = {
'nonce': nonce,
'gas': 1000000,
'gasLimit': 2000000,
'data': nftContract.methods.burn(tokenId).encodeABI()
};
console.log("Burning token #" + tokenId + " ...");
const signPromise = web3.eth.accounts.signTransaction(tx, PRIVATE_KEY);
...
Действительно, прописал для транзакции поле to и удалось сжечь. Пойду причесывать и копаться с контрактом дальше.