This article goes into detail about how cryptocurrency loans/repayments work. We will also look at CDP's like MakerDAO.
Taking out a cryptocurrency loan
Such transactions are imported into Koinly as regular Deposits. There is no tag needed for these. Think of this as borrowing fiat from a bank and then investing the fiat into a cryptocurrency. The crypto you receive is your own and the fact that it was borrowed makes no difference from a tax perspective. Any profit/loss you make from these coins is taxed as regular capital gains.
Taking out a fiat loan
This is not taxable unless you used the funds to purchase crypto. If you borrowed fiat and used it for household payments then theres no need to import this to Koinly.
Repaying a cryptocurrency loan
Repayments will be imported to Koinly as regular withdrawals. There is no tag needed here. Think of this as selling your crypto to pay off your loans. You will realize a profit or loss on these transactions in the same way as a "sell".
Sending crypto as collateral to the loan provider
If you have sent some cryptocurrency in the form of collateral then this would not be a taxable event since you have not sold the crypto yet. Such collateral transactions should not be imported to Koinly and we will skip these whenever possible.
However if you are sending collateral on a blockchain like ETH then this may get imported as a withdrawal. In such cases you should mark the transaction as "Sent to Pool" which will prevent gains from being realized on it.
Receiving your collateral back from the loan provider
Like the "sending collateral" transactions, such receive transactions should also not get imported to Koinly. However, if you are interacting with smart contracts on a blockchain like ETH then this transaction may get imported as a regular deposit transaction. You should mark it as "Received from Pool" in such cases so that Koinly can continue to keep track of the coins original cost-basis.
Liquidation of collateral
Koinly will import liquidation events since they are taxable. There is no difference between a liquidation carried out automatically by an exchange and a sell transaction initiated manually by you. You should see your liquidations being imported as "Trades" in Koinly. There is no need for any tag on these.
CDPs were popularized by the MakerDAO CDP contract and work in the same way as the transactions described above. The transaction where you are sending/receiving your collateral should be marked as being Sent to Pool or Received from Pool and the loan/repayments should be left alone (no tags/labels needed).
Note on pool tags: It is important to have just as many Sent to Pool transactions as Received from Pool, otherwise you will see missing purchase history errors. For ex. if you tag a +10 ETH transaction as Received from Pool then you should also find the -10 ETH transaction and tag it as Sent to Pool.