Example Gift Contracts
Explore the docs »
View Demo of a dApp interacting with the protocol.
·
Report Bug
·
Request Feature
Table of Contents
A fully open source solidity protocol for real-world customer engagment.
This repository provides a protocol for, and example implementations of, loyalty gift contracts: Contracts that exchange points for gifts or vouchers. These contracts interact with standard loyalty programs: ERC-1155 based contracts that mint (fungible) points and (non-fungible) loyalty cards.
If you have not checked out the loyalty programs repository, please do so first. See the repository at https://github.com/7Cedars/loyalty-program-contracts.
- PointsForLoyaltyGifts.sol: Simple exchange of points for immediate gift.
- PointsForLoyaltyVouchers.sol: Simple exchange of points for gift voucher.
- TieredAccess.sol: provides 'gold', 'silver', 'bronze' vouchers for tiered access to gifts.
- PointsForPseudoRaffle.sol: a pseudo random allocation of gifts and vouchers. Work in Progress.
- PointsForRaffle.sol: A randomised raffle, using Chainling VRF. Coming soon.
- FreeGiftFriday.sol: Gifts are only available on a certain day. Coming soon.
- TransactionsForGifts.sol: Gifts on the basis of number of transactions over the last 7 and 14 days. Coming soon.
- AuthorisedAllocation.sol: Have an external party distribute gifts at will. Coming soon.
- Solidity 0.8.19
- Foundry 0.2.0
- OpenZeppelin 5.0
- Chainlink
- www.svgrepo.com
To get a local copy up and running do the following.
Install Foundry
$ curl -L https://foundry.paradigm.xyz | bash
$ foundryup
- Get a free alchemy API Key at alchemy.com
- Clone the repo
git clone https://github.com/7Cedars/loyalty-program-contracts.git
- Install packages
yarn add
- run tests
$ forge test
- and build
$ forge build
$ forge script --fork-url <RPC_URL> script/[HERE YOU SCRIPT].s.sol --broadcast
A front-end dApp demonstration of this web3 protocol has been deployed on vercel.com. Try it out at https://loyalty-program-psi.vercel.app/.
- Code clean up and clarify structure.
- Build more examples. At the moment only one exists.
- Implement deploy scripts to multiple EVM compatible (test)nets
See the open issues for a full list of proposed features (and known issues).
Contributions make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Thank you!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Seven Cedars - @7__Cedars - [email protected]
GitHub profile https://github.com/7Cedars
- This project was build while following PatrickCollins amazing Learn Solidity, Blockchain Development, & Smart Contracts Youtube course. Comes highly recommended for anyone wanting to get into Foundry & intermediate/advanced solidity coding.
- I took the template for the readme file from Drew Othneil.
- All the images for the gifts and vouchers were created with help from www.svgrepo.com. A fantastic repo with CC licensed art work. Specific links are included in all the images.
- And a special thanks should go out to SpeedRunEthereum and LearnWeb3 for providing the first introductions to solidity coding.
- The DateTime library was copy-pasted from https://github.com/RollaProject/solidity-datetime/blob/master/contracts/DateTime.sol
- And the deploy scripts use Etherscan.io APIs.