A standard ERC20 token that users receive when they redeem vouchers.
The RedemptionToken is a standard ERC20 token that represents the actual value or reward that users receive when they redeem their vouchers. Unlike the vouchers, redemption tokens are fully transferable and can be used within the ecosystem for purchases, access, or other benefits.
0x8f71a7503284c69eb200605b5ab11fabc555c865
Initializes the token contract with a name, symbol, and initial owner.
_name
- Token name_symbol
- Token symbol_initialOwner
- Initial owner addressMints new tokens to a specified account.
to
- Recipient of the tokensamount
- Amount of tokens to mintOnly callable by the contract owner
Burns tokens from the caller's account.
amount
- Amount of tokens to burnBurns tokens from a specified account (requires approval).
account
- Account to burn fromamount
- Amount of tokens to burnThe caller must have allowance for the account's tokens
Adds a new address to the list of authorized minters.
minter
- Address to add as a minterOnly callable by the contract owner
Removes an address from the list of authorized minters.
minter
- Address to remove as a minterOnly callable by the contract owner
import { ethers } from "ethers";
// Connect to the contract
const tokenAddress = "0x8f71a7503284c69eb200605b5ab11fabc555c865";
const tokenABI = ["function balanceOf(address owner) view returns (uint256)"];
const provider = new ethers.providers.Web3Provider(window.ethereum);
const tokenContract = new ethers.Contract(tokenAddress, tokenABI, provider);
// Get the user's address
await provider.send("eth_requestAccounts", []);
const userAddress = await provider.getSigner().getAddress();
// Check the token balance
const balance = await tokenContract.balanceOf(userAddress);
console.log("Token Balance:", ethers.utils.formatUnits(balance, 18));
import { ethers } from "ethers";
// Connect to the contract
const tokenAddress = "0x8f71a7503284c69eb200605b5ab11fabc555c865";
const tokenABI = ["function transfer(address to, uint256 amount) returns (bool)"];
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const tokenContract = new ethers.Contract(tokenAddress, tokenABI, signer);
// Transfer tokens to another address
const recipientAddress = "0x..."; // Recipient address
const amount = ethers.utils.parseUnits("10", 18); // 10 tokens
try {
const tx = await tokenContract.transfer(recipientAddress, amount);
await tx.wait();
console.log("Tokens transferred successfully!");
} catch (error) {
console.error("Error transferring tokens:", error);
}
The ability to mint new tokens is a powerful capability. Ensure that minter addresses are secure and that minting is properly controlled to prevent inflation.
When approving tokens for spending by other contracts, be cautious about the amount approved. Consider using increaseAllowance and decreaseAllowance instead of approve when possible.