Force ASA exchange through specific smart contract?

Let’s consider an Airline allowing people to exchange NFTickets among themselves.
This airline want to be sure to always take a commission on each exchange, but it still want to allow self custody of the NFTicket.
A solution could be to make the exchange through a smart contract owned by the Airline.

But if the NFTicket is an ASA that could be owned by any account, is there a way to force the exchange to be done through a specific smart contract ?

In other words, is it possible to have at the same time :

  • self custody of NFT
  • enforced commission/royalties when this NFT is transferred
1 Like

Yes, the SimCompany game has done this already 2 years ago…

The solution is to make the asset as frozen, and clawback address to be smart sig contract where you say you have to pay royalty.

This way you have on your account the asa
You can freely transfer the ASA only if you pay royalty fee

But generally current better approach is to create user escrow account, rekey to the smart contract address, allow person to exchange with another person

This way the asa is not on his primary account, but his escrow account which he can self custody control form the smart contract.

1 Like

Thanks for your response!
Could you share more details on the workflow for each of your 2 proposed solutions.
Concretely, for the user A which is the NFT owner, what kind of transaction(s) must be sent in order to transfer the NFT to another user B, through the smart contract S ?

In meanwhile I have created onchain eshop with secondary NFT marketplace for the purpose of creating publicly auditable gold token -

The source code of the smart contract is here: gold-asa-frontend/asa-gold-smartcontract/ at main · scholtz/gold-asa-frontend · GitHub

Eshop owner can mint new NFT, anyone can buy the NFT for the specific amount of gold token. (State 1 - in reserves) Then NFT owner can put it on sale for specific amount of specified token. Or user can request the withdrawal.

The secondary NFT marketplace takes also small royalty fee (0,1% in our case) gold-asa-frontend/asa-gold-smartcontract/contracts/asa-gold-smartcontract.algo.ts at cebf90ee134a583026bfcfc8722d7758f41317f6 · scholtz/gold-asa-frontend · GitHub

For others wanting more details about how to execute custom logic when exchanging an ASA, I found this great post :