compare static method
A Comparator that compares one comparable to another.
It returns the result of a.compareTo(b).
The call may fail at run-time
if a is not comparable to the type of b.
This utility function is used as the default comparator for ordering collections, for example in the List sort function.
Implementation
static bool compare(MultiAsset lhs, MultiAsset rhs) {
for (final entry in lhs.assets.entries) {
final PolicyID pid = entry.key;
final Assets assets = entry.value;
for (final assetEntry in assets.assets.entries) {
final AssetName aname = assetEntry.key;
final BigInt amount = assetEntry.value;
final BigInt rhsAmount = _amount(rhs, pid, aname);
if (amount - rhsAmount > BigInt.zero) {
return false;
}
}
}
return true;
}