class DexCloseOrderTransaction extends DEX {

    @Override
    public void applyAttachment(Transaction transaction, Account senderAccount, Account recipientAccount) {
        DexCloseOrderAttachment attachment = (DexCloseOrderAttachment) transaction.getAttachment();
        DexService dexService = lookupDexService();
        ExchangeContract contract = dexService.getDexContractById(attachment.getContractId());
        long orderId = senderAccount.getId() == contract.getSender() ? contract.getOrderId() : contract.getCounterOrderId();
        dexService.closeOrder(orderId);
    }

}