tx · 6qZasWNEcJVm1eUmdNVzTegkBZVf4PBbf7BsRfchMfJB

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.27 13:19 [2508251] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "6qZasWNEcJVm1eUmdNVzTegkBZVf4PBbf7BsRfchMfJB", "fee": 5000000, "feeAssetId": null, "timestamp": 1679912414245, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "3jjziTe9zpeZA3P88Bxggca2Jy252tD8T8XtxrvV5sSHHqwqVj6UVS6EfFg1rgaJ7kUQkgoS2yUhWVGfn3zzPkpo" ], "script": "base64:BgIPCAISABIAEgASBQoDAQEBCwAMY29udHJhY3RGaWxlAglyZWJhbGFuY2UAD2tleXNUYXJnZXRSYXRpbwIPJXNfX3RhcmdldFJhdGlvABRrZXlBZGRpdGlvbmFsQmFsYW5jZQIaJXNfX2FkZGl0aW9uYWxXYXZlc0JhbGFuY2UAGmtleVNXYXZlc0FkZGl0aW9uYWxCYWxhbmNlAhElc19fc1dhdmVzQmFsYW5jZQAQa2V5U1dhdmVzQXNzZXRJZAIRJXNfX3NXYXZlc0Fzc2V0SWQAD2tleVByb3h5QWRkcmVzcwIQJXNfX3Byb3h5QWRkcmVzcwEQZ2V0SW50ZWdlck9yWmVybwEKaW50ZWdlcktleQQHJG1hdGNoMAkAmggCBQR0aGlzBQppbnRlZ2VyS2V5AwkAAQIFByRtYXRjaDACA0ludAQDdmFsBQckbWF0Y2gwBQN2YWwAAAEQZ2V0U3RyaW5nT3JUaHJvdwEJc3RyaW5nS2V5BAckbWF0Y2gwCQCdCAIFBHRoaXMFCXN0cmluZ0tleQMJAAECBQckbWF0Y2gwAgZTdHJpbmcEAXMFByRtYXRjaDA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UZXN0Aw5yZWd1bGFyQmFsYW5jZQphZGRpdGlvbmFsC3RhcmdldFJhdGlvBANzdW0JAGQCBQ5yZWd1bGFyQmFsYW5jZQUKYWRkaXRpb25hbAQXdGFyZ2V0QWRkaXRpb25hbEJhbGFuY2UJAGsDBQt0YXJnZXRSYXRpbwUDc3VtAGQEBmNoYW5nZQkAZQIFCmFkZGl0aW9uYWwFF3RhcmdldEFkZGl0aW9uYWxCYWxhbmNlBAZuZXdSZWcJAGQCBQ5yZWd1bGFyQmFsYW5jZQUGY2hhbmdlAwkAZgIAAAUGY2hhbmdlBApzZW5kQW1vdW50CQBoAgUGY2hhbmdlAP///////////wEJAJQKAgUDbmlsCQDMCAIFBm5ld1JlZwkAzAgCBRd0YXJnZXRBZGRpdGlvbmFsQmFsYW5jZQkAzAgCBQZjaGFuZ2UJAMwIAgkArAICAglkZXBvc2l0OiAJAKQDAQUKc2VuZEFtb3VudAUDbmlsBApzZW5kQW1vdW50BQZjaGFuZ2UJAJQKAgUDbmlsCQDMCAIFBm5ld1JlZwkAzAgCBRd0YXJnZXRBZGRpdGlvbmFsQmFsYW5jZQkAzAgCBQZjaGFuZ2UJAMwIAgkArAICAgp3aXRoZHJhdzogCQCkAwEFCnNlbmRBbW91bnQFA25pbAC9w18n", "height": 2508251, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ALSyjvDVKxkFhaACEuVFweozBT7CFNdrKEn7h1dDQboC Next: BN14Vfd9aoDBtQospVDznCoZboQsFZ5bmmSTPvtknHZD Diff:
OldNewDifferences
4343
4444 func getRate () = {
4545 let proxy = addressFromStringValue(getStringOrThrow(keyProxyAddress))
46- invoke(proxy, "getrate", nil, nil)
46+ invoke(proxy, "getRate", nil, nil)
4747 }
4848
4949
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__additionalWavesBalance"
99
1010 let keySWavesAdditionalBalance = "%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 func currentRate () = {
3636 let additionalBalance = getIntegerOrZero(keyAdditionalBalance)
3737 let sWavesBalance = getIntegerOrZero(keySWavesAdditionalBalance)
3838 if ((additionalBalance == 0))
3939 then 0
4040 else fraction(10000000000, additionalBalance, sWavesBalance)
4141 }
4242
4343
4444 func getRate () = {
4545 let proxy = addressFromStringValue(getStringOrThrow(keyProxyAddress))
46- invoke(proxy, "getrate", nil, nil)
46+ invoke(proxy, "getRate", nil, nil)
4747 }
4848
4949
5050 @Callable(i)
5151 func returnWavesBalance () = $Tuple2(nil, internalWavesBalance())
5252
5353
5454
5555 @Callable(i)
5656 func returnSWavesBalance () = $Tuple2(nil, getIntegerOrZero(keySWavesAdditionalBalance))
5757
5858
5959
6060 @Callable(i)
6161 func calcRatio () = {
6262 let regularWavesBalance = wavesBalance(this).regular
6363 let additional = getIntegerOrZero(keyAdditionalBalance)
6464 let ratio = fraction(100, additional, (additional + regularWavesBalance))
6565 $Tuple2(nil, ratio)
6666 }
6767
6868
6969
7070 @Callable(i)
7171 func calcRatioTest (regularBalance,additional,targetRatio) = {
7272 let sum = (regularBalance + additional)
7373 let targetAdditionalBalance = fraction(targetRatio, sum, 100)
7474 let change = (additional - targetAdditionalBalance)
7575 let newReg = (regularBalance + change)
7676 if ((0 > change))
7777 then {
7878 let sendAmount = (change * -1)
7979 $Tuple2(nil, [newReg, targetAdditionalBalance, change, ("deposit: " + toString(sendAmount))])
8080 }
8181 else {
8282 let sendAmount = change
8383 $Tuple2(nil, [newReg, targetAdditionalBalance, change, ("withdraw: " + toString(sendAmount))])
8484 }
8585 }
8686
8787

github/deemru/w8io/026f985 
25.30 ms