Inspiration
"Discount On The Block" is a decentralized discount management system designed to empower web3 projects with the creation, management, and claiming of various discounts. Leveraging the Ethereum blockchain, Chainlink's CCIP (Cross-Chain Interoperability Protocol), Chainlink Automation and innovative smart contract patterns, the architecture ensures security, flexibility, and cross-chain compatibility.
What it does
"Discount On The Block" is a groundbreaking discount ecosystem, offering web3 projects the ability to forge bespoke discount experiences on the blockchain. This service utilizes the Chainlink CCIP infrastructure, facilitating users in effortlessly claiming their discounts across various blockchains. Notably, our time-based discounts integrate Chainlink automation to gracefully handle the expiration of discounts, ensuring a dynamic and secure discount landscape for users navigating the decentralized realm. This NFT-based discount can be used as a form of payment within web3 platforms. When utilized, the discount is securely burned, ensuring a dynamic and one-time-use token that seamlessly blends real-world value with decentralized utility.
How we built it
I implemented the system using Solidity, Ethereum's smart contract language, with a focus on security and flexibility through OpenZeppelin's upgradeable contract framework. We incorporated the UUPS pattern for creating new discounts and utilized ERC1155 NFTs to represent each discount uniquely.
The Smart Contracts module is the backbone of the system, responsible for handling discount-related functionalities, user interactions, and integration with external protocols.
Main Functions:
initializeDiscount: Initializes a new discount with a specified name and type (TimeBased or StaticBased). This function sets the owner and type of the discount.
createStaticDiscount: Creates a static-based discount with specified parameters such as token name, symbol, token IDs, URIs, and chain ID. It involves interacting with Chainlink for cross-chain communication to create the contract on destination chain.
createTimeBasedDiscount: This function allows the owner of a discount to create a time-based discount contract on a specific Chain by sending a Chainlink CCIP message with the provided token information and expiration metadata.
batchIncrementUsersBalances: Increments the claim balances of multiple users for a specific discount. This function is useful for efficiently updating user balances.
claimStaticDiscount: Allows users to claim a static-based discount, involving Chainlink automation on the specific chain. (The user will be choosed the destination chain to claim and receive discount)
claimTimeBasedDiscount: Allows users to claim a time-based discount, involving Chainlink automation on the specific chain. (The user will be choosed the destination chain to claim and receive discount)
Discount Manager Contract: The Discount Manager Contract is the central component of the project, serving as the main contract that oversees the creation, initialization, and management of discounts. Deployed on the Sepolia chain, this contract has the unique capability to deploy and create discounts on various other chains using the Chainlink Cross-Chain Interoperability Protocol (CCIP).
Discount Collections: The Discount Collections module encompasses two distinct types of discounts: Static-Based and Time-Based.
Static-Based Discounts: Have static metadata with no expiration. Suitable for discounts that do not have a time constraint.
Time-Based Discounts: Event-based discounts that expire after a predefined duration. Leverages Chainlink automation for accurate expiration management.
CrossChainUtils: The CrossChainUtils module consists of two primary contracts: Source Manager and Destination Manager. These contracts work together to facilitate cross-chain communication and execute commands on destination chains.
Expiration Controller: The Expiration Controller is a smart contract that leverages Chainlink automation to manage the expiration of time-based discounts. When the expiration time is reached, this contract takes specific actions, such as updating metadata to indicate expiration, initializing the token ratio to 0, and marking the discount as no longer usable.
Challenges we ran into
One of the challenges faced during development was ensuring the seamless integration of Chainlink's CCIP and Handling various discount types on different chains, managing claim balances.
Accomplishments that we're proud of
I really proud to have successfully implemented a comprehensive discount management system on the blockchain, integrating it with Chainlink's CCIP. The system allows users to create and manage diverse discounts securely. The flexible design of the smart contract, with upgradability and pausability features, enhances the overall robustness of the solution.
What we learned
Through the development of "Discount On The Block," we gained valuable insights into smart contract development and integration with Chainlink's CCIP.
What's next for Discount On The Block
My next frontier for "Discount On The Block" involves enabling users to seamlessly claim their discounts from any sourceChain across multiple blockchains. To achieve this, we are planning to leverage Chainlink function and CCIP (Cross-Chain Interoperability Protocol).
Log in or sign up for Devpost to join the conversation.