| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "getters": "{ |
| 5 | |
| 6 | $get_reserve_price = () => { |
| 7 | $oracle = "XY6JXVBITD4EKY3DFT27XS65D2M3FJ5V"; |
| 8 | $feed_name = "IUSD_BBD_selling"; |
| 9 | $unit = data_feed[[oracles=$oracle, feed_name=$feed_name, what="unit", ifnone=false]]; |
| 10 | if (!$unit) |
| 11 | bounce('No data feed with IUSD_BBD_selling'); |
| 12 | $payload = unit[$unit].messages[[.app="data_feed"]].payload; |
| 13 | $iusd_bbd = $payload.IUSD_BBD_selling; |
| 14 | $bbd_usd = $payload.BBD_USD_selling; |
| 15 | if (!$bbd_usd) |
| 16 | bounce('Missing BBD_USD_selling in the unit'); |
| 17 | $dec_iusd_bbd = $payload.decimals_iusd_bbd; |
| 18 | if (!$dec_iusd_bbd) |
| 19 | bounce('Missing decimals_iusd_bbd in the unit'); |
| 20 | $dec_bbd_usd = $payload.decimals_bbd_usd; |
| 21 | if (!$dec_bbd_usd) |
| 22 | bounce('Missing decimals_bbd_usd in the unit'); |
| 23 | return $iusd_bbd / (10 ^ $dec_iusd_bbd) * $bbd_usd / (10 ^ $dec_bbd_usd); |
| 24 | }; |
| 25 | }", |
| 26 | "messages": [ |
| 27 | { |
| 28 | "app": "state", |
| 29 | "state": "{ |
| 30 | bounce('lib only'); |
| 31 | }" |
| 32 | } |
| 33 | ] |
| 34 | } |
| 35 | ] |