44DGAGK6PC7FAOH3STINHZOCXDHSABLA
[
"autonomous agent",
{
"init": "{
$my_address = 'N6XYEP3R26Y3R25AT4NAJCEF4RT7DZCH';
}",
"messages": {
"cases": [
{
"if": "{trigger.data.withdraw AND trigger.data.asset AND trigger.data.amount AND trigger.address == $my_address}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "{trigger.data.asset}",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{trigger.data.amount}"
}
]
}
}
]
},
{
"if": "{trigger.data.exchange_rate AND trigger.address == $my_address}",
"messages": [
{
"app": "state",
"state": "{ var['rate'] = trigger.data.exchange_rate; response['message'] = 'set exchange rate to '||var['rate']||' assets/bit'; }"
}
]
},
{
"if": "{trigger.output[[asset=base]] > 1}",
"init": "{ $bits_amount = trigger.output[[asset=base]]; $asset_amount = round($bits_amount * var['rate']); response['message'] = 'exchanged '||$bits_amount||' $ for bits'||$asset_amount||' asset.'; }",
"messages": [
{
"app": "payment",
"payload": {
"asset": "k9rkI09k2GZE53L18u8ZCZwIPvj7D+Zc+ydmbRltqR4=",
"outputs": [
{
"address": "{trigger.address}",
"amount": "{ $asset_amount }"
}
]
}
}
]
},
{
"messages": [
{
"app": "state",
"state": "{ response['message'] = 'accepted coins: '||trigger.output[[asset=base]]||' bytes and bits'||trigger.output[[asset='iYNKzMZSIpB+d+jMSh+35FxO9WJfQVJoyQyOn3Bi7u4=']]||' asset'; }"
}
]
}
]
}
}
]
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount