ERC20SignatureMintable
Functionality available for contracts that implement the
IERC20
and
ISignatureMintERC20
interfaces.
Allows you to utilize signature-based minting of new tokens.
Generate
Generate a signature that a wallet address can use to mint the specified number of tokens.
This is typically an admin operation, where the owner of the contract generates a signature that allows another wallet to mint tokens.
var payload = new ERC20MintPayload("{{wallet_address}}", "{{quantity}}");
var signedPayload = await contract.ERC20.signature.Generate(payload);
Configuration
The information you provide to the generate
function outlines what the signature can be used for.
The quantity
and to
fields are required, while the rest are optional.
to
The wallet address that can use this signature to mint tokens.
This is to prevent another wallet from intercepting the signature and using it to mint tokens for themselves.
Must be a string
.
quantity
The number of tokens this signature can be used to mint.
Must be a string
Mint
Mint tokens from a previously generated signature (see generate
).
var payload = new ERC20MintPayload("{{wallet_address}}", "{{quantity}}");
var signedPayload = await contract.ERC20.signature.Generate(payload);
var data = await contract.ERC20.signature.Mint(signedPayload);
Configuration
Verify
Verify that a payload is correctly signed.
This allows you to provide a payload, and prove that it was valid and was generated by a wallet with permission to generate signatures.
If a payload is not valid, the mint
function will fail (even without this verification check),
but you can use this function to verify that the payload is valid before attempting to mint the tokens
if you want to show a more user-friendly error message.
var payload = new ERC20MintPayload("{{wallet_address}}", "{{quantity}}");
var signedPayload = await contract.ERC20.signature.Generate(payload);
var data = await contract.ERC20.signature.Verify(signedPayload);