Skip to content

Commit

Permalink
Merge branch 'main' into feat/NTRN-332-add-token-factory
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Apr 3, 2023
2 parents 27dcb08 + d70c208 commit 54cde79
Show file tree
Hide file tree
Showing 18 changed files with 512 additions and 112 deletions.
67 changes: 60 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
"github.com/cosmos/interchain-security/legacy_ibc_testing/core"
ibctesting "github.com/cosmos/interchain-security/legacy_ibc_testing/testing"
"github.com/neutron-org/neutron/x/tokenfactory"
tokenfactorykeeper "github.com/neutron-org/neutron/x/tokenfactory/keeper"
tokenfactorytypes "github.com/neutron-org/neutron/x/tokenfactory/types"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
Expand All @@ -89,6 +86,10 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/neutron-org/neutron/x/tokenfactory"
tokenfactorykeeper "github.com/neutron-org/neutron/x/tokenfactory/keeper"
tokenfactorytypes "github.com/neutron-org/neutron/x/tokenfactory/types"

adminmodulemodule "github.com/cosmos/admin-module/x/adminmodule"
adminmodulecli "github.com/cosmos/admin-module/x/adminmodule/client/cli"
adminmodulemodulekeeper "github.com/cosmos/admin-module/x/adminmodule/keeper"
Expand Down Expand Up @@ -124,6 +125,10 @@ import (
ccvconsumer "github.com/cosmos/interchain-security/x/ccv/consumer"
ccvconsumerkeeper "github.com/cosmos/interchain-security/x/ccv/consumer/keeper"
ccvconsumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types"

"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v4/router/keeper"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
)

const (
Expand Down Expand Up @@ -201,6 +206,7 @@ var (
upgraderest.ProposalCancelRESTHandler,
),
),
router.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -272,6 +278,9 @@ type App struct {
FeeBurnerKeeper *feeburnerkeeper.Keeper
ConsumerKeeper ccvconsumerkeeper.Keeper
TokenFactoryKeeper *tokenfactorykeeper.Keeper
RouterKeeper *routerkeeper.Keeper

RouterModule router.AppModule

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -323,7 +332,7 @@ func New(
evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey,
icahosttypes.StoreKey, capabilitytypes.StoreKey,
interchainqueriesmoduletypes.StoreKey, contractmanagermoduletypes.StoreKey, interchaintxstypes.StoreKey, wasm.StoreKey, feetypes.StoreKey,
feeburnertypes.StoreKey, adminmodulemoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey,
feeburnertypes.StoreKey, adminmodulemoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey, routertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, feetypes.MemStoreKey)
Expand Down Expand Up @@ -367,7 +376,7 @@ func New(
)

app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(),
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.BlockedAddrs(),
)

