public IRoyalty ToRoyalty() { return(RoyaltyType switch { RoyaltyType.Fixed => new FixedRoyalty(Account !, Token ?? Address.None, FixedAmount.GetValueOrDefault()), RoyaltyType.Token => new TokenRoyalty(Account !, Numerator.GetValueOrDefault(), Denominator.GetValueOrDefault(), Minimum.GetValueOrDefault(), Maximum.GetValueOrDefault(), AssessAsSurcharge), RoyaltyType.Asset => new AssetRoyalty(Account !, Numerator.GetValueOrDefault(), Denominator.GetValueOrDefault(), FallbackAmount.GetValueOrDefault(), FallbackToken ?? Address.None), _ => throw new ArgumentOutOfRangeException("Unsupported Royalty Type"), });
public override int GetHashCode() { return($"RoyaltyDefinition:{RoyaltyType.GetHashCode()}:{Account?.GetHashCode()}:{Token?.GetHashCode()}:{FixedAmount?.GetHashCode()}:{Numerator?.GetHashCode()}:{Denominator?.GetHashCode()}:{FallbackAmount?.GetHashCode()}:{FallbackToken?.GetHashCode()}:{Minimum?.GetHashCode()}:{Maximum?.GetHashCode()}:{AssessAsSurcharge.GetHashCode()}".GetHashCode()); }