mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-09-13 20:00:10 +00:00

* added DER module * scaffold type --module der DER zigbeeID dirigeraID dirigeraMAC plmntAddress liquidAddress * ./ignite scaffold message registerDER der:DER --module der * changed URL * storing DER * added query * added liquid der asset type * added der asset notarization logic * added nft notarization for DER * added nft query * added query and fixed linter aspects * added store testcases to the der module * added test cases adjusted to the linter requirements * addd ignite generate code changes * added metadata json instead of specific data Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
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
|
|
}
|