github.com/MetalBlockchain/metalgo@v1.11.9/utils/constants/vm_ids.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package constants 5 6 import "github.com/MetalBlockchain/metalgo/ids" 7 8 const ( 9 PlatformVMName = "platformvm" 10 AVMName = "avm" 11 EVMName = "evm" 12 SubnetEVMName = "subnetevm" 13 XSVMName = "xsvm" 14 ) 15 16 var ( 17 PlatformVMID = ids.ID{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', 'v', 'm'} 18 AVMID = ids.ID{'a', 'v', 'm'} 19 EVMID = ids.ID{'e', 'v', 'm'} 20 SubnetEVMID = ids.ID{'s', 'u', 'b', 'n', 'e', 't', 'e', 'v', 'm'} 21 XSVMID = ids.ID{'x', 's', 'v', 'm'} 22 ) 23 24 // VMName returns the name of the VM with the provided ID. If a human readable 25 // name isn't known, then the formatted ID is returned. 26 func VMName(vmID ids.ID) string { 27 switch vmID { 28 case PlatformVMID: 29 return PlatformVMName 30 case AVMID: 31 return AVMName 32 case EVMID: 33 return EVMName 34 case SubnetEVMID: 35 return SubnetEVMName 36 case XSVMID: 37 return XSVMName 38 default: 39 return vmID.String() 40 } 41 }