Exemplo n.º 1
1
 @Override
 void validateAttachment(Transaction transaction) throws NxtException.ValidationException {
   Attachment.MonetarySystemCurrencyDeletion attachment =
       (Attachment.MonetarySystemCurrencyDeletion) transaction.getAttachment();
   Currency currency = Currency.getCurrency(attachment.getCurrencyId());
   CurrencyType.validate(currency, transaction);
   if (!currency.canBeDeletedBy(transaction.getSenderId())) {
     throw new NxtException.NotCurrentlyValidException(
         "Currency "
             + Long.toUnsignedString(currency.getId())
             + " cannot be deleted by account "
             + Long.toUnsignedString(transaction.getSenderId()));
   }
 }
Exemplo n.º 2
0
 @Override
 void applyAttachment(
     Transaction transaction, Account senderAccount, Account recipientAccount) {
   Attachment.MonetarySystemCurrencyDeletion attachment =
       (Attachment.MonetarySystemCurrencyDeletion) transaction.getAttachment();
   Currency currency = Currency.getCurrency(attachment.getCurrencyId());
   currency.delete(getLedgerEvent(), transaction.getId(), senderAccount);
 }
Exemplo n.º 3
0
 @Override
 boolean isDuplicate(
     Transaction transaction, Map<TransactionType, Map<String, Integer>> duplicates) {
   Attachment.MonetarySystemCurrencyDeletion attachment =
       (Attachment.MonetarySystemCurrencyDeletion) transaction.getAttachment();
   Currency currency = Currency.getCurrency(attachment.getCurrencyId());
   String nameLower = currency.getName().toLowerCase();
   String codeLower = currency.getCode().toLowerCase();
   boolean isDuplicate =
       TransactionType.isDuplicate(CURRENCY_ISSUANCE, nameLower, duplicates, true);
   if (!nameLower.equals(codeLower)) {
     isDuplicate =
         isDuplicate
             || TransactionType.isDuplicate(CURRENCY_ISSUANCE, codeLower, duplicates, true);
   }
   return isDuplicate;
 }