Skip to content

ic-n/ethcontractbind

Repository files navigation

Template for contract binding service using Go

TOC

Commands

Before you begin, make sure you have the following prerequisites:

  • task build will build application image and chart and store it at ./build
  • task deploy will install or upgrade helm deployment, requires to run task build first (be sure that values deploy/values/default.yaml are correctly populated, and extended for production enviroment)
  • task logs will show logs of running helm deployment, requires to run task deploy first
  • task port-forward will port forward to service of running helm deployment, reachable at http://127.0.0.1:8080, requires to run task deploy first
  • task clean will perform clean up, remove helm deployment and build artefacts
  • task gen will generate abi and bin for solidity contract, generate Go contract bindings, generate protobuf bindings for go, generate open API files
  • task dev-mac will install all dev requirements (macOS/linux-homebrew only supported)

Testing

Run go test -timeout 30s -v ./... for tests on emulated eth backend

To perform integrational test you need to have blockchain running, server running, and then test it via HTTP calls

  1. Open three terminal windows in root repository folder
  2. Run task testnet in first, to run local etherium node API
  3. Run task local-run in second, to run server at localhost:80
  4. Run go test -timeout 30s -count 1 -run ^TestAPI$ ./testing -v in third, to run test

TODO

  1. Put your contract into ./contracts

  2. https://github.com/ic-n/ethcontractbind/blob/main/proto/contractbind/v1/api.proto#L19

// TODO: define your custom api
  1. https://github.com/ic-n/ethcontractbind/blob/main/pkg/api/api.go#L54
// TODO: implement API
  1. https://github.com/ic-n/ethcontractbind/blob/main/pkg/contracts/crowdfund_test.go#L35
// TODO: implement contract test
  1. https://github.com/ic-n/ethcontractbind/blob/main/testing/local_test.go#L25
// TODO: implement testing make api calls
  1. Remove TODO section from this file :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages