Skip to content

Avalanche-Team1-DAO-Kenya/Loyalty-Points-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loyalty Points Platform

Description

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.

Features

1. ERC20-Based Token System

  • Implements an ERC20-compliant token named "Loyalty Points (LPT)."
  • Allows minting and transferring of tokens to represent loyalty points.

2. Points Earning and Redemption

  • 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.

3. Reward Management

  • Admins can add, update, or deactivate reward items.
  • Includes functionality to define item costs, availability, and activity status.

4. Secure Role-Based Access Control

  • It uses AccessControl to manage roles for admins and merchants.
  • Prevents unauthorized actions by leveraging roles and permissions.

5. Flexible and Transparent

  • Adjustable points earning rate (points per wei spent).
  • Tracks user redemption history for accountability and transparency.

6. Enhanced Security

  • Implements Pausable and ReentrancyGuard to ensure contract safety.
  • Includes emergency pause functionality for critical situations.

Tech Stack Used

Language

  • Solidity: Smart contract programming.

Framework

  • Avalanche C-Chain: Blockchain network for deploying the smart contract.

Tools

  • 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.

Usage

  1. Deployment

    • Deploy the contract on the Avalanche C-Chain.
    • Assign roles (DEFAULT_ADMIN_ROLE and MERCHANT_ROLE) as necessary.
  2. Award Points

    • Merchants with the MERCHANT_ROLE can call the awardPoints function to allocate points to customers.
  3. Redeem Points

    • Customers can redeem their points by calling the redeemPoints function and specifying the reward item ID and quantity.
  4. Manage Rewards

    • Admins can add new rewards, update details, or deactivate rewards using addRewardItem and updateRewardItem.
  5. Adjust Points Rate

    • Admins can modify the earning rate through the updatePointsRate function.
  6. Pause/Unpause Contract

    • Admins can pause or unpause the contract in case of emergencies using the pause and unpause functions.

Events

  • 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.

Contributing

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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published