project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

VoucherToken

ERC1155 vouchers with non-transferable ERC721 merchant certification & instant redemption.

VoucherToken

Created At

ETHGlobal Taipei

Winner of

Celo

Celo - Celo L2 Pool Prize

Prize Pool

Project Description

  1. Overall Architecture The system is built on an EVM-compatible blockchain and utilizes two token standards to meet its requirements:

Merchant Certification: Uses the ERC721 standard to issue non-transferable certification tokens that record the merchant type and expiration time, ensuring that only qualified merchants can participate in voucher redemptions.

Voucher Management: Based on the ERC1155 standard, it supports multiple voucher types. Each voucher type has its own expiration, maximum usage count, single-use limit, and allowed merchant types for redemption.

In addition, the system includes fund management functions that support deposits, withdrawals, and immediate payment during voucher redemption.

  1. Key Smart Contract Functions Merchant Certification Contract

mintCertification: Called by the owner only, this function mints a certification token for a specified address while recording the merchant type and expiration time.

revokeCertification: Allows the owner to burn a certification token when it expires or needs to be revoked.

Non-transferability: Overrides the transfer function to ensure that tokens can only be minted and burned.

Voucher Contract

defineVoucherType: Defines a voucher type by setting its expiration, maximum usage count, single usage limit, and allowed merchant types.

mintVoucher: Issues vouchers to a specified address; each address can only receive a voucher of a given type once.

useVoucher: When a consumer uses a voucher, it verifies the validity of the merchant’s certification token and checks that it meets the allowed merchant types. It also verifies the voucher’s balance, usage count, and single-use limit. Upon successful validation, the voucher is burned and the equivalent native currency is immediately paid to the merchant.

mintClaimableVoucher / claimVoucher: Extended functionality that allows the owner to mint vouchers that any address can claim, with each address limited to claiming a fixed amount once.

  1. Fund Management deposit and withdraw: The owner can deposit native currency into the contract to ensure funds are available for redemption or withdraw any unused funds.

Immediate Payment: During voucher redemption, the contract directly transfers the corresponding native currency amount to the merchant, ensuring transparent and instant fund movement.

  1. Frontend-Backend Interaction Frontend Application: Built with Next.js, the application uses RainbowKit and wagmi to enable wallet connection and blockchain interaction. The main modules include:

MerchantCertification: Displays and manages merchant certifications, supporting minting and revoking.

VoucherManagement: Defines voucher types, mints vouchers, and manages deposits.

VoucherConsumer: Allows users to view, use, and claim vouchers, including a modal for voucher redemption.

VoucherEvents: Displays all system events for tracking operational status.

Multilingual Support: Provided via i18next for internationalized text, enhancing the user experience.

How it's Made

We built this project with two smart contracts using OpenZeppelin libraries—one ERC721 for non-transferable merchant certifications (by overriding the transfer update) and one ERC1155 for vouchers with expiry and usage limits. We used Hardhat with the MultiBaas plugin from Curvegrid to deploy on Celo and interact with the contracts via a REST API. On the frontend, Next.js, React, RainbowKit, wagmi, and Tailwind CSS were combined, with the MultiBaas SDK tying everything together for smooth blockchain interactions.

background image mobile

Join the mailing list

Get the latest news and updates