Unit ID
2NALdnHnqSLVn4Yy1LjzL6wZrdhT4KbyuvdGKfZwROM=
Received
01.12.2023 11:42:30
Confirmation delay (full node)
11 minutes 58 seconds
Confirmation delay (light node)
31 minutes 15 seconds
Messages
Data
sender_address: 0xd68cE254c5C1AD12ef7c3eD41Ec37e2a00E14678
amount: 37720000
reward: 377200
txid: 0x82df7ad9cd6496d1b2768e24b8a262dca874523f4d8516379a499aa766bf8f39
txts: 1701430619
data: { "oswap_aa": "MBTF5GG44S3ARJHIZH3DEAB4DGUCHCF6", "address": "5DR2PSOXOWBMW6FOR3ED6UPU2SBHEYJN" }
address: EWPV5JZYOIKDCL6MTNHTWWO327FAEGET
AA responses
From APK5BB3FHLOPEU45D6ACELSH4UI2MEHL
  • Bounced
  • Response unit:
  • Response: { "error": "one of secondary AAs bounced with error: EWPV5JZYOIKDCL6MTNHTWWO327FAEGET: formula $amount = trigger.output[[asset=$asset]]; $address = $data.address; // final recipient $oswap_aa = $data.oswap_aa; $data_to_forward = $data.data; $definition = definition[$oswap_aa]; require($definition, "not an AA"); $params = $definition[1].params; require($params, "no params"); $x_asset = $params.x_asset; $y_asset = $params.y_asset; require($x_asset == $asset OR $y_asset == $asset, "wrong asset received"); $get_param = ($name, $default) => { $value = var[$oswap_aa][$name]; exists($value) ? $value : (exists($params[$name]) ? $params[$name] : $default) }; $alpha = $get_param('alpha', 0.5); $beta = 1 - $alpha; $gamma = $get_param('price_deviation', 0); $base_interest_rate = $get_param('base_interest_rate', 0.2); $get_shifts = () => { $mid_price = $get_param('mid_price', 0); // price of x_asset in terms of y_asset if ($mid_price){ $lp_shares = var[$oswap_aa]['lp_shares']; $s_curve = $lp_shares.linear * $lp_shares.coef; $x0 = $s_curve / $mid_price^$beta / $gamma; $y0 = $x0 * $mid_price; } // else{ // $x0 = 0; // $y0 = 0; // } {x0: $x0, y0: $y0} }; $get_denom = ($balances, $l_balances, $shifts, $pxy) => { $leverages = [2, 5, 10, 20, 50, 100]; // account for leveraged positions $L_sums = {x: 0}; foreach($leverages, 6, $L => { $L_sums.x = $L_sums.x + ($L - 1) * ($l_balances[$L||'x'].balance + $l_balances[-$L||'x'].balance / $pxy); }); $denom = $beta * ($balances.x + $shifts.x0) - $L_sums.x; // log({denom: $denom, sum: $L_sums.x, share: $L_sums.x/$denom}); require($denom > 0, "negative denom " || $denom); $denom }; $balances = var[$oswap_aa]['balances']; $l_balances = var[$oswap_aa]['leveraged_balances'] OTHERWISE {}; $profits = var[$oswap_aa]['profits'] OTHERWISE {}; $recent = var[$oswap_aa]['recent'] OTHERWISE {}; $shifts = $get_shifts(); $pxy = $alpha/$beta * ($balances.y + $shifts.y0) / ($balances.x + $shifts.x0); $denom = $get_denom($balances, $l_balances, $shifts, $pxy); $Lambda = $get_param('pool_leverage', 1); $pool_props = { alpha: $alpha, beta: $beta, Lambda: $Lambda, swap_fee: $get_param('swap_fee', 0.003), arb_profit_tax: $get_param('arb_profit_tax', 0), period_length: $get_param('period_length', 3600), }; if (length($l_balances)){ // charge interest accrued since the previous interaction $i = $base_interest_rate / (1 - $pool_lib#1.$get_utilization_ratio($balances, $l_balances, $shifts.x0, $shifts.y0, $alpha)); $charged_interest = $pool_lib#1.$charge_interest($balances, $l_balances, $profits, $shifts.x0, $shifts.y0, $recent.last_ts, $i, $alpha, $Lambda); } $y_in = $asset == $y_asset; $req = {share: 1, final_price: 0, found: false}; foreach([1, 2, 3, 4, 5], 5, $n => { if ($req.found) return; if ($y_in){ // buying x $y_amount = $amount; $x_amount = $y_amount / $pxy; $req.final_price = $pxy * (1 + $x_amount / $denom * $req.share); } else { $x_amount = $amount; $req.final_price = 1/$pxy * (1 + $x_amount/($denom + $beta * $Lambda * $x_amount) * $req.share); } // copy because they will be modified in each iteration $_balances = $balances; $_l_balances = $l_balances; $_profits = $profits; $_recent = $recent; $res = $pool_lib_by_price#6.$swap($_balances, $_l_balances, $_profits, $_recent, $shifts.x0, $shifts.y0, $y_in, 0, $req.final_price, -1, 0, trigger.initial_address, $pool_props); log('iteration', $n, 'required', $res.amount_Y, 'have', $amount); if ($res.amount_Y <= $amount) $req.found = true; else $req.share = $req.share * $amount/$res.amount_Y * 0.95; }); require($req.found, "failed to find suitable swap params"); $final_price = $req.final_price; failed: to pay -3.68632270956423e+22" }
Technical information
Fees:
2,117 bytes
(451 headers, 1666 payload)
Level:10634157
Witnessed level:10634144
Main chain index:10260509
Latest included mc index:10260508
Status:stable/confirmed/final