Skip to content

Commit

Permalink
add fee-burn module
Browse files Browse the repository at this point in the history
  • Loading branch information
trung2891 committed Nov 10, 2023
1 parent e56e870 commit e3bc02f
Show file tree
Hide file tree
Showing 28 changed files with 2,312 additions and 164 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,11 @@ install: go.sum

build:
go build $(BUILD_FLAGS) -o bin/migalood ./cmd/migalood

containerProtoVer=0.13.0
containerProtoImage=ghcr.io/cosmos/proto-builder:$(containerProtoVer)

proto-gen:
@echo "Generating Protobuf files"
@$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protocgen.sh;
21 changes: 21 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ import (
bank "github.com/terra-money/alliance/custom/bank"
custombankkeeper "github.com/terra-money/alliance/custom/bank/keeper"

feeburnmodule "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn"
feeburnmodulekeeper "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/keeper"
feeburnmoduletypes "github.com/White-Whale-Defi-Platform/migaloo-chain/v3/x/feeburn/types"

// use TFL's ibc-hooks from Osmosis' ibc-hooks
ibchooks "github.com/terra-money/core/v2/x/ibc-hooks"
ibchookskeeper "github.com/terra-money/core/v2/x/ibc-hooks/keeper"
Expand Down Expand Up @@ -240,6 +244,7 @@ var (
ibcfee.AppModuleBasic{},
ibchooks.AppModuleBasic{},
globalfee.AppModule{},
feeburnmodule.AppModule{},
)

// module account permissions
Expand Down Expand Up @@ -302,6 +307,7 @@ type MigalooApp struct {
TokenFactoryKeeper tokenfactorykeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
FeeburnKeeper feeburnmodulekeeper.Keeper
WasmKeeper wasm.Keeper
RouterKeeper routerkeeper.Keeper

Expand Down Expand Up @@ -594,6 +600,13 @@ func NewMigalooApp(
// For wasmd we use the demo controller from https://github.com/cosmos/interchain-accounts but see notes below
app.InterTxKeeper = intertxkeeper.NewKeeper(appCodec, keys[intertxtypes.StoreKey], app.ICAControllerKeeper, scopedInterTxKeeper)

app.FeeburnKeeper = *feeburnmodulekeeper.NewKeeper(
appCodec,
keys[feeburnmoduletypes.StoreKey],
keys[feeburnmoduletypes.MemStoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName),
)

// create evidence keeper with router
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -754,6 +767,7 @@ func NewMigalooApp(
router.NewAppModule(&app.RouterKeeper),
ibchooks.NewAppModule(app.AccountKeeper),
globalfee.NewAppModule(app.GetSubspace(globalfee.ModuleName)),
feeburnmodule.NewAppModule(appCodec, app.FeeburnKeeper, app.AccountKeeper, app.BankKeeper),
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand All @@ -778,6 +792,7 @@ func NewMigalooApp(
feegrant.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
feeburnmoduletypes.ModuleName,
// additional non simd modules
routertypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -809,6 +824,7 @@ func NewMigalooApp(
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
feeburnmoduletypes.ModuleName,
// additional non simd modules
routertypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -847,6 +863,7 @@ func NewMigalooApp(
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
feeburnmoduletypes.ModuleName,
// additional non simd modules
routertypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -893,6 +910,7 @@ func NewMigalooApp(
ibc.NewAppModule(app.IBCKeeper),
icaModule,
transfer.NewAppModule(app.TransferKeeper),
feeburnmodule.NewAppModule(appCodec, app.FeeburnKeeper, app.AccountKeeper, app.BankKeeper),
alliancemodule.NewAppModule(appCodec, app.AllianceKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
)

Expand Down Expand Up @@ -935,6 +953,8 @@ func NewMigalooApp(
GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName),
StakingSubspace: app.GetSubspace(stakingtypes.ModuleName),
TXCounterStoreKey: keys[wasm.StoreKey],
BankKeeper: app.BankKeeper,
FeeburnKeeper: &app.FeeburnKeeper,
},
)
if err != nil {
Expand Down Expand Up @@ -1197,6 +1217,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(routertypes.ModuleName)
paramsKeeper.Subspace(feeburnmoduletypes.ModuleName)
paramsKeeper.Subspace(alliancemoduletypes.ModuleName)
paramsKeeper.Subspace(globalfee.ModuleName)

Expand Down
Loading

0 comments on commit e3bc02f

Please sign in to comment.