github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/mint/simulation/decoder.go (about)

     1  package simulation
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  
     7  	tmkv "github.com/fibonacci-chain/fbc/libs/tendermint/libs/kv"
     8  
     9  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
    10  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/mint/internal/types"
    11  )
    12  
    13  // DecodeStore unmarshals the KVPair's Value to the corresponding mint type
    14  func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
    15  	switch {
    16  	case bytes.Equal(kvA.Key, types.MinterKey):
    17  		var minterA, minterB types.Minter
    18  		cdc.MustUnmarshalBinaryLengthPrefixed(kvA.Value, &minterA)
    19  		cdc.MustUnmarshalBinaryLengthPrefixed(kvB.Value, &minterB)
    20  		return fmt.Sprintf("%v\n%v", minterA, minterB)
    21  	default:
    22  		panic(fmt.Sprintf("invalid mint key %X", kvA.Key))
    23  	}
    24  }