Categories

Smart contract example: Native transaction with variables & pre-conditions for loan matching

You are here:
< All Topics

The loan offer is a signed transfer operation that contains a transfer from address A to variable address [x] of 100 USD and a transfer of 10 USD as a fee to the operator address C, both pre-conditioned on a second operation that would transfer 100 debt-USD tokens from [x] to address A, and a credential proof that [x] has a sufficient credit score. (The debt-USD token contains terms regarding a loan repayment schedule with interest).

 

A loan request is a signed transfer operation submitted to the network that transfers from address B to a variable address [y] 100 debt-USD, pre-conditioned on a second operation that would transfer 100 USD to address B. The transfer operation contains in its memo field a credential proof that address B belongs to a borrower with a sufficient credit score.

 

The lending platform operator collects both the loan request and the loan offer signed operations and packages them together into a valid transaction. When packaged together, the pre-conditions of both operations are satisfied. Once validated by the network, this transaction will send 100 USD from address A to address B, send 10 USD to the operator, and send 100 debt-USD tokens from address B to address A.

Previous Smart contract example: Atomic swaps via native transactions
Next Smart contract example: Crowdfunding contract pre-conditioned on variable UTXOs
Table of Contents