Giter Club home page Giter Club logo

kwenta's Introduction

CodeQL Discord Twitter Follow GitPOAP Badge

Kwenta

A dApp enabling derivatives trading โ€” powered by the Synthetix protocol.

The decentralized trading UI is available at kwenta.eth.limo.

ENS link: kwenta.eth.

The latest IPFS hash can be found under releases.

Tech stack

  • Next.js
  • React
  • Redux
  • Styled-Components

Ethereum stack

Development

Install dependencies

npm install --legacy-peer-deps

Set up environment variables

Copy the .env.local.example file in this directory to .env.local (which will be ignored by Git):

cp .env.local.example .env.local

Then, open .env.local and add the missing environment variables:

Required:

  • NEXT_PUBLIC_PROVIDER_ID - Specifies the default provider, options are INFURA or BLAST_API
  • NEXT_PUBLIC_INFURA_PROJECT_ID - Infura project id (get it from infura.io) or
  • NEXT_PUBLIC_BLASTAPI_PROJECT_ID - Blast API project id (get it from blastapi.io)

Run

npm run dev

Open http://localhost:3000 to view it in the browser.

Build

npm run build
npm start

Unit Testing

npm run test:unit

For unit tests we use a combination of Jest and React Testing Library

Page tests should be added to the __tests__ folder at the root as it is not possible co-locate tests and pages in nextjs. Other tests should be co-located in a __tests__ folder next to their related file.

End-2-End testing

In order to run fully automated end-2-end (e2e) tests Kwenta uses Synpress (a wrapper around Cypress).

Constraints

The current e2e tests are written to be run on Optimistic Kovan using Chrome as the browser.

Setup

  • Download and install Google Chrome
  • Setup a test wallet on Optimistic Kovan and fund it with plenty of ETH (to pay for gas) and sUSD
  • Prior to running the tests you must set the environment variables below in the shell from which npm is started. Unfortunately, at this time other methods to set said environment variables (eg. through .env.local) don't work in conjunction with Synpress.
PRIVATE_KEY=<INSERTPRIVATEKEY>
NETWORK_NAME=OptimisticKovan
RPC_URL=https://kovan.optimism.io
CHAIN_ID=69
BLOCK_EXPLORER=https://kovan-optimistic.etherscan.io
IS_TESTNET=true
Bash convenience script for setting up the environment

A Bash convenience script has been made available here.

  • Open bash
  • Copy the private key of the test wallet into the file SYNPRESS_PRIVATEKEY into the same folder location as the script. While using this method, please don't forget to update your .gitignore file to prevent your private key to be leaked.
  • Run the following command source ./synpress-envsetter.sh

Run the tests

npm run build
npm start
npm run test:e2e:only:tests

Contributing

Kwenta welcomes contributors. Regardless of the time you have available, everyone can provide meaningful contributions to the project by submitting bug reports, feature requests or even the smallest of fixes! To submit your contribution, please fork, fix, commit and create a pull-request describing your work in detail. For more details, please have a look at the Contribution guidelines.

Contact

Join the community on the Kwenta Discord server!

kwenta's People

Contributors

evgenyboxer avatar koredefashokun avatar jcmonte avatar drptbl avatar tburm avatar platschi avatar avclarke avatar leifuchen avatar dependabot[bot] avatar 0xclem avatar andytcf avatar asherism avatar jwineman avatar brossetti1 avatar kmeraz avatar 0xjocke avatar dbeal-eth avatar kelonye avatar xiaolei-shawn avatar 0xwontonsoup avatar 0xwalde avatar zhyd1997 avatar burtrico avatar leovct avatar kngzhi avatar abhisheknaiidu avatar lohba avatar keybig avatar joeyzhaozhao avatar kethcode avatar

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.