Skip to content

a WEB3 travel plan payment subsription wallet service

License

Notifications You must be signed in to change notification settings

karolsudol/TravelSaver

 
 

Repository files navigation

Travel Saver

a WEB3 travel plan payment subsription wallet service

Included:

  • smart contract
  • smart contract test - coverage and audit
  • deployment tools (muliple networks)

NotIncluded:

  • off chain integrators
  • real time RPC log consumer and ETL services

fw logo


Travel Saver Smart Contract

  1. TravelPlan: escrow and crowd-funding service: where user creates campaign(s) against flywallet travel-plan(s).

    • User creates a WEB3-TravelPlan against Flywallet-TravelPlan that locks funds in escrow service.
    • Contributions can be made ad hoc by anyone or/and scheduled with PaymentPlan contract.
    • User can claim specific Plan that will result in funds to be withdawn to Flywallet web3-wallet address, followed by the actual booking.
  2. PaymentPlan: A companion object that allows any user to schedule payments to specific TravelPlan(s).

    • user creates PaymentPlan(s) againts specific TravelPlan(s) that creates scheduled payments to it
    • user can cancel any plan at any time but funds are locked in TravelPlan unless user claims it
    • off chain application will attempt to make shceduled payment on behalf of the user
    • in case of insufficent funds: next scheduled attempt will trigger any missed payments on top of scheduled one
    • user can also make missing payments manually

User Story


web3-arch


User wants to make multiple future travel reservation and crowd-fund - schedule payments towards them.

Follow the above diagram:

  1. User makes a travel plan(s) via flywallet booking service.

  2. User creates savings plan(s) this time in TravelPlan smart contract where contributions will be made and funds will be stored against 1.

  3. User creates PaymentPlan(s) againts specific TravelPlan and defining how much, how many and how ofter he/she wishes to make payments of.

  4. Schedules payments are triggered automatically as per 3. Funds are moved from user's wallet to TravelPlan's contract.

  5. In addition, user can contribute directly to any TravelPlan(s) as long as they exist and have not been claimed.

  6. User decided that ammout he/she collected is sufficient for the desired trip(s), and claims specific TravelPlan

  7. TravelPlan makes a withdrawal to the flywallet-web3-address for the ammount contributed in this plan UUID.

  8. FW receives web3 funds, acknowleges their recepit and transferes the ammount into user's fiat account inside FW-web-app

  9. Immadiatelly after, FW purchases the travel booking(s)

Smart Contract Usage

TravelPlan:

  • createTravelPlan(uint256 operatorPlanID_, uint256 operatorUserID_

  • contributeToTravelPlan(uint256 UUID, uint256 amount)

  • claimTravelPlan(uint256 UUID, uint256 amount)

  • travelPlanDetails(uint256 UUID) returns (TravelPlan)

PaymentPlan:

  • createPaymentPlan(uint256 _travelPlanID, uint256 amountPerInterval, uint256 totalIntervals,uint256 intervalLength)

  • cancelPaymentPlan(uint256 UUID)

  • paymentPlanDetails(uint256 UUID) returns (PaymentPlan)

  • runInterval(uint256 UUID)

TravelPaymentPlan

  • createTravelPaymentPlan(uint256 operatorPlanID_,uint256 operatorUserID_, uint256 amountPerInterval,uint256 totalIntervals,uint256 intervalLength)

NOTES:

  • NOTE: user's address needs to approve to spend agreed ammount by calling: token.approve(address(TravelSaver), totalAmount) and token.approve(address(TravelSaver), totalAmount)
  • NOTE: both contracts interact with eachother only within deployed specfic network with specfic IERC20 address.

DEPLOYMENTS

Deployed at {network_name} with IERC20 token, smart-contract and operator address as:

    • Celo

    • alfajores:

      • cEUR: 0x10c892A6EC43a53E45D0B916B4b7D383B1b78C0F

      • TravelSaver: 0x50d0ceF61c0cf54b0EF56Bc8CC5e4E692055D4Fc

      • verified

      • cUSD: 0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1

      • TravelSaver: 0xB0C5D98c7CB7907b54719B0848c46699c6ffa4D8

      • verified

      • operatorWalletAddress: 0x2b5Fc7f001a173D49B29e34993bB2feF41Ccd803

    • mainnet:

      • cEUR: 0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73

      • TravelSaver: 0x46c4F585B1948f21E733C5e08e55330de22f9119

      • verified

      • cUSD: 0x765de816845861e75a25fca122bb6898b8b1282a

      • TravelSaver: 0xa1A612F94923C9ed70f9bC124BC035b3bFd6b00e

      • verified

      • operatorWalletAddress: 0x2e7997BaF30435d70b5a2EC3eA334975b16C5204

    • Polygon

    • mumbai:

      • USDC: 0xe11A86849d99F524cAC3E7A0Ec1241828e332C62

      • TravelSaver: 0x262997A234F193182ab87A63d4AE2D7273BE7e21

      • verified

      • operatorWalletAddress: 0x2b5Fc7f001a173D49B29e34993bB2feF41Ccd803

    • mainnet:

      • USDC: 0x2791bca1f2de4661ed88a30c99a7a9449aa84174

      • TravelSaver: 0x207856B02b264b7C60fdE304658d683184254330

      • verified

      • operatorWalletAddress: 0x383bC9Eae0DfAEC56d10a12BaF23603701A4A004

TravelSaver constructor params:

  • address _IERC20 hardcoded address of the ERC20 EUR/USD PEGGED and NON DEFLACTIONARY token that serves a currency of the contract
  • address _operatorWallet wallet address where all funds will be transfered when saving plan is sucessful, hardcoded address of the operator wallet where funds are send from travel-plan as external multisg wallet that is opearated and solely responsible for by the ticket issuer

Re-Deploying to a networks, tests and scripts:

  • npm install hardhat

  • npx hardhat coverage

  • npx hardhat run --network {NETWORK} scripts/deploy-{NETWORK}-{BRANCH}-{ERC20}.ts

Architecture: all services off and onchain


web3-arch


TESTS COVERAGE



LICENSE

Copyright (c) 2023-present Flywallet Inc.

Licensed under Apache-2.0

About

a WEB3 travel plan payment subsription wallet service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 51.4%
  • Solidity 48.6%