Is it possible to allow exchange-only transactions on some kind of asset?

+2 votes

Hello,

is it possible to allow exchange-only transactions on some kind of asset?

Consider this scenario: there are many assets, let's say asset_1, asset_2, ..., asset_n and there are also some special ones: special1, special2. I need to allow transactions which involve asset_i only if they are exchange transactions.

So:

  • A sends B asset_i: rejected
  • A sends B asset_i and B sends A special1 (or special2): approved
  • A sends B special1 (or special2): approved
  • A sends B special1 (or special2) and B sends A special1 (or special2): approved

 

I know I should use smart filters but I don't know where to begin.

Thank you very much.

 

asked Oct 27, 2018 by multichain_user123
edited Oct 29, 2018 by multichain_user123

1 Answer

+2 votes
 
Best answer
Using smart filters would a better choice. You might need to write a logic to compare the asset names in the inputs and outputs of transactions and then decide whether to proceed or not. You can take a look at this one example listed here in the official multichain github repo to get an idea.

https://github.com/MultiChain/smart-filter-examples/blob/master/transaction-filters/limit-asset-transfer.js
answered Oct 30, 2018 by jeshocarmel
selected Oct 31, 2018 by multichain_user123
...