An event listener for contracts deployed on binance smart chain to store the events information in the database
-
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
-
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
To change port, configure
listener:
addr: :8888
where 8888 is a port to listen on.
/missions # get all missions
/missions/{mission-id} # get mission by it's id
/explorers/{explorer-address} # get missions joined by explorer address