Unit ID
/2IPEOvYg8A6gTqXL3VKdilTCaxnks5lm7jWKmdiYuE=
Received
13.08.2019 22:28:34
Confirmation delay (full node)
3 minutes 55 seconds
Confirmation delay (light node)
6 minutes 8 seconds
AA responses
From 5XQC27RQGEZSB3Z3TZV2ODYEOY5VZZG2
  • Bounced
  • Response unit:
  • Response: { "error": "formula { $owner = 'JBGMJI7XSKLKNHZF26BUBWHVUZSDV3P5'; $stablecoin_issuer = '46RD24PCL22DMQSPQWRJPHFV24CH7SLA'; $addr = trigger.address; $base_inp = trigger.output[[asset=base]] - 700; if(!var['owner']) return; $base_asset = var['base_asset']; $last_coin_key = 'last_used_' || $addr; if($base_inp <= 0) bounce('not enough bytes for fees'); if(trigger.output[[asset!=base]].asset != 'none'){ if(trigger.output[[asset!=base]].asset != var['base_asset']){ $asset = trigger.output[[asset!=base]].asset; if($asset == 'ambiguous'){ bounce('only 1 asset per tx'); } if(trigger.output[[asset!=base]] == 0){ bounce('zero asset tx'); } } if($asset){ $asset_des = $base_asset; $asset_inp = trigger.output[[asset!=base]]; $name = var['reg_'||$asset]; } else{ if(!trigger.data.name) bounce('you must use a name'); $name = trigger.data.name; $asset_des = var['name_'||trigger.data.name]; $base_asset_inp = trigger.output[[asset!=$asset_des]]; } } else{ if(!trigger.data.withdraw){ bounce('there must be at least one asset'); } } $registered = $asset ? var['reg_'||$asset] : $asset_des; if(!$registered){ if(trigger.data.register_asset){ return; } else{ bounce('asset must be registered first'); } } $ratio_key = $name || '_last_price'; if(!var[$ratio_key] and !trigger.data.price){ bounce('price must be defined before first exchange'); } if(trigger.data.price){ $ratio = round(trigger.data.price);//microUSD per 1 asset if($ratio <= 0){ bounce('ratio not allowed'); } } else{ $ratio = var[$ratio_key]; } $base_key = $name || '_' || $addr || '_' || $ratio || '_base'; $total_key = $name || '_' || $ratio || '_total_base'; $exch_key = $name || '_' || $ratio || 'exchanged_base'; $asset_key = $name || '_' || $addr || '_' || $ratio; $total_asset_key = $name || '_' || $ratio || '_total_asset'; $exch_asset_key = $name || '_' || $ratio || 'exchanged_asset'; $max_b_to_exchange = var[$total_key] - var[$exch_key]; $max_a_to_exchange = var[$total_asset_key] - var[$exch_asset_key]; $base_inp_round = $base_inp_asset; $base_inp_in_asset = ($base_inp_round - ($base_inp_round % $ratio)/ $ratio); $asset_inp_in_base_asset = $asset_inp * $ratio; if($asset){ if($max_b_to_exchange and $max_b_to_exchange > 0 and !trigger.data.withdraw){ //exchange if($asset_inp_in_bytes > $max_b_to_exchange){ //partial exchange till empty,return rest and bfees $base_amount = $max_b_to_exchange; $asset_amount = (($asset_inp_in_bytes - $max_b_to_exchange) - (($asset_inp_in_bytes - $max_b_to_exchange) % $ratio)) / $ratio; } else{ //full exchange until empty,return bfees $base_amount = $asset_inp_in_bytes; $asset_amount = 0; } } else{ if(!trigger.data.cancel) $deposit = true; } } else{ if($max_a_to_exchange and $max_a_to_exchange > 0 and !trigger.data.withdraw){ //exchange if($base_inp_in_asset > $max_a_to_exchange){ //partial exchange till empty,return rest $asset_amount = $max_a_to_exchange; $base_amount = ($base_inp_in_asset - $max_a_to_exchange) * $ratio; } else{ if($base_inp_in_asset == 0) bounce('Not enough funds, try with higher amount'); //full exchange until empty $asset_amount = $base_inp_in_asset; $base_amount = 0; } } else{ if(!trigger.data.cancel) $deposit = true; } } } failed: trying to access amount of ambiguous asset" }
Technical information
Fees:
853 bytes
(353 headers, 500 payload)
Level:997663
Witnessed level:997656
Main chain index:996481
Latest included mc index:996480
Status:stable/confirmed/final