| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "getters": "{ |
| 5 | $pow2 = $x => $x*$x; |
| 6 | |
| 7 | $small_pow = ($x, $pow) => { |
| 8 | if ($pow == 0) |
| 9 | return 1; |
| 10 | if ($pow == 1) |
| 11 | return $x; |
| 12 | if ($pow == 2) |
| 13 | return $pow2($x); |
| 14 | if ($pow == 3) |
| 15 | return $pow2($x) * $x; |
| 16 | if ($pow == 4) |
| 17 | return $pow2($pow2($x)); |
| 18 | if ($pow == 5) |
| 19 | return $pow2($pow2($x)) * $x; |
| 20 | if ($pow == 6) |
| 21 | return $pow2($pow2($x) * $x); |
| 22 | if ($pow == 7) |
| 23 | return $pow2($pow2($x) * $x) * $x; |
| 24 | if ($pow == 8) |
| 25 | return $pow2($pow2($pow2($x))); |
| 26 | if ($pow == 9) |
| 27 | return $pow2($pow2($pow2($x))) * $x; |
| 28 | if ($pow == 10) |
| 29 | return $pow2($pow2($pow2($x)) * $x); |
| 30 | if ($pow == 11) |
| 31 | return $pow2($pow2($pow2($x)) * $x) * $x; |
| 32 | if ($pow == 12) |
| 33 | return $pow2($pow2($pow2($x) * $x)); |
| 34 | bounce("unsupported power "||$pow); |
| 35 | }; |
| 36 | |
| 37 | $get_reserve_price = () => data_feed[[oracles=params.oracle, feed_name=params.feed_name, ifnone=false]] / $small_pow(10, params.decimals OTHERWISE 0); |
| 38 | }", |
| 39 | "messages": [ |
| 40 | { |
| 41 | "app": "state", |
| 42 | "state": "{ |
| 43 | bounce('lib only'); |
| 44 | }" |
| 45 | } |
| 46 | ] |
| 47 | } |
| 48 | ] |