コード例 #1
0
  /**
   * Check if amount is within the minimum and maximum deposit limits and if is dust or if is more
   * money than currently in the wallet
   */
  private boolean isAmountWithinLimits(Value amount) {
    boolean isWithinLimits = amount != null && amount.isPositive() && !amount.isDust();

    // Check if within min & max deposit limits
    if (isWithinLimits && marketInfo != null && canCompare(marketInfo.limit, amount)) {
      isWithinLimits = amount.within(marketInfo.minimum, marketInfo.limit);
    }

    // Check if we have the amount
    if (isWithinLimits && canCompare(lastBalance, amount)) {
      isWithinLimits = amount.compareTo(lastBalance) <= 0;
    }

    return isWithinLimits;
  }