Ejemplo n.º 1
0
 @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;
 }
Ejemplo n.º 2
0
 @Override
 boolean applyAttachmentUnconfirmed(Transaction transaction, Account senderAccount) {
   Attachment.MonetarySystemCurrencyTransfer attachment =
       (Attachment.MonetarySystemCurrencyTransfer) transaction.getAttachment();
   if (attachment.getUnits()
       > senderAccount.getUnconfirmedCurrencyUnits(attachment.getCurrencyId())) {
     return false;
   }
   senderAccount.addToUnconfirmedCurrencyUnits(
       attachment.getCurrencyId(), -attachment.getUnits());
   return true;
 }
Ejemplo n.º 3
0
 @Override
 boolean applyAttachmentUnconfirmed(Transaction transaction, Account senderAccount) {
   Attachment.MonetarySystemReserveClaim attachment =
       (Attachment.MonetarySystemReserveClaim) transaction.getAttachment();
   if (senderAccount.getUnconfirmedCurrencyUnits(attachment.getCurrencyId())
       >= attachment.getUnits()) {
     senderAccount.addToUnconfirmedCurrencyUnits(
         getLedgerEvent(),
         transaction.getId(),
         attachment.getCurrencyId(),
         -attachment.getUnits());
     return true;
   }
   return false;
 }
Ejemplo n.º 4
0
 @Override
 boolean applyAttachmentUnconfirmed(Transaction transaction, Account senderAccount) {
   Attachment.MonetarySystemPublishExchangeOffer attachment =
       (Attachment.MonetarySystemPublishExchangeOffer) transaction.getAttachment();
   if (senderAccount.getUnconfirmedBalanceNQT()
           >= Math.multiplyExact(
               attachment.getInitialBuySupply(), attachment.getBuyRateNQT())
       && senderAccount.getUnconfirmedCurrencyUnits(attachment.getCurrencyId())
           >= attachment.getInitialSellSupply()) {
     senderAccount.addToUnconfirmedBalanceNQT(
         -Math.multiplyExact(attachment.getInitialBuySupply(), attachment.getBuyRateNQT()));
     senderAccount.addToUnconfirmedCurrencyUnits(
         attachment.getCurrencyId(), -attachment.getInitialSellSupply());
     return true;
   }
   return false;
 }