Skip to content

leandrobortolotto/payperbite

Repository files navigation

PayPerBite Matchmaking Marketing Tool

Project Info

URL: https://payperbite.lovable.app/

Lovable Project: https://lovable.dev/projects/14c7262a-adc3-479f-a2cc-913709c4e571

About the Project

TasteBud Match is a platform that connects restaurants and influencers for advertising campaigns, leveraging smart contracts on the Polkadot Asset Hub blockchain (Paseo Testnet).

Tech Stack

This project is built with:

  • Frontend: Vite, TypeScript, React, shadcn-ui, Tailwind CSS
  • Blockchain: Solidity, Hardhat, Ethers.js
  • Network: Polkadot Asset Hub Testnet (Paseo)

๐Ÿงช Testing the Contract on /test Page

Quick access to test on the development server

  1. Start the development server:

    npm run dev
  2. Navigate to the test page:

    http://localhost:8080/test
    

Quick access to test online

https://payperbite.lovable.app/test

What You Can Test

The /test page allows you to interact directly with the SimpleProposal contract deployed on Polkadot testnet.

๐Ÿ”‘ Test Wallet (Automatic)

  • Auto-Connect: When you open the page, a test wallet is automatically connected
  • No MetaMask Required: No need to install extensions or configure anything
  • Pre-funded: The wallet already has testnet balance to execute transactions
  • Address: 0xc48Bd4636bC57b3F06D9d45307b6f0CF42Fb1649

๐Ÿ“Š Contract Information

Deployed Contract:

Test Campaign Parameters:

  • Restaurant: 0xc48Bd4636bC57b3F06D9d45307b6f0CF42Fb1649
  • Influencer: 0x742d35Cc6634C0532925a3b844Bc454e4438f44e
  • Click Target: 100
  • Description: Test Campaign - TasteBud Match Restaurant Promotion

๐ŸŽฎ How to Use the Page

  1. View Campaign Data

    • On load, the page automatically displays:
      • Restaurant and influencer addresses
      • Current progress (visual bar)
      • Current clicks vs target
      • Completion percentage
  2. Register a View

    • Click the "Registrar View" button
    • A transaction will be sent to the blockchain
    • Wait for confirmation (a few seconds)
    • Progress will update automatically
  3. Manually Refresh Data

    • Click the "Atualizar Dados" button
    • Data will be reloaded from the contract
    • Useful to see changes made by other accounts
  4. Track Progress

    • The progress bar visually shows advancement
    • When reaching 100%, a completion message appears
    • The "Registrar View" button is disabled upon completion

๐Ÿ“ฑ Option: Use MetaMask

If you prefer to use your own wallet:

  1. Click "Conectar MetaMask" (alternative option)
  2. Configure Paseo Testnet network in MetaMask:
  3. Approve the connection
  4. Important: You'll need testnet funds to send transactions

๐Ÿ› ๏ธ Testing via Scripts

In addition to the web interface, you can test the contract using scripts:

1. Basic Function Tests

cd contracts
npx hardhat run scripts/test-proposal.ts --network passetHubTestnet

This script tests:

  • โœ… Contract connection
  • โœ… Reading information (getInfo(), getProgress())
  • โœ… Registering views (registerView())
  • โœ… Individual properties

2. UI Interaction Simulation

cd contracts
npx hardhat run scripts/simulate-ui-interactions.ts --network passetHubTestnet

This script simulates:

  • โœ… Complete wallet connection flow
  • โœ… Initial data loading
  • โœ… "Registrar View" button clicks
  • โœ… Data refresh
  • โœ… Multiple consecutive registrations

๐Ÿ“ฆ Project Structure

tastebud-match/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”œโ”€โ”€ Test.tsx                    # Contract test page
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ contracts/
โ”‚   โ”œโ”€โ”€ contracts/
โ”‚   โ”‚   โ”œโ”€โ”€ SimpleProposal.sol          # Test contract
โ”‚   โ”‚   โ”œโ”€โ”€ SBRLToken.sol               # SBRL token
โ”‚   โ”‚   โ””โ”€โ”€ AdvertisingProposal.sol     # Full contract
โ”‚   โ”œโ”€โ”€ scripts/
โ”‚   โ”‚   โ”œโ”€โ”€ deploy-simple-proposal.ts   # SimpleProposal deployment
โ”‚   โ”‚   โ”œโ”€โ”€ test-proposal.ts            # Basic tests
โ”‚   โ”‚   โ””โ”€โ”€ simulate-ui-interactions.ts # UI simulation
โ”‚   โ””โ”€โ”€ hardhat.config.ts               # Hardhat configuration
โ””โ”€โ”€ README.md

๐Ÿš€ Local Development

Installation

# Clone the repository
git clone <YOUR_GIT_URL>

# Navigate to the directory
cd tastebud-match

# Install dependencies
npm i

# Start the development server
npm run dev

Contract Deployment

# Navigate to contracts directory
cd contracts

# Compile contracts
npm run compile

# Deploy to testnet
npm run deploy:testnet

๐Ÿ”— Useful Links


๐Ÿ“ SimpleProposal Contract Features

Public Functions

  • registerView() - Registers a view/click
  • getProgress() - Returns progress percentage (0-100)
  • getInfo() - Returns all proposal information
  • restaurant() - Restaurant address
  • influencer() - Influencer address
  • clicksRequired() - Click target
  • currentClicks() - Current clicks
  • description() - Campaign description

Events

  • ViewRegistered(uint256 currentClicks, uint256 clicksRequired) - Emitted when registering a view
  • ProposalCompleted(uint256 totalClicks) - Emitted when target is reached

๐Ÿค How to Contribute

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License.


๐ŸŽฏ Roadmap

  • Integrate SBRL token into proposals
  • Add complete escrow system
  • Implement restaurant dashboard
  • Add campaign analytics
  • Mainnet deployment

โ“ Support

For questions or issues:

  1. Open an issue
  2. Check the Lovable documentation
  3. Contact the TasteBud Match team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •