tx · 48aSt5oow8Mhe99tnm4mKv85VBRZq3etH4tmQcFumLf7

3Muh4FMqQEciR4eM8aRSHaeSsezQpwgsewY:  -0.01000000 Waves

2022.11.24 09:43 [2330833] smart account 3Muh4FMqQEciR4eM8aRSHaeSsezQpwgsewY > SELF 0.00000000 Waves

{ "type": 13, "id": "48aSt5oow8Mhe99tnm4mKv85VBRZq3etH4tmQcFumLf7", "fee": 1000000, "feeAssetId": null, "timestamp": 1669272218351, "version": 2, "chainId": 84, "sender": "3Muh4FMqQEciR4eM8aRSHaeSsezQpwgsewY", "senderPublicKey": "AbKSXC77cdmH8X3UJXcPzxsXqAX2mr2mkYZRjfRBQ7te", "proofs": [ "3ALxnM9mD4gFASqcsFesjfaUWeGmap2Za83oviGUr2Sog1YvDNjeCyYxVomshAQqyKWWoDTM2E2NiTQt6Z3fFeLt" ], "script": "base64:BgIKCAISBgoEAQEBAQsABnNjYWxlOACAwtcvAAdzY2FsZTE2AICAhP6m3uERAAdkaWdpdHM4AAgAFWV4Y2hhbmdlUmF0aW9MaW1pdE1pbgCAlfUqABVleGNoYW5nZVJhdGlvTGltaXRNYXgAgO+5NAAFYWxwaGEAMgALYWxwaGFEaWdpdHMAAgAEYmV0YQCAgN6vz/WVCAEIc2tld25lc3MCAXgBeQkAaQIJAGQCCQBrAwUHc2NhbGUxNgUBeAUBeQkAawMFB3NjYWxlMTYFAXkFAXgAAgENaW52YXJpYW50Q2FsYwIBeAF5BAJzawkBCHNrZXduZXNzAgUBeAUBeQkAZAIJAGsDCQBkAgUBeAUBeQUHc2NhbGUxNgkAbAYFAnNrBQdkaWdpdHM4BQVhbHBoYQULYWxwaGFEaWdpdHMFB2RpZ2l0czgFB0NFSUxJTkcJAGgCAAIJAGsDCQCgAwEJAHYGCQC8AgMJALYCAQUBeAkAtgIBBQF5CQC2AgEFBnNjYWxlOAAACQC2AgEABQABCQBpAgUHZGlnaXRzOAACBQRET1dOCQBsBgkAZQIFAnNrBQRiZXRhBQdkaWdpdHM4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CQDMCAIAAQkAzAgCAAIJAMwIAgADCQDMCAIABAkAzAgCAAUJAMwIAgAGCQDMCAIABwkAzAgCAAgJAMwIAgAJCQDMCAIACgkAzAgCAAsJAMwIAgAMBQNuaWwKAAIkcwkAkAMBBQIkbAoABSRhY2MwCQCYCgYAAQUERG1heAD//////////38FAUIFBEZtaW4FBERtaW4KAQUkZjBfMQICJGECJGkDCQBnAgUCJGkFAiRzBQIkYQkBAkRGAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhRMaXN0IHNpemUgZXhjZWVkcyAxMgkBBSRmMF8yAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgkBBSRmMF8xAgUFJGFjYzAAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAMJAAACCAUBYQJfMQAACQBlAgUBQggFAWECXzIJAGUCBQFCCAUBYQJfNAEBaQEBRAQBQQFCCWludmFyaWFudAZhbW91bnQEA2VzdAkBAWQEBQFBBQFCBQlpbnZhcmlhbnQFBmFtb3VudAkAlAoCCQDMCAIJAQxJbnRlZ2VyRW50cnkCAgNlc3QFA2VzdAUDbmlsBQNlc3QAgtNaTA==", "height": 2330833, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5uvTNbCYV47eK3yoiMZRXERtywbMdohVAQtKGLvTKidN Next: 5XpXqnX7REsK9MvPyxmz7vPFZPJy9yfjuo9teboMyY3R Diff:
OldNewDifferences
8484
8585
8686 @Callable(i)
87-func D (A,B,invariant,amount) = $Tuple2(nil, d(A, B, invariant, amount))
87+func D (A,B,invariant,amount) = {
88+ let est = d(A, B, invariant, amount)
89+ $Tuple2([IntegerEntry("est", est)], est)
90+ }
8891
8992
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let scale8 = 100000000
55
66 let scale16 = 10000000000000000
77
88 let digits8 = 8
99
1010 let exchangeRatioLimitMin = 90000000
1111
1212 let exchangeRatioLimitMax = 110000000
1313
1414 let alpha = 50
1515
1616 let alphaDigits = 2
1717
1818 let beta = 4600000000000000
1919
2020 func skewness (x,y) = ((fraction(scale16, x, y) + fraction(scale16, y, x)) / 2)
2121
2222
2323 func invariantCalc (x,y) = {
2424 let sk = skewness(x, y)
2525 (fraction((x + y), scale16, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(toInt(pow(fraction(toBigInt(x), toBigInt(y), toBigInt(scale8)), 0, toBigInt(5), 1, (digits8 / 2), DOWN)), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8)))
2626 }
2727
2828
2929 func d (A,B,invariant,amount) = {
3030 let Dmin = (B - fraction(amount, exchangeRatioLimitMax, scale8))
3131 let Dmax = (B - fraction(amount, exchangeRatioLimitMin, scale8))
3232 let A_new = (A + amount)
3333 let Fmin = (invariantCalc(A_new, Dmin) - invariant)
3434 func DF (a,u) = if ((a._1 == 0))
3535 then a
3636 else {
3737 let D = a._2
3838 let Flastvalid = a._3
3939 let Dlastvalid = a._4
4040 let Fprev = a._5
4141 let Dprev = a._6
4242 let F = (invariantCalc(A_new, D) - invariant)
4343 if ((F == 0))
4444 then $Tuple6(0, D, 0, 0, 0, 0)
4545 else {
4646 let $t021762304 = if (if ((F > 0))
4747 then (Flastvalid > F)
4848 else false)
4949 then $Tuple2(F, D)
5050 else $Tuple2(Flastvalid, Dlastvalid)
5151 let Fvalid = $t021762304._1
5252 let Dvalid = $t021762304._2
5353 if (((F - Fprev) == 0))
5454 then $Tuple6(1, (D + 1), Fvalid, Dvalid, F, D)
5555 else {
5656 let Dnext = (D - fraction(F, (D - Dprev), (F - Fprev)))
5757 if (((D - Dnext) != 0))
5858 then $Tuple6(1, Dnext, Fvalid, Dvalid, F, D)
5959 else if ((0 > F))
6060 then $Tuple6(1, (D + 1), Fvalid, Dvalid, F, D)
6161 else $Tuple6(0, D, 0, 0, 0, 0)
6262 }
6363 }
6464 }
6565
6666 let a = {
6767 let $l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
6868 let $s = size($l)
6969 let $acc0 = $Tuple6(1, Dmax, 9223372036854775807, B, Fmin, Dmin)
7070 func $f0_1 ($a,$i) = if (($i >= $s))
7171 then $a
7272 else DF($a, $l[$i])
7373
7474 func $f0_2 ($a,$i) = if (($i >= $s))
7575 then $a
7676 else throw("List size exceeds 12")
7777
7878 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12)
7979 }
8080 if ((a._1 == 0))
8181 then (B - a._2)
8282 else (B - a._4)
8383 }
8484
8585
8686 @Callable(i)
87-func D (A,B,invariant,amount) = $Tuple2(nil, d(A, B, invariant, amount))
87+func D (A,B,invariant,amount) = {
88+ let est = d(A, B, invariant, amount)
89+ $Tuple2([IntegerEntry("est", est)], est)
90+ }
8891
8992

github/deemru/w8io/169f3d6 
38.27 ms