tx · DgNDjkTtE1qJoLncKwwuhSkn9hhDWxyYtnCEjpdNEQPY
3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h: -0.05000000 Waves
2023.03.27 10:34 [2508090] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves
{
"type": 13,
"id": "DgNDjkTtE1qJoLncKwwuhSkn9hhDWxyYtnCEjpdNEQPY",
"fee": 5000000,
"feeAssetId": null,
"timestamp": 1679902493735,
"version": 2,
"chainId": 84,
"sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h",
"senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2",
"proofs": [
"23TyfgfTQFXzKmrFbQisMwCdjCYMUBJGBXKj8z8abvW9ekW3CxBD3BmirdePh41qbKYW5q2Skf48Fc8KAqK2bJzM"
],
"script": "base64:BgIGCAISABIACAAMY29udHJhY3RGaWxlAglyZWJhbGFuY2UAD2tleXNUYXJnZXRSYXRpbwIPJXNfX3RhcmdldFJhdGlvABRrZXlBZGRpdGlvbmFsQmFsYW5jZQIbJXNfX2FkZGl0dGlvbmFsV2F2ZXNCYWxhbmNlABhrZXlTV2F2ZXNBZGRpdGlvbkJhbGFuY2UCESVzX19zV2F2ZXNCYWxhbmNlABBrZXlTV2F2ZXNBc3NldElkAhElc19fc1dhdmVzQXNzZXRJZAAPa2V5UHJveHlBZGRyZXNzAhAlc19fcHJveHlBZGRyZXNzARBnZXRJbnRlZ2VyT3JaZXJvAQppbnRlZ2VyS2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmludGVnZXJLZXkDCQABAgUHJG1hdGNoMAIDSW50BAN2YWwFByRtYXRjaDAFA3ZhbAAAARBnZXRTdHJpbmdPclRocm93AQlzdHJpbmdLZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUJc3RyaW5nS2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAUBcwkAAgEJAKwCAgkArAICAgFbBQlzdHJpbmdLZXkCCl0gaXMgZW1wdHkCAWkBEnJldHVybldhdmVzQmFsYW5jZQAJAJQKAgUDbmlsCQBkAggJAO8HAQUEdGhpcwdyZWd1bGFyCQEQZ2V0SW50ZWdlck9yWmVybwEFFGtleUFkZGl0aW9uYWxCYWxhbmNlAWkBE3JldHVyblNXYXZlc0JhbGFuY2UABAtzV2F2ZXNBc3NldAkAnQgCBQR0aGlzBRBrZXlTV2F2ZXNBc3NldElkCQCUCgIFA25pbAkAZAIJAPAHAgUEdGhpcwkA2QQBCQEQZ2V0U3RyaW5nT3JUaHJvdwEFEGtleVNXYXZlc0Fzc2V0SWQJARBnZXRJbnRlZ2VyT3JaZXJvAQUYa2V5U1dhdmVzQWRkaXRpb25CYWxhbmNlADhSuZw=",
"height": 2508090,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 2UTREQJdDQs8jDE9FDMFWNyX5eAJ1jw1oSaYXXRuzFks
Next: C9PbueCwr1Y7fe6WeHxFk5chD3WVsRiAwY6hS9JQ7iup
Diff:
Old | New | | Differences |
---|
13 | 13 | | |
---|
14 | 14 | | let keyProxyAddress = "%s__proxyAddress" |
---|
15 | 15 | | |
---|
16 | | - | func getAdditionalBalanceOrZero () = match getInteger(this, keyAdditionalBalance) { |
---|
17 | | - | case bal: Int => |
---|
18 | | - | bal |
---|
| 16 | + | func getIntegerOrZero (integerKey) = match getInteger(this, integerKey) { |
---|
| 17 | + | case val: Int => |
---|
| 18 | + | val |
---|
19 | 19 | | case _ => |
---|
20 | 20 | | 0 |
---|
21 | 21 | | } |
---|
22 | 22 | | |
---|
23 | 23 | | |
---|
| 24 | + | func getStringOrThrow (stringKey) = match getString(this, stringKey) { |
---|
| 25 | + | case s: String => |
---|
| 26 | + | s |
---|
| 27 | + | case _ => |
---|
| 28 | + | throw((("[" + stringKey) + "] is empty")) |
---|
| 29 | + | } |
---|
| 30 | + | |
---|
| 31 | + | |
---|
24 | 32 | | @Callable(i) |
---|
25 | | - | func returnBalance () = $Tuple2(nil, (wavesBalance(this).regular + getAdditionalBalanceOrZero())) |
---|
| 33 | + | func returnWavesBalance () = $Tuple2(nil, (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance))) |
---|
| 34 | + | |
---|
| 35 | + | |
---|
| 36 | + | |
---|
| 37 | + | @Callable(i) |
---|
| 38 | + | func returnSWavesBalance () = { |
---|
| 39 | + | let sWavesAsset = getString(this, keySWavesAssetId) |
---|
| 40 | + | $Tuple2(nil, (assetBalance(this, fromBase58String(getStringOrThrow(keySWavesAssetId))) + getIntegerOrZero(keySWavesAdditionBalance))) |
---|
| 41 | + | } |
---|
26 | 42 | | |
---|
27 | 43 | | |
---|
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 | | - | func getAdditionalBalanceOrZero () = match getInteger(this, keyAdditionalBalance) { |
---|
17 | | - | case bal: Int => |
---|
18 | | - | bal |
---|
| 16 | + | func getIntegerOrZero (integerKey) = match getInteger(this, integerKey) { |
---|
| 17 | + | case val: Int => |
---|
| 18 | + | val |
---|
19 | 19 | | case _ => |
---|
20 | 20 | | 0 |
---|
21 | 21 | | } |
---|
22 | 22 | | |
---|
23 | 23 | | |
---|
| 24 | + | func getStringOrThrow (stringKey) = match getString(this, stringKey) { |
---|
| 25 | + | case s: String => |
---|
| 26 | + | s |
---|
| 27 | + | case _ => |
---|
| 28 | + | throw((("[" + stringKey) + "] is empty")) |
---|
| 29 | + | } |
---|
| 30 | + | |
---|
| 31 | + | |
---|
24 | 32 | | @Callable(i) |
---|
25 | | - | func returnBalance () = $Tuple2(nil, (wavesBalance(this).regular + getAdditionalBalanceOrZero())) |
---|
| 33 | + | func returnWavesBalance () = $Tuple2(nil, (wavesBalance(this).regular + getIntegerOrZero(keyAdditionalBalance))) |
---|
| 34 | + | |
---|
| 35 | + | |
---|
| 36 | + | |
---|
| 37 | + | @Callable(i) |
---|
| 38 | + | func returnSWavesBalance () = { |
---|
| 39 | + | let sWavesAsset = getString(this, keySWavesAssetId) |
---|
| 40 | + | $Tuple2(nil, (assetBalance(this, fromBase58String(getStringOrThrow(keySWavesAssetId))) + getIntegerOrZero(keySWavesAdditionBalance))) |
---|
| 41 | + | } |
---|
26 | 42 | | |
---|
27 | 43 | | |
---|