Skip to content

openmetaearth/meta-earth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

181 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ME Hub

license Go issues

Overview

Welcome to the ME Hub, the Settlement Layer of the ME protocol.

This guide will walk you through the steps required to set up and run a ME Hub full node.

Table of Contents

Prerequisites

Installation

Clone me-hub:

git clone https://github.com/st-chain/me-hub.git
cd me-hub
make install

Check that the med binaries have been successfully installed:

med version

If the med command is not found an error message is returned, confirm that your GOPATH is correctly configured by running the following command:

export PATH=$PATH:$(go env GOPATH)/bin

Initializing med

  • Using the setup script:

    This method is preferred as it preconfigured to support running rollapps locally

    bash scripts/setup_local.sh
  • Manually:

    First, set the following environment variables:

    export CHAIN_ID="mechain_100-1"
    export KEY_NAME="hub-user"
    export MONIKER_NAME="local"

    Second, create genesis and init ME chain:

    med init "$MONIKER_NAME" --chain-id "$CHAIN_ID"

    Third, set parameters to ensure denom is umec:

    bash scripts/set_params.sh

    Then, add genesis account and provide token to the account:

    med keys add "$KEY_NAME" --keyring-backend test
    med add-genesis-account "$(med keys show "$KEY_NAME" -a --keyring-backend test)" 1000umec
    med gentx "$KEY_NAME" 670mec --chain-id "$CHAIN_ID" --keyring-backend test
    med collect-gentxs

Running the Chain

Now start the chain!

med start

You should have a running local node!

Bootstrapping liquidity pools

To bootstrap the GAMM module with pools:

sh scripts/pools/pools_bootstrap.sh

Adding incentives

Creating incentives streams

After creating the pools above, we create 2 incentive streams through gov:

sh scripts/incentives/fund_incentives.sh

Wait for the gov proposal to pass, and validate with:

med q streamer streams

Locking tokens

To get incentives, we need to lock the LP tokens:

sh scripts/incentives/lockup_bootstrap.sh

validate with:

med q lockup module-balance

check rewards

Every minute a share of the rewards will be distributed!

validate with:

med q incentives active-gauges

# alternatively, watch the outpup - you will see the "amount" change every minute
#  watch -n1 -d "med q incentives active-gauges --output json | jq '.data[] | { "id": .id, "coins": .coins } '"

Debugging Container

Pre-requisite: Install Docker Install VSCode Install VSCode Go extension Install Delve

To debug, you can use the following command to run the debug container:

make docker-run-debug

Then you can run the debugger with the following config for launch.json in VSCode:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ME Debug Container",
            "type": "go",
            "request": "attach",
            "mode": "remote",
            "port": 4000,
            "host": "127.0.0.1",
            "debugAdapter": "legacy" // To be remove in the future after https://github.com/golang/vscode-go/issues/3096 is fixed
        }
    ]
}

After that, you can run the debugger and set breakpoints in the code.

Example:

Add breakpoint to ctx in x/eibc/keeper/grpc_query.go :

func (q Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
	if req == nil {
		return nil, status.Error(codes.InvalidArgument, "invalid request")
	}
	ctx := sdk.UnwrapSDKContext(goCtx)

	return &types.QueryParamsResponse{Params: q.GetParams(ctx)}, nil
}

Open your browser and go to http://localhost:1318/st-chain/me-hub/eibc/params and you will see debugger stop and print the value at the breakpoint.

Developer

For support, join our Discord community and find us in the Developer section.

Setup push hooks

To setup push hooks, run the following command:

./scripts/setup_push_hooks.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors