Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions assets/erc721.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ contract {{.ContractName}} is ERC721PresetMinterPauserAutoId {
// This allows the minter to update the tokenURI after it's been minted.
// To disable this, delete this function.
function setTokenURI(uint256 tokenId, string memory tokenURI) public {
require(hasRole(MINTER_ROLE, _msgSender()), "web3 CLI: must have minter role to update tokenURI");
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "web3 CLI: must have admin role to update tokenURI");

_setTokenURI(tokenId, tokenURI);
}

function setBaseURI(string memory baseURI) public {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "web3 CLI: must have admin role to update tokenURI");

_setBaseURI(baseURI);
}
}`

const ERC721ABI = `[
Expand Down Expand Up @@ -362,5 +368,36 @@ const ERC721ABI = `[
],
"name": "Approval",
"type": "event"
}
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "string",
"name": "tokenURI",
"type": "string"
}
],
"name": "setTokenURI",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "baseURI",
"type": "string"
}
],
"name": "setBaseURI",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]`