0

I am trying to mint a ERC721 token using openzeppilin/contracts. It was working correctly, but later had to change the design. So now i am forced to use the msg.sender who is the minter to call the mint fuction.

I was trying to use msg.sender to call the mint function of a contract, will it work?

msg.sender.call.gas(1000000).value(1 ether)(abi.encodeWithSignature("mint(address,uint256)",to,tokenId));

It does execute with out any errors, but i cannot get the Transfer event.So i am sure it was never minted.

0

It is not possible for a contract to "impersonate" somebody else. The solution provided by OpenZeppelin is to setup your contract with the "minter" role.

Since your token inherit from ERC721Mintable the owner can call addMinter(contractAddress).

  • Thanks for the quick response – Sudeep Sagar Aug 10 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.