Skip to content

Commit

Permalink
Merge pull request #27 from thesixnetwork/release/0.1.0
Browse files Browse the repository at this point in the history
Release/0.1.0
  • Loading branch information
citrusaquarium authored Sep 27, 2022
2 parents 49ee9f4 + ad51d0d commit d5e2ec1
Show file tree
Hide file tree
Showing 547 changed files with 144,461 additions and 5,126 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@

# Dependency directories (remove the comment below to include it)
# vendor/


.DS_Store
.vscode/
test/*
ts-client/*
vue/node_modules/
195 changes: 195 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
#!/usr/bin/make -f

PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BINDIR ?= $(GOPATH)/bin
SIMAPP = ./app

# for dockerized protobuf tools
DOCKER := $(shell which docker)
BUF_IMAGE=bufbuild/buf@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
HTTPS_GIT := https://github.com/thesixnetwork/sixnft.git

export GO111MODULE = on

# process build tags

build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif

ifeq ($(WITH_CLEVELDB),yes)
build_tags += gcc
endif
build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

whitespace :=
empty = $(whitespace) $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(empty),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=sixnft \
-X github.com/cosmos/cosmos-sdk/version.AppName=sixnftd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/thesixnetwork/sixnft/app.Bech32Prefix=sixnft \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"

ifeq ($(WITH_CLEVELDB),yes)
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
endif
ifeq ($(LINK_STATICALLY),true)
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath

# The below include contains the tools and runsim targets.
include contrib/devtools/Makefile

all: install lint test

build: go.sum
ifeq ($(OS),Windows_NT)
exit 1
else
go build -mod=readonly $(BUILD_FLAGS) -o build/sixnftd ./cmd/sixnftd
endif

build-contract-tests-hooks:
ifeq ($(OS),Windows_NT)
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
else
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
endif

install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sixnftd

########################################
### Tools & dependencies

go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@go mod download

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@go mod verify

draw-deps:
@# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i ./cmd/sixnftd -d 2 | dot -Tpng -o dependency-graph.png

clean:
rm -rf snapcraft-local.yaml build/

distclean: clean
rm -rf vendor/

########################################
### Testing


test: test-unit
test-all: check test-race test-cover

test-unit:
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./...

test-race:
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...

test-cover:
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...

benchmark:
@go test -mod=readonly -bench=. ./...

test-sim-import-export: runsim
@echo "Running application import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport

test-sim-multi-seed-short: runsim
@echo "Running short multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation

###############################################################################
### Linting ###
###############################################################################

format-tools:
go install mvdan.cc/[email protected]
go install github.com/client9/misspell/cmd/[email protected]

lint: format-tools
golangci-lint run --tests=false
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d -s

format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/thesixnetwork/sixnft


###############################################################################
### Protobuf ###
###############################################################################
PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen@sha256:372dce7be2f465123e26459973ca798fc489ff2c75aeecd814c0ca8ced24faca
PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae

proto-all: proto-format proto-lint proto-gen format

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;

proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh

proto-lint:
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main

.PHONY: all install install-debug \
go-mod-cache draw-deps clean build format \
test test-all test-build test-cover test-unit test-race \
test-sim-import-export \
78 changes: 73 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -98,10 +99,20 @@ import (
monitoringpkeeper "github.com/tendermint/spn/x/monitoringp/keeper"
monitoringptypes "github.com/tendermint/spn/x/monitoringp/types"

"sixnft/docs"
nftmngrmodule "sixnft/x/nftmngr"
nftmngrmodulekeeper "sixnft/x/nftmngr/keeper"
nftmngrmoduletypes "sixnft/x/nftmngr/types"
"github.com/thesixnetwork/sixnft/docs"

evmsupportmodule "github.com/thesixnetwork/sixnft/x/evmsupport"
evmsupportmodulekeeper "github.com/thesixnetwork/sixnft/x/evmsupport/keeper"
evmsupportmoduletypes "github.com/thesixnetwork/sixnft/x/evmsupport/types"
nftnftadminmodule "github.com/thesixnetwork/sixnft/x/nftadmin"
nftadminmodulekeeper "github.com/thesixnetwork/sixnft/x/nftadmin/keeper"
nftadminmoduletypes "github.com/thesixnetwork/sixnft/x/nftadmin/types"
nftmngrmodule "github.com/thesixnetwork/sixnft/x/nftmngr"
nftmngrmodulekeeper "github.com/thesixnetwork/sixnft/x/nftmngr/keeper"
nftmngrmoduletypes "github.com/thesixnetwork/sixnft/x/nftmngr/types"
nftoraclemodule "github.com/thesixnetwork/sixnft/x/nftoracle"
nftoraclemodulekeeper "github.com/thesixnetwork/sixnft/x/nftoracle/keeper"
nftoraclemoduletypes "github.com/thesixnetwork/sixnft/x/nftoracle/types"
// this line is used by starport scaffolding # stargate/app/moduleImport
)

Expand Down Expand Up @@ -157,6 +168,9 @@ var (
vesting.AppModuleBasic{},
monitoringp.AppModuleBasic{},
nftmngrmodule.AppModuleBasic{},
evmsupportmodule.AppModuleBasic{},
nftoraclemodule.AppModuleBasic{},
nftnftadminmodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand All @@ -169,6 +183,7 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
nftadminmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -230,6 +245,11 @@ type App struct {
ScopedMonitoringKeeper capabilitykeeper.ScopedKeeper

NftmngrKeeper nftmngrmodulekeeper.Keeper

EvmsupportKeeper evmsupportmodulekeeper.Keeper

NftoracleKeeper nftoraclemodulekeeper.Keeper
AdminKeeper nftadminmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -267,6 +287,9 @@ func New(
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, monitoringptypes.StoreKey,
nftmngrmoduletypes.StoreKey,
evmsupportmoduletypes.StoreKey,
nftoraclemoduletypes.StoreKey,
nftadminmoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -388,13 +411,40 @@ func New(
)
monitoringModule := monitoringp.NewAppModule(appCodec, app.MonitoringKeeper)

app.EvmsupportKeeper = *evmsupportmodulekeeper.NewKeeper(
appCodec,
keys[evmsupportmoduletypes.StoreKey],
keys[evmsupportmoduletypes.MemStoreKey],
app.GetSubspace(evmsupportmoduletypes.ModuleName),
)
evmsupportModule := evmsupportmodule.NewAppModule(appCodec, app.EvmsupportKeeper, app.AccountKeeper, app.BankKeeper)

app.NftmngrKeeper = *nftmngrmodulekeeper.NewKeeper(
appCodec,
keys[nftmngrmoduletypes.StoreKey],
keys[nftmngrmoduletypes.MemStoreKey],
app.GetSubspace(nftmngrmoduletypes.ModuleName),
app.EvmsupportKeeper,
)
nftmngrModule := nftmngrmodule.NewAppModule(appCodec, app.NftmngrKeeper, app.AccountKeeper, app.BankKeeper, app.EvmsupportKeeper)
app.AdminKeeper = *nftadminmodulekeeper.NewKeeper(
appCodec,
keys[nftadminmoduletypes.StoreKey],
keys[nftadminmoduletypes.MemStoreKey],
app.GetSubspace(nftadminmoduletypes.ModuleName),

app.BankKeeper,
)
nftnftadminmodule := nftnftadminmodule.NewAppModule(appCodec, app.AdminKeeper, app.AccountKeeper, app.BankKeeper)
app.NftoracleKeeper = *nftoraclemodulekeeper.NewKeeper(
appCodec,
keys[nftoraclemoduletypes.StoreKey],
keys[nftoraclemoduletypes.MemStoreKey],
app.GetSubspace(nftoraclemoduletypes.ModuleName),
app.NftmngrKeeper,
app.AdminKeeper,
)
nftmngrModule := nftmngrmodule.NewAppModule(appCodec, app.NftmngrKeeper, app.AccountKeeper, app.BankKeeper)
nftoracleModule := nftoraclemodule.NewAppModule(appCodec, app.NftoracleKeeper, app.AccountKeeper, app.BankKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

Expand Down Expand Up @@ -438,6 +488,9 @@ func New(
transferModule,
monitoringModule,
nftmngrModule,
evmsupportModule,
nftoracleModule,
nftnftadminmodule,
// this line is used by starport scaffolding # stargate/app/appModule
)

Expand Down Expand Up @@ -466,6 +519,9 @@ func New(
paramstypes.ModuleName,
monitoringptypes.ModuleName,
nftmngrmoduletypes.ModuleName,
evmsupportmoduletypes.ModuleName,
nftoraclemoduletypes.ModuleName,
nftadminmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand All @@ -490,6 +546,9 @@ func New(
ibctransfertypes.ModuleName,
monitoringptypes.ModuleName,
nftmngrmoduletypes.ModuleName,
evmsupportmoduletypes.ModuleName,
nftoraclemoduletypes.ModuleName,
nftadminmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -519,6 +578,9 @@ func New(
feegrant.ModuleName,
monitoringptypes.ModuleName,
nftmngrmoduletypes.ModuleName,
evmsupportmoduletypes.ModuleName,
nftoraclemoduletypes.ModuleName,
nftadminmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)

Expand All @@ -544,6 +606,9 @@ func New(
transferModule,
monitoringModule,
nftmngrModule,
evmsupportModule,
nftoracleModule,
nftnftadminmodule,
// this line is used by starport scaffolding # stargate/app/appModule
)
app.sm.RegisterStoreDecoders()
Expand Down Expand Up @@ -734,6 +799,9 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(monitoringptypes.ModuleName)
paramsKeeper.Subspace(nftmngrmoduletypes.ModuleName)
paramsKeeper.Subspace(evmsupportmoduletypes.ModuleName)
paramsKeeper.Subspace(nftoraclemoduletypes.ModuleName)
paramsKeeper.Subspace(nftadminmoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
3 changes: 2 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func (app *App) ExportAppStateAndValidators(

// prepare for fresh start at zero height
// NOTE zero height genesis is a temporary feature which will be deprecated
// in favour of export at a block height
//
// in favour of export at a block height
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false

Expand Down
Loading

0 comments on commit d5e2ec1

Please sign in to comment.