mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-15 04:25:27 +00:00
26 lines
645 B
Go
26 lines
645 B
Go
package simulation
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
|
|
"github.com/tendermint/tendermint/libs/kv"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
"github.com/kava-labs/kava/x/hard/types"
|
|
)
|
|
|
|
// DecodeStore unmarshals the KVPair's Value to the corresponding hard type
|
|
func DecodeStore(cdc *codec.Codec, kvA, kvB kv.Pair) string {
|
|
switch {
|
|
case bytes.Equal(kvA.Key[:1], types.DepositsKeyPrefix):
|
|
var depA, depB types.Deposit
|
|
cdc.MustUnmarshalBinaryBare(kvA.Value, &depA)
|
|
cdc.MustUnmarshalBinaryBare(kvB.Value, &depB)
|
|
return fmt.Sprintf("%s\n%s", depA, depB)
|
|
default:
|
|
panic(fmt.Sprintf("invalid %s key prefix %X", types.ModuleName, kvA.Key[:1]))
|
|
}
|
|
}
|