Flysure: Instant flight delay insurance. Get paid in PYUSD before you board.
Here is a detailed project description for "Flysure," written in English, specifically tailored to the hackathon judging criteria you provided.
Project Name: Flysure
It requires passengers to manually file a claim, often with complex forms.
It involves a slow, manual approval process managed by centralized claims adjusters.
It relies on slow legacy payment rails (ACH, bank transfers), meaning compensation can take weeks or even months to arrive.
This creates a massive disconnect. The passenger's "pain point" (being stuck at an airport) happens now, but the financial relief arrives far too late to be useful, making it a poor user experience. This is a classic, real-world payments problem: a fundamental mismatch between the time of the insured event and the time of settlement.
"Parametric" insurance is a simple, non-negotiable, code-based contract: "If Event X happens, automatically pay Amount Y."
We remove the ambiguity, the claims adjusters, and the manual approvals. The insurance policy is the smart contract. Our first product focuses on flight delays.
Buy Policy (with PYUSD): A traveler connects their wallet to our dApp. They select their flight (e.g., "IST to BER"). They are offered a simple policy: "Pay a 10 PYUSD premium for a 100 PYUSD payout if your flight is delayed > 2 hours." The user approves the PYUSD spend and calls createPolicy, which transfers the 10 PYUSD premium into the smart contract's vault.
The Event (Flight Delay): The user's flight is delayed by 2 hours and 30 minutes.
The "Magic" (Instant Payout): A trusted, independent aviation data oracle (like FlightStats or IATA, as outlined in our architecture ) confirms the delay. This on-chain data automatically triggers our triggerPayout function. The smart contract verifies the delay meets the policy threshold (2.5 hours > 2 hours).
Result (PYUSD in Wallet): The smart contract instantly and programmatically executes the payout, transferring 100 PYUSD directly to the traveler's wallet.
The passenger receives their compensation while they are still at the airport. They can immediately use this PYUSD to buy lounge access, book a hotel, or buy a meal, transforming a negative experience into a positive one in real-time. No forms, no waiting, no phone calls.
Solves a Real-World Payment Challenge: We are disrupting the slow, high-friction, and opaque insurance claims industry. We replace legacy banking rails with PYUSD for instant, 24/7, programmatic settlement. This directly addresses the "Payments Applicability" criterion.
The Ultimate PYUSD User Experience (UX): The "magic moment" of our UX is the speed of settlement. Using a volatile asset for this would be a terrible user experience; a user might receive $95 or $105, not the $100 they were promised. Using PYUSD means the user receives a stable, reliable, and immediately spendable digital dollar. The value promised is the value received, which builds trust and delivers an unparalleled UX.
New Economic Opportunity: This model unlocks a new market for micro-insurance policies that were previously not economically viable due to the high administrative overhead of traditional claims processing.
Smart Contract (Policy.sol): A Solidity contract deployed on the Sepolia testnet.
It is Ownable and integrates OpenZeppelin's IERC20 interface.
constructor(pyusdAddress): Sets the official PYUSD token address.
createPolicy(...): Receives the premium from the user via pyusdToken.transferFrom(), locking it in the contract.
triggerPayout(...): A secured function callable only by our authorized oracle address. It verifies the delay, updates the policy status to PAID, and executes the pyusdToken.transfer() of the payout amount to the policyholder.
Oracle Mechanism: For the demo, we built an "Admin Panel" (admin.tsx). This page simulates the trusted oracle, allowing us to manually trigger the triggerPayout function for a specific policy ID. This allows us to prove the complete, end-to-end functionality for the demo video.
Frontend (Next.js dApp):
A clean UI built with Next.js, TypeScript, and wagmi/RainbowKit.
Users can connect their wallet, see the PYUSD-denominated premium, and buy a policy. This flow correctly handles the two-step approve and createPolicy transactions.
A "My Policies" dashboard where the user can see their ACTIVE policies and watch their status change to PAID in real-time after the oracle triggers the payout.
Business Model: A sustainable business can be built by charging a small, transparent, programmatic fee (e.g., 2-5%) from each premium sold. This fee is automatically routed to the treasury, fully auditable on-chain.
Scalability: The "if-then-pay" logic is a powerful primitive. We started with flight delays, but this architecture can be scaled to:
Baggage Loss Insurance
Event Cancellation Insurance (concerts, conferences)
Parametric Weather Insurance (e.g., for farmers or outdoor venues)
Flysure demonstrates a powerful and scalable real-world use case for PYUSD, setting a new benchmark for how digital payments can transform an entire industry from a slow, manual process into one that is instant, transparent, and programmatic.
How It's Made: The Nitty-Gritty of Flysure We built Flysure as a full-stack, decentralized application designed to demonstrate a powerful, real-world use case for PYUSD. Our philosophy was to strip away all production-grade complexities (like multi-chain bridging or complex governance ) from our initial, broader architecture concepts and focus exclusively on one thing: proving the core PYUSD premium-to-payout loop.
Frontend: Next.js, TypeScript, CSS Modules
Web3 Frontend: wagmi (for React Hooks) & RainbowKit (for wallet connections)
Core Partner Technology: PayPal USD (PYUSD) on the Sepolia testnet.
Flow 1: Buying a Policy (The Premium)
Frontend (UI): A user connects their wallet via RainbowKit. They are presented with a simple form to buy a policy (e.g., 10 PYUSD premium for a 100 PYUSD payout).
Frontend (Web3): When the user clicks "Buy," our frontend executes two transactions using wagmi's useWriteContract hook:
Transaction 1 (Approve): It calls the approve() function on the PYUSD ERC-20 contract, granting our Policy.sol contract permission to spend the 10 PYUSD premium.
Transaction 2 (Create): Once approved, it calls the createPolicy() function on our Policy.sol contract.
Backend (Smart Contract): The Policy.sol contract's createPolicy() function then executes. It securely pulls the 10 PYUSD from the user using pyusdToken.transferFrom() and stores it in the contract's vault. It then mints the policy, saving its state (flight ID, user address, payout amount, ACTIVE status) in a struct.
Flow 2: Getting Paid (The Instant Payout)
Backend (Oracle Trigger): An oracle (simulated in our hack) confirms a flight delay. It calls the triggerPayout(policyId, actualDelay) function on our Policy.sol contract.
Backend (Smart Contract): The contract verifies three things:
Is the caller the authorized oracleAddress?
Is the policy status ACTIVE?
Does the actualDelay meet or exceed the delayThreshold?
Backend (The PYUSD Magic): If all checks pass, the contract updates the policy status to PAID and—most importantly—executes pyusdToken.transfer(policyHolder, payoutAmount). This instantly sends the 100 PYUSD payout to the user.
Frontend (UI): The user's "My Policies" dashboard, which uses wagmi's useReadContract hook to read the policy status, automatically updates to show "PAID," and the user can see the 100 PYUSD in their wallet.
As a Programmable Settlement Layer: We used PYUSD's ERC-20 interface to make the smart contract a self-executing claims adjuster and bank. The logic "IF delay > 2 hours, THEN pay $100" is no longer a manual process but a single, programmatic transfer() call within the contract itself.
For an Instant UX: The core "Payments Applicability" we demonstrated is speed. By using PYUSD, we replaced a weeks-long bank transfer process with a 5-second blockchain transaction. This transforms the user's experience from "file a claim and wait" to "get paid instantly" at their moment of frustration.
For Trust & Stability: Using a trusted, stable asset like PYUSD is critical. No user wants to be paid for a $100 claim with a volatile asset that might be worth $95 by the time they get it. PYUSD ensures the value promised is the value delivered.
So, we built a "Demo Magic" Admin Panel.
How it Works: We created a special page (/admin) in our Next.js app.
The "Hack": This page uses useReadContract to fetch the owner() of our Policy.sol contract. It then compares this to the connected wallet address.
The Result: If you are the contract owner, a simple admin form appears. This form allows you to type in a policyId and an actualDelay and click "Trigger Payout." This manually calls the triggerPayout() function.
This "hack" was essential for our project. It allowed us to prove the entire end-to-end PYUSD payment loop works flawlessly, simulating the final piece of the puzzle (the oracle) and making our demo video possible.

