CosmWasm / CosmWasm/wasmd

Allow feegrant for whitelisted contracts

Open
#1,571 6 comments 10 reactions 1 assignee Claimed by @pinosu View on GitHub
Dominant language
Go
Stars
416
Forks
538
PR merge metrics
No merged PRs in 30d

Description

# Feature : Allow feegrant for whitelisted contracts

## Summary
Currently, we can create Feegrants for the msg `cosmwasm.wasm.v1.MsgExecuteContract`, however, that is an extremely broad feegrant. A granter might not be comfortable subsidizing most possible txs of the grantee, esp on a permissionless Cosmwasm chain. The solution we propose is to allow feegrant for individual/set-of-whitelisted contracts.

## Problem Definition
On permissionless wasm chains, where the dapp contracts are more decoupled from the protocol, a general feegrant using `AllowedMsgAllowance` for `cosmwasm.wasm.v1.MsgExecuteContract` is too permissive.

e.g If a new NFT marketplace dapp wants to subsidize its users fees for launch week, there is no way they can provide the feegrant ensuring that it cant be used for other contracts.

## Proposed Feature

Similar to how wasmd provides custom Authz extensions, we propose the implementation of custom `FeeAllowanceI` extension.
```proto
// AllowedContractAllowance creates allowance only for MsgExecuteContract msgs which executes specified contracts.
message AllowedContractAllowance {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI";
option (amino.name) = "cosmos-sdk/AllowedContractAllowance";

google.protobuf.Any allowance = 1 [(cosmos_proto.accepts_interface) = "cosmos.feegrant.v1beta1.FeeAllowanceI"];

// allowed_contracts are the contracts for which the grantee has the access.
repeated string allowed_contracts = 2;
}
```
This allows a dapp developer to provide feegrants for all their contracts, while ensuring other dapps cannot take advantage of the granters funds. And thus enables improved UX for dapps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.