🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/Alien-Worlds/missions-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/Alien-Worlds/missions-api

v0.0.0-20221214085405-3bf72d06271a
Source
Go
Version published
Created
Source

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

  • 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
      
  • Open project using IDE (e.g GoLand from JetBrains), open IDE terminal, run

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

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

  • Modify run configuration as follows:

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

    migrate up
    run service
    

For deployment purposes

  • Navigate to the cloned repository

  • 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

  • Build container image:

    docker compose build
    
  • 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

FAQs

Package last updated on 14 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts