Code Monkey home page Code Monkey logo

app's Introduction

๐Ÿ—ป Fuji App

๐Ÿ“– Introduction

The Fuji App it's a web application that helps interact with Fuji, a decentralized synthetic asset protocol, combining Liquid and Lightning Network to allow users to mint synthetic assets and trade them in a trustless way.

๐Ÿ“ฆ Installation

To install the Fuji App, you need to have Node.js installed in your machine. Then, you can clone the repository and install the dependencies with the following commands:

yarn install

๐Ÿš€ Usage

To run the Fuji App in development, you can use the following command:

yarn dev

To build the Fuji App for production, you can use the following command:

yarn build

๐Ÿงช Test

The app is using Playwright to test UI interactions. Tests should be located in the tests folder with the .spec.ts extension.

Downloads the testing browser extensions

Fuji App needs some browser extension wallets to be installed. test:init script downloads them for you. The extensions are downloaded in the tests folder and should not be committed.

# DL the extensions for testing, only needed once
yarn test:init

Run the tests

yarn test

๐Ÿ“ License

The Fuji App is licensed under the MIT License

app's People

Contributors

easter-monolith avatar louisinger avatar miyo-fuji avatar tiero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

app's Issues

Implement whitelist middleware for closed beta

We want to give access to the first 10th subscribers (per referral count) that opted-in, on our website.

We have a DB of emails on viral-loops and through their API we could check if present in the whitelist and his rank

We can use nextjs middleware function to perform

  1. API call to viral-loops to check email and the rank of the user
  2. send magic.link to confirm
  3. inject a cookie to allow to redirect to the actual app
  4. call viral-loop to flag the participant out of the waitlist, as successfully onboarded

If coin is spent, cross-check on explorer what leaf has been used

At the moment we assume that all the operations will be done from the same frontends, so we can infer if the contract is liquidate simply not having it in getCoins in Marina.

But this is short-sighted since external frontends may be used or simply user if restores, we need to be able to reconstruct the actual history only looking at the chain.

The best approach is:

Integrate with Marina

The app must use the custom script account of Marina.
The Fuji contract template to be imported to the account can be harcoded (contract), like the issuer and oracle public keys (02a3d89442c53fa319737bce93e0408d00f817f992a276fea1a2aa0ffbdc4a8a76 and 0256e332a5134f31dbea899e0cb7c75d3e2cff969d3958d066f8198caaee3a6159 respectively).

The flow for contract creation is a bit different from spec: since the app already knows oracle and issuer pubkeys, it doesn't need to contact the server to know those params, but rather it directly sends a complete proposal. The server then accepts or rejects it depending on the proposed terms.
The same stands for the topup flow.

The button Connect Wallet should prompt a modal

To "push" wallet integration, we can show a modal on the top-right button that allows you to choose the wallet to connect

For now we only make clickable Marina option, with the others grayed out

image

Supports Nostr Connect

What methods are needed for a Nostr Signer to support Fuji app? (Marina mobile, Nostrum etc..)

  • getting a pub key to be used in the covenant: would this be ok if we use the nostr pubkey? In the end the address will be different all the time as the constructor parameters will make it change, even if reuse from the same pubkey.

  • Get addresses: Do need a dedicated nostr-connect method to get a fresh receiving address (for fuji) and change the address for collateral change?

  • sign inputs: we should have a sign_pset method or a more low-level sign_schnorr? The advantage of the sign_pset is the possibility to show more information about what the user is signing in to the app.

  • fetch blinders: as we need the factory to blind the change outputs and we may use confidential inputs for the collateral, we need to fetch this?

Remove Email login

As we gearing up for opening up the testnet beta, let's remove the login form at the beginning

Poll prices from oracle

The app must keep track of the price of every contracts' collateral asset so that the user can eventually add funds before the price goes underwater (to prevent liquidation).
Therefore, the app must periodically fetch the price (/oracle/:ticker alpha-server endpoint) of such assets and update the safe/usafe status of the contracts accordingly.

Liquidated contracts on UI

The problem:

The app needs to know about liquidated contracts, in order to show them on the UI as liquidated.

Different approaches:

  1. The app could detect which contracts are below the minimum ratio level and mark them as Liquidated. But if the contract was liquidated in the past, but now has a ratio above that limit, the app will show it as Critical or even Safe, and will have the Redeem and Topup buttons enabled, which is wrong.

  2. When the app gets each contract from local storage, cross reference its txid with available coins, and if the contract was not redeemed, it will mark it as liquidated if no coin is found. Theoretically I think this solution works, what do you think?

cc @miyo-fuji @FlyingMonkey0

The first page must be the `dashboard`

The current index.tsx should be hosted on ie. fuji.money main domain, meanwhile the app should start from the /dashabord page as landing and will be hosted on other domains tryfuji.com, app.fuji.money etc..

Integrate with alpha-server

The app must consume alpha-server's endpoints for contract creation (BORROW) or for adding funds to an existing one (TOPUP).

The flow for these 2 operations is a bit different from spec: for sake of simplicity, we'll hardcode issuer (02a3d89442c53fa319737bce93e0408d00f817f992a276fea1a2aa0ffbdc4a8a76) and oracle (0256e332a5134f31dbea899e0cb7c75d3e2cff969d3958d066f8198caaee3a6159) pubkeys so that the app is capable of creating contracts without contacting the server first.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.