mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
23 lines
666 B
Go
23 lines
666 B
Go
package keeper
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/der/types"
|
|
)
|
|
|
|
func (k Keeper) StoreLiquidDerAsset(ctx sdk.Context, asset types.LiquidDerAsset) {
|
|
appendValue := k.cdc.MustMarshal(&asset)
|
|
k.storeAsset(ctx, types.KeyPrefix(types.LiquidDerAssetKey), asset.ZigbeeID, appendValue)
|
|
}
|
|
|
|
func (k Keeper) LookupLiquidDerAsset(ctx sdk.Context, zigbeeID string) (val types.LiquidDerAsset, found bool) {
|
|
bz, found := k.lookupAsset(ctx, types.KeyPrefix(types.LiquidDerAssetKey), zigbeeID)
|
|
if !found {
|
|
return val, false
|
|
}
|
|
if err := k.cdc.Unmarshal(bz, &val); err != nil {
|
|
return val, false
|
|
}
|
|
return val, true
|
|
}
|