Can Mosaic tokens be exchanged by a smart contract on NEM?

Can Mosaic tokens be exchanged by smart contract on NEM?

Example:

Person A creates Mosaic token "apple"
Person B creates Mosaic token “pears”

Person A posts a contract and agrees to swap 1 apple for 2 pears valid for X hours from Person B
Person B accepts contract agreeing to swap 2 pears for the 1 apple

Swap between both parties only occurs when B commits to send 1 apple, Person A immediately receives 2 pears.

This is how it works on ByteBall, can NEM do this? Or will it be able to do this in the future?

If it can’t NEM Mosaic tokens will only be exchangeable through centralized exchanges?

Any answer appreciated?

Right now that is not handled by NIS, but we are looking into and discussing adding that feature in Catapult.

3 Likes

Wow!
Does that mean that you plan to develop DEX?

this feature would be great! :slight_smile:

Having this feature or something similar like SQL triggers to automate transactions on a blockchain would be really cool.
That means that functionality once implemented could work stay on even
if the person who implemented it is gone.

The problem of course is how to implement such functionality in a decentralized environment it make it efficient and secure (for example like against DAO attack).
Should every node in the network re run the code and create a proof of execution (validate the transaction) or
should this be kind of plugin to NIS (catapult) that gives reward to the the node that installs it
and runs that kind of transaction meaning that is not required to run the code by all nodes
but just those that want to.

:question: :question::question:

I would like to see LuxTag assets being transferred in a similar fashion; current owner can set a price for redeeming a spot in the asset multisig account.