evmos-conploy

command module
v0.0.0-...-d13eab0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

evmos-conploy

A CLI app to deploy smart-contracts on evmos node, and keep track of the contracts deployed.

Table of Contents

Description

The goal of the project is to create ,deploy and query smart contract. The user should be able to transfer balance, get balance and deployment reciept. we are currently using go-ethereum, but this should adapt to other libraries in future.

Setup

Usage

.env.template is a placeholder for env variables, this command will generate .env

make envgen

To generate abi, bin and gofile run the below make commands respectively

make generate-abi
make generate-bin contract=goldcoin
make generate-go contract=goldcoin

Build program with make build and then trigger cli functions to deploy, check , read or transact and interact with smartcontracts. Use the below command. The make command is just for convinience here. If you would like to build and trigger manually you can do that as well.

NOTE: After deployment you will get TxHash and Address for the contract that was deployed on the chain, for now we are not having any method to persist those.Thus, save it in .env under CONTRACT_HASH and CONTRACT_ADDRESS respectively.

# Deploy contract
make deploy
# Check if the contract is deployed successfully
make check
# Query smart contract to get balance when given no arguments it returns owner_address balance
make balanceOf
make balanceOf address=SOME_ADDRESS
# Transact tokens from owner_address to reciever_address with supplied amount
make transfer amount=AMOUNT to=RECIEVER_ADDRESS

Testing

We are unit testing using two different patterns i.e Table Driven Tests and Behaviour Driven Tests. Each of the respective tests are being implemented within their own suites to make it easier to differentiate and make tests more readable.

To run table driven tests

make test-table

To run BDD tests

make test-bdd

Alternatively, if you would like to run both the tests simultaneously you can run that simply by go test -v ./... or using make

make test

To Do

  • Refactor tests, add more bdd test cases currently only important testcases are covered
  • Add a persistant storage to keep track of contract address and txhash
  • Have a way to manually create and generate validator address with given private key, this will ensure consistency when the node restarts
  • currently with simulated backend we do not test all the generated functions, ensure most of the key functions are tested.
  • https://github.com/golangci/golangci-lint/issues/3107 -- known issue , currently there seems to be some issue with the linter, need to find a workaround

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package contract is a generated GoMock package.
Package contract is a generated GoMock package.

Jump to

Keyboard shortcuts

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