tx · 8UMfycH6F2ETEkT9G69D2F8owGu5JBuuMEiZSZ7WniCB

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.27 11:34 [2508150] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "8UMfycH6F2ETEkT9G69D2F8owGu5JBuuMEiZSZ7WniCB", "fee": 5000000, "feeAssetId": null, "timestamp": 1679906167629, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "25bxY157YFrTwn2rsvjthvSFYjuZZwqe9AVGmseFZcvqHmqSM9b2DrXJZJFKgZfraFb6ursk9PBuQtmY6sYcJaxs" ], "script": "base64:BgIOCAISABIAEgASBAoCAQEJAAxjb250cmFjdEZpbGUCCXJlYmFsYW5jZQAPa2V5c1RhcmdldFJhdGlvAg8lc19fdGFyZ2V0UmF0aW8AFGtleUFkZGl0aW9uYWxCYWxhbmNlAhslc19fYWRkaXR0aW9uYWxXYXZlc0JhbGFuY2UAGGtleVNXYXZlc0FkZGl0aW9uQmFsYW5jZQIRJXNfX3NXYXZlc0JhbGFuY2UAEGtleVNXYXZlc0Fzc2V0SWQCESVzX19zV2F2ZXNBc3NldElkAA9rZXlQcm94eUFkZHJlc3MCECVzX19wcm94eUFkZHJlc3MBEGdldEludGVnZXJPclplcm8BCmludGVnZXJLZXkEByRtYXRjaDAJAJoIAgUEdGhpcwUKaW50ZWdlcktleQMJAAECBQckbWF0Y2gwAgNJbnQEA3ZhbAUHJG1hdGNoMAUDdmFsAAABEGdldFN0cmluZ09yVGhyb3cBCXN0cmluZ0tleQQHJG1hdGNoMAkAnQgCBQR0aGlzBQlzdHJpbmdLZXkDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFzBQckbWF0Y2gwBQFzCQACAQkArAICCQCs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8y2fMxF2j5owy4bQXFUSaccdR Diff:
OldNewDifferences
5757 let targetRatio = 80
5858 let sum = (regularBalance + additional)
5959 let targetBalance = fraction(targetRatio, sum, 100)
60- let change = (targetBalance - additional)
60+ let change = (additional - targetBalance)
6161 let newReg = (regularBalance + change)
6262 $Tuple2(nil, [targetBalance, newReg])
6363 }
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 (regularBalance,additional) = {
5757 let targetRatio = 80
5858 let sum = (regularBalance + additional)
5959 let targetBalance = fraction(targetRatio, sum, 100)
60- let change = (targetBalance - additional)
60+ let change = (additional - targetBalance)
6161 let newReg = (regularBalance + change)
6262 $Tuple2(nil, [targetBalance, newReg])
6363 }
6464
6565

github/deemru/w8io/026f985 
38.63 ms