5

How do I implement the issuance of a loan with a pledge?

I want to send a loan from a multi-signature account and receive a pledge in the form of custom tokens in a single transaction.

At the moment I'm stuck in this place:

const transaction = new Stellar.TransactionBuilder(loan)
    .addOperation(Stellar.Operation.payment({
      destination: borrowerPublicKey,
      asset: Stellar.Asset.native(),
      amount
    }))
    .addOperation(... receive custom tokens)
    .build();

1 Answer 1

5
const transaction = new Stellar.TransactionBuilder(loan)
    .addOperation(Stellar.Operation.payment({
      destination: borrowerPublicKey,
      asset: Stellar.Asset.native(),
      amount
    }))
    .addOperation(Stellar.Operation.payment({
      destination: loan,
      asset: new Stellar.Asset('LOAN', loan),
      amount,
      source: borrowerPublicKey
    }))
    .build()

You'll need signatures from both the loan and borrowerPublicKey accounts, otherwise the transaction will fail. To achieve this you can prepare and sign a transaction with loan secret key on the server, and then request a signature from the borrower on the client side.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.