tx · C9PbueCwr1Y7fe6WeHxFk5chD3WVsRiAwY6hS9JQ7iup
3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h: -0.05000000 Waves
2023.03.27 11:23 [2508137] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves
{
"type": 13,
"id": "C9PbueCwr1Y7fe6WeHxFk5chD3WVsRiAwY6hS9JQ7iup",
"fee": 5000000,
"feeAssetId": null,
"timestamp": 1679905434656,
"version": 2,
"chainId": 84,
"sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h",
"senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2",
"proofs": [
"3JS8wH8cmbSgeFZCfcDxqGXPZtaMjqieZLZ3FtgbqhRgm98yK95LngeAPFs3SNaF7d6GDkkvQtnLSafwpvWYtWCg"
],
"script": "base64:BgIKCAISABIAEgASAAkADGNvbnRyYWN0RmlsZQIJcmViYWxhbmNlAA9rZXlzVGFyZ2V0UmF0aW8CDyVzX190YXJnZXRSYXRpbwAUa2V5QWRkaXRpb25hbEJhbGFuY2UCGyVzX19hZGRpdHRpb25hbFdhdmVzQmFsYW5jZQAYa2V5U1dhdmVzQWRkaXRpb25CYWxhbmNlAhElc19fc1dhdmVzQmFsYW5jZQAQa2V5U1dhdmVzQXNzZXRJZAIRJXNfX3NXYXZlc0Fzc2V0SWQAD2tleVByb3h5QWRkcmVzcwIQJXNfX3Byb3h5QWRkcmVzcwEQZ2V0SW50ZWdlck9yWmVybwEKaW50ZWdlcktleQQHJG1hdGNoMAkAmggCBQR0aGlzBQppbnRlZ2VyS2V5AwkAAQIFByRtYXRjaDACA0ludAQDdmFsBQckbWF0Y2gwBQN2YWwAAAEQZ2V0U3RyaW5nT3JUaHJvdwEJc3RyaW5nS2V5BAckbWF0Y2gwCQCdCAIFBHRoaXMFCXN0cmluZ0tleQMJAAECBQckbWF0Y2gwAgZTdHJpbmcEAXMFByRtYXRjaDAFAXMJAAIBCQCsAgIJAKwCAgIBWwUJc3RyaW5nS2V5AgpdIGlzIGVtcHR5ARRpbnRlcm5hbFdhdmVzQmFsYW5jZQAJAGQCCAkA7wcBBQR0aGlzB3JlZ3VsYXIJARBnZXRJbnRlZ2VyT3JaZXJvAQUUa2V5QWRkaXRpb25hbEJhbGFuY2UEAWkBEnJldHVybldhdmVzQmFsYW5jZQAJAJQKAgUDbmlsCQEUaW50ZXJuYWxXYXZlc0JhbGFuY2UAAWkBE3JldHVyblNXYXZlc0JhbGFuY2UACQCUCgIFA25pbAkBEGdldEludGVnZXJPclplcm8BBRhrZXlTV2F2ZXNBZGRpdGlvbkJhbGFuY2UBaQEJY2FsY1JhdGlvAAQTcmVndWxhcldhdmVzQmFsYW5jZQgJAO8HAQUEdGhpcwdyZWd1bGFyBAphZGRpdGlvbmFsCQEQZ2V0SW50ZWdlck9yWmVybwEFFGtleUFkZGl0aW9uYWxCYWxhbmNlBAVyYXRpbwkAawMAZAUKYWRkaXRpb25hbAkAZAIFCmFkZGl0aW9uYWwFE3JlZ3VsYXJXYXZlc0JhbGFuY2UJAJQKAgUDbmlsBQVyYXRpbwFpAQ1jYWxjUmF0aW9UZXN0AAQTcmVndWxhcldhdmVzQmFsYW5jZQAVBAphZGRpdGlvbmFsAE8EBXJhdGlvCQBrAwBkBQphZGRpdGlvbmFsCQBkAgUKYWRkaXRpb25hbAUTcmVndWxhcldhdmVzQmFsYW5jZQkAlAoCBQNuaWwFBXJhdGlvAHlWxqI=",
"height": 2508137,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: DgNDjkTtE1qJoLncKwwuhSkn9hhDWxyYtnCEjpdNEQPY
Next: 368dhDXsJgRRhAaREpiijCUPN1DpH9Mg3Ekn9d7Eyfr1
Diff:
Old | New | | Differences |
---|
29 | 29 | | } |
---|
30 | 30 | | |
---|
31 | 31 | | |
---|
| 32 | + | func internalWavesBalance () = (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance)) |
---|
| 33 | + | |
---|
| 34 | + | |
---|
32 | 35 | | @Callable(i) |
---|
33 | | - | func returnWavesBalance () = $Tuple2(nil, (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance))) |
---|
| 36 | + | func returnWavesBalance () = $Tuple2(nil, internalWavesBalance()) |
---|
34 | 37 | | |
---|
35 | 38 | | |
---|
36 | 39 | | |
---|
37 | 40 | | @Callable(i) |
---|
38 | | - | func returnSWavesBalance () = { |
---|
39 | | - | let sWavesAsset = getString(this, keySWavesAssetId) |
---|
40 | | - | $Tuple2(nil, (assetBalance(this, fromBase58String(getStringOrThrow(keySWavesAssetId))) + getIntegerOrZero(keySWavesAdditionBalance))) |
---|
| 41 | + | func returnSWavesBalance () = $Tuple2(nil, getIntegerOrZero(keySWavesAdditionBalance)) |
---|
| 42 | + | |
---|
| 43 | + | |
---|
| 44 | + | |
---|
| 45 | + | @Callable(i) |
---|
| 46 | + | func calcRatio () = { |
---|
| 47 | + | let regularWavesBalance = wavesBalance(this).regular |
---|
| 48 | + | let additional = getIntegerOrZero(keyAdditionalBalance) |
---|
| 49 | + | let ratio = fraction(100, additional, (additional + regularWavesBalance)) |
---|
| 50 | + | $Tuple2(nil, ratio) |
---|
| 51 | + | } |
---|
| 52 | + | |
---|
| 53 | + | |
---|
| 54 | + | |
---|
| 55 | + | @Callable(i) |
---|
| 56 | + | func calcRatioTest () = { |
---|
| 57 | + | let regularWavesBalance = 21 |
---|
| 58 | + | let additional = 79 |
---|
| 59 | + | let ratio = fraction(100, additional, (additional + regularWavesBalance)) |
---|
| 60 | + | $Tuple2(nil, ratio) |
---|
41 | 61 | | } |
---|
42 | 62 | | |
---|
43 | 63 | | |
---|
Full:
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 | + | func internalWavesBalance () = (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance)) |
---|
| 33 | + | |
---|
| 34 | + | |
---|
32 | 35 | | @Callable(i) |
---|
33 | | - | func returnWavesBalance () = $Tuple2(nil, (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance))) |
---|
| 36 | + | func returnWavesBalance () = $Tuple2(nil, internalWavesBalance()) |
---|
34 | 37 | | |
---|
35 | 38 | | |
---|
36 | 39 | | |
---|
37 | 40 | | @Callable(i) |
---|
38 | | - | func returnSWavesBalance () = { |
---|
39 | | - | let sWavesAsset = getString(this, keySWavesAssetId) |
---|
40 | | - | $Tuple2(nil, (assetBalance(this, fromBase58String(getStringOrThrow(keySWavesAssetId))) + getIntegerOrZero(keySWavesAdditionBalance))) |
---|
| 41 | + | func returnSWavesBalance () = $Tuple2(nil, getIntegerOrZero(keySWavesAdditionBalance)) |
---|
| 42 | + | |
---|
| 43 | + | |
---|
| 44 | + | |
---|
| 45 | + | @Callable(i) |
---|
| 46 | + | func calcRatio () = { |
---|
| 47 | + | let regularWavesBalance = wavesBalance(this).regular |
---|
| 48 | + | let additional = getIntegerOrZero(keyAdditionalBalance) |
---|
| 49 | + | let ratio = fraction(100, additional, (additional + regularWavesBalance)) |
---|
| 50 | + | $Tuple2(nil, ratio) |
---|
| 51 | + | } |
---|
| 52 | + | |
---|
| 53 | + | |
---|
| 54 | + | |
---|
| 55 | + | @Callable(i) |
---|
| 56 | + | func calcRatioTest () = { |
---|
| 57 | + | let regularWavesBalance = 21 |
---|
| 58 | + | let additional = 79 |
---|
| 59 | + | let ratio = fraction(100, additional, (additional + regularWavesBalance)) |
---|
| 60 | + | $Tuple2(nil, ratio) |
---|
41 | 61 | | } |
---|
42 | 62 | | |
---|
43 | 63 | | |
---|