Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v18] x/FeePay Module #808

Merged
merged 85 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a37c467
comments
Reecepbcups Aug 23, 2023
11a0449
decorator
Reecepbcups Aug 23, 2023
6f27f2d
Base POC setup
joelsmith-2019 Aug 24, 2023
34157f3
Create FeePrepay Module,
joelsmith-2019 Aug 25, 2023
6d5022d
Send funds to user on zero fee tx
joelsmith-2019 Aug 25, 2023
1a527fa
Transfer funds between modules (incomplete)
joelsmith-2019 Aug 26, 2023
93dc8f4
Handle Transfer Errors
joelsmith-2019 Aug 26, 2023
2ba870e
Move ante to x/feepay
joelsmith-2019 Aug 29, 2023
6a17f72
Add FeePay keeper
joelsmith-2019 Aug 29, 2023
71d6de9
Add example contract and script for fee pay
Reecepbcups Aug 29, 2023
81730af
fix errors
Reecepbcups Aug 30, 2023
2f0d202
Hook Keeper Into Ante,
joelsmith-2019 Aug 30, 2023
c019a35
Merge branch 'joel_fee-prepay' of https://github.com/CosmosContracts/…
joelsmith-2019 Aug 30, 2023
4a2d793
Register FeePay Module,
joelsmith-2019 Sep 1, 2023
4d558ea
Add BondDenom to ante
Reecepbcups Sep 1, 2023
282301f
Cover exact fee
joelsmith-2019 Sep 1, 2023
845ae4b
Start fund contract tx
joelsmith-2019 Sep 1, 2023
575b98d
Add bond denom from main
Reecepbcups Sep 6, 2023
ca2dce9
Update Fund CLI
joelsmith-2019 Sep 6, 2023
7eb25b2
Merge branch 'joel_fee-prepay' of https://github.com/CosmosContracts/…
joelsmith-2019 Sep 6, 2023
8e130b6
Fund Contract via User Wallet
joelsmith-2019 Sep 6, 2023
5101407
Fix contract funding,
joelsmith-2019 Sep 8, 2023
5a94316
Implement Contract Query Pagination
joelsmith-2019 Sep 8, 2023
c89e7aa
Code cleanup,
joelsmith-2019 Sep 8, 2023
8090a8e
Implement wallet limits,
joelsmith-2019 Sep 8, 2023
81d0e01
Query if wallet is eligible,
joelsmith-2019 Sep 12, 2023
3e85261
Improve ante error messages
joelsmith-2019 Sep 12, 2023
ab97eec
Add Tx for Unregistering Contract (WIP)
joelsmith-2019 Sep 14, 2023
bd89c04
Fix refund account address
joelsmith-2019 Sep 14, 2023
0c75d4a
Add Tx Msg Validation
joelsmith-2019 Sep 15, 2023
6487f2b
Add bech32 validation to queries
joelsmith-2019 Sep 15, 2023
bd89399
Update wallet limit bounds
joelsmith-2019 Sep 15, 2023
9de6640
Refactor queries, txs, & keeper
joelsmith-2019 Sep 19, 2023
8b543dc
Add Tx for Updating Wallet Limit
joelsmith-2019 Sep 19, 2023
bcbe593
Add Params & Genesis Integration
joelsmith-2019 Sep 21, 2023
5272da5
Prevent FeePay Tx in Ante when Disabled
joelsmith-2019 Sep 21, 2023
c08709f
add base test
Reecepbcups Oct 3, 2023
ba4862a
Add Tests for Msg Server
joelsmith-2019 Oct 5, 2023
cbf3252
Add Query Tests
joelsmith-2019 Oct 6, 2023
0b8bae7
Cleanup Query Response Validation
joelsmith-2019 Oct 6, 2023
d890568
Add Genesis Tests
joelsmith-2019 Oct 6, 2023
e9d4487
Add genesis state validation
joelsmith-2019 Oct 9, 2023
808d6be
Add Contract Registration Helper
joelsmith-2019 Oct 9, 2023
ab03d6c
update ictest to latest v7 + PR 810 backport
Reecepbcups Oct 9, 2023
1477880
add feepay test base
Reecepbcups Oct 9, 2023
9203aa0
fix: nil deduct fee if GlobalFee does not contain
Reecepbcups Oct 9, 2023
54de610
feepay e2e test
Reecepbcups Oct 9, 2023
540182f
test: globalfee e2e
Reecepbcups Oct 11, 2023
ae439a6
Merge branch 'main' into joel_fee-prepay
Reecepbcups Oct 11, 2023
562b535
feepay v18 namespace
Reecepbcups Oct 11, 2023
a0aa013
minor cleanup
Reecepbcups Oct 11, 2023
11ba89f
add feepay to v18 upgrade handler
Reecepbcups Oct 11, 2023
e9ba532
default disable feepay for all e2e
Reecepbcups Oct 11, 2023
8e17767
only feepayTx check if isEnabled
Reecepbcups Oct 11, 2023
4c66f33
Merge branch 'main' into joel_fee-prepay
Reecepbcups Oct 12, 2023
6963292
fix drip test:: don't be overly assertive
Reecepbcups Oct 12, 2023
f400f1c
upgrade test: standalone old version genesis cfg
Reecepbcups Oct 12, 2023
471bf5e
go mod tidy
Reecepbcups Oct 12, 2023
5bad633
fix ibc_test int64 -> math.Int cmp
Reecepbcups Oct 12, 2023
6d29035
Adds back POB test (v0.2.1)
Reecepbcups Oct 12, 2023
6c4dbe7
Integrate GlobalFee with FeePay (wip)
joelsmith-2019 Oct 13, 2023
b743dde
Fix missing zero fee check
joelsmith-2019 Oct 14, 2023
31eec78
pfm fix test
Reecepbcups Oct 14, 2023
b40d2e5
lintor
Reecepbcups Oct 15, 2023
6a1e48d
Refactor Fee Pay Tx Validation
joelsmith-2019 Oct 15, 2023
35686ba
Merge branch 'joel_fee-prepay' of https://github.com/CosmosContracts/…
joelsmith-2019 Oct 15, 2023
3f35487
tidy lint
Reecepbcups Oct 15, 2023
cf64e8d
Add query err checks
joelsmith-2019 Oct 16, 2023
9daebdd
Use sdk errors
joelsmith-2019 Oct 16, 2023
d515e37
Force new contract balance of 0
joelsmith-2019 Oct 16, 2023
cb79e18
Removed unused file
joelsmith-2019 Oct 16, 2023
acecf59
Remove fee pay testing script
joelsmith-2019 Oct 16, 2023
30fff19
Update query endpoints
joelsmith-2019 Oct 16, 2023
54f6b66
Remove incorrect comment
joelsmith-2019 Oct 16, 2023
9cb22dc
Require balance in register contract helper method
joelsmith-2019 Oct 16, 2023
9bfd32b
Update proto
joelsmith-2019 Oct 17, 2023
40a9d75
Delete chain state export file
joelsmith-2019 Oct 17, 2023
ed27a11
Removed unused parameter
joelsmith-2019 Oct 17, 2023
6b5590e
Remove contract balance check for eligiblity
joelsmith-2019 Oct 17, 2023
82574c2
lintor
Reecepbcups Oct 17, 2023
d3012fa
Update Msg Server Endpoints
joelsmith-2019 Oct 23, 2023
d8f2015
Merge branch 'main' into joel_fee-prepay
Reecepbcups Oct 24, 2023
a1b2d18
ictest v7 latest
Reecepbcups Oct 24, 2023
c3ba792
remove pob test for now (works, just out of date)
Reecepbcups Oct 24, 2023
d5b3750
adds back feepay e2e
Reecepbcups Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/interchaintest-E2E.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- "ictest-tokenfactory"
- "ictest-feeshare"
- "ictest-pfm"
- "ictest-globalfee"
- "ictest-upgrade"
- "ictest-ibc"
- "ictest-unity-deploy"
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ ictest-feeshare: rm-testcache
ictest-pfm: rm-testcache
cd interchaintest && go test -race -v -run TestPacketForwardMiddlewareRouter .

