The Loyalty Points Platform is a decentralized application that implements a loyalty rewards system using ERC20 tokens on the Avalanche C-Chain. The platform enables merchants to award points to customers for purchases and allows customers to redeem these points for rewards. Designed with security, scalability, and flexibility, it ensures seamless integration for merchants and a user-friendly customer experience.
- Implements an ERC20-compliant token named "Loyalty Points (LPT)."
- Allows minting and transferring of tokens to represent loyalty points.
- Merchants can award loyalty points to customers based on their purchase amounts.
- Customers can redeem loyalty points for rewards from a catalog of reward items.
- Admins can add, update, or deactivate reward items.
- Includes functionality to define item costs, availability, and activity status.
- It uses AccessControl to manage roles for admins and merchants.
- Prevents unauthorized actions by leveraging roles and permissions.
- Adjustable points earning rate (points per wei spent).
- Tracks user redemption history for accountability and transparency.
- Implements Pausable and ReentrancyGuard to ensure contract safety.
- Includes emergency pause functionality for critical situations.
- Solidity: Smart contract programming.
- Avalanche C-Chain: Blockchain network for deploying the smart contract.
- OpenZeppelin: Secure contract libraries for ERC20, AccessControl, Pausable, and ReentrancyGuard.
- Hardhat: Development and testing framework for smart contracts.
- Metamask: Wallet integration for interacting with the contract.
- Ethers.js: JavaScript library for interacting with the Ethereum blockchain and Avalanche.
-
Deployment
- Deploy the contract on the Avalanche C-Chain.
- Assign roles (DEFAULT_ADMIN_ROLE and MERCHANT_ROLE) as necessary.
-
Award Points
- Merchants with the
MERCHANT_ROLE
can call theawardPoints
function to allocate points to customers.
- Merchants with the
-
Redeem Points
- Customers can redeem their points by calling the
redeemPoints
function and specifying the reward item ID and quantity.
- Customers can redeem their points by calling the
-
Manage Rewards
- Admins can add new rewards, update details, or deactivate rewards using
addRewardItem
andupdateRewardItem
.
- Admins can add new rewards, update details, or deactivate rewards using
-
Adjust Points Rate
- Admins can modify the earning rate through the
updatePointsRate
function.
- Admins can modify the earning rate through the
-
Pause/Unpause Contract
- Admins can pause or unpause the contract in case of emergencies using the
pause
andunpause
functions.
- Admins can pause or unpause the contract in case of emergencies using the
PointsEarned
: Emitted when points are awarded to a customer.PointsRedeemed
: Emitted when a customer redeems points for a reward.RewardItemAdded
: Emitted when a new reward item is added.RewardItemUpdated
: Emitted when a reward item is updated.
I want you to know that contributions to enhance the platform are welcome. Please fork the repository and submit a pull request with your proposed changes.
This project is licensed under the MIT License. See the LICENSE
file for details.