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:BgIOCAISABIAEgASBAoCAQEJAAxjb250cmFjdEZpbGUCCXJlYmFsYW5jZQAPa2V5c1RhcmdldFJhdGlvAg8lc19fdGFyZ2V0UmF0aW8AFGtleUFkZGl0aW9uYWxCYWxhbmNlAhslc19fYWRkaXR0aW9uYWxXYXZlc0JhbGFuY2UAGGtleVNXYXZlc0FkZGl0aW9uQmFsYW5jZQIRJXNfX3NXYXZlc0JhbGFuY2UAEGtleVNXYXZlc0Fzc2V0SWQCESVzX19zV2F2ZXNBc3NldElkAA9rZXlQcm94eUFkZHJlc3MCECVzX19wcm94eUFkZHJlc3MBEGdldEludGVnZXJPclplcm8BCmludGVnZXJLZXkEByRtYXRjaDAJAJoIAgUEdGhpcwUKaW50ZWdlcktleQMJAAECBQckbWF0Y2gwAgNJbnQEA3ZhbAUHJG1hdGNoMAUDdmFsAAABEGdldFN0cmluZ09yVGhyb3cBCXN0cmluZ0tleQQHJG1hdGNoMAkAnQgCBQR0aGlzBQlzdHJpbmdLZXkDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFzBQckbWF0Y2gwBQFzCQACAQkArAICCQCsA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y2fMxF2j5owy4bQXFUSaccdR Diff:
Old | New | Differences | |
---|---|---|---|
57 | 57 | let targetRatio = 80 | |
58 | 58 | let sum = (regularBalance + additional) | |
59 | 59 | let targetBalance = fraction(targetRatio, sum, 100) | |
60 | - | let change = ( | |
60 | + | let change = (additional - targetBalance) | |
61 | 61 | let newReg = (regularBalance + change) | |
62 | 62 | $Tuple2(nil, [targetBalance, newReg]) | |
63 | 63 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "rebalance" | |
5 | 5 | ||
6 | 6 | let keysTargetRatio = "%s__targetRatio" | |
7 | 7 | ||
8 | 8 | let keyAdditionalBalance = "%s__addittionalWavesBalance" | |
9 | 9 | ||
10 | 10 | let keySWavesAdditionBalance = "%s__sWavesBalance" | |
11 | 11 | ||
12 | 12 | let keySWavesAssetId = "%s__sWavesAssetId" | |
13 | 13 | ||
14 | 14 | let keyProxyAddress = "%s__proxyAddress" | |
15 | 15 | ||
16 | 16 | func getIntegerOrZero (integerKey) = match getInteger(this, integerKey) { | |
17 | 17 | case val: Int => | |
18 | 18 | val | |
19 | 19 | case _ => | |
20 | 20 | 0 | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func getStringOrThrow (stringKey) = match getString(this, stringKey) { | |
25 | 25 | case s: String => | |
26 | 26 | s | |
27 | 27 | case _ => | |
28 | 28 | throw((("[" + stringKey) + "] is empty")) | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func internalWavesBalance () = (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance)) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func returnWavesBalance () = $Tuple2(nil, internalWavesBalance()) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(i) | |
41 | 41 | func returnSWavesBalance () = $Tuple2(nil, getIntegerOrZero(keySWavesAdditionBalance)) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | 46 | func calcRatio () = { | |
47 | 47 | let regularWavesBalance = wavesBalance(this).regular | |
48 | 48 | let additional = getIntegerOrZero(keyAdditionalBalance) | |
49 | 49 | let ratio = fraction(100, additional, (additional + regularWavesBalance)) | |
50 | 50 | $Tuple2(nil, ratio) | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func calcRatioTest (regularBalance,additional) = { | |
57 | 57 | let targetRatio = 80 | |
58 | 58 | let sum = (regularBalance + additional) | |
59 | 59 | let targetBalance = fraction(targetRatio, sum, 100) | |
60 | - | let change = ( | |
60 | + | let change = (additional - targetBalance) | |
61 | 61 | let newReg = (regularBalance + change) | |
62 | 62 | $Tuple2(nil, [targetBalance, newReg]) | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 |
github/deemru/w8io/026f985 38.63 ms ◑