ictest-globalfee: rm-testcache
cd interchaintest && go test -race -v -run TestJunoGlobalFee .

# Executes a basic chain upgrade test via interchaintest
ictest-upgrade: rm-testcache
cd interchaintest && go test -race -v -run TestBasicJunoUpgrade .
Expand All @@ -163,6 +166,9 @@ ictest-pob: rm-testcache
ictest-drip: rm-testcache
cd interchaintest && go test -race -v -run TestJunoDrip .

ictest-feepay: rm-testcache
cd interchaintest && go test -race -v -run TestJunoFeePay .

ictest-burn: rm-testcache
cd interchaintest && go test -race -v -run TestJunoBurnModule .

Expand Down
15 changes: 11 additions & 4 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

decorators "github.com/CosmosContracts/juno/v18/app/decorators"
feepayante "github.com/CosmosContracts/juno/v18/x/feepay/ante"
feepaykeeper "github.com/CosmosContracts/juno/v18/x/feepay/keeper"
feeshareante "github.com/CosmosContracts/juno/v18/x/feeshare/ante"
feesharekeeper "github.com/CosmosContracts/juno/v18/x/feeshare/keeper"
globalfeeante "github.com/CosmosContracts/juno/v18/x/globalfee/ante"
Expand All @@ -36,8 +39,9 @@ type HandlerOptions struct {

GovKeeper govkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
FeePayKeeper feepaykeeper.Keeper
FeeShareKeeper feesharekeeper.Keeper
BankKeeperFork feeshareante.BankKeeper
BankKeeper bankkeeper.Keeper
TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmtypes.WasmConfig
Cdc codec.BinaryCodec
Expand All @@ -50,6 +54,8 @@ type HandlerOptions struct {
BuilderKeeper builderkeeper.Keeper
TxEncoder sdk.TxEncoder
Mempool builderante.Mempool

BondDenom string
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
Expand All @@ -74,6 +80,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
}

anteDecorators := []sdk.AnteDecorator{
// GLobalFee query params for minimum fee
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
Expand All @@ -83,9 +90,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
globalfeeante.NewFeeDecorator(options.BypassMinFeeMsgTypes, options.GlobalFeeKeeper, options.StakingKeeper, maxBypassMinFeeMsgGasUsage),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
feeshareante.NewFeeSharePayoutDecorator(options.BankKeeperFork, options.FeeShareKeeper),
globalfeeante.NewFeeDecorator(options.BypassMinFeeMsgTypes, options.GlobalFeeKeeper, options.StakingKeeper, options.FeePayKeeper, maxBypassMinFeeMsgGasUsage),
feepayante.NewDeductFeeDecorator(options.FeePayKeeper, options.GlobalFeeKeeper, options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker, options.BondDenom),
feeshareante.NewFeeSharePayoutDecorator(options.BankKeeper, options.FeeShareKeeper),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand Down
5 changes: 4 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func New(
enabledProposals,
appOpts,
wasmOpts,
app.GetChainBondDenom(),
)
app.keys = app.AppKeepers.GetKVStoreKey()

Expand Down Expand Up @@ -363,8 +364,9 @@ func New(

GovKeeper: app.AppKeepers.GovKeeper,
IBCKeeper: app.AppKeepers.IBCKeeper,
FeePayKeeper: app.AppKeepers.FeePayKeeper,
FeeShareKeeper: app.AppKeepers.FeeShareKeeper,
BankKeeperFork: app.AppKeepers.BankKeeper, // since we need extra methods
BankKeeper: app.AppKeepers.BankKeeper,
TxCounterStoreKey: app.AppKeepers.GetKey(wasmtypes.StoreKey),
WasmConfig: wasmConfig,
Cdc: appCodec,
Expand All @@ -376,6 +378,7 @@ func New(
TxEncoder: app.txConfig.TxEncoder(),
BuilderKeeper: app.AppKeepers.BuildKeeper,
Mempool: mempool,
BondDenom: app.GetChainBondDenom(),
},
)
if err != nil {
Expand Down
108 changes: 108 additions & 0 deletions app/decorators/feeprepay_poc.go.archive
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package decorators
joelsmith-2019 marked this conversation as resolved.
Show resolved Hide resolved

import (
globalfeekeeper "github.com/CosmosContracts/juno/v18/x/globalfee/keeper"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"

errorsmod "cosmossdk.io/errors"
)

type MsgFeePrepayDecorator struct {
BankKeeper bankkeeper.Keeper
// TODO: This could be incorrect. We may need the full AuthKeeper/AccountKeeper, not just from the ante
AccountKeeper authante.AccountKeeper
GlobalFeeKeeper globalfeekeeper.Keeper

FeeGrantKeeper feegrantkeeper.Keeper
}

func NewMsgFeePrepayDecorator(bank bankkeeper.Keeper, auth authante.AccountKeeper, globalFee globalfeekeeper.Keeper) MsgFeePrepayDecorator {
return MsgFeePrepayDecorator{
BankKeeper: bank,
AccountKeeper: auth,
GlobalFeeKeeper: globalFee,
}
}

// junod tx tokenfactory create-denom joel --fees=0ujuno --from=juno1 --home=/home/joel/.juno1 --chain-id=local-1 --keyring-backend=test -y --gas=2200000
func (fpd MsgFeePrepayDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {

ctx.Logger().Error("MsgFeePrepayDecorator", "Starting", true)

// 1. Confirm the transaction is a FeeTx
// 2. Calculate the total fee
// 3. Transfer funds to the user (either indirectly through the bank module or directly)
// 4. Set the new fee on the Tx
// 5. Continue processing as normal

// if tx is read only
// tx := new sdk.Tx(...tx, set the new fee)

// This may not be a FeeTx, so if error then don't exit early
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must implement the sdk.FeeTx interface")
}

// feePrePayModuleAcc := fpd.AccountKeeper.GetModuleAddress("feeprepay")
// fpd.FeeGrantKeeper.GrantAllowance(ctx, feePrePayModuleAcc, feeTx.FeePayer(), &feegranttypes.{})

if ctx.BlockHeight() > 0 {

// Global fee keeper params
p := fpd.GlobalFeeKeeper.GetParams(ctx)

// Get min juno gas
var minGasPrice sdk.DecCoin
for _, c := range p.MinimumGasPrices {
if c.Denom == "ujuno" {
minGasPrice = c
}
}

ctx.Logger().Error("MsgFeePrepayDecorator", "MinGas", minGasPrice)
ctx.Logger().Error("MsgFeePrepayDecorator", "FeeTx (gas)", feeTx.GetGas())
ctx.Logger().Error("MsgFeePrepayDecorator", "Consumed Gas", ctx.GasMeter().GasConsumed())

// Calculate gas consumed
consumed := ctx.GasMeter().GasConsumed()

// Determine fee by multiplying gas price by gas consumed
fee := minGasPrice.Amount.Mul(sdk.NewDec(int64(consumed))).RoundInt()

ctx.Logger().Error("MsgFeePrepayDecorator", "Fee", fee)

// payment := sdk.NewCoins(sdk.NewCoin("ujuno", fee))
payment := sdk.NewCoins(sdk.NewCoin("ujuno", sdk.NewDec(500_000).RoundInt()))
fpd.BankKeeper.MintCoins(ctx, "mint", payment)
fpd.BankKeeper.SendCoinsFromModuleToAccount(ctx, "mint", feeTx.FeePayer(), payment)

ctx.Logger().Error("MsgFeePrepayDecorator", "Minted & Sent to User", feeTx.FeePayer())
}

// TODOL: Thuis could give you funds and then make your next Tx successful.
// fpd.BankKeeper.MintCoins(ctx, "bank", coinsAmt)
// fpd.BankKeeper.SendCoinsFromModuleToAccount(ctx, "bank", "userAccount", coinsAmt)
// auto feeprepay with the TxFee or somethuing here? as an option
// set the Tx fee to be correct, set the accoiunt to be new and work, and then continue on

ctx.Logger().Error("MsgFeePrepayDecorator", "Finished", true)

return next(ctx, tx, simulate)
}

// TODO: Future: execute contract only.
// func hasInvalidExecuteMsgs(msgs []sdk.Msg) bool {
// for _, msg := range msgs {
// if _, ok := msg.(*wasmtypes.msgExecuteContract); ok {
// return true
// }
// }

// return false
// }
23 changes: 17 additions & 6 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ import (
cwhookstypes "github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
dripkeeper "github.com/CosmosContracts/juno/v18/x/drip/keeper"
driptypes "github.com/CosmosContracts/juno/v18/x/drip/types"
feepaykeeper "github.com/CosmosContracts/juno/v18/x/feepay/keeper"
feepaytypes "github.com/CosmosContracts/juno/v18/x/feepay/types"
feesharekeeper "github.com/CosmosContracts/juno/v18/x/feeshare/keeper"
feesharetypes "github.com/CosmosContracts/juno/v18/x/feeshare/types"
"github.com/CosmosContracts/juno/v18/x/globalfee"
Expand Down Expand Up @@ -128,6 +130,7 @@ var maccPerms = map[string][]string{
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
globalfee.ModuleName: nil,
buildertypes.ModuleName: nil,
feepaytypes.ModuleName: nil,
junoburn.ModuleName: {authtypes.Burner},
}

Expand Down Expand Up @@ -160,6 +163,7 @@ type AppKeepers struct {
AuthzKeeper authzkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
NFTKeeper nftkeeper.Keeper
FeePayKeeper feepaykeeper.Keeper
FeeShareKeeper feesharekeeper.Keeper
GlobalFeeKeeper globalfeekeeper.Keeper
ContractKeeper *wasmkeeper.PermissionedKeeper
Expand Down Expand Up @@ -198,6 +202,7 @@ func NewAppKeepers(
enabledProposals []wasmtypes.ProposalType,
appOpts servertypes.AppOptions,
wasmOpts []wasmkeeper.Option,
bondDenom string,
) AppKeepers {
appKeepers := AppKeepers{}

Expand Down Expand Up @@ -543,6 +548,16 @@ func NewAppKeepers(
wasmOpts...,
)

appKeepers.FeePayKeeper = feepaykeeper.NewKeeper(
appKeepers.keys[feepaytypes.StoreKey],
appCodec,
&appKeepers.BankKeeper,
appKeepers.WasmKeeper,
appKeepers.AccountKeeper,
bondDenom,
govModAddress,
)

// set the contract keeper for the Ics20WasmHooks
appKeepers.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(appKeepers.WasmKeeper)
appKeepers.Ics20WasmHooks.ContractKeeper = &appKeepers.WasmKeeper
Expand Down Expand Up @@ -731,16 +746,12 @@ func BlockedAddresses() map[string]bool {

// allow the following addresses to receive funds
delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String())
delete(modAccAddrs, authtypes.NewModuleAddress(feepaytypes.ModuleName).String())

return modAccAddrs
}

// GetMaccPerms returns a copy of the module account permissions
func GetMaccPerms() map[string][]string {
dupMaccPerms := make(map[string][]string)
for k, v := range maccPerms {
dupMaccPerms[k] = v
}

return dupMaccPerms
return maccPerms
joelsmith-2019 marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 2 additions & 0 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
clocktypes "github.com/CosmosContracts/juno/v18/x/clock/types"
cwhookstypes "github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
driptypes "github.com/CosmosContracts/juno/v18/x/drip/types"
feepaytypes "github.com/CosmosContracts/juno/v18/x/feepay/types"
feesharetypes "github.com/CosmosContracts/juno/v18/x/feeshare/types"
globalfeetypes "github.com/CosmosContracts/juno/v18/x/globalfee/types"
minttypes "github.com/CosmosContracts/juno/v18/x/mint/types"
Expand All @@ -55,6 +56,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {
packetforwardtypes.StoreKey,
ibchookstypes.StoreKey,
tokenfactorytypes.StoreKey,
feepaytypes.StoreKey,
feesharetypes.StoreKey,
globalfeetypes.StoreKey,
buildertypes.StoreKey,
Expand Down
8 changes: 8 additions & 0 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ import (
cwhooks "github.com/CosmosContracts/juno/v18/x/cw-hooks"
"github.com/CosmosContracts/juno/v18/x/drip"
driptypes "github.com/CosmosContracts/juno/v18/x/drip/types"
feepay "github.com/CosmosContracts/juno/v18/x/feepay"
feepaytypes "github.com/CosmosContracts/juno/v18/x/feepay/types"
feeshare "github.com/CosmosContracts/juno/v18/x/feeshare"
feesharetypes "github.com/CosmosContracts/juno/v18/x/feeshare/types"
"github.com/CosmosContracts/juno/v18/x/globalfee"
Expand Down Expand Up @@ -107,6 +109,7 @@ var ModuleBasics = module.NewBasicManager(
feegrantmodule.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
drip.AppModuleBasic{},
feepay.AppModuleBasic{},
feeshare.AppModuleBasic{},
globalfee.AppModuleBasic{},
ibc_hooks.AppModuleBasic{},
Expand Down Expand Up @@ -152,6 +155,7 @@ func appModules(
ibcfee.NewAppModule(app.AppKeepers.IBCFeeKeeper),
tokenfactory.NewAppModule(app.AppKeepers.TokenFactoryKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
globalfee.NewAppModule(appCodec, app.AppKeepers.GlobalFeeKeeper, bondDenom),
feepay.NewAppModule(app.AppKeepers.FeePayKeeper, app.AppKeepers.AccountKeeper),
feeshare.NewAppModule(app.AppKeepers.FeeShareKeeper, app.AppKeepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)),
wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ica.NewAppModule(&app.AppKeepers.ICAControllerKeeper, &app.AppKeepers.ICAHostKeeper),
Expand Down Expand Up @@ -194,6 +198,7 @@ func simulationModules(
wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibc.NewAppModule(app.AppKeepers.IBCKeeper),
transfer.NewAppModule(app.AppKeepers.TransferKeeper),
feepay.NewAppModule(app.AppKeepers.FeePayKeeper, app.AppKeepers.AccountKeeper),
feeshare.NewAppModule(app.AppKeepers.FeeShareKeeper, app.AppKeepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)),
ibcfee.NewAppModule(app.AppKeepers.IBCFeeKeeper),
}
Expand Down Expand Up @@ -231,6 +236,7 @@ func orderBeginBlockers() []string {
icqtypes.ModuleName,
tokenfactorytypes.ModuleName,
driptypes.ModuleName,
feepaytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasmtypes.ModuleName,
Expand Down Expand Up @@ -270,6 +276,7 @@ func orderEndBlockers() []string {
icqtypes.ModuleName,
tokenfactorytypes.ModuleName,
driptypes.ModuleName,
feepaytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasmtypes.ModuleName,
Expand Down Expand Up @@ -309,6 +316,7 @@ func orderInitBlockers() []string {
icqtypes.ModuleName,
tokenfactorytypes.ModuleName,
driptypes.ModuleName,
feepaytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasmtypes.ModuleName,
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v18/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/CosmosContracts/juno/v18/app/upgrades"
cwhooks "github.com/CosmosContracts/juno/v18/x/cw-hooks"
feepaytypes "github.com/CosmosContracts/juno/v18/x/feepay/types"
)

// UpgradeName defines the on-chain upgrade name for the upgrade.
Expand All @@ -16,6 +17,7 @@ var Upgrade = upgrades.Upgrade{
StoreUpgrades: store.StoreUpgrades{
Added: []string{
cwhooks.ModuleName,
feepaytypes.ModuleName,
},
},
}
8 changes: 8 additions & 0 deletions app/upgrades/v18/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/CosmosContracts/juno/v18/app/keepers"
"github.com/CosmosContracts/juno/v18/app/upgrades"
cwhookstypes "github.com/CosmosContracts/juno/v18/x/cw-hooks/types"
feepaytypes "github.com/CosmosContracts/juno/v18/x/feepay/types"
)

func CreateV18UpgradeHandler(
Expand Down Expand Up @@ -37,6 +38,13 @@ func CreateV18UpgradeHandler(
return nil, err
}

// x/feepay
if err := k.FeePayKeeper.SetParams(ctx, feepaytypes.Params{
EnableFeepay: true,
}); err != nil {
return nil, err
}

return versionMap, err
}
}
Loading
Loading