Termination and set-off of a loan agreement: who, when and how?

Termination of a loan agreement and conditions of set-off in case of assignment of the claim.