Skip to content

Commit

Permalink
feat(uniond): introduce token-factory
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-aitlahcen committed Sep 1, 2023
1 parent 1910288 commit 2a55771
Show file tree
Hide file tree
Showing 98 changed files with 11,076 additions and 233 deletions.
42 changes: 32 additions & 10 deletions uniond/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ import (

ibccometblsclient "union/app/ibc/cometbls/02-client/keeper"

// this line is used by starport scaffolding # stargate/app/moduleImport
tfmodule "union/x/tokenfactory"
tfbindings "union/x/tokenfactory/bindings"
tfkeeper "union/x/tokenfactory/keeper"
tftypes "union/x/tokenfactory/types"

appparams "union/app/params"
"union/docs"
Expand Down Expand Up @@ -202,7 +205,7 @@ var (
unionmodule.AppModuleBasic{},
wasm.AppModuleBasic{},
ibcfee.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
tfmodule.AppModuleBasic{},
)

// module account permissions
Expand All @@ -217,6 +220,7 @@ var (
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
wasmtypes.ModuleName: {authtypes.Burner}, // TODO(aeryz): is this necessary?
tftypes.ModuleName: {authtypes.Minter, authtypes.Burner},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -292,6 +296,7 @@ type UnionApp struct {
GroupKeeper groupkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
WasmKeeper wasmkeeper.Keeper
TfKeeper tfkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -349,11 +354,11 @@ func New(
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey,
feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, ibcwasmtypes.StoreKey, icahosttypes.StoreKey,
capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey,
unionmoduletypes.StoreKey, ibcfeetypes.StoreKey, wasmtypes.StoreKey,
unionmoduletypes.StoreKey, ibcfeetypes.StoreKey, wasmtypes.StoreKey, tftypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, tftypes.MemStoreKey)

app := &UnionApp{
BaseApp: bApp,
Expand Down Expand Up @@ -410,14 +415,16 @@ func New(
app.AccountKeeper,
)

app.BankKeeper = bankkeeper.NewBaseKeeper(
appBankBaseKeeper := bankkeeper.NewBaseKeeper(
appCodec,
keys[banktypes.StoreKey],
app.AccountKeeper,
app.BlockedModuleAccountAddrs(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.BankKeeper = appBankBaseKeeper

app.StakingKeeper = stakingkeeper.NewKeeper(
appCodec,
keys[stakingtypes.StoreKey],
Expand Down Expand Up @@ -586,6 +593,21 @@ func New(
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))

app.TfKeeper = tfkeeper.NewKeeper(
appCodec,
keys[tftypes.StoreKey],
app.GetSubspace(tftypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
app.DistrKeeper,
)
tfModule := tfmodule.NewAppModule(app.TfKeeper,
app.AccountKeeper,
app.BankKeeper,
)

wasmOpts = append(wasmOpts, tfbindings.RegisterCustomPlugins(&appBankBaseKeeper, &app.TfKeeper)...)

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand Down Expand Up @@ -715,7 +737,7 @@ func New(
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
icaModule,
unionModule,
// this line is used by starport scaffolding # stargate/app/appModule
tfModule,
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -748,7 +770,7 @@ func New(
consensusparamtypes.ModuleName,
unionmoduletypes.ModuleName,
wasmtypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
tftypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -776,7 +798,7 @@ func New(
consensusparamtypes.ModuleName,
unionmoduletypes.ModuleName,
wasmtypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
tftypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -809,7 +831,7 @@ func New(
consensusparamtypes.ModuleName,
unionmoduletypes.ModuleName,
wasmtypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
tftypes.ModuleName,
}
app.mm.SetOrderInitGenesis(genesisModuleOrder...)
app.mm.SetOrderExportGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -1064,7 +1086,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(unionmoduletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace
paramsKeeper.Subspace(tftypes.ModuleName)

return paramsKeeper
}
Expand Down
6 changes: 6 additions & 0 deletions uniond/app/params/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package params

const (
// BondDenom defines the native staking token denomination.
BondDenom = "muno"
)
21 changes: 21 additions & 0 deletions uniond/app/params/proto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package params

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
)

// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration.
func MakeEncodingConfig() EncodingConfig {
amino := codec.NewLegacyAmino()
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)
return EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
TxConfig: txCfg,
Amino: amino,
}
}
9 changes: 9 additions & 0 deletions uniond/app/params/weights.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package params

const (
DefaultWeightMsgCreateDenom int = 100
DefaultWeightMsgMint int = 100
DefaultWeightMsgBurn int = 100
DefaultWeightMsgChangeAdmin int = 100
DefaultWeightMsgSetDenomMetadata int = 100
)
18 changes: 10 additions & 8 deletions uniond/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ go 1.20
require (
cosmossdk.io/api v0.3.1
cosmossdk.io/errors v1.0.0
cosmossdk.io/math v1.0.1
github.com/CosmWasm/wasmd v0.41.0
github.com/CosmWasm/wasmvm v1.3.0
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.47.4
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-go/v7 v7.2.0
Expand All @@ -22,7 +24,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529
google.golang.org/grpc v1.56.2
google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -33,14 +35,13 @@ require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.0 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cosmossdk.io/core v0.5.1 // indirect
cosmossdk.io/core v0.6.1 // indirect
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca // indirect
cosmossdk.io/math v1.0.1 // indirect
cosmossdk.io/tools/rosetta v0.2.1 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.44.203 // indirect
Expand All @@ -49,7 +50,7 @@ require (
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.5.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
Expand All @@ -59,12 +60,11 @@ require (
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.9.1-0.20230127122953-83736ef21d69 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
github.com/creachadair/taskgroup v0.4.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
Expand Down Expand Up @@ -142,6 +142,7 @@ require (
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down Expand Up @@ -176,6 +177,7 @@ require (
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
Expand All @@ -196,7 +198,7 @@ replace (
github.com/cometbft/cometbft => github.com/unionlabs/cometbls v0.0.0-20230606200400-20834775a066
// Fork of gnark crypto until https://github.com/ConsenSys/gnark-crypto/pull/314 is merged
github.com/consensys/gnark-crypto => github.com/unionlabs/gnark-crypto v0.0.0-20230409222230-5346db050fea
github.com/cosmos/cosmos-sdk => github.com/unionlabs/cosmos-sdk v0.0.0-20230830184222-30e47ad4927b
github.com/cosmos/cosmos-sdk => github.com/unionlabs/cosmos-sdk v0.0.0-20230811204628-91742f9fdc1c
github.com/cosmos/ibc-go/v7 => github.com/unionlabs/ibc-go/v7 v7.0.0-20230622093418-f1bf9b990248

github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
Expand Down
Loading

0 comments on commit 2a55771

Please sign in to comment.