How my asset script work?


#1

Hi,

I’m developing a smart asset that only someone can place sell order in exchange.

I’m testing my smart asset on test net with script:

let namiAddress = addressFromString("3MsicoQqvYLqcnj4HDkxn3d4MNugCdAU4B5")
match tx {
    case t : ExchangeTransaction => (t.sellOrder.sender == namiAddress || t.buyOrder.sender == namiAddress)
    case _ => true
}

I set this script to my smart asset (id: FbPsAJDVz1KmEJxqr9P8D8BHsXS4zDvJ8DxtyxtEvjhB, name: Nami)
After that, i test my new smart asset follow some steps:

  • from address 3MsicoQqvYLqcnj4HDkxn3d4MNugCdAU4B5, i place sell Nami order with price 0.000001
  • from address 3N5h5G6ToFR7cMMzdzR1hvUaMNuz7quCt4H, i place buy Nami order with the same price 0.000001 and i receive this error:
    18

As i understand, script can’t prevent any address place order.

Is my script wrong?

Thanks


#2

Hello, Duong)
You did not fully understand the work of the matcher
I advise you to read this