Giter Site home page Giter Site logo

ursify / dex-contracts-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geniusyield/dex-contracts-api

0.0 0.0 0.0 478 KB

Off-chain code to interact with Genius Yield DEX contracts

Home Page: https://www.geniusyield.co/

License: Apache License 2.0

Shell 1.67% Haskell 96.46% Makefile 0.13% Dockerfile 1.74%

dex-contracts-api's Introduction

GeniusYield DEX

This repository houses on-chain smart contracts, Haskell off-chain interaction logic and server endpoints enabling users to easily interact with DEX in language of their choice.

Table of Contents

Structure of repository

  • geniusyield-dex-api provides off-chain code to interact with our DEX. See it's README.md for more information about it.
  • geniusyield-server-lib serves endpoints using our off-chain code to easily interact with GeniusYield DEX in language of user's choice.
  • geniusyield-orderbot-lib cater to additional requirements such as building up of an order-book, receiving price feed, etc.

Spinning up server

Endpoints made available by server are specified here.

  1. Make sure your environment is configured properly, consult "How to build?" section of Atlas documentation for it.

  2. Prepare a configuration, which can be stored either in file or in SERVER_CONFIG environment variable. Structure of it is as follows:

     # Blockchain provider used by Atlas, our off-chain transaction building tool.
     # Supported values of `coreProvider` represented as JSON for brevity:
     # Local node in combination of Kupo, `{ socketPath: string, kupoUrl: string }`
     # Maestro, `{ maestroToken: string, turboSubmit: boolean }`
     # Blockfrost, `{ blockfrostKey: string }`
     # Note that Blockfrost is not recommended as some of the operations performed aren't optimal with it.
    coreProvider:
      maestroToken: YOUR_MAESTRO_TOKEN
      turboSubmit: false
     # Network id, only `mainnet` and `preprod` are supported for at the moment.
    networkId: mainnet
     # Logging configuration. It's an array to cater for potentially multiple scribes.
    logging:
      - type:
           # TODO: Possible values of `tag` are to be documented.
          tag: stderr
         # Possible values of `severity` are `Debug`, `Info`, `Warning` and `Error`.
        severity: Debug
         # Possible values of `verbosity` are `V0`, `V1`, `V2`, `V3` and `V4`. Consult https://hackage.haskell.org/package/katip-0.8.8.0/docs/Katip.html#t:Verbosity for more information about it.
        verbosity: V2
     # Port to serve endpoints at.
    port: 8082
     # Maestro API key (token) to access information such as asset details given it's currency symbol and token name.
    maestroToken: YOUR_MAESTRO_TOKEN
     # API key to protect server endpoints with. It's value must be provided under `api-key` header of request.
    serverApiKey: YOUR_SECRET_KEY
     # Optionally, wallet key details if one wants server to be able to sign transactions using this key.
    wallet:
      tag: mnemonicWallet
      contents:
        mnemonic:
          - health
          - unable
          - dog
          - lend
          - artefact
          - arctic
          - dinner
          - energy
          - silent
          - wealth
          - shock
          - safe
          - glad
          - mail
          - gas
          - flag
          - beauty
          - penalty
          - mixed
          - garbage
          - erupt
          - wonder
          - magnet
          - around
        # Account index.
        accIx: 0
        # Payment address index.
        addrIx: 0
     # Optionally, a stake address which is used to place orders at a mangled address, i.e., an address having payment component of the order validator but staking component from the given stake address. It has to bech32 encoded, with prefix "stake_test" for testnet and "stake" for mainnet.
    stakeAddress: stake1...
     # Optionally, one can specify collateral in the configuration to avoid sending it's information in the endpoints which require it.
    collateral: 15522d2518b36bdeb8e2e4829aff7ae9e5afbf74387d756543c5e955e83a9434#2
  3. Run the server with command cabal run geniusyield-server -- serve -c my-config.yaml. Run cabal run geniusyield-server -- -h for help ๐Ÿ˜‰.

  4. Test if server is running successfully by calling, say, /settings endpoint. Example curl request: curl -H 'api-key: YOUR_SECRET_KEY' -X GET http://localhost:8082/v0/settings | jq, assuming port was specified as 8082. On success, it should return something akin to:

    {
      "network": "mainnet",
      "version": "0.1.0",
      "revision": "c2f8db2bc82a13c850c3b0088a1ce089bb1065b7",
      "backend": "mmb"
    }
    

Contributing

We welcome all contributors! See contributing guide for how to get started.

License

Apache-2.0 ยฉ GYELD GMBH.

dex-contracts-api's People

Contributors

sourabhxyz avatar 4tt1l4 avatar brunjlar avatar matd9 avatar ursify avatar micrograx 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.