OSDN Git Service

Mov (#518)
[bytom/vapor.git] / common / crossin_asset.go
1 package common
2
3 import (
4         "encoding/json"
5 )
6
7 // IsOpenFederationIssueAsset check if the asset definition satisfy ofmf asset
8 func IsOpenFederationIssueAsset(rawDefinitionByte []byte) bool {
9         var defMap map[string]interface{}
10         if err := json.Unmarshal(rawDefinitionByte, &defMap); err != nil {
11                 return false
12         }
13
14         description, ok := defMap["description"].(map[string]interface{})
15         if !ok {
16                 return false
17         }
18
19         issueAssetAction, ok := description["issue_asset_action"].(string)
20         if !ok {
21                 return false
22         }
23
24         return issueAssetAction == "open_federation_cross_chain"
25 }