mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
a573625df8
* bump SDK version to v0.38.3 Co-authored-by: Denali Marsh <denali@kava.io> Co-authored-by: Kevin Davis <kjydavis3@gmail.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> Co-authored-by: denalimarsh <denalimarsh@gmail.com> Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
31 lines
944 B
Go
31 lines
944 B
Go
package simulation
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/cosmos/cosmos-sdk/x/auth/exported"
|
|
"github.com/kava-labs/kava/x/validator-vesting/types"
|
|
"github.com/tendermint/tendermint/libs/kv"
|
|
)
|
|
|
|
// DecodeStore unmarshals the KVPair's Value to the corresponding auth type
|
|
func DecodeStore(cdc *codec.Codec, kvA, kvB kv.Pair) string {
|
|
switch {
|
|
case bytes.Equal(kvA.Key[:1], types.ValidatorVestingAccountPrefix):
|
|
var accA, accB exported.Account
|
|
cdc.MustUnmarshalBinaryBare(kvA.Value, &accA)
|
|
cdc.MustUnmarshalBinaryBare(kvB.Value, &accB)
|
|
return fmt.Sprintf("%v\n%v", accA, accB)
|
|
case bytes.Equal(kvA.Key, types.BlocktimeKey):
|
|
var btA, btB time.Time
|
|
cdc.MustUnmarshalBinaryLengthPrefixed(kvA.Value, &btA)
|
|
cdc.MustUnmarshalBinaryLengthPrefixed(kvB.Value, &btB)
|
|
return fmt.Sprintf("%v\n%v", btA, btB)
|
|
default:
|
|
panic(fmt.Sprintf("invalid %s key %X", types.ModuleName, kvA.Key))
|
|
}
|
|
}
|