Sort:  

I looked at the code. It applies the fee to the converted_amount which is the amount of HBD received at the beginning of the request. This is then subtracted from the total collateral to determine the collateral to return. This appears correct to me (5%).

Thank you for looking! This seems exactly right.