Stays: book accommodation on-chain, pay in crypto, and help local communities

Overview

Stays: on-chain bookings

Installation

Make sure you have node and nvm installed:

nvm use v16
npm install -g yarn
npm install -g lerna
yarn install
lerna bootstrap

Make sure to run lerna bootstrap after any git pull or whenever you have a problem with missing dependencies.

Local Development

  • Sign Up for Web3.Storage, get an API key

  • Create a packages/smart-contracts/.env file (if you don't have one) and add the Web3.Storage API key to it there as follows

    WEB3STORAGE_KEY=<Web3.Storage API key>
    
  • Open packages/smart-contracts in two terminal windows. Run yarn start:node in one and then yarn start:setup in the other one. Make sure to copy one of the private keys displayed after you run yarn start:node.

  • Add to packages/dapp/.env config:

    FAST_REFRESH=true
    BROWSER=false
    HTTPS=true
    REACT_APP_LOG_LEVEL=debug
    REACT_APP_FILE_WEB3STORAGE_KEY=<Web3.Storage API key>
    REACT_APP_NETWORK_ID=31337
    REACT_APP_NETWORK_PROVIDER=http://127.0.0.1:8545
    REACT_APP_CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
    
  • Add Hardhat Testnet network to Metamask

    • URL: http://127.0.0.1:8545
    • Chain ID: 31337
  • Add to Metamask some of the private keys from the hardhat console output that will be displayed when you run yarn start:node

  • Start the Dapp from packages/dapp: yarn start

Sokol Testnet

Contract Address: 0x0cc294153cE26686DE79E2c6bD76027D136ddfF7 (etherscan)

  • Get SPOA (Sokol Testned DAI)

  • Get your Google Maps API KEY (for getting GPS from Address)

  • Change packages/dapp/.env config:

    FAST_REFRESH=true
    BROWSER=false
    HTTPS=true
    REACT_APP_LOG_LEVEL=debug
    REACT_APP_FILE_WEB3STORAGE_KEY=<Web3.Storage API key>
    REACT_APP_GOOGLE_API_KEY=<GOOGLE_API_KEY>
    REACT_APP_MODE=production
    REACT_APP_NETWORK_ID=77
    REACT_APP_NETWORK_PROVIDER=https://sokol.poa.network
    REACT_APP_CONTRACT_ADDRESS=0x0cc294153cE26686DE79E2c6bD76027D136ddfF7
    
  • Add Sokol Testnet to Metamask:

    • URL: https://sokol.poa.network
    • Chain ID: 77
  • Start the Dapp from packages/dapp: yarn start

Comments
  • bug: check-in flow shows incorrect date range

    bug: check-in flow shows incorrect date range

    Report

    Hey guys, I'm at the Front Office from Hilton and I'm scanning a QR code from a random booking with my mobile MetaMask, but when scan it nothing shows up (I'm connected to the Gnosis chain). Is that correct? Cause the same happened with an actual guest this morning. Also Token 9 is booked for 17-24 April. but when the guest showed up he showed token 9 with 18-25 April (according to the Front Office).

    bug 
    opened by mfw78 5
  • Uploading facility images is not working

    Uploading facility images is not working

    I was able to upload facility logo, but then while trying to upload multiple "facility images" (they are called "room images" for some reason on the facility page), I get this error:

    FacilityProfileCard: Error: Cannot connect to the source: https://api.web3.storage/upload

    bug 
    opened by kvakes 4
  • Sometimes the `stats.ts` script in `smart-contracts` exits with an error

    Sometimes the `stats.ts` script in `smart-contracts` exits with an error

    This script is, of course, just a nice-to-have, but I wonder if this is a symptom of a larger issue, e.g. availability of the GNO node we're using...

    Error:

    Error: missing revert data in call exception (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"error\":{\"code\":-32015,\"data\":\"Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000\",\"message\":\"VM execution error.\"},\"id\":72,\"jsonrpc\":\"2.0\"}","error":{"code":-32015,"data":"Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000"},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0xecff1da7acd4025c532c04db3b57b454bab95b4e\",\"data\":\"0x6352211e0000000000000000000000000000000000000000000000000000000000000007\"},\"latest\"],\"id\":72,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://poa-xdai.gateway.pokt.network/v1/lb/6255d2a0adb03f003800758d"}, data="0x", code=CALL_EXCEPTION, version=providers/5.5.3)
        at Logger.makeError (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
        at Logger.throwError (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
        at checkError (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:34:16)
        at JsonRpcProvider.<anonymous> (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:562:20)
        at step (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
        at Object.throw (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
        at rejected (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
        at processTicksAndRejections (node:internal/process/task_queues:96:5) {
      reason: 'missing revert data in call exception',
      code: 'CALL_EXCEPTION',
      error: Error: processing response error (body="{\"error\":{\"code\":-32015,\"data\":\"Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000\",\"message\":\"VM execution error.\"},\"id\":72,\"jsonrpc\":\"2.0\"}", error={"code":-32015,"data":"Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000"}, requestBody="{\"method\":\"eth_call\",\"params\":[{\"to\":\"0xecff1da7acd4025c532c04db3b57b454bab95b4e\",\"data\":\"0x6352211e0000000000000000000000000000000000000000000000000000000000000007\"},\"latest\"],\"id\":72,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://poa-xdai.gateway.pokt.network/v1/lb/6255d2a0adb03f003800758d", code=SERVER_ERROR, version=web/5.5.1)
          at Logger.makeError (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
          at Logger.throwError (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
          at /home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/src.ts/index.ts:321:28
          at step (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/lib/index.js:33:23)
          at Object.next (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/lib/index.js:14:53)
          at fulfilled (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/lib/index.js:5:58)
          at processTicksAndRejections (node:internal/process/task_queues:96:5) {
        reason: 'processing response error',
        code: 'SERVER_ERROR',
        body: '{"error":{"code":-32015,"data":"Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000","message":"VM execution error."},"id":72,"jsonrpc":"2.0"}',
        error: Error: VM execution error.
            at getResult (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:97:28)
            at processJsonFunc (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/src.ts/index.ts:363:22)
            at /home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/src.ts/index.ts:300:42
            at step (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/lib/index.js:33:23)
            at Object.next (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/lib/index.js:14:53)
            at fulfilled (/home/kvakes/Projects/stays/packages/smart-contracts/node_modules/@ethersproject/web/lib/index.js:5:58)
            at processTicksAndRejections (node:internal/process/task_queues:96:5) {
          code: -32015,
          data: 'Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000'
        },
        requestBody: '{"method":"eth_call","params":[{"to":"0xecff1da7acd4025c532c04db3b57b454bab95b4e","data":"0x6352211e0000000000000000000000000000000000000000000000000000000000000007"},"latest"],"id":72,"jsonrpc":"2.0"}',
        requestMethod: 'POST',
        url: 'https://poa-xdai.gateway.pokt.network/v1/lb/6255d2a0adb03f003800758d'
      },
      data: '0x'
    }
    
    bug 
    opened by kvakes 3
  • Booking doesn't work

    Booking doesn't work

    OS: Ubuntu 20.04 Browser: Firefox 99.0

    I'm loading the app's main page with the freshly cleaned localStorage and disconnected wallet. Here's what I see in the browser console:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://xdai.poanetwork.dev/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
    

    And then

    useSmartContractData: Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32001,\"message\":\"26141565 could not be found\"},\"id\":47}", error={"code":-32001}, requestBody="{\"method\":\"eth_getLogs\",\"params\":[{\"fromBlock\":\"0x18ee37d\",\"toBlock\":\"latest\",\"address\":\"0xecff1da7acd4025c532c04db3b57b454bab95b4e\",\"topics\":[\"0x28c9a25063d40c8cf423202182ed575cc97982c1fd1771bd9721e19a38cc491d\"]}],\"id\":47,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://xdai.poanetwork.dev/", code=SERVER_ERROR, version=web/5.6.0)
    

    And a few lines after

    Reducer: Dispatch 
    Object { type: "ERROR_ADD", payload: "processing response error (body=\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"error\\\":{\\\"code\\\":-32001,\\\"message\\\":\\\"26141565 could not be found\\\"},\\\"id\\\":47}\", error={\"code\":-32001}, requestBody=\"{\\\"method\\\":\\\"eth_getLogs\\\",\\\"params\\\":[{\\\"fromBlock\\\":\\\"0x18ee37d\\\",\\\"toBlock\\\":\\\"latest\\\",\\\"address\\\":\\\"0xecff1da7acd4025c532c04db3b57b454bab95b4e\\\",\\\"topics\\\":[\\\"0x28c9a25063d40c8cf423202182ed575cc97982c1fd1771bd9721e19a38cc491d\\\"]}],\\\"id\\\":47,\\\"jsonrpc\\\":\\\"2.0\\\"}\", requestMethod=\"POST\", url=\"https://xdai.poanetwork.dev/\", code=SERVER_ERROR, version=web/5.6.0)" }
    

    And immediately after

    useDayZeroDate: Error: from address mismatch (argument="transaction", value={"data":"0x9ff68214","to":"0xEcfF1da7acD4025c532C04db3B57b454bAB95b4E","from":"0xa4eD6995989FF046B3d47d9112F28f5da19431E9"}, code=INVALID_ARGUMENT, version=abstract-signer/5.6.0)
    
    opened by kvakes 3
  • Feature: Rates and Rate Modifiers

    Feature: Rates and Rate Modifiers

    Right now I can only say that my Space has a certain price, e.g. 100 xDAI. This rate will be available indefinitely, the only way for me to limit it is to remove the space. Instead I propose to introduce the concept of "Rate", so our internal hierarchy will look like this:

    Facility - Space - Rate - Modifier

    Facility ~ Hotel Space ~ Room Type Rate ~ Room Rate Modifier ~ Logical/Mathematical rules that change the Room Rate

    Rate Properties

    • Price in xDAI
    • Date Range: date range FROM and TO (with the possibility to specify that the rate should be valid until 1/2/3 years from TODAY)
    • Minimum Stay: minimum number of nights required for this rate to trigger
    • Rate Modifiers that should apply to this rate

    Example: Queen Room

    Rate 1:

    • 150 xDAI
    • Available from April 17 to 25
    • Minimum Stay: 1 night
    • Rate modifiers: none

    Rate 2:

    • 130 xDAI
    • Available from April 17 to 25
    • Minimum stay: 8 nights
    • Rate modifiers: none

    Rate Modifiers

    Rate modifiers are stored in a separate pool of available rate modifiers. They don't belong to a Space, i.e. different Spaces may use the same Rate Modifier.

    1. Blackout: specify dates during which the rate is not available
    2. Weekend price increase: automatically increase the rate by a certain amount of xDAI or by %.
    3. Holiday price increase: specify holiday dates (in your country) and increase the price by xDAI amount or by %
    4. High season, low season modifiers: specify a date range during which prices go up or down by xDAI amount or by %
    5. Loyalty: you may specify that a holder of a certain number of tokens / NFT will get a discount (xDAI amount or %)
    feature 
    opened by kvakes 2
  • As a hotel owner/admin I should be able to specify a date range during which a Space is available

    As a hotel owner/admin I should be able to specify a date range during which a Space is available

    Right now we can only create "spaces" with infinite availability into the future. We should give hotel admins an option to say that a space is available FROM and TO.

    feature 
    opened by kvakes 1
  • Forms for Issues

    Forms for Issues

    Created a few forms for issues to make it easy for anyone to contribute in signalling bugs or feature requests. It also means that each path automatically assigns the relevant label.

    opened by xdaluca 0
Owner
Winding Tree
Open source tools for decentralized travel ecosystem
Winding Tree
AweSome Book App displays the book details entered by user and saves the information in Local storage. User can add and remove a book title/author to the library and from the library.

Awesome Book App with ES6 Used npm init -y command to create package.json file. Created the entry point for the JavaScript code called index.js Create

Krishna Prasad Acharya 8 Aug 15, 2022
Pay Creators to Promote your Product in $CRYPTO

Next.js + Tailwind CSS Example This example shows how to use Tailwind CSS (v3.0) with Next.js. It follows the steps outlined in the official Tailwind

Satyam Kulkarni 1 Feb 7, 2022
This is a single page web application that keeps tracks of books. Book details captured are the book title, author and ISBN. User can add a book, view a list of books and also remove any un wanted books.

Project Name This is a single page web application that keeps tracks of books. Book details captured are the book title, author and ISBN. User can add

Olivier 6 Nov 20, 2022
Awesome Books project : An online Book Library. Storing book information using local storage and displaying it as a list on HTML page

This is project is my based on building an online Book Library. Storing book information using local storage and displaying it as a list on html page

Richard Chileya 7 Nov 11, 2022
Multi-chain defi crypto sniper written in typescript/javascript. Fastest method of sniping with auto-sell and rug prevention features.

CryptoSniper Community Edition Multi-chain defi crypto sniper written in typescript/javascript. Fastest method of sniping with auto-sell and rug preve

null 18 Nov 3, 2022
Hasbik is a community based social token and the new paradigm in the crypto space. With the goal to build a community around a crypto token.

Hasbik is a community based social token and the new paradigm in the crypto space. With the goal to build a community around a crypto token.

null 2 Jan 5, 2022
🌈 Put a date and a crypto, optionally a quantity of that crypto, to see how much has augmented/increased in dollars & percentage

crypif Put a date and a crypto, optionally a quantity of that crypto, to see how much has augmented/increased in dollars & percentage Figma I still ha

Eliaz Bobadilla 8 Apr 4, 2022
Crypto-tracker - Get crypto currency data in one click. Followed by a few more clicks.

https://crypto-tracker-ayaanzaveri08.vercel.app/ Crypto Tracker Crypto Tracker tracks crypto with the CoinGecko API. This app uses the React framework

Ayaan Zaveri 0 Apr 30, 2022
e-ONG, an authorial project, whose objective is to help ONGs to find people who need help or would like to help them

This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: npm start Runs the app in the developmen

Lucas Lima 2 Nov 11, 2022
Pull a smart contract from mainnet onto your local chain.

hardhat-copy hardhat-copy helps you import an Ethereum mainnet smart contract onto your local Hardhat node, enabling you to rapidly experiment with pr

Alexander Thomas 6 Aug 21, 2022
Build homes, communities and hope through a virtual house-building game that mirrors the experience of physical volunteering programmes.

Habitat Heroes Note: The current house building time and quiz reset time have been shortened for the purpose of allowing users to try out more feature

Habitat Heroes 4 Mar 15, 2022
A social network to connect web3 users and their communities.

Introduction This project is built using react, tailwindcss and Moralis (documentation) for our backend. We are also heavily using the built-in Morali

null 8 Jan 5, 2023
A mesh network that connects remote communities to emergency responders without relying on internet, cell towers, or satellites

A mesh network that connects remote communities to emergency responders without relying on internet, cell towers, or satellites. Winner of Hack the North 2022. ??

Alice Cai 4 Sep 23, 2022
NFT vending machine proof of concept built on Solana Pay, Metaplex, Phantom Mobile and Next.js.

Solana NFT Vending Machine This is a proof of concept of an NFT vending machine built using Solana Pay, Metaplex, Phantom Mobile, and Next.js. This wa

Matt Rosenzweig 55 Dec 15, 2022
Generate wechat / wework pay signture for NodeJs

WXSIGN Generate wechat / wework pay signture The library uses strdm ?? to generate random strings of a specified length How to installtion? # yarn

y.tianyuan 8 Nov 17, 2022
This is a decentralised application that allows you to pay your employees salary in Ethereum.

This is our project for Ethernals Hackathon. Built on Polygon and deploye dusing Spheron. You can check out live project here: https://ethernals_dapp-

Kushagra Sarathe 3 Sep 20, 2022
Awesome Pay - This is a virtual payment module made from react

Awesome Pay - This is a virtual payment module made from react

AhhyunLee 5 Jun 18, 2022
Open-source Solana Pay framework

Bedrock Bedrock is a framework for Solana Pay that: Standardizes the methodology used to create transaction requests Provides implementations for many

Bedrock Foundation 11 Nov 26, 2022
A single-page application that allows users to keep track of their books. Users can add the book details (book title and author) and also, and the books can also be removed. Built with JavaScript, HTML, and CSS

Project Name Awesome book with ES6 Description the project. This is a single page application that allows users to keep track of their books. Users ca

Micheal Oguntayo 4 Oct 13, 2022