Giter Club home page Giter Club logo

website's Introduction

Website & 0x Portal DApp

This repository contains our website and 0x Portal DApp (over-the-counter exchange), facilitating trustless over-the-counter trading of Ethereum-based tokens using 0x protocol.

Contributing

We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.

Please read our contribution guidelines before getting started.

Local Dev Setup

Requires Node version 6.9.5 or higher

Add the following to your /etc/hosts file:

127.0.0.1 0xproject.localhost

You will also need to have the aws CLI installed locally and your credentials set up.

Install dependencies:

yarn install

Initial setup

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

yarn build

Run dev server

yarn dev

Visit 0xproject.localhost:3572 in your browser.

Clean

yarn clean

Lint

yarn lint

Indexing docs

Before you can index the docs on Algolia, you need to set the admin API key environment variable:

# 0x Website frontend
export ALGOLIA_ADMIN_API_KEY={YOUR_ADMIN_API_KEY}
yarn index_docs

The above script will index all the docs found in the /mdx folder on Algolia. It's possible to pass in arguments that match the directory names to index only those document types, i.e. yarn index_docs --indexes 'tools,core-concepts' --environment development will index tools and core concepts for development.

Running the script updates some of the meta information about the files (relative paths to files and versions of the doc). For other types of information (i.e. title, subtitle, tags...) you will have to update it yourself.

Resources

Toolkit
Recommended Atom packages:

website's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

website's Issues

ZRX Portal - migrate website to use web3-react

