tx · QKY7KPXGK5AjA7wPDp8y2fMxF2j5owy4bQXFUSaccdR

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.27 11:36 [2508151] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "QKY7KPXGK5AjA7wPDp8y2fMxF2j5owy4bQXFUSaccdR", "fee": 5000000, "feeAssetId": null, "timestamp": 1679906224108, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "2BBsXNzyKTHZyJ2DS71EHGojFEZ5uBNeW7L8deLJQFDprn6oF3zMXMCDMAGhf6CwDx3nLLmBKPTYRMofER56PAx7" ], "script": "base64:BgIPCAISABIAEgASBQoDAQEBCQAMY29udHJhY3RGaWxlAglyZWJhbGFuY2UAD2tleXNUYXJnZXRSYXRpbwIPJXNfX3RhcmdldFJhdGlvABRrZXlBZGRpdGlvbmFsQmFsYW5jZQIbJXNfX2FkZGl0dGlvbmFsV2F2ZXNCYWxhbmNlABhrZXlTV2F2ZXNBZGRpdGlvbkJhbGFuY2UCESVzX19zV2F2ZXNCYWxhbmNlABBrZXlTV2F2ZXNBc3NldElkAhElc19fc1dhdmVzQXNzZXRJZAAPa2V5UHJveHlBZGRyZXNzAhAlc19fcHJveHlBZGRyZXNzARBnZXRJbnRlZ2VyT3JaZXJvAQppbnRlZ2VyS2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmludGVnZXJLZXkDCQABAgUHJG1hdGNoMAIDSW50BAN2YWwFByRtYXRjaDAFA3ZhbAAAARBnZXRTdHJpbmdPclRocm93AQlzdHJpbmdLZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUJc3RyaW5nS2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAUBcwkAAgE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iZSZ7WniCB Next: 8Gf6LecFJ8qt6Q17gNyF6mhyaXVzxDXETYvbGpEyvm2X Diff:
OldNewDifferences
5353
5454
5555 @Callable(i)
56-func calcRatioTest (regularBalance,additional) = {
57- let targetRatio = 80
56+func calcRatioTest (regularBalance,additional,targetRatio) = {
5857 let sum = (regularBalance + additional)
5958 let targetBalance = fraction(targetRatio, sum, 100)
6059 let change = (additional - targetBalance)
6160 let newReg = (regularBalance + change)
62- $Tuple2(nil, [targetBalance, newReg])
61+ $Tuple2(nil, [targetBalance, newReg, change])
6362 }
6463
6564
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)
56-func calcRatioTest (regularBalance,additional) = {
57- let targetRatio = 80
56+func calcRatioTest (regularBalance,additional,targetRatio) = {
5857 let sum = (regularBalance + additional)
5958 let targetBalance = fraction(targetRatio, sum, 100)
6059 let change = (additional - targetBalance)
6160 let newReg = (regularBalance + change)
62- $Tuple2(nil, [targetBalance, newReg])
61+ $Tuple2(nil, [targetBalance, newReg, change])
6362 }
6463
6564

github/deemru/w8io/026f985 
21.06 ms