diff --git a/fvm/evm/types/address.go b/fvm/evm/types/address.go index a37b63d21e2..d099d605164 100644 --- a/fvm/evm/types/address.go +++ b/fvm/evm/types/address.go @@ -57,6 +57,15 @@ func (fa Address) Bytes() []byte { return fa[:] } +// String returns the hex encoding of the address +// it returns empty string if address is empty +func (fa Address) String() string { + if fa == EmptyAddress { + return "" + } + return fa.ToCommon().Hex() +} + // ToCommon returns the geth address func (fa Address) ToCommon() gethCommon.Address { return gethCommon.Address(fa) diff --git a/fvm/evm/types/events.go b/fvm/evm/types/events.go index b3cd35134c8..126fa6e485e 100644 --- a/fvm/evm/types/events.go +++ b/fvm/evm/types/events.go @@ -143,7 +143,7 @@ func (p *TransactionExecutedPayload) CadenceEvent() (cadence.Event, error) { cadence.String(p.Result.VMErrorString()), cadence.NewUInt8(p.Result.TxType), cadence.NewUInt64(p.Result.GasConsumed), - cadence.String(p.Result.DeployedContractAddress.ToCommon().Hex()), + cadence.String(p.Result.DeployedContractAddress.String()), cadence.String(hex.EncodeToString(p.Result.ReturnedValue)), cadence.String(hex.EncodeToString(encodedLogs)), },