Currently ZRX Portal relies on custom logic to handle interactions with web3 wallets in both the Staking portal and the governance page. To be quicker in adding support for new wallets we would like to migrate our custom implementation to using web3-react (https://github.com/NoahZinsmeister/web3-react/) and its simple hook-based interface.

Requirements:

  • Swap out all custom web3 logic to standardized web3-react integrations for the different wallets.
  • Web3 connection information should come from the web3-react hook, it should be removed from global Redux state.
  • We want to support the same wallets as we do today, with added support for WalletConnect mobile wallets.
    • Injected wallets (Metamask, Coinbase Wallet, Cipher, Trust Wallet, ImToken, BitPie)
    • WalletLink wallets (Coinbase Wallet)
    • WalletConnect wallets (Trust Wallet, Argent, Metamask Mobile, Rainbow)
  • We want keep the same UI dialog for connecting wallets.

Useful information about current implementation

See below PRs for information about how the current implementation is implemented.

Staking APR on 0x.org/zrx pools table

Propose to change the Average Rewards Shared column with the Average APR (last 3 epochs)

The proposed approach here calculates the APR client side, using staking API

Missing data point on Staking API : historical memberZrxStaked per epoch per pool necessary for calculation *
example
https://api.0x.org/staking/pools/23 -> allTimeStats -> memberZrxStaked (together with totalRewardsPaidInEth,membersRewardsPaidInEth..., indexed by epoch)

Endpoints used in calculation

Algo

Assume we want to calculate average across N=5 epochs
Assume current epochId = eid = 54

Pull start date of every epoch from eid - N (loop through https://api.0x.org/staking/epochs/X)
{{[epochId: 49, epochStart: timestamp], [epochId: 50, epochStart: timestamp]...[epochId: 53, epochStart: timestamp]}

For each Pool Y
From https://api.0x.org/staking/pool/Y, pull last N data points of

  • memberZrxStaked by epoch {[epochId: 49, memberZrxStaked], [epochId: 50: memberZrxStaked], ...[epochId: eid-1, memberZrxStaked]} --> * needs to be added in endpoint
  • membersRewardsPaidInEth by epoch {[epochId: 51, membersRewardsPaidInEth], [epochId: 52, membersRewardsPaidInEth], ...[epochId: eid-1, membersRewardsPaidInEth]}

Pull ZRX and ETH prices for every epochStart (day closure price seems fine).
{[epochId: 49, ZRX, ETH], [epochId: 50, ZRX, ETH], ...[epochId: eid-1, ZRX, ETH]}

Now it's possible to compute the APR per epoch per pool

APR_e_p = (membersRewardsPaidInEth * ETH / memberZrxStaked * ZRX )_e_p * (365 / epoch_length)

Can assume epoch_length = 7. Could be using the difference of the epoch start/end to generalize
It's now possible compute average per pool over N epochs.

Variations

The approach above excludes the current epoch.
Adding the current epoch APR can introduce strong fluctuations at the beginning of an epoch, as it requires estimating earnings on the fly and that can change dramatically with pool saturation.

What could be used alternatively for that would be the sevenDayProtocolFeesGeneratedInEth field, which should progressively match the actual value, but smoothens out the beginning of an epoch.

Algo for current epoch APR:

  1. Fetch nextEpochStats -> memberZrxStaked (it's fixed during the epoch, and that's what used for calculations. Could use currentEpoch alternatively, but it will not show the effect of new/churned stake) from https://api.0x.org/staking/pools/X
  2. Fetch last ETH price
  3. Use ZRX price at the beginning of the current epoch
  4. APR_currentepoch_p = ( sevenDayProtocolFeesGeneratedInEth * ETH / memberZrxStaked * ZRX )_p * (365 / epoch_length)

Would suggest averaging past N APRs with current epoch APR for best-smoothened result

Trezor T

Hi, when i connect and try to stake from my Trezor T wallet, i recive this message,

`The current version of firmware (2.3.0) may be not compatible with the running version of Trezor Connect.
The current version of firmware contains major changes that could affect the efficient functionality of Trezor Connect.

If you’re experiencing any issue as a user, please contact the owner of chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn.
If you are a developer of chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn please, update Trezor Connect to the newest version.`

Add wCELO balances in /treasury page

The 0x Treasury will soon have wCELO balances as a result of the injection of capital by CELO foundation.

Currently, ZRX Portal Treasury page does not support any other tokens than ZRX and MATIC.

The parts of the code that are likely to be modified are

The Treasury has already 1 wCELO balance so it could be tested even before the entire funds are transferred.

ZRX Portal - Staking Simulator

One of the most requested features by ZRX Portal users is a tool that helps them simulate rewards based on a prospective stake.
The design team at 0xLabs prepared mocks of a sliding widget to be added to the Portal.

Designs

https://www.figma.com/file/hYG4xEMFrugLn6jnUmsOvH/Staking-Dashboard-(staking-calculator)?node-id=3728%3A0

Behavior

Refer to prototype mode in the Figma file.
The widget slides laterally from the right. It's pre-populated with staking pool data, in condensed view. The additional data is available when clicking on 'more settings'.
At the bottom, the reward and the yearly return is estimated and returned to the user.

It's possible to manually enter values. When pool-related metrics are manually entered, the dropdown menu switched to 'Manual'.

Data (WIP)

Here's a rough mapping of the 0xAPI endpoints to be used to calculate the different fields

Access

This widget is contextually available in multiple locations in the Portal:

  • in the staking pool page, via a dedicated CTA button.
  • in the account page, via a 'Calculate Rewards' button near the estimated reward for the staked pool. This section will have to be updated as well (as per designs)

Only coinbase wallet being displayed

Screenshot 2020-08-22 at 20 08 27

Is this normal?

Am I not supposed to see Metamask or Ledger wallets as well? Do I absolutely have to pass through Coinbase in order to stack ZRX?

Create onchain vote infrastructure in ZRX Portal

As mentioned in 0x’s latest governance roadmap update, 0x Labs is planning to migrate its governance infrastructure into on chain-binding systems in 2021. One of the most battle-tested smart contract architectures in this category is the one created and used by Compound. The system has been functioning smoothly since its launch, and recently adopted also by Uniswap. In Q1, we are planning to start customizing Compound’s contracts to support the governance of the 0x protocol.

In the meantime, we’re looking for someone to help us adapt ZRX Portal to support such a governance flow. More specifically the 0x.org/zrx/vote page will have to pull onchain proposals, and provide a flow for ZRX holders to vote and/or delegate their ZRX to other address. 0x specific contracts will not be available for testing this feature, but we're planning to test it with Compound's or Uniswap's implementations.

Requirements

Web2

  • create onchain vote ("proposal") page components and containers. It will likely be a simplified version of the current "zeip" page.
  • if necessary, create abstraction of 'vote page', which will accommodate both existing off-chain votes ("zeip" page, example) and onchain vote ("proposal") pages - the one added in this effort. Both vote types will have to co-exist.
  • blend the two types of page in the /zrx/vote page list. Users will be able to access them interchangeably and will be sorted chronologically.
  • add a label to identify the different statuses of the votes (Upcoming, Live, Passed, Rejected), based on status.
  • link to the 0x forum in the /zrx/vote page
  • (nice to have) label to distinguish votes coming from onchain sources ("proposal") and off-chain ("zeip").
  • create delegation widget (example in Compound and Uniswap) with popup flow to change delegation.
  • create leaderboard page, similar to Compound's. TBD where to link it from main governance page, and whether to have a widget embedded there.

Web3

  • connect through infura/alchemy (already available in ZRX Portal) to pull onchain proposals from either Uniswap or Compound
  • populate "proposal" page with the information pulled onchain. You can refer to examples like this 1 2. The minimum set of details needed will be [Yes|No], the description, the vote start/end, the link to the onchain transaction.
  • vote on onchain votes ("proposals"), utilizing web3-react already provided in ZRX Portal
  • change delegation signing transaction, utilizing web3-react already provided in ZRX Portal
  • populate leaderboard page

This issue requires a fair amount of creative freedom when it comes to designing and architecting the page. We are looking for a dev that enjoys loosely specced projects and is autonomous in making decisions.
Experience in web3 is required. You will be working together with Theo and Paul from the 0x Platform team, and who will help you clarify the requirements and make decisions/prioritizations with you.
Theo will contact you over DM (if you left that option open on gitcoin) or over email to setup an intro call, before assigning bounty.

saturation metric fix

the saturation metric uses

getGlobalStakeByStatus("delegated")

which is different from the metric used for staking rewards calculations (totalWeightedStake), which is

aggregatedStatsByEpoch(current epoch)[3]

I believe the choice was made in order to display saturation as a projective measure for the upcoming epoch, taking into account new stake which has occurred before the start of the next epoch.

There's tradeoffs in either solution, and I think it's worth a discussion to understand whether the issue is relevant. I am happy to close the issue should we deem the projective measure, though incorrect, is better from a users' perspective.

Meta tags for ZRX Portal and upcoming 0x API page

0x API

Title: 0x API: Access all DEX liquidity through one API

Description: A single developer endpoint to source an aggregation of liquidity

Tags: aggregated liquidity, DeFi liquidity, DEX, Decentralized Exchange, Ethereum, 0x, 0x Protocol, Tokens, ZRX, Crypto Exchange, Cryptocurrency, Crypto, DeFi, Decentralized Finance, crypto trading, token swaps, swap tokens, swap crypto, fill orders, networked liquidity, contract-fillable liquidity, CFL, atomic arbitrage, arbitrage bots, algo trading

ZRX Portal

Title: ZRX Portal: Stake and vote with your ZRX tokens

Description: Earn liquidity rewards by staking ZRX

Tags: DEX, Decentralized Exchange, Ethereum, 0x, 0x Protocol, ZRX, token staking, ZRX token, ZRX price, ZRX staking, ZRX voting, 0x governance, Crypto Exchange, Cryptocurrency, Crypto, DeFi, Decentralized Finance, Open Finance, Crypto Market Maker, Networked Liquidity, 0x Home, staking dashboard

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.