tx · FK7h5iBdDLezw4JNfAZSNDuUt3EYp5FcoM9xgtZ3sxsx 3N1Kt6er9nzzrv8DYLUNybdUdKhto6buhu3: -0.00100000 Waves 2022.08.09 17:08 [2177026] smart account 3N1Kt6er9nzzrv8DYLUNybdUdKhto6buhu3 > SELF 0.00000000 Waves
{ "type": 13, "id": "FK7h5iBdDLezw4JNfAZSNDuUt3EYp5FcoM9xgtZ3sxsx", "fee": 100000, "feeAssetId": null, "timestamp": 1660054142303, "version": 2, "chainId": 84, "sender": "3N1Kt6er9nzzrv8DYLUNybdUdKhto6buhu3", "senderPublicKey": "HgKeKH88GY1mp5NpcZUDMRa9iw9LS79HZAnRt3ntaXpE", "proofs": [ "5E6Yii7BeYRvMEbXqzArDQtHPjGasaHipdeAu5NpLaijGoRKCMvBTM3iGEnc7m8REWSzWBZz95soQgxh73br7Yuc" ], "script": "base64:BgIHCAISAwoBAQUACE1JTl9USUNLAJjsyf///////wEACE1BWF9USUNLCQEBLQEFCE1JTl9USUNLAARCQVNFCQC2AgEAkU4ADUJBU0VfREVDSU1BTFMABAAIREVDSU1BTFMAEgEBaQESZ2V0U3FydFJhdGlvQXRUaWNrAQR0aWNrBAdhYnNUaWNrAwkAZgIAAAUEdGljawkAaAIFBHRpY2sA////////////AQUEdGljawQDZXJyAwkAZgIFBHRpY2sFCE1BWF9USUNLCQACAQIMaW52YWxpZCB0aWNrBQR1bml0AwkAAAIFA2VycgUDZXJyBAZwcmljZTEJAHYGBQRCQVNFBQ1CQVNFX0RFQ0lNQUxTCQC2AgEAAQAAABIFBERPV04EBnByaWNlMgkAdgYFBEJBU0UFDUJBU0VfREVDSU1BTFMJALYCAQUITUlOX1RJQ0sAAAASBQRET1dOBAZwcmljZTMJAHYGBQRCQVNFBQ1CQVNFX0RFQ0lNQUxTCQC2AgEFCE1BWF9USUNLAAAAEgUERE9XTgQGcHJpY2U0CQB2BgkAtgIBAJFOAAQJALYCAQACAAAAEgUERE9XTgQGcHJpY2U1CQBsBgAUAAEA////////////AQAAAAQFBERPV04EBnByaWNlNgkAdgYJALYCAQAUAAEJALYCAQD///////////8BAAAABAUERE9XTgkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzEJAKYDAQUGcHJpY2UxCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzIJAKYDAQUGcHJpY2UyCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzMJAKYDAQUGcHJpY2UzCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzQJAKYDAQUGcHJpY2U0CQDMCAIJAQxJbnRlZ2VyRW50cnkCAgdwcmljZV81BQZwcmljZTUJAMwIAgkBC1N0cmluZ0VudHJ5AgIHcHJpY2VfNgkApgMBBQZwcmljZTYFA25pbAUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAGSwaRYA==", "height": 2177026, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F9mSLB9e7t9acFJcAJxHyMja1CvgbhRS1jaW1XSec9NR Next: 46Gyx9Ndq3iyXvpKbUMehmpGXY2cshVmyY9a2nud53jH Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let MIN_TICK = -887272 | |
5 | 5 | ||
6 | 6 | let MAX_TICK = -(MIN_TICK) | |
7 | + | ||
8 | + | let BASE = toBigInt(10001) | |
9 | + | ||
10 | + | let BASE_DECIMALS = 4 | |
11 | + | ||
12 | + | let DECIMALS = 18 | |
7 | 13 | ||
8 | 14 | @Callable(i) | |
9 | 15 | func getSqrtRatioAtTick (tick) = { | |
15 | 21 | else unit | |
16 | 22 | if ((err == err)) | |
17 | 23 | then { | |
18 | - | let price1 = pow( | |
19 | - | let price2 = pow( | |
20 | - | let price3 = pow( | |
24 | + | let price1 = pow(BASE, BASE_DECIMALS, toBigInt(1), 0, 18, DOWN) | |
25 | + | let price2 = pow(BASE, BASE_DECIMALS, toBigInt(MIN_TICK), 0, 18, DOWN) | |
26 | + | let price3 = pow(BASE, BASE_DECIMALS, toBigInt(MAX_TICK), 0, 18, DOWN) | |
21 | 27 | let price4 = pow(toBigInt(10001), 4, toBigInt(2), 0, 18, DOWN) | |
22 | 28 | let price5 = pow(20, 1, -1, 0, 4, DOWN) | |
23 | 29 | let price6 = pow(toBigInt(20), 1, toBigInt(-1), 0, 4, DOWN) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let MIN_TICK = -887272 | |
5 | 5 | ||
6 | 6 | let MAX_TICK = -(MIN_TICK) | |
7 | + | ||
8 | + | let BASE = toBigInt(10001) | |
9 | + | ||
10 | + | let BASE_DECIMALS = 4 | |
11 | + | ||
12 | + | let DECIMALS = 18 | |
7 | 13 | ||
8 | 14 | @Callable(i) | |
9 | 15 | func getSqrtRatioAtTick (tick) = { | |
10 | 16 | let absTick = if ((0 > tick)) | |
11 | 17 | then (tick * -1) | |
12 | 18 | else tick | |
13 | 19 | let err = if ((tick > MAX_TICK)) | |
14 | 20 | then throw("invalid tick") | |
15 | 21 | else unit | |
16 | 22 | if ((err == err)) | |
17 | 23 | then { | |
18 | - | let price1 = pow( | |
19 | - | let price2 = pow( | |
20 | - | let price3 = pow( | |
24 | + | let price1 = pow(BASE, BASE_DECIMALS, toBigInt(1), 0, 18, DOWN) | |
25 | + | let price2 = pow(BASE, BASE_DECIMALS, toBigInt(MIN_TICK), 0, 18, DOWN) | |
26 | + | let price3 = pow(BASE, BASE_DECIMALS, toBigInt(MAX_TICK), 0, 18, DOWN) | |
21 | 27 | let price4 = pow(toBigInt(10001), 4, toBigInt(2), 0, 18, DOWN) | |
22 | 28 | let price5 = pow(20, 1, -1, 0, 4, DOWN) | |
23 | 29 | let price6 = pow(toBigInt(20), 1, toBigInt(-1), 0, 4, DOWN) | |
24 | 30 | $Tuple2([StringEntry("price_1", toString(price1)), StringEntry("price_2", toString(price2)), StringEntry("price_3", toString(price3)), StringEntry("price_4", toString(price4)), IntegerEntry("price_5", price5), StringEntry("price_6", toString(price6))], unit) | |
25 | 31 | } | |
26 | 32 | else throw("Strict value is not equal to itself.") | |
27 | 33 | } | |
28 | 34 | ||
29 | 35 | ||
30 | 36 | @Verifier(tx) | |
31 | 37 | func verify () = true | |
32 | 38 |
github/deemru/w8io/169f3d6 24.78 ms ◑