Coder Social home page Coder Social logo

docs's Introduction

Uniswap Documentation

This web application contains all documentation for Uniswap products. It is built using Docusaurus 2, a modern static website generator.

Project Layout

Uniswap documentation is broken down into four sections:

  • Concepts - General Uniswap information or concepts useful for using Uniswap products, such as Liquidity and Fees
  • Contracts - Uniswap smart contracts such as the V3 Contracts or Permit2
  • SDKs - Uniswap integrations such as the v3-sdk and the Swap Widget
  • APIs - The Uniswap APIs such the Subgraph API

Each item in a section should include the following:

  • Overview
  • Guides
  • Technical Reference

Adding Documentation

After deploying your change, please make sure you update the search indices if a new file was added as part of the change

Overview

A product overview should address points such as:

  • What are the high level components of the product?
  • What what is the high level functionality the product offers?
  • Where does the source code of the product live?
  • Where does the code artifact live (eg npm) and how does someone integrate with it?

A good example is the V3 Smart Contracts.

Guides

Guides should follow the Principles of a Good Guide:

  • A guide corresponds to a reusable piece of code that demonstrates a single concept in the Uniswap ecosystem.
  • Guides have three parts:
    1. An introduction that explains the concept that the piece of code implements and a summary of what the guide will cover and result in.
    2. A step-by-step walkthrough of each line of the example code
    3. An output or end state that users can test against what they’re seeing to know if they implemented correctly
  • Guides do not show source code snippets that should not be included in the example (IE using snippets from a source contract to explain how to integrate with it). If a guide needs to reference an external piece of code it should link to the source code or technical reference.
  • We keep Links and References only at the bottom of pages and reference them using footnotes to keep distractions at a minimum
  • Our goal is to have the developer build something within 10 minutes per guide but also provide the option for a deep dive by providing references to extra content.
  • Guides should end with a transition to the next one, recommendations and real world projects examples
  • Each guides should refer to a code example in our example-repo
  • Guides should be standalone pieces
  • Use the least dependencies as possible
  • Input changes (eg address, tokens, amounts) should be in the code

By implementing these consistent principles Uniswap will have docs that are easy to understand and produce reusable code for its community.

A good example is the V3 SDK Guides.

Technical References

This should contain the technical reference for the exported interfaces. A good example is the V3 SDK. These files can be created using the guides below.

Contributing to Uniswap Docs

Guidelines

Contributing to the docs site is a great way to get involved in the dev community and help other developers along the way! Check out our guidelines here.

Checklist for adding a new product

  • Did I pick the right section for the product?
  • Did I create the product folder?
  • Did I introduce any new concepts? If so add under /concepts/<category_name><product_name>
  • Did I include an Overview of the product under <category_name>/<product_name>/overview ?
  • Did I include Guides of the product under <category_name>/<product_name>/guides ?
  • Did I include Technical Reference of the product under <category_name>/<product_name>/reference ?
  • Did I give a descriptive name/id to each document? This is important because that shows up in the URL
  • Did I open a PR using the the contributing guidelines?
  • Did I update the search indices after my change was deployed?

Checklist example

Let's walk through an example by considering the Permit2 smart contract:

  • Did I pick the right section for the product?
  • Did I create the product folder?
    • In this case, yes
  • Did I introduce any new concepts?
    • No
  • Did I include an Overview of the product under /contracts/permit2/overview ?
    • Yes, I did add them here
  • Did I include Guides of the product under contracts/permit2/guides ?
    • No, they should be added here
  • Did I include Technical Reference of the product under contracts/permit2/reference ?
    • Yes I added them here
  • Did I open a PR using the the Contributing guidelines?
    • Yes
  • Did I update the search indices after my change was deployed?

How to create a Technical Reference

How to generate markdown files from solidity Natspec comments

Install solidity doc gen npm install solidity-docgen

Get the correct compiler version npm install -D solc-0.7@npm:[email protected]

Put the updated template contract.hbs in a /templates folder under the same directory as /contracts that you want to generate

