diff --git a/app/modules.go b/app/modules.go index d9ed90cf3..bee9b2268 100644 --- a/app/modules.go +++ b/app/modules.go @@ -150,7 +150,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, app.GetSubspace(feepaytypes.ModuleName)), + 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), @@ -191,7 +191,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, app.GetSubspace(feepaytypes.ModuleName)), + 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), } diff --git a/proto/juno/feepay/v1/query.proto b/proto/juno/feepay/v1/query.proto index 32b7ffc50..296952be7 100644 --- a/proto/juno/feepay/v1/query.proto +++ b/proto/juno/feepay/v1/query.proto @@ -41,7 +41,7 @@ message QueryFeePayContract { // QueryFeePayContractResponse defines the response for retrieving a single fee pay contract message QueryFeePayContractResponse { // contract defines the fee pay contract - FeePayContract contract = 1; + FeePayContract fee_pay_contract = 1; } // Message for querying a list of fee pay contracts @@ -53,7 +53,7 @@ message QueryFeePayContracts { // The response for querying all fee pay contracts message QueryFeePayContractsResponse { // A slice of all the stored fee pay contracts - repeated FeePayContract contracts = 1 [ (gogoproto.nullable) = false ]; + repeated FeePayContract fee_pay_contracts = 1 [ (gogoproto.nullable) = false ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -84,6 +84,4 @@ message QueryFeePayWalletIsEligible { message QueryFeePayWalletIsEligibleResponse { // The eligibility of the wallet for fee pay contract interactions bool eligible = 1; - // The reason (if any) for the wallet being ineligible for fee pay contract interactions - string reason = 2; } \ No newline at end of file diff --git a/proto/juno/feepay/v1/tx.proto b/proto/juno/feepay/v1/tx.proto index 12141f61d..dbde95622 100644 --- a/proto/juno/feepay/v1/tx.proto +++ b/proto/juno/feepay/v1/tx.proto @@ -44,7 +44,7 @@ message MsgRegisterFeePayContract { string sender_address = 1; // The fee pay contract to register. - FeePayContract contract = 2; + FeePayContract fee_pay_contract = 2; } // The response message for registering a fee pay contract. @@ -95,7 +95,7 @@ message MsgUpdateParams { // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // params defines the x/feeshare parameters to update. + // params defines the x/feepay parameters to update. // // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false]; diff --git a/x/feepay/ante/dedcuct_fee.go b/x/feepay/ante/deduct_fee.go similarity index 88% rename from x/feepay/ante/dedcuct_fee.go rename to x/feepay/ante/deduct_fee.go index 8c95e60ab..9d9483b4d 100644 --- a/x/feepay/ante/dedcuct_fee.go +++ b/x/feepay/ante/deduct_fee.go @@ -36,6 +36,7 @@ type DeductFeeDecorator struct { // type TxFeeChecker func(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) txFeeChecker ante.TxFeeChecker + // TODO: test this. bondDenom string } @@ -58,7 +59,6 @@ func NewDeductFeeDecorator(fpk feepaykeeper.Keeper, gfk globalfeekeeper.Keeper, func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { - // return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx") } @@ -151,9 +151,10 @@ func (dfd DeductFeeDecorator) handleZeroFees(ctx sdk.Context, deductFeesFromAcc msg := tx.GetMsgs()[0] cw := msg.(*wasmtypes.MsgExecuteContract) - // We need to check if it is a valid contract. Utilize the FeePay Keeper for validation - if !dfd.feepayKeeper.IsRegisteredContract(ctx, cw.GetContract()) { - return feepaytypes.ErrContractNotRegistered + // Get the fee pay contract + feepayContract, err := dfd.feepayKeeper.GetContract(ctx, cw.GetContract()) + if err != nil { + return errorsmod.Wrapf(err, "error getting contract %s", cw.GetContract()) } // Get the fee price in the chain denom @@ -176,19 +177,14 @@ func (dfd DeductFeeDecorator) handleZeroFees(ctx sdk.Context, deductFeesFromAcc ctx.Logger().Error("HandleZeroFees", "RequiredFee", requiredFee) - // Get the fee pay contract - feepayContract, err := dfd.feepayKeeper.GetContract(ctx, cw.GetContract()) - if err != nil { - return err - } - // Check if wallet exceeded usage limit on contract - if dfd.feepayKeeper.HasWalletExceededUsageLimit(ctx, cw.GetContract(), deductFeesFromAcc.GetAddress().String()) { + accBech32 := deductFeesFromAcc.GetAddress().String() + if dfd.feepayKeeper.HasWalletExceededUsageLimit(ctx, feepayContract, accBech32) { return errorsmod.Wrapf(feepaytypes.ErrWalletExceededUsageLimit, "wallet has exceeded usage limit (%d)", feepayContract.WalletLimit) } // Check if the contract has enough funds to cover the fee - if !dfd.feepayKeeper.CanContractCoverFee(ctx, cw.GetContract(), requiredFee.Uint64()) { + if !dfd.feepayKeeper.CanContractCoverFee(ctx, feepayContract, requiredFee.Uint64()) { return errorsmod.Wrapf(feepaytypes.ErrContractNotEnoughFunds, "contract has insufficient funds; expected: %d, got: %d", requiredFee.Uint64(), feepayContract.Balance) } @@ -198,23 +194,16 @@ func (dfd DeductFeeDecorator) handleZeroFees(ctx sdk.Context, deductFeesFromAcc ctx.Logger().Error("HandleZeroFees", "Payment", payment) // Cover the fees of the transaction, send from FeePay Module to FeeCollector Module - err = dfd.bankKeeper.SendCoinsFromModuleToModule(ctx, feepaytypes.ModuleName, types.FeeCollectorName, payment) - if err != nil { + if err := dfd.bankKeeper.SendCoinsFromModuleToModule(ctx, feepaytypes.ModuleName, types.FeeCollectorName, payment); err != nil { return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, "error transfering funds from FeePay to FeeCollector; %s", err) } // Deduct the fee from the contract balance - dfd.feepayKeeper.UpdateContractBalance(ctx, cw.GetContract(), feepayContract.Balance-requiredFee.Uint64()) + dfd.feepayKeeper.SetContractBalance(ctx, feepayContract, feepayContract.Balance-requiredFee.Uint64()) // Increment wallet usage - uses, err := dfd.feepayKeeper.GetContractUses(ctx, cw.GetContract(), deductFeesFromAcc.GetAddress().String()) - if err != nil { - return err - } + dfd.feepayKeeper.IncrementContractUses(ctx, feepayContract, accBech32, 1) - if err := dfd.feepayKeeper.SetContractUses(ctx, cw.GetContract(), deductFeesFromAcc.GetAddress().String(), uses+1); err != nil { - return err - } return nil } @@ -224,7 +213,6 @@ func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI return errorsmod.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees) } - // TODO: if 0 fees are sent, then the module account needs to pay it. (prepay module) ELSE have the standard user err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), types.FeeCollectorName, fees) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error()) @@ -234,6 +222,7 @@ func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI } // from the SDK pulled out +// TODO: modify this in part with globalfee for bypasses with ibc, force set 0? need an override in the event of DOS attacks func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error) { feeTx, ok := tx.(sdk.FeeTx) if !ok { @@ -246,6 +235,7 @@ func checkTxFeeWithValidatorMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, // Ensure that the provided fees meet a minimum threshold for the validator, // if this is a CheckTx. This is only for local mempool purposes, and thus // is only ran on check tx. + // TODO: see if we can remove, since we do call this twice. if ctx.IsCheckTx() && !isValidFeePayTransaction(ctx, tx, feeTx.GetFee()) { minGasPrices := ctx.MinGasPrices() if !minGasPrices.IsZero() { @@ -292,15 +282,11 @@ func getTxPriority(fee sdk.Coins, gas int64) int64 { // Check if a transaction should be processed as a FeePay transaction. // A valid FeePay transaction has no fee, and only 1 message for executing a contract. func isValidFeePayTransaction(ctx sdk.Context, tx sdk.Tx, fee sdk.Coins) bool { - - ctx.Logger().Error("FeePayAnte", "IsZero", fee.IsZero(), "Msgs", len(tx.GetMsgs())) + // TODO: Future allow for multiple msgs. // Check if fee is zero, and tx has only 1 message for executing a contract if fee.IsZero() && len(tx.GetMsgs()) == 1 { _, ok := (tx.GetMsgs()[0]).(*wasmtypes.MsgExecuteContract) - - ctx.Logger().Error("FeePayAnte", "IsCWExecuteContract", ok) - return ok } diff --git a/x/feepay/client/cli/query.go b/x/feepay/client/cli/query.go index 71f659610..65b731e76 100644 --- a/x/feepay/client/cli/query.go +++ b/x/feepay/client/cli/query.go @@ -139,7 +139,7 @@ func NewQueryFeePayContractUsage() *cobra.Command { // Query if a wallet is eligible func NewQueryWalletIsEligible() *cobra.Command { cmd := &cobra.Command{ - Use: "eligible [contract_address] [wallet_address]", + Use: "is-eligible [contract_address] [wallet_address]", Short: "Query if a wallet is eligible to interact with a FeePay contract", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/feepay/client/cli/tx.go b/x/feepay/client/cli/tx.go index 4f7b217a0..2461fffd8 100644 --- a/x/feepay/client/cli/tx.go +++ b/x/feepay/client/cli/tx.go @@ -28,6 +28,7 @@ func NewTxCmd() *cobra.Command { NewRegisterFeePayContract(), NewUnregisterFeePayContract(), NewFundFeePayContract(), + // TODO: update wallet limit for usage. (0 = disabled) ) return txCmd } @@ -38,7 +39,6 @@ func NewRegisterFeePayContract() *cobra.Command { cmd := &cobra.Command{ Use: "register [contract_bech32] [wallet_limit]", Short: "Register a contract for fee pay. Only the contract admin can register a contract.", - Long: "Register a contract for fee pay. Only the contract admin can register a contract.", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { cliCtx, err := client.GetClientTxContext(cmd) @@ -62,8 +62,8 @@ func NewRegisterFeePayContract() *cobra.Command { } msg := &types.MsgRegisterFeePayContract{ - SenderAddress: deployer_address.String(), - Contract: fpc, + SenderAddress: deployer_address.String(), + FeePayContract: fpc, } if err := msg.ValidateBasic(); err != nil { diff --git a/x/feepay/genesis.go b/x/feepay/genesis.go index afe5520cc..47cee6245 100644 --- a/x/feepay/genesis.go +++ b/x/feepay/genesis.go @@ -13,7 +13,7 @@ func InitGenesis( k keeper.Keeper, data types.GenesisState, ) { - + // TODO: impl, just remember that ParamsKey is going to be nil? } // ExportGenesis export module state diff --git a/x/feepay/keeper/feepay.go b/x/feepay/keeper/feepay.go new file mode 100644 index 000000000..bfc7f5f0d --- /dev/null +++ b/x/feepay/keeper/feepay.go @@ -0,0 +1,290 @@ +package keeper + +import ( + "cosmossdk.io/math" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/CosmosContracts/juno/v17/x/feepay/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" +) + +// Check if a contract is registered as a fee pay contract +func (k Keeper) IsContractRegistered(ctx sdk.Context, contractAddr string) bool { + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) + return store.Has([]byte(contractAddr)) +} + +// Get a contract from KV store +func (k Keeper) GetContract(ctx sdk.Context, contractAddress string) (*types.FeePayContract, error) { + + // Return nil, contract not registered + if !k.IsContractRegistered(ctx, contractAddress) { + return nil, types.ErrContractNotRegistered + } + + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) + + key := []byte(contractAddress) + bz := store.Get(key) + + var fpc types.FeePayContract + if err := k.cdc.Unmarshal(bz, &fpc); err != nil { + return nil, err + } + + return &fpc, nil +} + +// Get all registered fee pay contracts +func (k Keeper) GetAllContracts(ctx sdk.Context, pag *query.PageRequest) (*types.QueryFeePayContractsResponse, error) { + + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) + + // Filter and paginate all contracts + results, pageRes, err := query.GenericFilteredPaginate( + k.cdc, + store, + pag, + func(key []byte, value *types.FeePayContract) (*types.FeePayContract, error) { + return value, nil + }, + func() *types.FeePayContract { + return &types.FeePayContract{} + }, + ) + + if err != nil { + return nil, err + } + + // Dereference pointer array of contracts + var contracts []types.FeePayContract + for _, contract := range results { + contracts = append(contracts, *contract) + } + + return &types.QueryFeePayContractsResponse{ + FeePayContracts: contracts, + Pagination: pageRes, + }, nil +} + +// Register the contract in the module store +func (k Keeper) RegisterContract(ctx sdk.Context, rfp *types.MsgRegisterFeePayContract) error { + + // Return false because the contract was already registered + if k.IsContractRegistered(ctx, rfp.FeePayContract.ContractAddress) { + return types.ErrContractAlreadyRegistered + } + + // Check if sender is the owner of the cw contract + contractAddr, err := sdk.AccAddressFromBech32(rfp.FeePayContract.ContractAddress) + if err != nil { + return err + } + + if ok := k.wasmKeeper.HasContractInfo(ctx, contractAddr); !ok { + return types.ErrInvalidCWContract + } + + // Get the contract owner + contractInfo := k.wasmKeeper.GetContractInfo(ctx, contractAddr) + + // Check if sender is contract manager + if ok, err := k.IsContractManager(rfp.SenderAddress, contractInfo); !ok { + return err + } + + // Register the new fee pay contract in the KV store + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) + key := []byte(rfp.FeePayContract.ContractAddress) + bz := k.cdc.MustMarshal(rfp.FeePayContract) + + store.Set(key, bz) + return nil +} + +// Unregister contract (loop through usage store & remove all usage entries for contract) +func (k Keeper) UnregisterContract(ctx sdk.Context, rfp *types.MsgUnregisterFeePayContract) error { + + // Get fee pay contract + contract, err := k.GetContract(ctx, rfp.ContractAddress) + if err != nil { + return err + } + + // Get contract address + contractAddr, err := sdk.AccAddressFromBech32(rfp.ContractAddress) + if err != nil { + return err + } + + // Ensure CW contract is valid + if ok := k.wasmKeeper.HasContractInfo(ctx, contractAddr); !ok { + return types.ErrInvalidCWContract + } + + // Get the contract info + contractInfo := k.wasmKeeper.GetContractInfo(ctx, contractAddr) + + // Check if sender is the contract manager + if ok, err := k.IsContractManager(rfp.SenderAddress, contractInfo); !ok { + return err + } + + // Remove contract from KV store + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) + store.Delete([]byte(rfp.ContractAddress)) + + // Remove all usage entries for contract + store = prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContractUses)) + iterator := sdk.KVStorePrefixIterator(store, []byte(rfp.ContractAddress)) + + for ; iterator.Valid(); iterator.Next() { + store.Delete(iterator.Key()) + } + + // Transfer funds back to contract owner + coins := sdk.NewCoins(sdk.NewCoin(k.bondDenom, math.NewIntFromUint64(contract.Balance))) + + // Default refund address to admin, fallback to creator + var refundAddr string + if contractInfo.Admin != "" { + refundAddr = contractInfo.Admin + } else { + refundAddr = contractInfo.Creator + } + + // Send coins from the FeePay module to the refund address + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(refundAddr), coins); err != nil { + return err + } + + return nil +} + +// Set the contract balance in the KV store +func (k Keeper) SetContractBalance(ctx sdk.Context, fpc *types.FeePayContract, newBalance uint64) { + + // Get the existing contract in KV store + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) + + // Set new balance and save to KV store + fpc.Balance = newBalance + store.Set([]byte(fpc.ContractAddress), k.cdc.MustMarshal(fpc)) +} + +// Fund an existing fee pay contract +func (k Keeper) FundContract(ctx sdk.Context, fpc *types.FeePayContract, senderAddr sdk.AccAddress, coins sdk.Coins) error { + + // Only transfer the bond denom + var transferCoin sdk.Coin + for _, c := range coins { + if c.Denom == k.bondDenom { + transferCoin = c + } + } + + // Transfer from sender to module + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, senderAddr, types.ModuleName, sdk.NewCoins(transferCoin)); err != nil { + return err + } + + // Increment the fpc balance + k.SetContractBalance(ctx, fpc, fpc.Balance+transferCoin.Amount.Uint64()) + return nil +} + +// Check if a fee pay contract has a balance greater than or equal to the fee +func (k Keeper) CanContractCoverFee(ctx sdk.Context, fpc *types.FeePayContract, fee uint64) bool { + return fpc.Balance >= fee +} + +// Get the number of times a wallet has interacted with a fee pay contract (err only if contract not registered) +func (k Keeper) GetContractUses(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string) (uint64, error) { + + // Get usage from store + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContractUses)) + key := []byte(fpc.ContractAddress + "-" + walletAddress) + bz := store.Get(key) + + var walletUsage types.FeePayWalletUsage + if err := k.cdc.Unmarshal(bz, &walletUsage); err != nil { + return 0, err + } + + return walletUsage.Uses, nil +} + +// Set the number of times a wallet has interacted with a fee pay contract +func (k Keeper) IncrementContractUses(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string, increment uint64) error { + + uses, err := k.GetContractUses(ctx, fpc, walletAddress) + if err != nil { + return err + } + + // Get store, key, & value for setting usage + store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContractUses)) + key := []byte(fpc.ContractAddress + "-" + walletAddress) + bz, err := k.cdc.Marshal(&types.FeePayWalletUsage{ + ContractAddress: fpc.ContractAddress, + WalletAddress: walletAddress, + Uses: uses + increment, + }) + + if err != nil { + return err + } + + store.Set(key, bz) + return nil +} + +// Check if a wallet exceeded usage limit (defaults to true if contract not registered) +func (k Keeper) HasWalletExceededUsageLimit(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string) bool { + + // Get account uses + uses, err := k.GetContractUses(ctx, fpc, walletAddress) + if err != nil { + return true + } + + // Return if the wallet has used the contract too many times + return uses >= fpc.WalletLimit +} + +// Check if a wallet is eligible to interact with a contract +func (k Keeper) IsWalletEligible(ctx sdk.Context, fpc *types.FeePayContract, walletAddress string) (bool, error) { + + // Check if wallet has exceeded usage limit + if k.HasWalletExceededUsageLimit(ctx, fpc, walletAddress) { + return false, types.ErrWalletExceededUsageLimit + } + + // Check if contract has enough funds + if fpc.Balance == 0 { + return true, types.ErrContractNotEnoughFunds + } + + return true, nil +} + +// Check if the sender is the designated contract manager for the FeePay contract. If +// an admin is present, they are considered the manager. If there is no admin, the +// contract creator is considered the manager. +func (k Keeper) IsContractManager(senderAddress string, contractInfo *wasmtypes.ContractInfo) (bool, error) { + // Flags for admin existence & sender being admin/creator + adminExists := len(contractInfo.Admin) > 0 + isSenderAdmin := contractInfo.Admin == senderAddress + isSenderCreator := contractInfo.Creator == senderAddress + + if adminExists && !isSenderAdmin { + return false, types.ErrContractNotAdmin + } else if !adminExists && !isSenderCreator { + return false, types.ErrContractNotCreator + } + + return true, nil +} diff --git a/x/feepay/keeper/grpc_query.go b/x/feepay/keeper/grpc_query.go index be6f81c55..13b60a18b 100644 --- a/x/feepay/keeper/grpc_query.go +++ b/x/feepay/keeper/grpc_query.go @@ -22,12 +22,17 @@ func NewQuerier(k Keeper) Querier { // FeePayContract implements types.QueryServer. func (q Querier) FeePayContract(ctx context.Context, req *types.QueryFeePayContract) (*types.QueryFeePayContractResponse, error) { + // Check if contract address are valid + if _, err := sdk.AccAddressFromBech32(req.ContractAddress); err != nil { + return nil, types.ErrInvalidAddress + } + sdkCtx := sdk.UnwrapSDKContext(ctx) contract, err := q.Keeper.GetContract(sdkCtx, req.ContractAddress) return &types.QueryFeePayContractResponse{ - Contract: contract, + FeePayContract: contract, }, err } @@ -36,7 +41,7 @@ func (q Querier) FeePayContracts(ctx context.Context, req *types.QueryFeePayCont sdkCtx := sdk.UnwrapSDKContext(ctx) - res, err := q.Keeper.GetAllContracts(sdkCtx, req) + res, err := q.Keeper.GetAllContracts(sdkCtx, req.Pagination) if err != nil { return nil, err @@ -47,10 +52,24 @@ func (q Querier) FeePayContracts(ctx context.Context, req *types.QueryFeePayCont // FeePayContractUses implements types.QueryServer. func (q Querier) FeePayContractUses(ctx context.Context, req *types.QueryFeePayContractUses) (*types.QueryFeePayContractUsesResponse, error) { + // Check if wallet & contract address are valid + if _, err := sdk.AccAddressFromBech32(req.ContractAddress); err != nil { + return nil, types.ErrInvalidAddress + } + + if _, err := sdk.AccAddressFromBech32(req.WalletAddress); err != nil { + return nil, types.ErrInvalidAddress + } sdkCtx := sdk.UnwrapSDKContext(ctx) - uses, err := q.Keeper.GetContractUses(sdkCtx, req.ContractAddress, req.WalletAddress) + // Get contract from KV store + fpc, err := q.Keeper.GetContract(sdkCtx, req.ContractAddress) + if err != nil { + return nil, err + } + + uses, err := q.Keeper.GetContractUses(sdkCtx, fpc, req.WalletAddress) return &types.QueryFeePayContractUsesResponse{ Uses: uses, @@ -59,13 +78,27 @@ func (q Querier) FeePayContractUses(ctx context.Context, req *types.QueryFeePayC // FeePayContractEligible implements types.QueryServer. func (q Querier) FeePayWalletIsEligible(ctx context.Context, req *types.QueryFeePayWalletIsEligible) (*types.QueryFeePayWalletIsEligibleResponse, error) { + // Check if wallet & contract address are valid + if _, err := sdk.AccAddressFromBech32(req.ContractAddress); err != nil { + return nil, types.ErrInvalidAddress + } + + if _, err := sdk.AccAddressFromBech32(req.WalletAddress); err != nil { + return nil, types.ErrInvalidAddress + } sdkCtx := sdk.UnwrapSDKContext(ctx) - eligible, reason := q.Keeper.IsWalletEligible(sdkCtx, req.ContractAddress, req.WalletAddress) + // Get fee pay contract + fpc, err := q.Keeper.GetContract(sdkCtx, req.ContractAddress) + if err != nil { + return nil, err + } + + // Return if wallet is eligible + isEligible, err := q.Keeper.IsWalletEligible(sdkCtx, fpc, req.WalletAddress) return &types.QueryFeePayWalletIsEligibleResponse{ - Eligible: eligible, - Reason: reason, - }, nil + Eligible: isEligible, + }, err } diff --git a/x/feepay/keeper/keeper.go b/x/feepay/keeper/keeper.go index acc438374..912307110 100644 --- a/x/feepay/keeper/keeper.go +++ b/x/feepay/keeper/keeper.go @@ -3,21 +3,17 @@ package keeper import ( "fmt" - "cosmossdk.io/math" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/CosmosContracts/juno/v17/x/feepay/types" - revtypes "github.com/CosmosContracts/juno/v17/x/feeshare/types" + feepaytypes "github.com/CosmosContracts/juno/v17/x/feepay/types" + feesharetypes "github.com/CosmosContracts/juno/v17/x/feeshare/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - - "github.com/cosmos/cosmos-sdk/types/query" ) const ( @@ -33,7 +29,7 @@ type Keeper struct { bankKeeper *bankkeeper.BaseKeeper wasmKeeper wasmkeeper.Keeper - accountKeeper revtypes.AccountKeeper + accountKeeper feesharetypes.AccountKeeper bondDenom string @@ -48,7 +44,7 @@ func NewKeeper( cdc codec.BinaryCodec, bk *bankkeeper.BaseKeeper, wk wasmkeeper.Keeper, - ak revtypes.AccountKeeper, + ak feesharetypes.AccountKeeper, bondDenom string, authority string, ) Keeper { @@ -70,364 +66,5 @@ func (k Keeper) GetAuthority() string { // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", revtypes.ModuleName)) -} - -// === TODO: MOVE BELOW FUNCTIONS TO NEW FILE === - -// Check if a contract is registered as a fee pay contract -func (k Keeper) IsRegisteredContract(ctx sdk.Context, contractAddr string) bool { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) - return store.Has([]byte(contractAddr)) -} - -// Get a contract from KV store -func (k Keeper) GetContract(ctx sdk.Context, contractAddress string) (*types.FeePayContract, error) { - - // Check if address is valid - if _, err := sdk.AccAddressFromBech32(contractAddress); err != nil { - return nil, types.ErrInvalidAddress - } - - // Return nil, contract not registered - if !k.IsRegisteredContract(ctx, contractAddress) { - return nil, types.ErrContractNotRegistered - } - - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) - - key := []byte(contractAddress) - bz := store.Get(key) - - var fpc types.FeePayContract - if err := k.cdc.Unmarshal(bz, &fpc); err != nil { - return nil, err - } - - return &fpc, nil -} - -// Get all registered fee pay contracts -func (k Keeper) GetAllContracts(ctx sdk.Context, req *types.QueryFeePayContracts) (*types.QueryFeePayContractsResponse, error) { - - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) - - // Filter and paginate all contracts - results, pageRes, err := query.GenericFilteredPaginate( - k.cdc, - store, - req.Pagination, - func(key []byte, value *types.FeePayContract) (*types.FeePayContract, error) { - return value, nil - }, - func() *types.FeePayContract { - return &types.FeePayContract{} - }, - ) - - if err != nil { - return nil, err - } - - // Dereference pointer array of contracts - var contracts []types.FeePayContract - for _, contract := range results { - contracts = append(contracts, *contract) - } - - return &types.QueryFeePayContractsResponse{ - Contracts: contracts, - Pagination: pageRes, - }, nil -} - -// Register the contract in the module store -func (k Keeper) RegisterContract(ctx sdk.Context, rfp *types.MsgRegisterFeePayContract) error { - - // Return false because the contract was already registered - if k.IsRegisteredContract(ctx, rfp.Contract.ContractAddress) { - return types.ErrContractAlreadyRegistered - } - - // Check if sender is the owner of the cw contract - contractAddr, err := sdk.AccAddressFromBech32(rfp.Contract.ContractAddress) - if err != nil { - return err - } - - // Get the contract owner - contractInfo := k.wasmKeeper.GetContractInfo(ctx, contractAddr) - - // Check if the sender is first the admin & then the creator (if no admin exists) - adminExists := len(contractInfo.Admin) > 0 - if adminExists && contractInfo.Admin != rfp.SenderAddress { - return types.ErrContractNotAdmin - } else if !adminExists && contractInfo.Creator != rfp.SenderAddress { - return types.ErrContractNotCreator - } - - // Register the new fee pay contract in the KV store - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) - key := []byte(rfp.Contract.ContractAddress) - bz := k.cdc.MustMarshal(rfp.Contract) - - store.Set(key, bz) - return nil -} - -// Unregister contract (loop through usage store & remove all usage entries for contract) -func (k Keeper) UnregisterContract(ctx sdk.Context, rfp *types.MsgUnregisterFeePayContract) error { - - // Return false because the contract was already registered - if !k.IsRegisteredContract(ctx, rfp.ContractAddress) { - return types.ErrContractNotRegistered - } - - // Get fee pay contract - contract, err := k.GetContract(ctx, rfp.ContractAddress) - if err != nil { - return err - } - - // Get contract address - contractAddr, err := sdk.AccAddressFromBech32(rfp.ContractAddress) - if err != nil { - return err - } - - // Get the contract info - contractInfo := k.wasmKeeper.GetContractInfo(ctx, contractAddr) - - // Check if sender is the contract owner - if contractInfo.Creator != rfp.SenderAddress { - return types.ErrContractNotCreator - } - - // Remove contract from KV store - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) - store.Delete([]byte(rfp.ContractAddress)) - - // Remove all usage entries for contract - store = prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContractUses)) - iterator := sdk.KVStorePrefixIterator(store, []byte(rfp.ContractAddress)) - - for ; iterator.Valid(); iterator.Next() { - store.Delete(iterator.Key()) - } - - // Transfer funds back to contract owner - coins := sdk.NewCoins(sdk.NewCoin(k.bondDenom, math.NewIntFromUint64(contract.Balance))) - - // Find admin or creator - var refundAddr string - if contractInfo.Admin != "" { - refundAddr = contractInfo.Admin - } else { - refundAddr = contractInfo.Creator - } - - // Send coins from the FeePay module to the refund address - if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(refundAddr), coins); err != nil { - return err - } - - return nil -} - -// Update the contract balance in the KV store -func (k Keeper) UpdateContractBalance(ctx sdk.Context, contractAddress string, newBalance uint64) error { - - // Skip if the contract is not registered - if !k.IsRegisteredContract(ctx, contractAddress) { - return types.ErrContractNotRegistered - } - - // Get the existing contract in KV store - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContracts)) - - key := []byte(contractAddress) - bz := store.Get(key) - - var fpc types.FeePayContract - if err := k.cdc.Unmarshal(bz, &fpc); err != nil { - return err - } - - // Set new balance and save to KV store - fpc.Balance = newBalance - - store.Set(key, k.cdc.MustMarshal(&fpc)) - return nil -} - -// Fund an existing fee pay contract -func (k Keeper) FundContract(ctx sdk.Context, mfc *types.MsgFundFeePayContract) error { - // Check if the contract is registered - if !k.IsRegisteredContract(ctx, mfc.ContractAddress) { - return types.ErrContractNotRegistered - } - - // Only transfer the bond denom - var transferCoin sdk.Coin - for _, c := range mfc.Amount { - if c.Denom == k.bondDenom { - transferCoin = c - } - } - - // Confirm the sender has enough funds to fund the contract - addr, err := sdk.AccAddressFromBech32(mfc.SenderAddress) - if err != nil { - return err - } - - if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, sdk.NewCoins(transferCoin)); err != nil { - return err - } - - // Get existing fee pay contract from store - fpc, err := k.GetContract(ctx, mfc.ContractAddress) - if err != nil { - return err - } - - // Increment the fpc balance - fpc.Balance += transferCoin.Amount.Uint64() - k.UpdateContractBalance(ctx, mfc.ContractAddress, fpc.Balance) - return nil -} - -// Get the funds associated with a contract -func (k Keeper) GetContractFunds(ctx sdk.Context, contractAddress string) (uint64, error) { - contract, err := k.GetContract(ctx, contractAddress) - - if err != nil { - return 0, err - } - - return contract.Balance, nil -} - -// Check if a contract can cover the fees of a transaction -func (k Keeper) CanContractCoverFee(ctx sdk.Context, contractAddress string, fee uint64) bool { - - funds, err := k.GetContractFunds(ctx, contractAddress) - - // Check if contract exists in KV store - if err != nil { - return false - } - - // Check for enough funds - if funds < fee { - return false - } - - return true -} - -// Get the number of times a wallet has interacted with a fee pay contract (err only if contract not registered) -func (k Keeper) GetContractUses(ctx sdk.Context, contractAddress string, walletAddress string) (uint64, error) { - - // Check if wallet & contract address are valid - if _, err := sdk.AccAddressFromBech32(contractAddress); err != nil { - return 0, types.ErrInvalidAddress.GRPCStatus().Err() - } - - if _, err := sdk.AccAddressFromBech32(walletAddress); err != nil { - return 0, types.ErrInvalidAddress - } - - if !k.IsRegisteredContract(ctx, contractAddress) { - return 0, types.ErrContractNotRegistered - } - - // Get usage from store - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContractUses)) - key := []byte(contractAddress + "-" + walletAddress) - bz := store.Get(key) - - var walletUsage types.FeePayWalletUsage - if err := k.cdc.Unmarshal(bz, &walletUsage); err != nil { - return 0, err - } - - return walletUsage.Uses, nil -} - -// Set the number of times a wallet has interacted with a fee pay contract -func (k Keeper) SetContractUses(ctx sdk.Context, contractAddress string, walletAddress string, uses uint64) error { - - if !k.IsRegisteredContract(ctx, contractAddress) { - return types.ErrContractNotRegistered - } - - // Get store for updating usage - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(StoreKeyContractUses)) - key := []byte(contractAddress + "-" + walletAddress) - bz, err := k.cdc.Marshal(&types.FeePayWalletUsage{ - ContractAddress: contractAddress, - WalletAddress: walletAddress, - Uses: uses, - }) - - if err != nil { - return err - } - - store.Set(key, bz) - return nil -} - -// Check if a wallet exceeded usage limit (defaults to true if contract not registered) -func (k Keeper) HasWalletExceededUsageLimit(ctx sdk.Context, contractAddress string, walletAddress string) bool { - - contract, err := k.GetContract(ctx, contractAddress) - - // Check if contract exists in KV store - if err != nil { - return true - } - - // Get account uses - uses, err := k.GetContractUses(ctx, contractAddress, walletAddress) - - if err != nil { - return true - } - - // Return if the wallet has used the contract too many times - return uses >= contract.WalletLimit -} - -// Check if a wallet is eligible to interact with a contract -func (k Keeper) IsWalletEligible(ctx sdk.Context, contractAddress string, walletAddress string) (bool, string) { - - // Check if wallet & contract address are valid - if _, err := sdk.AccAddressFromBech32(contractAddress); err != nil { - return false, types.ErrInvalidAddress.Error() - } - - if _, err := sdk.AccAddressFromBech32(walletAddress); err != nil { - return false, types.ErrInvalidAddress.Error() - } - - // Check if contract is registered - if !k.IsRegisteredContract(ctx, contractAddress) { - return false, types.ErrContractNotRegistered.Error() - } - - // Check if wallet has exceeded usage limit - if k.HasWalletExceededUsageLimit(ctx, contractAddress, walletAddress) { - return false, types.ErrWalletExceededUsageLimit.Error() - } - - // Check if contract has enough funds - funds, err := k.GetContractFunds(ctx, contractAddress) - - if err != nil || funds <= 0 { - return false, types.ErrContractNotEnoughFunds.Error() - } - - return true, "" + return ctx.Logger().With("module", fmt.Sprintf("x/%s", feepaytypes.ModuleName)) } diff --git a/x/feepay/keeper/msg_server.go b/x/feepay/keeper/msg_server.go index ab2c130b5..ed5955a85 100644 --- a/x/feepay/keeper/msg_server.go +++ b/x/feepay/keeper/msg_server.go @@ -27,7 +27,17 @@ func (k Keeper) UnregisterFeePayContract(goCtx context.Context, msg *types.MsgUn // FundFeePayContract funds a contract with the given amount of tokens. func (k Keeper) FundFeePayContract(goCtx context.Context, msg *types.MsgFundFeePayContract) (*types.MsgFundFeePayContractResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.MsgFundFeePayContractResponse{}, k.FundContract(ctx, msg) + + // Get the contract + contract, err := k.GetContract(ctx, msg.ContractAddress) + if err != nil { + return nil, err + } + + // Sender address (already validated in msg.go) + senderAddr := sdk.MustAccAddressFromBech32(msg.SenderAddress) + + return &types.MsgFundFeePayContractResponse{}, k.FundContract(ctx, contract, senderAddr, msg.Amount) } func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { diff --git a/x/feepay/keeper/params.go b/x/feepay/keeper/params.go index d0cce8e4e..91fe928d4 100644 --- a/x/feepay/keeper/params.go +++ b/x/feepay/keeper/params.go @@ -8,6 +8,7 @@ import ( // GetParams returns the total set of fees parameters. func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + // set to nil? add a ParamsKey which is a 0x00 value. Maybe a bool for enable and disable (set in .proto file genesis.proto (kill switch)) // store := ctx.KVStore(k.storeKey) // bz := store.Get(types.ParamsKey) // if bz == nil { @@ -27,6 +28,5 @@ func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { // store := ctx.KVStore(k.storeKey) // bz := k.cdc.MustMarshal(&p) // store.Set(types.ParamsKey, bz) - return nil } diff --git a/x/feepay/module.go b/x/feepay/module.go index e262188c1..2e80f8630 100644 --- a/x/feepay/module.go +++ b/x/feepay/module.go @@ -1,6 +1,7 @@ package feepay import ( + "context" "encoding/json" "fmt" @@ -21,7 +22,6 @@ import ( "github.com/CosmosContracts/juno/v17/x/feepay/client/cli" "github.com/CosmosContracts/juno/v17/x/feepay/keeper" "github.com/CosmosContracts/juno/v17/x/feepay/types" - "github.com/CosmosContracts/juno/v17/x/mint/exported" ) // type check to ensure the interface is properly implemented @@ -32,7 +32,7 @@ var ( ) // ConsensusVersion defines the current x/feepay module consensus version. -const ConsensusVersion = 2 +const ConsensusVersion = 1 // AppModuleBasic type for the fees module type AppModuleBasic struct{} @@ -82,11 +82,9 @@ func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the fees // module. func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux) { - - // TODO: UNCOMMENT FOR QUERIES - // if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { - // panic(err) - // } + if err := types.RegisterQueryHandlerClient(context.Background(), serveMux, types.NewQueryClient(c)); err != nil { + panic(err) + } } // GetTxCmd returns the root tx command for the fees module. @@ -106,22 +104,17 @@ type AppModule struct { AppModuleBasic keeper keeper.Keeper ak authkeeper.AccountKeeper - - // legacySubspace is used solely for migration of x/params managed parameters - legacySubspace exported.Subspace } // NewAppModule creates a new AppModule Object func NewAppModule( k keeper.Keeper, ak authkeeper.AccountKeeper, - ss exported.Subspace, ) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: k, ak: ak, - legacySubspace: ss, } } diff --git a/x/feepay/types/errors.go b/x/feepay/types/errors.go index 8f52e058f..f29218251 100644 --- a/x/feepay/types/errors.go +++ b/x/feepay/types/errors.go @@ -15,4 +15,5 @@ var ( ErrInvalidWalletLimit = errorsmod.Register(ModuleName, 8, "invalid wallet limit; must be between 0 and 1,000,000") ErrInvalidJunoFundAmount = errorsmod.Register(ModuleName, 9, "fee pay contracts only accept juno funds") ErrInvalidAddress = errorsmod.Register(ModuleName, 10, "invalid bech32 address") + ErrInvalidCWContract = errorsmod.Register(ModuleName, 11, "invalid CosmWasm contract") ) diff --git a/x/feepay/types/msg.go b/x/feepay/types/msg.go index 666226284..12e445196 100644 --- a/x/feepay/types/msg.go +++ b/x/feepay/types/msg.go @@ -30,11 +30,11 @@ func (msg MsgRegisterFeePayContract) ValidateBasic() error { return err } - if _, err := sdk.AccAddressFromBech32(msg.Contract.ContractAddress); err != nil { + if _, err := sdk.AccAddressFromBech32(msg.FeePayContract.ContractAddress); err != nil { return err } - if msg.Contract.WalletLimit < 1 || msg.Contract.WalletLimit > 1_000_000 { + if msg.FeePayContract.WalletLimit > 1_000_000 { return ErrInvalidWalletLimit } diff --git a/x/feepay/types/query.pb.go b/x/feepay/types/query.pb.go index 60b79e515..0c1e049e5 100644 --- a/x/feepay/types/query.pb.go +++ b/x/feepay/types/query.pb.go @@ -79,7 +79,7 @@ func (m *QueryFeePayContract) GetContractAddress() string { // QueryFeePayContractResponse defines the response for retrieving a single fee pay contract type QueryFeePayContractResponse struct { // contract defines the fee pay contract - Contract *FeePayContract `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` + FeePayContract *FeePayContract `protobuf:"bytes,1,opt,name=fee_pay_contract,json=feePayContract,proto3" json:"fee_pay_contract,omitempty"` } func (m *QueryFeePayContractResponse) Reset() { *m = QueryFeePayContractResponse{} } @@ -115,9 +115,9 @@ func (m *QueryFeePayContractResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryFeePayContractResponse proto.InternalMessageInfo -func (m *QueryFeePayContractResponse) GetContract() *FeePayContract { +func (m *QueryFeePayContractResponse) GetFeePayContract() *FeePayContract { if m != nil { - return m.Contract + return m.FeePayContract } return nil } @@ -171,7 +171,7 @@ func (m *QueryFeePayContracts) GetPagination() *query.PageRequest { // The response for querying all fee pay contracts type QueryFeePayContractsResponse struct { // A slice of all the stored fee pay contracts - Contracts []FeePayContract `protobuf:"bytes,1,rep,name=contracts,proto3" json:"contracts"` + FeePayContracts []FeePayContract `protobuf:"bytes,1,rep,name=fee_pay_contracts,json=feePayContracts,proto3" json:"fee_pay_contracts"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -209,9 +209,9 @@ func (m *QueryFeePayContractsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryFeePayContractsResponse proto.InternalMessageInfo -func (m *QueryFeePayContractsResponse) GetContracts() []FeePayContract { +func (m *QueryFeePayContractsResponse) GetFeePayContracts() []FeePayContract { if m != nil { - return m.Contracts + return m.FeePayContracts } return nil } @@ -383,8 +383,6 @@ func (m *QueryFeePayWalletIsEligible) GetWalletAddress() string { type QueryFeePayWalletIsEligibleResponse struct { // The eligibility of the wallet for fee pay contract interactions Eligible bool `protobuf:"varint,1,opt,name=eligible,proto3" json:"eligible,omitempty"` - // The reason (if any) for the wallet being ineligible for fee pay contract interactions - Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` } func (m *QueryFeePayWalletIsEligibleResponse) Reset() { *m = QueryFeePayWalletIsEligibleResponse{} } @@ -427,13 +425,6 @@ func (m *QueryFeePayWalletIsEligibleResponse) GetEligible() bool { return false } -func (m *QueryFeePayWalletIsEligibleResponse) GetReason() string { - if m != nil { - return m.Reason - } - return "" -} - func init() { proto.RegisterType((*QueryFeePayContract)(nil), "juno.feepay.v1.QueryFeePayContract") proto.RegisterType((*QueryFeePayContractResponse)(nil), "juno.feepay.v1.QueryFeePayContractResponse") @@ -448,46 +439,46 @@ func init() { func init() { proto.RegisterFile("juno/feepay/v1/query.proto", fileDescriptor_d6539df905bf35ca) } var fileDescriptor_d6539df905bf35ca = []byte{ - // 615 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x4b, 0x5b, 0x25, 0x83, 0x48, 0xd1, 0x52, 0x85, 0xca, 0xad, 0x5c, 0xe4, 0x02, 0xa5, - 0x14, 0x79, 0x95, 0x56, 0x5c, 0xb8, 0x40, 0x13, 0xb5, 0x05, 0x71, 0x29, 0x96, 0x10, 0x2a, 0x07, - 0xd0, 0x26, 0x1d, 0x8c, 0x21, 0xf5, 0xba, 0x59, 0x27, 0x10, 0x55, 0xbd, 0x20, 0x71, 0x47, 0x42, - 0x7c, 0x45, 0x3f, 0x80, 0x4f, 0xa0, 0xc7, 0x4a, 0x5c, 0x38, 0x21, 0x94, 0xf0, 0x21, 0xc8, 0xbb, - 0xb6, 0x43, 0x8c, 0xdb, 0xba, 0x07, 0x6e, 0xeb, 0x9d, 0x37, 0xf3, 0xde, 0xbc, 0x99, 0x4d, 0x40, - 0x7f, 0xd3, 0xf1, 0x38, 0x7d,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x51, 0x83, 0xa9, 0xf4, 0xdb, 0xb8, 0x9e, 0x83, 0x53, 0xe8, 0x77, 0xf2, 0xa0, 0x12, 0x69, 0x86, - 0x94, 0x36, 0x43, 0x2a, 0xd9, 0xd2, 0xc8, 0x57, 0x0d, 0x48, 0xc6, 0x56, 0x2e, 0xe6, 0x20, 0x09, - 0x81, 0x3a, 0xcd, 0x09, 0x4c, 0x04, 0x6d, 0x4a, 0x41, 0x6b, 0xe4, 0x7e, 0x6e, 0xaf, 0x68, 0xb8, - 0x9e, 0x74, 0x7f, 0x74, 0xa5, 0x0e, 0xc8, 0x37, 0x0d, 0x2a, 0x27, 0xec, 0xea, 0x69, 0xc3, 0x4b, - 0x83, 0xf5, 0xd5, 0x73, 0x80, 0x93, 0x2e, 0x1e, 0xcb, 0x2e, 0xd6, 0x49, 0x3d, 0x7f, 0x17, 0xf1, - 0xd2, 0xfe, 0xd3, 0x49, 0xed, 0xe1, 0x51, 0xdf, 0xd0, 0x8e, 0xfb, 0x86, 0xf6, 0xab, 0x6f, 0x68, - 0x9f, 0x06, 0x46, 0xe1, 0x78, 0x60, 0x14, 0x7e, 0x0c, 0x8c, 0xc2, 0x73, 0xcb, 0x71, 0x83, 0xd7, - 0x9d, 0x86, 0xd5, 0xe4, 0xbb, 0xb4, 0x2e, 0x7f, 0x76, 0x92, 0x09, 0x2b, 0xe2, 0xf7, 0x31, 0x61, - 0xd0, 0xf3, 0x51, 0x34, 0x26, 0xe5, 0x3f, 0xc3, 0xea, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7c, - 0x30, 0x61, 0xab, 0xe2, 0x06, 0x00, 0x00, + // 613 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x6d, 0x4a, 0x87, 0x86, 0x11, 0xed, 0x30, 0xd3, 0x98, 0xb2, 0x29, 0x43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, 0xe6, 0xbb, 0xb4, 0x2e, 0x7f, 0x5e, 0xe2, 0x0e, 0x2b, 0xe1, 0xb7, 0x91, 0xa0, 0x3f, 0xf4, + 0x40, 0xb4, 0x2e, 0xca, 0x7f, 0x87, 0xb5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xa3, 0x66, + 0xda, 0xe6, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -736,9 +727,9 @@ func (m *QueryFeePayContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l - if m.Contract != nil { + if m.FeePayContract != nil { { - size, err := m.Contract.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FeePayContract.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -818,10 +809,10 @@ func (m *QueryFeePayContractsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e i-- dAtA[i] = 0x12 } - if len(m.Contracts) > 0 { - for iNdEx := len(m.Contracts) - 1; iNdEx >= 0; iNdEx-- { + if len(m.FeePayContracts) > 0 { + for iNdEx := len(m.FeePayContracts) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Contracts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FeePayContracts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -957,13 +948,6 @@ func (m *QueryFeePayWalletIsEligibleResponse) MarshalToSizedBuffer(dAtA []byte) _ = i var l int _ = l - if len(m.Reason) > 0 { - i -= len(m.Reason) - copy(dAtA[i:], m.Reason) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Reason))) - i-- - dAtA[i] = 0x12 - } if m.Eligible { i-- if m.Eligible { @@ -1007,8 +991,8 @@ func (m *QueryFeePayContractResponse) Size() (n int) { } var l int _ = l - if m.Contract != nil { - l = m.Contract.Size() + if m.FeePayContract != nil { + l = m.FeePayContract.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -1033,8 +1017,8 @@ func (m *QueryFeePayContractsResponse) Size() (n int) { } var l int _ = l - if len(m.Contracts) > 0 { - for _, e := range m.Contracts { + if len(m.FeePayContracts) > 0 { + for _, e := range m.FeePayContracts { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1101,10 +1085,6 @@ func (m *QueryFeePayWalletIsEligibleResponse) Size() (n int) { if m.Eligible { n += 2 } - l = len(m.Reason) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -1227,7 +1207,7 @@ func (m *QueryFeePayContractResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeePayContract", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1254,10 +1234,10 @@ func (m *QueryFeePayContractResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Contract == nil { - m.Contract = &FeePayContract{} + if m.FeePayContract == nil { + m.FeePayContract = &FeePayContract{} } - if err := m.Contract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FeePayContract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1399,7 +1379,7 @@ func (m *QueryFeePayContractsResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contracts", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeePayContracts", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1426,8 +1406,8 @@ func (m *QueryFeePayContractsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Contracts = append(m.Contracts, FeePayContract{}) - if err := m.Contracts[len(m.Contracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FeePayContracts = append(m.FeePayContracts, FeePayContract{}) + if err := m.FeePayContracts[len(m.FeePayContracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1834,38 +1814,6 @@ func (m *QueryFeePayWalletIsEligibleResponse) Unmarshal(dAtA []byte) error { } } m.Eligible = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/feepay/types/tx.pb.go b/x/feepay/types/tx.pb.go index 88a72b323..eea9eabf5 100644 --- a/x/feepay/types/tx.pb.go +++ b/x/feepay/types/tx.pb.go @@ -39,7 +39,7 @@ type MsgRegisterFeePayContract struct { // The wallet address of the sender. SenderAddress string `protobuf:"bytes,1,opt,name=sender_address,json=senderAddress,proto3" json:"sender_address,omitempty"` // The fee pay contract to register. - Contract *FeePayContract `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` + FeePayContract *FeePayContract `protobuf:"bytes,2,opt,name=fee_pay_contract,json=feePayContract,proto3" json:"fee_pay_contract,omitempty"` } func (m *MsgRegisterFeePayContract) Reset() { *m = MsgRegisterFeePayContract{} } @@ -82,9 +82,9 @@ func (m *MsgRegisterFeePayContract) GetSenderAddress() string { return "" } -func (m *MsgRegisterFeePayContract) GetContract() *FeePayContract { +func (m *MsgRegisterFeePayContract) GetFeePayContract() *FeePayContract { if m != nil { - return m.Contract + return m.FeePayContract } return nil } @@ -325,7 +325,7 @@ var xxx_messageInfo_MsgFundFeePayContractResponse proto.InternalMessageInfo type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/feeshare parameters to update. + // params defines the x/feepay parameters to update. // // NOTE: All parameters must be supplied. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` @@ -432,50 +432,50 @@ func init() { func init() { proto.RegisterFile("juno/feepay/v1/tx.proto", fileDescriptor_d739bd30c8846fd5) } var fileDescriptor_d739bd30c8846fd5 = []byte{ - // 675 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x4f, 0x4f, 0xd4, 0x40, - 0x18, 0xc6, 0x77, 0x80, 0x10, 0x19, 0x10, 0xb4, 0x41, 0xd8, 0x5d, 0xb4, 0x8b, 0x25, 0x84, 0x05, - 0xb2, 0x9d, 0x2c, 0x18, 0x0f, 0xdc, 0x5c, 0x12, 0xe2, 0x65, 0x13, 0x52, 0x63, 0x62, 0xbc, 0x90, - 0xd9, 0xdd, 0x61, 0xa8, 0xd2, 0x99, 0xa6, 0x33, 0x25, 0xf4, 0x4a, 0xbc, 0x6b, 0xe2, 0x49, 0x4f, - 0x1e, 0xd5, 0x13, 0x26, 0x7e, 0x08, 0x8e, 0x44, 0x2f, 0x26, 0x26, 0x6a, 0xc0, 0x04, 0xe3, 0xa7, - 0x30, 0x6d, 0xa7, 0x05, 0x76, 0x5b, 0xc5, 0x18, 0x2f, 0xfb, 0x67, 0x9e, 0xa7, 0xf3, 0xfe, 0xde, - 0x37, 0xcf, 0x5b, 0x38, 0xf9, 0xc8, 0x67, 0x1c, 0x6d, 0x12, 0xe2, 0xe2, 0x00, 0xed, 0xd4, 0x91, - 0xdc, 0x35, 0x5d, 0x8f, 0x4b, 0xae, 0x8d, 0x86, 0x82, 0x19, 0x0b, 0xe6, 0x4e, 0xbd, 0x3c, 0x4e, - 0x39, 0xe5, 0x91, 0x84, 0xc2, 0x5f, 0xb1, 0xab, 0x7c, 0x9d, 0x72, 0x4e, 0xb7, 0x09, 0xc2, 0xae, - 0x8d, 0x30, 0x63, 0x5c, 0x62, 0x69, 0x73, 0x26, 0x94, 0x7a, 0x15, 0x3b, 0x36, 0xe3, 0x28, 0xfa, - 0x54, 0x47, 0x93, 0x6d, 0x2e, 0x1c, 0x2e, 0x90, 0x23, 0x68, 0x58, 0xce, 0x11, 0x54, 0x09, 0xba, - 0x12, 0x5a, 0x58, 0x10, 0xb4, 0x53, 0x6f, 0x11, 0x89, 0xeb, 0xa8, 0xcd, 0x6d, 0xa6, 0xf4, 0x52, - 0xac, 0x6f, 0xc4, 0x08, 0xf1, 0x9f, 0x04, 0xa2, 0xab, 0x07, 0x4a, 0x18, 0x11, 0x76, 0xa2, 0x4e, - 0x75, 0xa9, 0xaa, 0xa5, 0x48, 0x34, 0x9e, 0x00, 0x58, 0x6a, 0x0a, 0x6a, 0x11, 0x6a, 0x0b, 0x49, - 0xbc, 0x35, 0x42, 0xd6, 0x71, 0xb0, 0xca, 0x99, 0xf4, 0x70, 0x5b, 0x6a, 0xb3, 0x70, 0x54, 0x10, - 0xd6, 0x21, 0xde, 0x06, 0xee, 0x74, 0x3c, 0x22, 0x44, 0x11, 0x4c, 0x83, 0xea, 0x90, 0x75, 0x39, - 0x3e, 0xbd, 0x13, 0x1f, 0x6a, 0x2b, 0xf0, 0x52, 0x5b, 0x3d, 0x52, 0xec, 0x9b, 0x06, 0xd5, 0xe1, - 0x25, 0xdd, 0x3c, 0x3f, 0x3d, 0xf3, 0xfc, 0xc5, 0x56, 0xea, 0x5f, 0x19, 0xf8, 0xf1, 0xaa, 0x52, - 0x30, 0x66, 0xe0, 0xcd, 0x5c, 0x0a, 0x8b, 0x08, 0x97, 0x33, 0x41, 0x0c, 0x1f, 0x4e, 0x35, 0x05, - 0xbd, 0xcf, 0xbc, 0x7f,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, 0x00, 0x00, + // 686 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x41, 0x4f, 0x13, 0x4f, + 0x18, 0xc6, 0x3b, 0x40, 0x48, 0x18, 0xf8, 0x17, 0xfe, 0x1b, 0x84, 0xb6, 0xe8, 0x16, 0x97, 0x10, + 0x0a, 0xa4, 0x3b, 0x29, 0x18, 0x0f, 0xdc, 0x2c, 0x09, 0xe1, 0xd2, 0x84, 0xac, 0x31, 0x31, 0x5e, + 0x9a, 0x69, 0x3b, 0x1d, 0x56, 0xd9, 0x99, 0xcd, 0xce, 0x2c, 0xa1, 0x57, 0xbe, 0x80, 0x46, 0x4f, + 0x7a, 0xf2, 0xa8, 0x9e, 0x30, 0xf1, 0x43, 0x70, 0x24, 0x7a, 0x31, 0x31, 0x51, 0x03, 0x26, 0x18, + 0x3f, 0x85, 0xd9, 0xdd, 0xd9, 0x42, 0xdb, 0x5d, 0xc5, 0x18, 0x2f, 0x6d, 0x77, 0x9e, 0x67, 0xf7, + 0xfd, 0xbd, 0x6f, 0x9f, 0x77, 0xe1, 0xec, 0x43, 0x9f, 0x71, 0xd4, 0x26, 0xc4, 0xc5, 0x1d, 0xb4, + 0x5f, 0x41, 0xf2, 0xc0, 0x74, 0x3d, 0x2e, 0xb9, 0x96, 0x0d, 0x04, 0x33, 0x12, 0xcc, 0xfd, 0x4a, + 0x61, 0x9a, 0x72, 0xca, 0x43, 0x09, 0x05, 0xbf, 0x22, 0x57, 0xe1, 0x3a, 0xe5, 0x9c, 0xee, 0x11, + 0x84, 0x5d, 0x1b, 0x61, 0xc6, 0xb8, 0xc4, 0xd2, 0xe6, 0x4c, 0x28, 0xf5, 0x7f, 0xec, 0xd8, 0x8c, + 0xa3, 0xf0, 0x53, 0x1d, 0xcd, 0x36, 0xb9, 0x70, 0xb8, 0x40, 0x8e, 0xa0, 0x41, 0x39, 0x47, 0x50, + 0x25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xee, 0xb4, 0x2a, 0x87, + 0x1f, 0xbe, 0x3d, 0x1b, 0x5a, 0x35, 0x96, 0xd1, 0xc0, 0xbb, 0x09, 0xa5, 0xa4, 0xfd, 0x2d, 0x80, + 0xb9, 0xd4, 0x55, 0x58, 0x4d, 0x40, 0x48, 0x33, 0x17, 0xd6, 0xff, 0xc0, 0xdc, 0x25, 0x5e, 0x0f, + 0x89, 0xcb, 0xc6, 0x6a, 0x02, 0xb1, 0x9f, 0x86, 0xf5, 0x1c, 0x40, 0x2d, 0x69, 0x3f, 0x12, 0x00, + 0x06, 0x6d, 0x85, 0xf2, 0x95, 0x6c, 0x5d, 0xc2, 0x72, 0x48, 0xb8, 0x64, 0x2c, 0x26, 0x10, 0xb6, + 0x07, 0x21, 0xee, 0xc3, 0x89, 0x9e, 0xb0, 0x16, 0x93, 0xa6, 0x72, 0xc9, 0x50, 0x58, 0xfa, 0x8d, + 0x21, 0x06, 0xa9, 0x6e, 0x1f, 0x9f, 0xea, 0xe0, 0xe4, 0x54, 0x07, 0x5f, 0x4f, 0x75, 0xf0, 0xe4, + 0x4c, 0xcf, 0x9c, 0x9c, 0xe9, 0x99, 0x8f, 0x67, 0x7a, 0xe6, 0x81, 0x79, 0x69, 0x27, 0x37, 0xc3, + 0x25, 0x88, 0x71, 0x44, 0x04, 0x7d, 0x10, 0x63, 0x87, 0xfb, 0xd9, 0x18, 0x0d, 0xdf, 0xe0, 0xeb, + 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x18, 0x62, 0x74, 0xc2, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -694,9 +694,9 @@ func (m *MsgRegisterFeePayContract) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - if m.Contract != nil { + if m.FeePayContract != nil { { - size, err := m.Contract.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FeePayContract.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -957,8 +957,8 @@ func (m *MsgRegisterFeePayContract) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.Contract != nil { - l = m.Contract.Size() + if m.FeePayContract != nil { + l = m.FeePayContract.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1124,7 +1124,7 @@ func (m *MsgRegisterFeePayContract) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeePayContract", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1151,10 +1151,10 @@ func (m *MsgRegisterFeePayContract) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Contract == nil { - m.Contract = &FeePayContract{} + if m.FeePayContract == nil { + m.FeePayContract = &FeePayContract{} } - if err := m.Contract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FeePayContract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex