3

We are trying to build a collateral system without Escrow wallet.

We want to:

  • Freeze the asset in the user's wallet
  • Transfer it out if the user doesn't pay their loan
  • Un-freeze it if the loan has been paid.

If possible, we would like to do it using just the JSON api.

Any feedback or insights are greatly appreciated!

1 Answer 1

2

Freeze the asset in the user's wallet

You can create a Token Account PDA for each user. Then the frozen assets will be deposited in that PDA. this will insure that the assets will only be withdrawn if certain criteria are met. (loan has been paid)

Transfer it out if the user doesn't pay their loan

You can use Clockwork Automation Engine to invoke transactions at certain times or events. Here are some examples https://github.com/clockwork-xyz/examples

Basically what you can do is create a thread (which listens for a block time to occur) that transfers the funds from the PDA if the user did not pay his loan after some time.

Un-freeze it if the loan has been paid.

As I mentioned at the start. The user will be able to withdraw the assets if certain criteria are met.

This is a broad overview of how I would implement this. Others might do it differently. This is a very opinion-based question and I did my best to follow the best conventions.

6
  • 1
    Thank you for that answer. One question: if I deposit the frozen assets in a PDA, they will no longer be shown in the user's wallet right? There is this platform called Sharky that is able to freeze the NFT while it stays in the user's wallet. Any idea how they are able to do this?
    – John
    Jan 28, 2023 at 18:57
  • You could fetch the PDA token account balance and show it to the user. It should be a UI problem rather than an on-chain one.
    – vicyyn
    Jan 28, 2023 at 19:56
  • OK, that could be an option. The user would still lose the ability to use the NFT as an access pass, or other community features.
    – John
    Jan 31, 2023 at 15:08
  • Not really, you can make them check the PDA. that will tell if you have the NFT or not. You can't just freeze tokens inside a wallet.
    – vicyyn
    Feb 1, 2023 at 8:01
  • Cool! How would I make them check the PDA?
    – John
    Feb 3, 2023 at 2:14

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.