Run npx solidity-docgen --solc-module solc-0.7 -t ./templates

How to generate markdown files from typescript comments

npm install --save-dev typedoc typedoc-plugin-markdown

Depending on how your project was created, you might have to install Typescript: npm install --save-dev typescript

npx typedoc --out <docs> src/index.ts

You might have to use the --skipErrorChecking flag to the typedoc command for cases where types are fetched during transpile time, such as contract ABIs.

See https://www.npmjs.com/package/typedoc-plugin-markdown for details.

How to Update search indices with algolia

  • Create an .env file with APPLICATION_ID and the API_KEY (write access). If you don't have those, one for the Engineering Managers should be able to help you.
  • Edit config.json file if needed:
  • Install and start running Docker Desktop
  • Install jq brew install jq
  • Run docker run -it --env-file=.env -e "CONFIG=$(cat ./config.json | jq -r tostring)" algolia/docsearch-scraper

Installation

yarn install

Local Development

yarn run start

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

Clear cache

yarn docusaurus clear

Build

yarn build

This command generates static content into the build directory and can be served using any static contents hosting service.

Deployment

The application automatically deployed to production using Vercel upon merge into main.

docs's People

Contributors

adjkant avatar akarys92 avatar ben-29 avatar bradens avatar callil avatar dannydaniil avatar danrobinson avatar electrone901 avatar eulerbeat5 avatar ewilz avatar ianlapham avatar jfrankfurt avatar just-toby avatar kamaci avatar kristiehuang avatar mrossesf avatar nathanhleung avatar nhausman1 avatar noahzinsmeister avatar pablocastellano avatar rachel-eichenberger avatar romainhuet avatar sandianyu avatar scbuergel avatar snreynolds avatar uniyj avatar willhennessy avatar willpote avatar yorkemartin avatar zhongeric avatar

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

docs's Issues

Docs for Liquidity Mining

Draft how to guides for Liquidity Mining. I would suggest two:

  • User Guide: how to participate
    • how to join a liquidity mining program (either with an existing LP position, or by creating a new LP position)
    • how rewards are calculated
    • how to claim (what happens if you claim after the end time)
  • Dev Guide: how to create a Liquidity Mining program
    • lots of little details to know about

reference: https://docs.google.com/document/d/1DBxUVmp2Qq-JZYNe0XloZ968tdVO8SNGD83sEMOUu3A/edit#

liquidity provider user guide page - "deposit amounts" section has wrong info

https://docs.uniswap.org/concepts/introduction/liquidity-user-guide#5-deposit-amounts currently says:

Entering a value in one of the 'Select Deposit Amounts' modules will automatically fill the remaining module on a 50/50 split basis. As an example, if an LP is depositing into the ETH-DAI pool and the ETH price is 2,000 DAI per ETH, a deposit amount of 1 ETH will be automatically matched with 2,000 DAI.

An LP may choose to deviate from a 50/50 portfolio balance from the outset. LPs can adjust their exposures by returning to the previous step β€” Select Price Range β€” and modifying either upper or lower bound.

But nowhere in the preceding "select price range" section did it mention/assume an example price range that is geometrically-equidistance from the current price (a prerequisite for the 50/50 split quoted above).

I will try to rewrite some of these, to be consistent/correct in the example/assumptions, and then submit a PR.

SDK docgen template (Handlebars.js) needs to be rewritten

https://typedoc.org/

https://www.npmjs.com/package/typedoc-plugin-markdown

The typescript template for generating markdown pages is generating too much unhelpful content in the pages, and is organized (imo) in an unintuitive way. The template is written in Handlebars, and is broken into a bunch of libraries and was pretty confusing to me, so this will take some time.

Its possible that the better option is to manually create the SDK reference docs and abandon the docgen process, but that path has its own issues.

Update add Liquidity user guide

  • Maggie is creating new gifs
  • Will or Teo to write new copy for selecting price range based on distribution chart. Also explain auto fee tier.
  • Migrate to the new Intercom site

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.