@Override void undoAttachmentUnconfirmed(Transaction transaction, Account senderAccount) { Attachment.MonetarySystemExchangeSell attachment = (Attachment.MonetarySystemExchangeSell) transaction.getAttachment(); Currency currency = Currency.getCurrency(attachment.getCurrencyId()); if (currency != null) { senderAccount.addToUnconfirmedCurrencyUnits( attachment.getCurrencyId(), attachment.getUnits()); } }
@Override boolean applyAttachmentUnconfirmed(Transaction transaction, Account senderAccount) { Attachment.MonetarySystemExchangeSell attachment = (Attachment.MonetarySystemExchangeSell) transaction.getAttachment(); if (senderAccount.getUnconfirmedCurrencyUnits(attachment.getCurrencyId()) >= attachment.getUnits()) { senderAccount.addToUnconfirmedCurrencyUnits( attachment.getCurrencyId(), -attachment.getUnits()); return true; } return false; }
@Override void applyAttachment( Transaction transaction, Account senderAccount, Account recipientAccount) { Attachment.MonetarySystemExchangeSell attachment = (Attachment.MonetarySystemExchangeSell) transaction.getAttachment(); ExchangeRequest.addExchangeRequest(transaction, attachment); CurrencyExchangeOffer.exchangeCurrencyForNXT( transaction, senderAccount, attachment.getCurrencyId(), attachment.getRateNQT(), attachment.getUnits()); }