tx · 6dniRdu6hRKbZYSV7bxrtXdw8jRMwmoBVeEnbRb4mV1P

3N1Kt6er9nzzrv8DYLUNybdUdKhto6buhu3:  -0.00100000 Waves

2022.08.09 18:14 [2177092] smart account 3N1Kt6er9nzzrv8DYLUNybdUdKhto6buhu3 > SELF 0.00000000 Waves

{ "type": 13, "id": "6dniRdu6hRKbZYSV7bxrtXdw8jRMwmoBVeEnbRb4mV1P", "fee": 100000, "feeAssetId": null, "timestamp": 1660058044310, "version": 2, "chainId": 84, "sender": "3N1Kt6er9nzzrv8DYLUNybdUdKhto6buhu3", "senderPublicKey": "HgKeKH88GY1mp5NpcZUDMRa9iw9LS79HZAnRt3ntaXpE", "proofs": [ "3AoGXKUEcSVaR1wdGnJvKonJF12WfZ956EKvXyjgv5S9e2fCaBRiJ9CreqFSMdr3G52UKLSrFJ8QB3C7qgXjHwuF" ], "script": "base64:BgIMCAISAwoBARIDCgEIBQAITUlOX1RJQ0sAmOzJ////////AQAITUFYX1RJQ0sJAQEtAQUITUlOX1RJQ0sABEJBU0UJALYCAQCRTgANQkFTRV9ERUNJTUFMUwAEAAhERUNJTUFMUwASAgFpARJnZXRTcXJ0UmF0aW9BdFRpY2sBBHRpY2sEB2Fic1RpY2sDCQBmAgAABQR0aWNrCQBoAgUEdGljawD///////////8BBQR0aWNrBANlcnIDCQBmAgUEdGljawUITUFYX1RJQ0sJAAIBAgxpbnZhbGlkIHRpY2sFBHVuaXQDCQAAAgUDZXJyBQNlcnIEBnByaWNlMQkAdgYFBEJBU0UFDUJBU0VfREVDSU1BTFMJALYCAQABAAAAEgUERE9XTgQGcHJpY2UyCQB2BgUEQkFTRQUNQkFTRV9ERUNJTUFMUwkAtgIBAOrZ5v///////wEAAAASBQRET1dOBAZwcmljZTMJAHYGBQRCQVNFBQ1CQVNFX0RFQ0lNQUxTCQC2AgEAlqYZAAAAEgUERE9XTgQGcHJpY2U0CQB2BgkAtgIBAJFOAAQJALYCAQACAAAAEgUERE9XTgQGcHJpY2U1CQBsBgAUAAEA////////////AQAAAAQFBERPV04EBnByaWNlNgkAdgYJALYCAQAUAAEJALYCAQD///////////8BAAAABAUERE9XTgkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzEJAKYDAQUGcHJpY2UxCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzIJAKYDAQUGcHJpY2UyCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzMJAKYDAQUGcHJpY2UzCQDMCAIJAQtTdHJpbmdFbnRyeQICB3ByaWNlXzQJAKYDAQUGcHJpY2U0CQDMCAIJAQxJbnRlZ2VyRW50cnkCAgdwcmljZV81BQZwcmljZTUJAMwIAgkBC1N0cmluZ0VudHJ5AgIHcHJpY2VfNgkApgMBBQZwcmljZTYFA25pbAUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpARJnZXRUaWNrQXRTcXJ0UmF0aW8BBnByaWNlXwQFcHJpY2UJAKcDAQUGcHJpY2VfBAR0aWNrCQB3BgUFcHJpY2UFCERFQ0lNQUxTBQRCQVNFBQ1CQVNFX0RFQ0lNQUxTBQhERUNJTUFMUwUERE9XTgkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQICBHRpY2sJAKYDAQUEdGljawUDbmlsBQR1bml0AQJ0eAEGdmVyaWZ5AAYHJ95B", "height": 2177092, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3joZm6WZC1uK5FggpbXWkrNiMEbVwUN8cd2Nt4o3qegx Next: AGhRoG6yxq3bMyDAGEWYN1ExAZVUyRu8n2tBXtHJdS79 Diff:
OldNewDifferences
3333 }
3434
3535
36+
37+@Callable(i)
38+func getTickAtSqrtRatio (price_) = {
39+ let price = parseBigIntValue(price_)
40+ let tick = log(price, DECIMALS, BASE, BASE_DECIMALS, DECIMALS, DOWN)
41+ $Tuple2([StringEntry("tick", toString(tick))], unit)
42+ }
43+
44+
3645 @Verifier(tx)
3746 func verify () = true
3847
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let MIN_TICK = -887272
55
66 let MAX_TICK = -(MIN_TICK)
77
88 let BASE = toBigInt(10001)
99
1010 let BASE_DECIMALS = 4
1111
1212 let DECIMALS = 18
1313
1414 @Callable(i)
1515 func getSqrtRatioAtTick (tick) = {
1616 let absTick = if ((0 > tick))
1717 then (tick * -1)
1818 else tick
1919 let err = if ((tick > MAX_TICK))
2020 then throw("invalid tick")
2121 else unit
2222 if ((err == err))
2323 then {
2424 let price1 = pow(BASE, BASE_DECIMALS, toBigInt(1), 0, 18, DOWN)
2525 let price2 = pow(BASE, BASE_DECIMALS, toBigInt(-414486), 0, 18, DOWN)
2626 let price3 = pow(BASE, BASE_DECIMALS, toBigInt(414486), 0, 18, DOWN)
2727 let price4 = pow(toBigInt(10001), 4, toBigInt(2), 0, 18, DOWN)
2828 let price5 = pow(20, 1, -1, 0, 4, DOWN)
2929 let price6 = pow(toBigInt(20), 1, toBigInt(-1), 0, 4, DOWN)
3030 $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)
3131 }
3232 else throw("Strict value is not equal to itself.")
3333 }
3434
3535
36+
37+@Callable(i)
38+func getTickAtSqrtRatio (price_) = {
39+ let price = parseBigIntValue(price_)
40+ let tick = log(price, DECIMALS, BASE, BASE_DECIMALS, DECIMALS, DOWN)
41+ $Tuple2([StringEntry("tick", toString(tick))], unit)
42+ }
43+
44+
3645 @Verifier(tx)
3746 func verify () = true
3847

github/deemru/w8io/169f3d6 
28.63 ms