GithubHelp home page GithubHelp logo

ignite-to-feather's Introduction

Ignite to Feather

This repository contains the minimal changes required to convert a chain scaffolded using Ignite CLI to conform to the Feather Core interface.

Steps

Please see this commit for a full example diff of the changes required.

1. Rename the cmd/<app>d directory to cmd/feather-cored

This ensures that the Makefile that will be added later references the correct directory. If your IDE does not automatically update the import changes caused by step 1, you can fix it manually (remember to replace <go_module> with your project's Go module):

import (
  // "<go_module>/cmd/<app>d/cmd"
  "<go_module>/cmd/feather-cored/cmd"
)

2. Modify the app/simulation_test.go file

Rename the BenchmarkSimulation function to TestFullAppSimulation, and make sure it's taking in testing.T as args and not testing.B

// OLD
// func BenchmarkSimulation(b *testing.B) {
//   ...
// }

// NEW
func TestFullAppSimulation(t *testing.T) {
  ...
}

3. Copy the config directory of feather-core

Copy the config directory from feather-core into the root of your project. There should be exactly two files in the directory: config.go and config.json.

4. Copy the Makefile of feather-core

Copy the Makefile from feather-core into the root of your project. Though not essential, the HTTPS_GIT variable should be set to the correct GitHub URL of your project.

Warning: this makefile should NOT be edited unless you know what you're doing.

5. Copy the contrib/devtools/Makefile of feather-core

Copy the contrib/devtools/Makefile from feather-core into the root of your project.

Warning: this makefile should NOT be edited unless you know what you're doing.

6. Modify the app/app.go file

Firstly, declare new variables to be used as ldflags during compile time:

// OLD
// const (
//   AccountAddressPrefix = "cosmos"
//   Name                 = "pluto"
// )

// NEW
// Note: 'const' is changed to 'var' and the values are no longer initialised.
// DO NOT change the names and values of these variables! They are populated by the `init` function.
var (
  AccountAddressPrefix string
  Name                 string
  BondDenom            string
  CoinType             uint32
)

Then, update the init function by loading configurations from config/config.json (note that the added code MUST be placed at the start of the init function):

func init() {
  // ADD THIS TO START OF FUNCTION
  // Load and use config from config.json
  config, err := cfg.Load()
  if err != nil {
   panic(err)
  }
  Name = config.AppName
  BondDenom = config.BondDenom
  AccountAddressPrefix = config.AddressPrefix
  // Feather chains' coin type should follow Terra's coin type.
  // WARNING: changing this value will break feather's assumptions and functionalities.
  CoinType = 330

  // REST OF ORIGINAL FUNCTION
  ...
}

7. Modify the cmd/feather-cored/cmd/config.go file

Add two additional lines of configurations immediately before calling config.Seal():

config.SetCoinType(app.CoinType)     // Set coin type
sdk.DefaultBondDenom = app.BondDenom // Set default bond denom

ignite-to-feather's People

Contributors

aaroncql avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.