mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-29 10:33:11 +00:00
45 lines
949 B
C#
45 lines
949 B
C#
namespace Utils
|
|
{
|
|
public interface IHasEthAddress
|
|
{
|
|
EthAddress EthAddress { get; }
|
|
}
|
|
|
|
[Serializable]
|
|
public class EthAddress
|
|
{
|
|
public EthAddress(string address)
|
|
{
|
|
Address = address.ToLowerInvariant();
|
|
}
|
|
|
|
public string Address { get; }
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
return obj is EthAddress address &&
|
|
Address == address.Address;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(Address);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Address;
|
|
}
|
|
|
|
public static bool operator ==(EthAddress a, EthAddress b)
|
|
{
|
|
return a.Address == b.Address;
|
|
}
|
|
|
|
public static bool operator !=(EthAddress a, EthAddress b)
|
|
{
|
|
return a.Address != b.Address;
|
|
}
|
|
}
|
|
}
|