Closed RafilxTenfen closed 3 weeks ago
It is possible to add the e2e test checking the feegrant overall we can make sure to only allow some specific msg types with AllowedMsgAllowance also tested putting limits, so we can limit the fees usage for 10000ubbn with BasicAllowance.SpendLimit I also combined both, so we have like only msgs of type MsgCreateBTCDelegation and limit of 10000ubbn There is one other possibility that is also cool which is called PeriodicAllowance
// PeriodicAllowance extends Allowance to allow for both a maximum cap,
// as well as a limit per time period.
type PeriodicAllowance struct {
// basic specifies a struct of `BasicAllowance`
Basic BasicAllowance `protobuf:"bytes,1,opt,name=basic,proto3" json:"basic"`
// period specifies the time duration in which period_spend_limit coins can
// be spent before that allowance is reset
Period time.Duration `protobuf:"bytes,2,opt,name=period,proto3,stdduration" json:"period"`
// period_spend_limit specifies the maximum number of coins that can be spent
// in the period
PeriodSpendLimit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=period_spend_limit,json=periodSpendLimit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"period_spend_limit"`
// period_can_spend is the number of coins left to be spent before the period_reset time
PeriodCanSpend github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=period_can_spend,json=periodCanSpend,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"period_can_spend"`
// period_reset is the time at which this period resets and a new one begins,
// it is calculated from the start time of the first transaction after the
// last period ended
PeriodReset time.Time `protobuf:"bytes,5,opt,name=period_reset,json=periodReset,proto3,stdtime" json:"period_reset"`
}
With this type we could allow per period like each 4 years you have one spend limit of 10000ubbn for the msg type MsgCreateBTCDelegation...
Create a test with BTC delegation that uses feegrant from only for a specific type or even bundle tx with grant and revoke right after