Skip to content

Commit

Permalink
Merge branch 'v8/develop' into patch/erc20
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jul 9, 2024
2 parents 3686ca7 + f75ccb3 commit c1c8622
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 86 deletions.
43 changes: 1 addition & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -508,48 +508,7 @@ proto-format:
@echo "Formatting Protobuf files"
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;

.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking


TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.15/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
COSMOS_SDK_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.45.1
ETHERMINT_URL = https://raw.githubusercontent.com/Canto-Network/ethermint-v2/v0.10.0
IBC_GO_URL = https://raw.githubusercontent.com/cosmos/ibc-go/v3.0.0-rc0
COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master

TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto
TM_ABCI_TYPES = third_party/proto/tendermint/abci
TM_TYPES = third_party/proto/tendermint/types

GOGO_PROTO_TYPES = third_party/proto/gogoproto

COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto

proto-update-deps:
@mkdir -p $(GOGO_PROTO_TYPES)
@curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto

@mkdir -p $(COSMOS_PROTO_TYPES)
@curl -sSL $(COSMOS_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto

## Importing of tendermint protobuf definitions currently requires the
## use of `sed` in order to build properly with cosmos-sdk's proto file layout
## (which is the standard Buf.build FILE_LAYOUT)
## Issue link: https://github.com/tendermint/tendermint/issues/5021
@mkdir -p $(TM_ABCI_TYPES)
@curl -sSL $(TM_URL)/abci/types.proto > $(TM_ABCI_TYPES)/types.proto

@mkdir -p $(TM_TYPES)
@curl -sSL $(TM_URL)/types/types.proto > $(TM_TYPES)/types.proto

@mkdir -p $(TM_CRYPTO_TYPES)
@curl -sSL $(TM_URL)/crypto/proof.proto > $(TM_CRYPTO_TYPES)/proof.proto
@curl -sSL $(TM_URL)/crypto/keys.proto > $(TM_CRYPTO_TYPES)/keys.proto



.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps
.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-swagger-gen proto-format

###############################################################################
### Localnet ###
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ require (
github.com/cosmos/rosetta v0.0.0-20231205133638-3bc76705a1c6
github.com/ethereum/go-ethereum v1.10.26
github.com/evmos/ethermint v0.22.0
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
Expand Down Expand Up @@ -88,6 +87,7 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand Down
13 changes: 0 additions & 13 deletions scripts/proto-tools-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,6 @@ f_install_buf() {
f_print_done
}

f_install_protoc_gen_gocosmos() {
f_print_installing_with_padding protoc-gen-gocosmos

if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then
echo -e "\tPlease run this command from somewhere inside the canto folder."
return 1
fi

go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null
f_print_done
}

f_install_protoc_gen_grpc_gateway() {
f_print_installing_with_padding protoc-gen-grpc-gateway
f_needs_install "${DESTDIR}/${PREFIX}/bin/protoc-gen-grpc-gateway" || return 0
Expand Down Expand Up @@ -149,7 +137,6 @@ f_ensure_tools
f_ensure_dirs
f_install_protoc
f_install_buf
f_install_protoc_gen_gocosmos
f_install_protoc_gen_grpc_gateway
f_install_protoc_gen_swagger
f_install_clang_format
6 changes: 3 additions & 3 deletions x/coinswap/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strconv"

gogotypes "github.com/gogo/protobuf/types"
gogoprototypes "github.com/cosmos/gogoproto/types"

"cosmossdk.io/core/store"
errorsmod "cosmossdk.io/errors"
Expand Down Expand Up @@ -352,7 +352,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
// SetStandardDenom sets the standard denom for the coinswap module.
func (k Keeper) SetStandardDenom(ctx sdk.Context, denom string) error {
store := k.storeService.OpenKVStore(ctx)
denomWrap := gogotypes.StringValue{Value: denom}
denomWrap := gogoprototypes.StringValue{Value: denom}
bz := k.cdc.MustMarshal(&denomWrap)
err := store.Set(types.KeyStandardDenom, bz)
if err != nil {
Expand All @@ -369,7 +369,7 @@ func (k Keeper) GetStandardDenom(ctx sdk.Context) (string, error) {
return "", err
}

var denomWrap = gogotypes.StringValue{}
var denomWrap = gogoprototypes.StringValue{}
k.cdc.MustUnmarshal(bz, &denomWrap)
return denomWrap.Value, nil
}
6 changes: 3 additions & 3 deletions x/coinswap/keeper/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keeper
import (
"fmt"

gogotypes "github.com/gogo/protobuf/types"
gogoprototypes "github.com/cosmos/gogoproto/types"

errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
Expand Down Expand Up @@ -64,7 +64,7 @@ func (k Keeper) GetPoolByLptDenom(ctx sdk.Context, lptDenom string) (types.Pool,
return types.Pool{}, false
}

poolId := &gogotypes.StringValue{}
poolId := &gogoprototypes.StringValue{}
k.cdc.MustUnmarshal(bz, poolId)
return k.GetPool(ctx, poolId.Value)
}
Expand Down Expand Up @@ -138,7 +138,7 @@ func (k Keeper) setPool(ctx sdk.Context, pool *types.Pool) {
store.Set(types.GetPoolKey(pool.Id), bz)

// save by lpt denom
poolId := &gogotypes.StringValue{Value: pool.Id}
poolId := &gogoprototypes.StringValue{Value: pool.Id}
poolIdBz := k.cdc.MustMarshal(poolId)
store.Set(types.GetLptDenomKey(pool.LptDenom), poolIdBz)
}
Expand Down
7 changes: 6 additions & 1 deletion x/coinswap/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -25,9 +26,13 @@ import (
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
)

// AppModuleBasic defines the basic application module used by the coinswap module.
Expand Down
15 changes: 11 additions & 4 deletions x/csr/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,28 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"github.com/Canto-Network/Canto/v7/x/csr/client/cli"
"github.com/Canto-Network/Canto/v7/x/csr/keeper"
"github.com/Canto-Network/Canto/v7/x/csr/types"
"cosmossdk.io/core/appmodule"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"

"github.com/Canto-Network/Canto/v7/x/csr/client/cli"
"github.com/Canto-Network/Canto/v7/x/csr/keeper"
"github.com/Canto-Network/Canto/v7/x/csr/types"
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)

// ----------------------------------------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion x/epochs/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -26,8 +27,13 @@ import (
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
_ appmodule.HasBeginBlocker = AppModule{}
)

// ----------------------------------------------------------------------------
Expand Down
15 changes: 10 additions & 5 deletions x/erc20/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import (
"fmt"
"math/rand"

"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -15,8 +19,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"github.com/Canto-Network/Canto/v7/x/erc20/client/cli"
"github.com/Canto-Network/Canto/v7/x/erc20/keeper"
Expand All @@ -25,9 +27,12 @@ import (

// type check to ensure the interface is properly implemented
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleSimulation = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
)

// app module Basics object
Expand Down
17 changes: 12 additions & 5 deletions x/govshuttle/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"github.com/Canto-Network/Canto/v7/x/govshuttle/client/cli"
"github.com/Canto-Network/Canto/v7/x/govshuttle/keeper"
"github.com/Canto-Network/Canto/v7/x/govshuttle/types"
"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"

"github.com/Canto-Network/Canto/v7/x/govshuttle/client/cli"
"github.com/Canto-Network/Canto/v7/x/govshuttle/keeper"
"github.com/Canto-Network/Canto/v7/x/govshuttle/types"
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.AppModuleSimulation = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
)

// ----------------------------------------------------------------------------
Expand Down
15 changes: 10 additions & 5 deletions x/inflation/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (
"fmt"
"math/rand"

"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/core/appmodule"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -16,8 +20,6 @@ import (
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"github.com/Canto-Network/Canto/v7/x/inflation/client/cli"
"github.com/Canto-Network/Canto/v7/x/inflation/keeper"
Expand All @@ -26,9 +28,12 @@ import (

// type check to ensure the interface is properly implemented
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleSimulation = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
)

// app module Basics object
Expand Down
10 changes: 7 additions & 3 deletions x/onboarding/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

abci "github.com/cometbft/cometbft/abci/types"

"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -26,9 +27,12 @@ import (

// type check to ensure the interface is properly implemented
var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleSimulation = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
_ module.AppModuleBasic = AppModule{}
_ module.HasServices = AppModule{}
_ module.HasABCIGenesis = AppModule{}

_ appmodule.AppModule = AppModule{}
)

// app module Basics object
Expand Down

0 comments on commit c1c8622

Please sign in to comment.