missions-api

command module
v0.0.0-...-3bf72d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

README

missions-api

An event listener for contracts deployed on binance smart chain to store the events information in the database

Visual Source

Requirements

Running the service

For development purposes
  1. Modify config.yaml file with your needs:

    • Provide a database url where the information will be stored in the form as provided here

      db:
         url: "postgresql://[userspec@][hostspec][/dbname][?paramspec]"
      
    • Provide contract address instead of 0x0..0

      contract:
         address: "0x0000000000000000000000000000000000000000"
      
    • Provide block number to start with

      blockchain_info:
                 from_block_num: 8325019
      
    • If you are using local blockchain (e.g Ganache), provide other endpoint

      rpc:
         endpoint: "http://127.0.0.1:8545" # or localhost
      
  2. Open project using IDE (e.g GoLand from JetBrains), open IDE terminal, run

    go mod init
    go mod vendor
    
  3. At bsc-checker-events/assets/main.go run two migration related scripts:

    //go:generate packr2 clean
    //go:generate packr2
    
  4. Entry point is bsc-checker-events/main.go

  5. Modify run configuration as follows:

    • KV_VIPER_FILE=config.yaml (environment variable)
  6. Run service twice with the following command arguments:

    migrate up
    run service
    
For deployment purposes
  1. Navigate to the cloned repository

  2. Do the step 1 from development build, except modify config at configs/spaceship-staking.yaml, changing contract address and database url (for the contract deployed on the Binance Smart Chain leave the endpoint as it is

  3. Build container image:

    docker compose build
    
  4. Run using docker-compose

    docker-compose down -v
    docker-compose up -d
    
API

To change port, configure

listener:
  addr: :8888

where 8888 is a port to listen on.

Endpoints
/missions # get all missions
/missions/{mission-id} # get mission by it's id
/explorers/{explorer-address} # get missions joined by explorer address

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
assets
You can use the "packr clean" command to clean up this, and any other packr generated files.
You can use the "packr clean" command to clean up this, and any other packr generated files.
assets/packrd
You can use the "packr2 clean" command to clean up this, and any other packr generated files.
You can use the "packr2 clean" command to clean up this, and any other packr generated files.
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL