Giter VIP home page Giter VIP logo

frontend's Introduction

Porter Finance Front-end

Development

Install Dependencies and Run

pnpm i && pnpm start

If the graphql schema changes, run typechain:all

License and origin

This program is free software: you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The project is a fork of the uniswap front-end from the following commit.

Copyright ยฉ 2021, Porter limited.

Released under GNU General Public License v3.0

frontend's People

Contributors

geczy avatar jordanalexandermeyer avatar namaskar-1f64f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frontend's Issues

Auction Page

NEW: https://www.figma.com/file/ddShWxG1yufVKYFTvJHgci/Product?node-id=8586%3A650
Old: https://www.figma.com/file/55kihuNidQlR8YReCTJlPY/Product-(Jordan)?node-id=8586%3A650

This page gets its info from the gnosis auction api

  • Add page as designed
  • Handle private auctions https://ido-ux.dev.gnosisdev.com/#/auction?auctionId=501&chainId=4#topAnchor. Gnosis has the ability to create auctions either public or private. They already have the functionality for this built into their UI. We will need to disable the bidding panel if the connected address is not on the allow-list. There does not currently seem to be a component for this in the vectordao designs. Should we build our own, or ask them to make one? @jordanalexandermeyer

image

image

previews of tokens

In the future - the input boxes will probably be disabled as well if the buttons are disabled

Originally posted by @RusseII in #17 (comment)

Use variables instead of functional components for graphql

https://github.com/porter-finance/frontend-ido/blob/3e952cc8774e3527982d5821695b0792b31fb7db/src/hooks/useBondDetails.ts#L8-L23

Apollo client has a native way for passing in variables that helps with caching - https://www.apollographql.com/docs/react/data/queries#caching-query-results

So for example, instead it should be

 const bondsQuery = gql` 
   query Bond { 
     bond(id: $bondID) { 
       id 
       name 
       symbol 
       owner 
       maturityDate 
       paymentToken 
       collateralToken 
       collateralRatio 
       convertibleRatio 
       isAuction 
     } 
   } 
   
  const { loading, error, data } = useQuery(bondsQuery, {
    variables: { bondID },
  });

Add graphql support for portfolio page

amount column in portfolio? how to get this. from gql, do i have to aggregate the bids and collect their full size for each bond?

Hmm, that's a good question. The portfolio page should show the porter bonds that the currently connected user has, and the amount should be the quantity for each bond. I don't believe this data is currently easily fetch-able via graphql but it should be. Use a dummy value for now, I'll create an issue to make this data available via graphql

image

Originally posted by @RusseII in #69 (comment)

Product Discovery Page

image

https://www.figma.com/file/55kihuNidQlR8YReCTJlPY/Product-(Jordan)?node-id=8586%3A650

This page shows all of the current bonds that exist and the info about them. Very similar to #31

  • Add page as designed

Auction page graph

  • bids should have filler
  • keep new order line
  • dont start sell supply line from 0
  • #63
  • remove am chart logo
  • minimum funding threshold missing
  • bug when adding amount & same price, graph dont update
  • chart seems innacurate , not hovering on right corners with right data? (need more info, can you check to reproduce @jordanalexandermeyer on the new pr preview) #53
  • interest rate in hover
  • #62

2022-04-11 at 08 42 34

Add Gnosis Safe Integration

Most of our users are DAOs that use gnosis safe.

Priority

This could be in the next flight. We probably do not need this at launch, but it is a good functional story to work on if blocked by designs

AC

  • look into if it makes sense for us to integrate with gnosis safe directly
  • integrate with it

More context

https://canary.discord.com/channels/903094151002857492/919775951523557456/951273692770471936
image

Example of how gnosis initiates an auction

https://github.com/gnosis/ido-starter

Improve UI through permit

Use permit method for supported paymentTokens and collateralTokens

Investigate checking if the token being used as collateral or payment could use .permit instead of .pay to reduce on gas costs.

Update frontend to use new version of the graph

@Namaskar-1F64F this would be a follow up of the subgraph update that you did the other day.

There has been even more changes to our subgraph so the ABIs and handlers will need updated again. We should also move to the new version on our frontend.

We may want to wait until after Peteris does a code review before doing this...

  • Update subgraph
  • (follow up) Work with lucky to figure out what data he needs that's missing from the subgraph and make it available. Example of one such issue #72

Get price data for collateral token

I think we should use uniswaps subgraph for price data.

https://thegraph.com/hosted-service/subgraph/ianlapham/uniswap-v3-subgraph?selected=playground

Example Query:

// tokenID is the collateral token 
{
  token(id: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9") {
 derivedETH
  }
  bundles(first: 5) {
    id
    ethPriceUSD
  }
}

Then the price per collateral token will be derivedEth * ethPriceUSD

I'm not sure the best way that we can test this since our testnet tokens won't have any value.

Thoughts and removing this from the bond file and encapsulating the state in the hook itself? Then doing the format wherever the value is being displayed?

Thoughts and removing this from the bond file and encapsulating the state in the hook itself? Then doing the format wherever the value is being displayed?

So instead of:

const previewConvert = useCallback(
    async (amountToPreview?: TokenAmount | null): Promise<string> => {
      if (!tokenContract) {
        logger.error('tokenContract is null')
        return ''
      }

      if (!amountToPreview) {
        logger.error('missing amount to preview')
        return ''
      }

      const response = await tokenContract
        .previewConvertBeforeMaturity(amountToPreview.raw.toString())
        .catch((error: Error) => {
          logger.debug('Failed to preview token', error)
          throw error
        })

      return response
    },
    [tokenContract],
  )

Something like

  const usePreviewConvert = async (amountToPreview?: TokenAmount | null, bondAddress: string): Promise<string> => {
    const tokenContract = useBondContract(bondAddress)

    const [amount, setAmount] = useState(null)
    if (!tokenContract) {
      logger.error('tokenContract is null')
    }
    useEffect(() => {
      const previewConvert = async () => {
        const number = await tokenContract
          .previewConvertBeforeMaturity(amountToPreview.raw.toString())
          .catch((error: Error) => {
            logger.debug('Failed to preview token', error)
            throw error
          })
        setAmount(number)

      }

      previewConvert()
    }, [amountToPreview, tokenContract])

    return amount 

  )
}

We could also leave cleanup tasks like this to later if you think that makes sense

Originally posted by @RusseII in #24 (comment)

Post V1 Brainstorming

Some optimizations/additions we could focus on from the frontend side after finishing our V1 frontend.

  • Upgrade tooling (nextjs?)
  • Frontend testing
  • Add verified and unverified bonds
  • Add geolocation
  • Add way to sell bonds OTC
  • Integrate with 3rd party protocol like prime.xzy to fetch more risk information about the bonds
  • Multiple collateral
  • Better support for fractionalized NFTs
  • Add additional ways to sell bonds
  • Preloading

Offering Discovery Page

image

https://www.figma.com/file/55kihuNidQlR8YReCTJlPY/Product-(Jordan)?node-id=8586%3A650

This page shows a list of all of the current offers. An offering can be a Gnosis Auction or an Over the Counter (OTC) offering using something like airswap. Ignore OTC for now and only fetch/show the list of Auctions.

Get the images displayed from the collateralToken being used. Gnosis has code that handles getting an image from an address - https://github.com/porter-finance/frontend-ido/blob/5a532365c6d09689538c889e7fbfb5bbb3866f37/src/components/token/TokenLogo/index.tsx

Auctions/Products/Portfolio lists should probably all use the same table component

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.