* -add comments to proto fields -add comments to msg and query server -remove decorator from docs -add coments to msgs.go -remove decorator from godoc * Update x/feegrant/spec/04_events.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * refactor and add to docs *refactor proto msg names and functions *add docs pertaining to auth's ante handler for deducted fees * lint * update comment * gofmt Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
27 lines
728 B
Go
27 lines
728 B
Go
package simulation
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/cosmos/cosmos-sdk/types/kv"
|
|
"github.com/cosmos/cosmos-sdk/x/feegrant/types"
|
|
)
|
|
|
|
// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's
|
|
// Value to the corresponding feegrant type.
|
|
func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string {
|
|
return func(kvA, kvB kv.Pair) string {
|
|
switch {
|
|
case bytes.Equal(kvA.Key[:1], types.FeeAllowanceKeyPrefix):
|
|
var grantA, grantB types.Grant
|
|
cdc.MustUnmarshal(kvA.Value, &grantA)
|
|
cdc.MustUnmarshal(kvB.Value, &grantB)
|
|
return fmt.Sprintf("%v\n%v", grantA, grantB)
|
|
default:
|
|
panic(fmt.Sprintf("invalid feegrant key %X", kvA.Key))
|
|
}
|
|
}
|
|
}
|