tx · 368dhDXsJgRRhAaREpiijCUPN1DpH9Mg3Ekn9d7Eyfr1

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.27 11:30 [2508145] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "368dhDXsJgRRhAaREpiijCUPN1DpH9Mg3Ekn9d7Eyfr1", "fee": 5000000, "feeAssetId": null, "timestamp": 1679905870537, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "2x5FFw715ej7bnwQJgyquwukpjFC3XKfE21ACDey3gCoPmtgyK14M3JcuTJgES4U8VzsDXtcC9KxzHzH2vbqsn74" ], "script": "base64:BgIKCAISABIAEgASAAkADGNvbnRyYWN0RmlsZQIJcmViYWxhbmNlAA9rZXlzVGFyZ2V0UmF0aW8CDyVzX190YXJnZXRSYXRpbwAUa2V5QWRkaXRpb25hbEJhbGFuY2UCGyVzX19hZGRpdHRpb25hbFdhdmVzQmFsYW5jZQAYa2V5U1dhdmVzQWRkaXRpb25CYWxhbmNlAhElc19fc1dhdmVzQmFsYW5jZQAQa2V5U1dhdmVzQXNzZXRJZAIRJXNfX3NXYXZlc0Fzc2V0SWQAD2tleVByb3h5QWRkcmVzcwIQJXNfX3Byb3h5QWRkcmVzcwEQZ2V0SW50ZWdlck9yWmVybwEKaW50ZWdlcktleQQHJG1hdGNoMAkAmggCBQR0aGlzBQppbnRlZ2VyS2V5AwkAAQIFByRtYXRjaDACA0ludAQDdmFsBQckbWF0Y2gwBQN2YWwAAAEQZ2V0U3RyaW5nT3JUaHJvdwEJc3RyaW5nS2V5BAckbWF0Y2gwCQCdCAIFBHRoaXMFCXN0cmluZ0tleQMJAAECBQckbWF0Y2gwAgZTdHJpbmcEAXMFByRtYXRjaDAFAXMJAAIBCQCsAgIJAKwCAgIBWwUJc3RyaW5nS2V5AgpdIGlzIGVtcHR5ARRpbnRlcm5hbFdhdmVzQmFsYW5jZQAJAGQCCAkA7wcBBQR0aGlzB3JlZ3VsYXIJARBnZXRJbnRlZ2VyT3JaZXJvAQUUa2V5QWRkaXRpb25hbEJhbGFuY2UEAWkBEnJldHVybldhdmVzQmFsYW5jZQAJAJQKAgUDbmlsCQEUaW50ZXJuYWxXYXZlc0JhbGFuY2UAAWkBE3JldHVyblNXYXZlc0JhbGFuY2UACQCUCgIFA25pbAkBEGdldEludGVnZXJPclplcm8BBRhrZXlTV2F2ZXNBZGRpdGlvbkJhbGFuY2UBaQEJY2FsY1JhdGlvAAQTcmVndWxhcldhdmVzQmFsYW5jZQgJAO8HAQUEdGhpcwdyZWd1bGFyBAphZGRpdGlvbmFsCQEQZ2V0SW50ZWdlck9yWmVybwEFFGtleUFkZGl0aW9uYWxCYWxhbmNlBAVyYXRpbwkAawMAZAUKYWRkaXRpb25hbAkAZAIFCmFkZGl0aW9uYWwFE3JlZ3VsYXJXYXZlc0JhbGFuY2UJAJQKAgUDbmlsBQVyYXRpbwFpAQ1jYWxjUmF0aW9UZXN0AAQTcmVndWxhcldhdmVzQmFsYW5jZQAVBAphZGRpdGlvbmFsAE8EC3RhcmdldFJhdGlvAFAEA3N1bQkAZAIFE3JlZ3VsYXJXYXZlc0JhbGFuY2UFCmFkZGl0aW9uYWwEBmNoYW5nZQkAawMFC3RhcmdldFJhdGlvBQNzdW0AZAkAlAoCBQNuaWwFBmNoYW5nZQByfdUC", "height": 2508145, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C9PbueCwr1Y7fe6WeHxFk5chD3WVsRiAwY6hS9JQ7iup Next: 8NxPduikPXoTW3xRJUbredzauXnzA7vTzqLC3YHGDsJz Diff:
OldNewDifferences
5656 func calcRatioTest () = {
5757 let regularWavesBalance = 21
5858 let additional = 79
59- let ratio = fraction(100, additional, (additional + regularWavesBalance))
60- $Tuple2(nil, ratio)
59+ let targetRatio = 80
60+ let sum = (regularWavesBalance + additional)
61+ let change = fraction(targetRatio, sum, 100)
62+ $Tuple2(nil, change)
6163 }
6264
6365
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFile = "rebalance"
55
66 let keysTargetRatio = "%s__targetRatio"
77
88 let keyAdditionalBalance = "%s__addittionalWavesBalance"
99
1010 let keySWavesAdditionBalance = "%s__sWavesBalance"
1111
1212 let keySWavesAssetId = "%s__sWavesAssetId"
1313
1414 let keyProxyAddress = "%s__proxyAddress"
1515
1616 func getIntegerOrZero (integerKey) = match getInteger(this, integerKey) {
1717 case val: Int =>
1818 val
1919 case _ =>
2020 0
2121 }
2222
2323
2424 func getStringOrThrow (stringKey) = match getString(this, stringKey) {
2525 case s: String =>
2626 s
2727 case _ =>
2828 throw((("[" + stringKey) + "] is empty"))
2929 }
3030
3131
3232 func internalWavesBalance () = (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance))
3333
3434
3535 @Callable(i)
3636 func returnWavesBalance () = $Tuple2(nil, internalWavesBalance())
3737
3838
3939
4040 @Callable(i)
4141 func returnSWavesBalance () = $Tuple2(nil, getIntegerOrZero(keySWavesAdditionBalance))
4242
4343
4444
4545 @Callable(i)
4646 func calcRatio () = {
4747 let regularWavesBalance = wavesBalance(this).regular
4848 let additional = getIntegerOrZero(keyAdditionalBalance)
4949 let ratio = fraction(100, additional, (additional + regularWavesBalance))
5050 $Tuple2(nil, ratio)
5151 }
5252
5353
5454
5555 @Callable(i)
5656 func calcRatioTest () = {
5757 let regularWavesBalance = 21
5858 let additional = 79
59- let ratio = fraction(100, additional, (additional + regularWavesBalance))
60- $Tuple2(nil, ratio)
59+ let targetRatio = 80
60+ let sum = (regularWavesBalance + additional)
61+ let change = fraction(targetRatio, sum, 100)
62+ $Tuple2(nil, change)
6163 }
6264
6365

github/deemru/w8io/169f3d6 
24.28 ms