github.com/iotexproject/iotex-core@v1.14.1-rc1/pkg/util/addrutil/addrutil.go (about) 1 // Copyright (c) 2019 IoTeX Foundation 2 // This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 3 // or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 4 // This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 5 6 package addrutil 7 8 import ( 9 "github.com/ethereum/go-ethereum/common" 10 "github.com/iotexproject/iotex-address/address" 11 ) 12 13 // IoAddrToEvmAddr converts IoTeX address into evm address 14 func IoAddrToEvmAddr(ioAddr string) (common.Address, error) { 15 address, err := address.FromString(ioAddr) 16 if err != nil { 17 return common.Address{}, err 18 } 19 return common.BytesToAddress(address.Bytes()), nil 20 }