Function: transfer(address to, uint256 amount)
Available only for minters, so accounts with debt cannot freely transfer debt tokens. Also, minters do not need to have an approve to transfer debt tokens from any accounts. The debt tokens will be burned from the debtor. If the debtor's debt is less than amount, the transaction will revert. At first, the debtor's interest will be covered by amount and the rest of the tokens will decrease the principal. Then, the same amount of debt tokens will be minted to the to debtor, the debtor's principal will be increased by amount, and totalPrincipal will be increased.
Branches and code coverage
Intended branches
totalPrincipalwas updated properly.The
msg.sender'sprincipalandinterestCheckpointwere updated properly.The
to'sprincipalwas increased.
Negative behavior
Caller is not a minter.
msg.senderdoes not have debt.tois zero address.amountis zero.