app.SlashingKeeper = slashingkeeper.NewKeeper(
Expand Down Expand Up @@ -421,12 +430,27 @@ func New(
)
feeBurnerModule := feeburner.NewAppModule(appCodec, *app.FeeBurnerKeeper)

// RouterKeeper must be created before TransferKeeper
app.RouterKeeper = routerkeeper.NewKeeper(
appCodec,
app.keys[routertypes.StoreKey],
app.GetSubspace(routertypes.ModuleName),
app.TransferKeeper.Keeper,
app.IBCKeeper.ChannelKeeper,
app.FeeBurnerKeeper,
app.BankKeeper,
app.IBCKeeper.ChannelKeeper,
)

// Create Transfer Keepers
app.TransferKeeper = wrapkeeper.NewKeeper(
appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.RouterKeeper, app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, app.FeeKeeper, app.ContractManagerKeeper,
)

app.RouterKeeper.SetTransferKeeper(app.TransferKeeper.Keeper)

transferModule := transferSudo.NewAppModule(app.TransferKeeper)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
Expand Down Expand Up @@ -557,9 +581,19 @@ func New(
interchainTxsModule := interchaintxs.NewAppModule(appCodec, app.InterchainTxsKeeper, app.AccountKeeper, app.BankKeeper)
contractManagerModule := contractmanager.NewAppModule(appCodec, app.ContractManagerKeeper)

app.RouterModule = router.NewAppModule(app.RouterKeeper)

ibcStack := router.NewIBCMiddleware(
transferIBCModule,
app.RouterKeeper,
0,
routerkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
routerkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)

ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule).
AddRoute(ibctransfertypes.ModuleName, ibcStack).
AddRoute(interchaintxstypes.ModuleName, icaControllerStack).
AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper)).
AddRoute(ccvconsumertypes.ModuleName, consumerModule)
Expand Down Expand Up @@ -591,6 +625,7 @@ func New(
transferModule,
consumerModule,
icaModule,
app.RouterModule,
interchainQueriesModule,
interchainTxsModule,
feeModule,
Expand Down Expand Up @@ -628,6 +663,7 @@ func New(
feetypes.ModuleName,
feeburnertypes.ModuleName,
adminmodulemoduletypes.ModuleName,
routertypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand All @@ -654,6 +690,7 @@ func New(
feetypes.ModuleName,
feeburnertypes.ModuleName,
adminmodulemoduletypes.ModuleName,
routertypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -685,6 +722,7 @@ func New(
feetypes.ModuleName,
feeburnertypes.ModuleName,
adminmodulemoduletypes.ModuleName,
routertypes.ModuleName,
)

app.mm.RegisterInvariants(&app.CrisisKeeper)
Expand Down Expand Up @@ -815,6 +853,19 @@ func (app *App) ModuleAccountAddrs() map[string]bool {
return modAccAddrs
}

// BlockedAddrs returns the set of addresses that are not allowed
// to send and receive funds
func (app *App) BlockedAddrs() map[string]bool {
// Remove the fee-pool from the group of blocked recipient addresses in bank
// this is required for the consumer chain to be able to send tokens to
// the provider chain
bankBlockedAddrs := app.ModuleAccountAddrs()
delete(bankBlockedAddrs, authtypes.NewModuleAddress(
ccvconsumertypes.ConsumerToSendToProviderName).String())

return bankBlockedAddrs
}

// LegacyAmino returns SimApp's amino codec.
//
// NOTE: This is solely to be used for testing purposes as it may be desirable
Expand Down Expand Up @@ -919,6 +970,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)

paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable())

paramsKeeper.Subspace(ccvconsumertypes.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)

Expand Down
Binary file added contracts/cwd_subdao_core.wasm
Binary file not shown.
Binary file added contracts/cwd_subdao_pre_propose_single.wasm
Binary file not shown.
Binary file added contracts/cwd_subdao_proposal_single.wasm
Binary file not shown.
Binary file added contracts/cwd_subdao_timelock_single.wasm
Binary file not shown.
Binary file added contracts_thirdparty/cw4_group.wasm
Binary file not shown.
Binary file added contracts_thirdparty/cw4_voting.wasm
Binary file not shown.
27 changes: 14 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ go 1.18
require (
github.com/CosmWasm/wasmd v0.30.0
github.com/CosmWasm/wasmvm v1.1.1
github.com/confio/ics23/go v0.7.0
github.com/confio/ics23/go v0.9.0
github.com/cosmos/admin-module v0.0.0-00010101000000-000000000000
github.com/cosmos/cosmos-sdk v0.45.11
github.com/cosmos/ibc-go/v4 v4.2.0
github.com/cosmos/cosmos-sdk v0.45.13
github.com/cosmos/ibc-go/v4 v4.3.0
github.com/cosmos/interchain-security v1.0.0-rc3
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
Expand All @@ -20,8 +20,9 @@ require (
github.com/regen-network/cosmos-proto v0.3.1
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.1
github.com/strangelove-ventures/packet-forward-middleware/v4 v4.0.5
github.com/stretchr/testify v1.8.2
github.com/tendermint/tendermint v0.34.24
github.com/tendermint/tendermint v0.34.26
github.com/tendermint/tm-db v0.6.7
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923
google.golang.org/grpc v1.53.0
Expand All @@ -36,8 +37,8 @@ require (
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.4.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/btcsuite/btcd v0.22.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand All @@ -47,9 +48,8 @@ require (
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogoproto v1.4.3 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/cosmos/iavl v0.19.4 // indirect
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
github.com/cosmos/ledger-go v0.9.3 // indirect
github.com/cosmos/iavl v0.19.5 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -85,6 +85,7 @@ require (
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect
github.com/iancoleman/orderedmap v0.2.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
Expand Down Expand Up @@ -119,13 +120,13 @@ require (
github.com/spf13/viper v1.14.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/spm v0.1.9 // indirect
github.com/tidwall/btree v1.5.0 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
Expand All @@ -141,7 +142,7 @@ replace (
github.com/CosmWasm/wasmd v0.30.0 => github.com/neutron-org/wasmd v0.30.0-ics-support
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/admin-module => github.com/Ethernal-Tech/admin-module v0.0.0-20221102105340-e693f4d379c3
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.45.11-ics
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.45.13-ics
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/tendermint/tendermint => github.com/skip-mev/mev-tendermint v0.34.24-mev.16
google.golang.org/grpc => google.golang.org/grpc v1.33.2
Expand Down
Loading

0 comments on commit 54cde79

Please sign in to comment.