Giter Site home page Giter Site logo

idclegacy's Introduction

Notes

make sure to change terra station to testnet

nvm use 14
npm install
npm start

Astroport Token Sales Frontend

Frontend app to buy & sell tokens using Astroport's LBP contracts.

Getting Started

Teams are expected to customize and host the frontend themselves. This guide will walk you through the steps necessary to configure and deploy the app. If further customization is desired, check out the Development section below.

It is recommended that you fork this repo and then make your changes there.

Important Note: The frontend assumes that one side of the LBP pair is UST. Changes will need to be made to the app to support other assets.

Configuration

  • Replace src/assets/images/logo.svg with your own logo
    • You may want/need to tweak the logo's size, or if your logo is not an SVG, change its import. The logo is rendered in the TokenSales component.
  • Configure your color scheme in theme.css
  • Update src/config/networks.js with:
    • Your mainnet Astroport LBP factory contract address (you are expected to deploy the factory and pair contracts yourself)
    • Your mainnet Astroport LBP pair contract address(es) (these are whitelisted by the frontend to control the asset pairs that are visible on the UI)
    • If you'd like to test the frontend on the testnet first, you could also deploy the necessary contracts to the testnet and update the testnet portion of networks.js with the factory and pair addresses.
  • If further UI customization is desired, the CSS entrypoint is src/index.css, and there are also component-specific CSS files in src/components.
    • You also have full access to Tailwind's wonderful suite of utility classes.
    • The app makes extensive use of Tailwind's utility classes for things like spacing, font size, weight, etc., and generally avoids custom styles wherever possible. You can configure Tailwind in tailwind.config.js.
  • This app is configured out-of-the-box with Sentry support for error tracking/reporting.
    • If you do not plan on using Sentry, or any other error tracking/reporting service, no action is necessary.
    • If you'd like to use Sentry, you'll need to set the REACT_APP_SENTRY_DSN environment variable at build time (more on this below in the Deployment section).
    • If you'd like to use a different service, you can make the necessary changes in src/index.js and src/report_exception.js.

Deployment

The recommended process is to configure continuous deployment via Github Actions or some other means, but you could also build the project yourself and upload the resulting static site to any web host.

Via Github Actions

If deploying via Github Actions, you can reference .github/workflows/staging_ci_cd.yml as a template.

That workflow will run the test suite and then, if it passes, deploy to Netlify. If you'd like to deploy to Netlify as well, you'll only need to make a few changes:

  1. Update REACT_APP_DEFAULT_NETWORK in staging_ci_cd.yml to mainnet for your production workflow.
  2. Configure the NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID Github Actions secrets.
  3. Configure the SENTRY_DSN Github Actions secret if using Sentry.

Manual Deployment

To build the project, you'll need to set up your local environment by installing node and npm and then all project dependencies as described in the Development section below.

Once your local environment is set up, building the project is as easy as running:

$ npm run build

Or, if using Sentry:

$ REACT_APP_SENTRY_DSN=https://your-sentry-dsn npm run build

That will build everything that you need to host the app in the build folder. Simply upload that to your web host of choice.

Note: The network that's used in the build is pulled from the REACT_APP_DEFAULT_NETWORK environment variable, which defaults to mainnet. If you'd like to generate a build using another network by default (e.g. testnet for a test deployment), you should run something like:

$ REACT_APP_DEFAULT_NETWORK=testnet npm run build

Development

Stack

Requirements

  • node v14.
  • npm v6.

If you have nvm installed, it should select the correct version for you based on the .nvmrc.

Install dependencies

$ npm install

Configuration

  • The mainnet and testnet networks are configured in src/config/networks.js, but you can configure additional networks, or override those networks entirely, in src/config/environments/development.js. See development.js.sample for a template.
  • The default network is selected based on the REACT_APP_DEFAULT_NETWORK env variable. By default (in .env), it's set to mainnet. You can override this to a network that you specify in src/config/environments/development.js in a .env.development.local file. See .env.development.local.sample for a template.
  • A sensible configuration for local development would be to define a localterra network in src/config/environments/development.js, and set REACT_APP_DEFAULT_NETWORK to localterra in .env.development.local.
  • Important Note: You must whitelist any pairs that you want the app to care about in the allowedPairContracts key of each network config.

Running the development server

$ npm start

You can then access the application by going to http://localhost:3000 in your web browser.

The page will reload if you make edits. You will also see any lint errors in the console.

Testing

$ npm test

Launches the test runner in the interactive watch mode.

Building

$ npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

TODO

  • Add historical pricing plot

LICENSE

This repo is under a MIT license.

idclegacy's People

Contributors

jimryan avatar idtokenone avatar ivan0101010101 avatar stefanionescu avatar zlace0x avatar

Watchers

 avatar

Forkers

idc1201

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.