LoyalSparkERC20 is an extended ERC20 token implementation with loyalty program management functions, including mint, burn, pause, and activity status.
Official project website: https://loyalspark.online
- LoyaltyTokenFactory:
0x5F3DdBa12580CFdc6016258774cCc19C4250dA80 - LoyalSparkERC20 (Implementation):
0xe6BA426C9c51281B929a17444De02c65815E27C3 - Chain ID:
8453(Base Mainnet)
Returns the token balance at the specified address.
Example:
const balance = await tokenContract.balanceOf(userAddress);Transfers tokens to the specified address.
Example:
await tokenContract.transfer(recipientAddress, ethers.parseUnits("10", 18));Allows the specified address to spend tokens on behalf of the owner.
Example:
await tokenContract.approve(spenderAddress, ethers.parseUnits("100", 18));Returns the amount of tokens that spender can spend on behalf of owner.
Example:
const allowance = await tokenContract.allowance(ownerAddress, spenderAddress);Transfers tokens from one address to another (requires prior approve).
Example:
await tokenContract.transferFrom(fromAddress, toAddress, ethers.parseUnits("50", 18));Returns the token name.
Returns the token symbol.
Returns the number of decimal places (typically 18).
Returns the total supply of issued tokens.
Mints new tokens to the specified address.
Restrictions:
- Can only be called by the owner (merchant)
- Requires active minting status (
isMintingActive == true)
Parameters:
account- Token recipient addressamount- Token amount (in wei, i.e., with 18 decimals)
Example:
// Mint 100 tokens
await tokenContract.mint(customerAddress, ethers.parseUnits("100", 18));Burns (destroys) tokens from the specified address.
Restrictions:
- Can only be called by the owner (merchant)
- Does not require
approvefrom token holder
Parameters:
account- Address from which tokens are burnedamount- Amount of tokens to burn
Usage: Used when deleting a loyalty program to burn all existing tokens.
Example:
// Burn all user tokens
await tokenContract.burn(customerAddress, balance);Enables the ability to mint new tokens.
Restrictions:
- Owner only
Example:
await tokenContract.enableMinting();Disables the ability to mint new tokens.
Restrictions:
- Owner only
Example:
await tokenContract.disableMinting();Pauses token usage (transfers, reward activation).
Restrictions:
- Owner only
Effects:
- All
transferandtransferFromcalls will be rejected - Tokens remain in balance but cannot be used
Example:
await tokenContract.pauseUtility();Resumes token usage.
Restrictions:
- Owner only
Example:
await tokenContract.unpauseUtility();Checks if token minting is active.
Returns:
true- minting is allowedfalse- minting is blocked
Example:
const isActive = await tokenContract.isMintingActive();Checks if token usage is active (not paused).
Returns:
true- tokens can be transferred and usedfalse- tokens are paused
Example:
const isActive = await tokenContract.isUtilityActive();Returns the merchant owner address of the program.
Example:
const merchantAddress = await tokenContract.getMerchantAddress();Returns the contract owner address (typically matches the merchant).
Example:
const owner = await tokenContract.owner();// Merchant mints tokens to customer
await loyaltyToken.mint(
customerAddress,
ethers.parseUnits("50", 18) // 50 токенов
);// Customer transfers tokens to merchant to activate reward
await loyaltyToken.transfer(
merchantAddress,
ethers.parseUnits("10", 18) // 10 токенов за вознаграждение
);// Merchant temporarily pauses the program
await loyaltyToken.pauseUtility();
// Check status
const isActive = await loyaltyToken.isUtilityActive(); // false// Merchant resumes the program
await loyaltyToken.unpauseUtility();// Get all token holders
const holders = await getTokenHolders(tokenAddress);
// Burn tokens from all holders in batches of 5
for (let i = 0; i < holders.length; i += 5) {
const batch = holders.slice(i, i + 5);
for (const holder of batch) {
const balance = await loyaltyToken.balanceOf(holder.address);
if (balance > 0) {
await loyaltyToken.burn(holder.address, balance);
}
}
}- Owner only can:
- Mint tokens (
mint) - Burn tokens (
burn) - Enable/disable minting
- Pause/unpause usage
- Mint tokens (
- Pause mechanism: Allows merchant to instantly stop all token operations
- Burn without approve: Merchant can burn tokens from any holder without prior approval (for program closure)
- Disable minting: Prevents minting of new tokens after program completion
The program can be in one of the following states:
| Status | isMintingActive | isUtilityActive | Description |
|---|---|---|---|
| Active | ✅ true | ✅ true | Fully operational program |
| Paused | ✅ true | ❌ false | Tokens frozen, minting possible |
| Closed | ❌ false | ❌ false | Program completed |
import { CONTRACTS } from '@/config/contracts';
import { useWriteContract, useReadContract } from 'wagmi';
// Minting tokens
const { writeContract } = useWriteContract();
await writeContract({
address: tokenAddress,
abi: CONTRACTS.LOYAL_SPARK_ERC20.abi,
functionName: 'mint',
args: [recipientAddress, amount],
});// Checking program status
const { data: isActive } = useReadContract({
address: tokenAddress,
abi: CONTRACTS.LOYAL_SPARK_ERC20.abi,
functionName: 'isUtilityActive',
});// Pause program
await writeContract({
address: tokenAddress,
abi: CONTRACTS.LOYAL_SPARK_ERC20.abi,
functionName: 'pauseUtility',
});
// Resume program
await writeContract({
address: tokenAddress,
abi: CONTRACTS.LOYAL_SPARK_ERC20.abi,
functionName: 'unpauseUtility',
});No, burned tokens are permanently deleted and cannot be recovered.
Tokens remain in holders' balances but cannot be transferred or used until the pause is lifted.
Yes, using the standard transferOwnership function (if implemented in the contract).
Yes, tokens are fully ERC20 compliant and can be traded on any DEX (Uniswap, SushiSwap, and etc.).
The transaction will be rejected with an error, and tokens will remain in the sender's balance.
For questions and support:
- Official website: https://loyalspark.online
- Email: gerassyk@gmail.com
MIT License - see LICENSE file for details.