Unit ID
CZ9wQzBUzcYfcGiXgZjH5FjoO7Te9kjFH1FXC9usW8I=
Received
24.05.2024 16:56:09
Confirmation delay (full node)
22 minutes 27 seconds
Confirmation delay (light node)
29 minutes 23 seconds
Messages
Definition
Definition: [ "autonomous agent", { "init": "{ $id = trigger.data.CH.id.ch; }", "messages": { "cases": [ { "if": "{trigger.data.register AND $id}", "init": "{ if (var['owner_' || $id]) bounce('La valeur ' || $id || ' est déjà enregistrée'); if (trigger.data.sell){ $price = trigger.data.price; if (!$price || !($price > 0) || round($price) != $price) bounce('Veuillez définir un prix entier positif'); } }", "messages": [ { "app": "state", "state": "{ var['owner_' || $id] = trigger.address; if (trigger.data.sell AND trigger.data.price) var['price_' || $id] = trigger.data.price; response['message'] = 'Enregistrée' || (trigger.data.sell AND trigger.data.price ? ' et mise en vente à ' || trigger.data.price : ''); }" } ] }, { "if": "{$id AND trigger.data.sell AND trigger.data.price}", "init": "{ $owner = var['owner_' || $id]; if (!$owner OR $owner != trigger.address) bounce('La chose ' || $id || ' ne vous appartient pas'); if (!(trigger.data.price > 0) OR round(trigger.data.price) != trigger.data.price) bounce('Veuillez définir un prix entier positif'); }", "messages": [ { "app": "state", "state": "{ var['price_' || $id] = trigger.data.price; response['message'] = 'Mise en vente à ' || trigger.data.price; }" } ] }, { "if": "{$id AND trigger.data.withdraw_from_sale}", "init": "{ $owner = var['owner_' || $id]; if (!$owner OR $owner != trigger.address) bounce('La chose ' || $id || ' ne vous appartient pas'); }", "messages": [ { "app": "state", "state": "{ var['price_' || $id] = false; // Pas de prix signifie pas en vente response['message'] = 'Retirée de la vente'; }" } ] }, { "if": "{$id AND trigger.data.buy}", "init": "{ $owner = var['owner_' || $id]; if (!$owner) bounce('La chose ' || $id || ' n\'existe pas'); if ($owner == trigger.address) bounce('La chose ' || $id || ' est déjà la vôtre'); $price = var['price_' || $id]; if (!$price) bounce('La chose ' || $id || ' n\'est pas en vente'); $amount = trigger.output[[asset=base]]; if ($amount < $price) bounce("Le prix de la chose est de " || $price || ", vous avez envoyé seulement " || $amount); $change = $amount - $price; }", "messages": [ { "app": "payment", "payload": { "asset": "base", "outputs": [ { "address": "{$owner}", "amount": "{$price}" }, { "if": "{$change > 0}", "address": "{trigger.address}", "amount": "{$change}" } ] } }, { "app": "state", "state": "{ var['owner_' || $id] = trigger.address; // Nouveau propriétaire var['price_' || $id] = false; // Plus en vente response['message'] = 'Vendue à ' || trigger.address; }" } ] } ] } } ]
Technical information
Fees:
3,422 bytes
(544 headers, 2878 payload)
Level:11003858
Witnessed level:11003849
Main chain index:10623697
Latest included mc index:10623692
Status:stable/confirmed/final