Example #1
0
 @Override
 void applyAttachment(
     Transaction transaction, Account senderAccount, Account recipientAccount) {
   Attachment.MonetarySystemReserveClaim attachment =
       (Attachment.MonetarySystemReserveClaim) transaction.getAttachment();
   Currency.claimReserve(senderAccount, attachment.getCurrencyId(), attachment.getUnits());
 }
Example #2
0
 @Override
 void validateAttachment(Transaction transaction) throws NxtException.ValidationException {
   Attachment.MonetarySystemReserveClaim attachment =
       (Attachment.MonetarySystemReserveClaim) transaction.getAttachment();
   if (attachment.getUnits() <= 0) {
     throw new NxtException.NotValidException(
         "Reserve claim number of units must be positive: " + attachment.getUnits());
   }
   CurrencyType.validate(Currency.getCurrency(attachment.getCurrencyId()), transaction);
 }
Example #3
0
 @Override
 void undoAttachmentUnconfirmed(Transaction transaction, Account senderAccount) {
   Attachment.MonetarySystemReserveClaim attachment =
       (Attachment.MonetarySystemReserveClaim) transaction.getAttachment();
   Currency currency = Currency.getCurrency(attachment.getCurrencyId());
   if (currency != null) {
     senderAccount.addToUnconfirmedCurrencyUnits(
         attachment.getCurrencyId(), attachment.getUnits());
   }
 }
Example #4
0
 @Override
 boolean applyAttachmentUnconfirmed(Transaction transaction, Account senderAccount) {
   Attachment.MonetarySystemReserveClaim attachment =
       (Attachment.MonetarySystemReserveClaim) transaction.getAttachment();
   if (senderAccount.getUnconfirmedCurrencyUnits(attachment.getCurrencyId())
       >= attachment.getUnits()) {
     senderAccount.addToUnconfirmedCurrencyUnits(
         attachment.getCurrencyId(), -attachment.getUnits());
     return true;
   }
   return false;
 }