Code Monkey home page Code Monkey logo

emp-tools's People

Contributors

adrianmcli avatar akhanubis avatar ashutoshvarma avatar chrismaree avatar daywiss avatar dependabot[bot] avatar mrice32 avatar nicholaspai avatar smb2796 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emp-tools's Issues

Get rid of null checks in rendering logic

I was thinking about how we might avoid the null checks in normal logic throughout the dapp. In the past I've generally used loading guards to block off the logic until the data is all non-null.

However, @adrianmcli mentioned is that the user shouldn't have to connect their wallet to view read-only info. I like that philosophy a lot, but there are a few issues with it in this dapp right now:

  • Many of these pages are't viewable until the EMP-selector has data, so these pages can't be seen without connecting anyway.
  • Since we're unable to load much data on the page before connecting, the data that the user can see (at least on many pages) is somewhat useless.

I think we should:

  • Put loading guards at the top of most of the pages (at least the ones that require an EMP) to block the render function until all required data is loaded. This would look like:
if (someDataFromContainer === null || otherDataFromContainer === null || ... ) {
  return (
    <LoadingJSX />
  );
}
  • Figure out how to connect a read-only provider that would allow us to load blockchain data without the user connecting a wallet.

Thoughts @nicholaspai @chrismaree @adrianmcli?

Latest build feedback

  1. Create refers to "Balance too low" but Deposit refers to "Dai balance too low"
    image
    image

These should be the same standard. I think bot being the collateral type is good.

  1. I can still submit a withdrawal request that would defiantly be liquidated.
    I have a position of 412.5 collateral but I can submit a withdrawal request of 400 Dai. The resulting CR of this is 0.0795, which would clearly liquidate me.
    image

Ideally, the UI should NOT let me submit any tx that would make my CR < CR requirement.

  1. Create shows me a red CR before I've entered any info
    image

Here the "CR of newly created tokens" is red. the color here is correct but perhaps only make it red if the value is > 0 & < GCR so it does not start as red by default.

Fallback to infura if no wallet connected

If the user has not connected metamask the app should still work to show contract information. It should gracefully use infura directly to show EMP contract info but disable the manage tab until they connect their wallet.

Improve how we deal with `promise.all`s syntax

Thre are a few places in the dapp where promises are dealt with like this:

      const res = await Promise.all([

This is pretty messy as each response needs to be quired as res[0],res[1] etc.

Consider refactoring this to something more like:

const [hasPriceResult, finalFeeResult] = Promise.all...

Add EIP747

EIP747 enables a UI sugar facilitating a button that adds a known token to a users metamask account. This could be nice for tracking the synthetic tokens created in the dapp. See EIP747 for implementation details.

Mobile optimize emp-tools

Right now some of the components look fine on mobile, but others really don't. Overall, the app styling needs major refinement for mobile screen sizes.

Add helpful links to footer

Some candidate helpful links (Wrapped in IconButtons):

  • Smart contract source code
  • dApp source code
  • EMP smart contract audit by OpenZeppelin-
  • Community audit
  • UMA docs

Return only BigNumberish/BigNumbers from Containers, cast in Features

Currently, container data read from on-chain is returned as a combination of string and number types, however this opens the door for precision loss. Containers should return raw data and let downstream modules cast the data as they wish.

Example:
Position container returns position stats as strings and numbers but all should just be returned as BigNumbers, including derivative stats such as GCR

Paginate graphql queries

Currently queries first 1000 uma:positions and balancer:shares but should also be able to pass in a skip paramater to paginate.

Add a price feed to the CR ratio calculation

Right now the CR is calculated only with position size and collateral. No price is included which means you cant actually represent the CR as a percentage. If a price feed was added we would be able to show a CR % based off the current price of the underlier. Simply divide the current CR by the price to get the CR expressed as a percent.

Refine null type checks for consistency

Right now how we check for null types is inconsistent in some places of the dapp. Additionally, some places use a renderComponent and others do not.

We should define one consistent pattern any apply this through the dapp. For example, early returns which have two major readability advantages:

  1. Less nested logic.
  2. You don't have to search to find the else or see if it exists.

Add favicon.

Right now the dapp does not have any favicon. Current candidates:

  1. ๐Ÿ—
  2. ๐Ÿ› 
  3. ๐Ÿงฐ
  4. ๐Ÿšง
  5. ๐Ÿค‘

Create does not deal well if you already have a position

In the smart contracts, the create function can be called once a use already has a position. This increases their debt and collateral in the same tx. The front end currently does not gracefully deal with the case where the use already has a position. If this is the case they should be told what the resultant CR will be after making the position and show them the delta on their position stats.

The screenshot below shows how this could potentially be appended to the current components:
image

Show proper messaging on Create when no EMP is selected

  1. Connect
  2. Go to Manage Position
  3. When Create is selected (and no EMP is selected), the following message is displayed:

You need to cancel or execute your pending withdrawal request before creating additional tokens.

Instead we should probably have a different message if an EMP has not been selected, like:

Please first select an EMP from the dropdown above

Support Kovan contracts

We have deployed our contracts + many EMP's to the Kovan network. We should be able to switch networks on our web3 provider when using the dApp seamlessly

Add more wallet support

Right now the dapp only supports metamask. This is very limiting.

Consider adding onboard.js. While doing it consider adding notify.js

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.