Function borrow
The function adds a borrowed amount into the accounting of the obligation. Then it updates the borrowed amount totals and checks that the debt does not exceed the maximum allowed amount. Since calls to borrow must be preceded by a refresh call, the updated amounts here are correct for the check.