One of the questions that tormented me about defi is the problem of how to implement the issuance of loans in a decentralized anonymous network. Obviously, in such a system, it is not possible for the bank to issue the amount of money to the applicant, since there is no force that could control the repayment process in the event of non-fulfillment of loan obligations. But maybe there is some other possibility?
I will try here to give an abstract concept describing how this can be implemented in the ethereum.
Suppose we have an applicant A who want to take loan for the amount of X USD. For this purpose, he applies to a decentralized bank DB. He enters into a smart-contract SM, which specifies the amount issued, the term and the interest rate. DB gives him X virtual" USD, which cannot be withdrawn from the network (provided to avoid fraud), but can be used inside the network. To do this, the bank must have the amount X of real dollars that are used in the SM: this amount is frozen inside SM and also duplicate is created for it in the form of virtual dollars. Also issued virtual coins must be associated (linked) with such a SM.
A can, for example, exchange this X virtual USD on Y BTC on the uniswap - it will work like this:
the market freezes Y bitcoins, Y virtual bitcoins are generated for this amount, which are exchanged for X virtual USD. Y virtual coins inherit the link to the SM. Until the loan is repaid, that is, the repayment period has not come, exchanges (or another actions) occur in this way with virtual currencies.
As soon as the maturity date has come, there are two options:
if A has successfully coped with its obligations - then all virtual currencies turn into real ones, and the frozen ones disappear (burn off);
if A do not return with the payment, the virtual money is burned, and the frozen money is defrost (they are again available for operations).
Thus, there is a certain period of time (from taking out a loan until its maturity), in which there is uncertainty and there is an exchange of virtual money, the status of which at a certain point in the future is determined unambiguously.
P.S.: the name"virtual money" is a reference to virtual particles in quantum theory involved in the intermediate interaction between real particles.
P.S.S: from the moment of taking out the loan until the maturity date, the money taken out on the loan is in a superposition of 2 states: freeze> and virtual>.