tx · 3xvDRTCdrDcZ8a3QBGxbDkaw8DMcXHXmXrcNicdCQjv4 3MyRvoZJL2s56N6TK8RX1iJZcCXZkc77hcX: -0.00700000 Waves 2023.04.25 22:30 [2550492] smart account 3MyRvoZJL2s56N6TK8RX1iJZcCXZkc77hcX > SELF 0.00000000 Waves
{ "type": 13, "id": "3xvDRTCdrDcZ8a3QBGxbDkaw8DMcXHXmXrcNicdCQjv4", "fee": 700000, "feeAssetId": null, "timestamp": 1682451074683, "version": 2, "chainId": 84, "sender": "3MyRvoZJL2s56N6TK8RX1iJZcCXZkc77hcX", "senderPublicKey": "Bj1Bhn537ibh7az2kjDvbHshLHPXpyCyHm3t4bFQQ73k", "proofs": [ "Zobj8s6UUdAJxus5UpWoYzvUofDY7oEmU2bq839uGy2Er6BXmKPZKxqUuYPtmJwBx8BBdfGkHCiy6Ujg3bPAjRp" ], "script": "base64:BgIJCAISAwoBCBIABwEPZ2V0QXNzZXRCYWxhbmNlAgdhZGRyZXNzB2Fzc2V0SWQEAWEJAPAHAgUHYWRkcmVzcwUHYXNzZXRJZAUBYQEPZ2V0V2F2ZXNCYWxhbmNlAQdhZGRyZXNzBAF3CAkA7wcBBQdhZGRyZXNzCWF2YWlsYWJsZQUBdwEKZ2V0QmFsYW5jZQIGcmVzdWx0B2Fzc2V0SWQEB2FkZHJlc3MJAK8CAgUGcmVzdWx0ACMEBGFkZHIJAQdBZGRyZXNzAQkA2QQBBQdhZGRyZXNzBAdiYWxhbmNlAwkAAAIFB2Fzc2V0SWQCBVdBVkVTCQEPZ2V0V2F2ZXNCYWxhbmNlAQUEYWRkcgQDYUlkCQDZBAEFB2Fzc2V0SWQJAQ9nZXRBc3NldEJhbGFuY2UCBQRhZGRyBQNhSWQEA2xlbgkAsQIBBQZyZXN1bHQJAKwCAgkArAICCQCsAgIJAKwCAgkArAICBQdhZGRyZXNzCQCwAgIFBnJlc3VsdAAjBQdhc3NldElkAgE6CQCkAwEFB2JhbGFuY2UCASwBB2RvUG9vb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"spentComplexity": 0 } View: original | compacted Prev: Dnr9ADQXeEXAdCZQPS6vAvCkzr44xSQ2rTLxJCN9P5ME Next: FLsVwa6FbPRYBnCWnKMn2x3oeRqd2D3jAJzhrVTDmxbH Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let ruler = "BgxpCm4wxbW8SKLPKZnf4KU2D6ZU29ov8MgZrkaSAqpY" | |
5 | - | ||
6 | - | let bobma_id = "5xyrUoJuXJcYxc8RfroWj4QeLaw6xhBfAdSreStYCRMn" | |
7 | - | ||
8 | - | let buggs_id = "H5UUuPJ7WBXzjg6Z1ahBUxj7VWoVFFfG3BMzyAAnRWt6" | |
9 | - | ||
10 | - | func getAssetString (assetId) = match assetId { | |
11 | - | case b: ByteVector => | |
12 | - | toBase58String(b) | |
13 | - | case _ => | |
14 | - | "WAVES" | |
15 | - | } | |
4 | + | func getAssetBalance (address,assetId) = { | |
5 | + | let a = assetBalance(address, assetId) | |
6 | + | a | |
7 | + | } | |
16 | 8 | ||
17 | 9 | ||
18 | - | func getAssetBytes (assetId) = if ((assetId == "WAVES")) | |
19 | - | then unit | |
20 | - | else fromBase58String(assetId) | |
10 | + | func getWavesBalance (address) = { | |
11 | + | let w = wavesBalance(address).available | |
12 | + | w | |
13 | + | } | |
21 | 14 | ||
22 | 15 | ||
23 | - | func myBalance (assetId) = match assetId { | |
24 | - | case b: ByteVector => | |
25 | - | assetBalance(this, b) | |
26 | - | case _ => | |
27 | - | wavesBalance(this).available | |
28 | - | } | |
16 | + | func getBalance (result,assetId) = { | |
17 | + | let address = take(result, 35) | |
18 | + | let addr = Address(fromBase58String(address)) | |
19 | + | let balance = if ((assetId == "WAVES")) | |
20 | + | then getWavesBalance(addr) | |
21 | + | else { | |
22 | + | let aId = fromBase58String(assetId) | |
23 | + | getAssetBalance(addr, aId) | |
24 | + | } | |
25 | + | let len = size(result) | |
26 | + | (((((address + drop(result, 35)) + assetId) + ":") + toString(balance)) + ",") | |
27 | + | } | |
28 | + | ||
29 | + | ||
30 | + | func doPools (poolParams) = { | |
31 | + | let arr = split_4C(poolParams, ";") | |
32 | + | let $t09491003 = $Tuple3(arr[0], arr[1], arr[2]) | |
33 | + | let address = $t09491003._1 | |
34 | + | let type = $t09491003._2 | |
35 | + | let assets = $t09491003._3 | |
36 | + | 0 | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | func test_loop (result,ele) = ele :: result | |
41 | + | ||
42 | + | ||
43 | + | func getBalancesStr (assetsStr,address) = { | |
44 | + | let assets = split_4C(assetsStr, ",") | |
45 | + | let res = { | |
46 | + | let $l = assets | |
47 | + | let $s = size($l) | |
48 | + | let $acc0 = address | |
49 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
50 | + | then $a | |
51 | + | else getBalance($a, $l[$i]) | |
52 | + | ||
53 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
54 | + | then $a | |
55 | + | else throw("List size exceeds 2") | |
56 | + | ||
57 | + | $f0_2($f0_1($f0_1($acc0, 0), 1), 2) | |
58 | + | } | |
59 | + | let balances = drop(res, 35) | |
60 | + | balances | |
61 | + | } | |
62 | + | ||
63 | + | ||
64 | + | func process (result,params) = { | |
65 | + | let arr = split_4C(params, ";") | |
66 | + | let $t014051462 = $Tuple3(arr[0], arr[1], arr[2]) | |
67 | + | let address = $t014051462._1 | |
68 | + | let type = $t014051462._2 | |
69 | + | let assetsStr = $t014051462._3 | |
70 | + | let assetsString = getBalancesStr(assetsStr, address) | |
71 | + | let resItem = ((address + "/") + assetsString) | |
72 | + | resItem :: result | |
73 | + | } | |
29 | 74 | ||
30 | 75 | ||
31 | 76 | @Callable(i) | |
32 | - | func exchange (minAmountToReceive) = { | |
33 | - | let bomba_balance = myBalance(getAssetBytes(bobma_id)) | |
34 | - | let buggs_balance = myBalance(getAssetBytes(buggs_id)) | |
35 | - | let pmt = i.payments[0] | |
36 | - | let assetIn = value(pmt.assetId) | |
37 | - | let amountIn = value(pmt.amount) | |
38 | - | let amountOut = (amountIn * 2) | |
39 | - | let assetOut = if ((getAssetString(assetIn) == bobma_id)) | |
40 | - | then buggs_id | |
41 | - | else bobma_id | |
42 | - | [ScriptTransfer(i.caller, amountOut, getAssetBytes(assetOut))] | |
77 | + | func getWX (params) = { | |
78 | + | let pools_params = split_4C(params, "|") | |
79 | + | let resArr = { | |
80 | + | let $l = pools_params | |
81 | + | let $s = size($l) | |
82 | + | let $acc0 = nil | |
83 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
84 | + | then $a | |
85 | + | else process($a, $l[$i]) | |
86 | + | ||
87 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
88 | + | then $a | |
89 | + | else throw("List size exceeds 80") | |
90 | + | ||
91 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80) | |
92 | + | } | |
93 | + | let result = makeString(resArr, "|") | |
94 | + | throw(result) | |
43 | 95 | } | |
44 | 96 | ||
45 | 97 | ||
46 | - | @Verifier(tx) | |
47 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
98 | + | ||
99 | + | @Callable(i) | |
100 | + | func test () = { | |
101 | + | let a = ["1", "2", "3", "4", "5"] | |
102 | + | let res = { | |
103 | + | let $l = a | |
104 | + | let $s = size($l) | |
105 | + | let $acc0 = nil | |
106 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
107 | + | then $a | |
108 | + | else test_loop($a, $l[$i]) | |
109 | + | ||
110 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
111 | + | then $a | |
112 | + | else throw("List size exceeds 10") | |
113 | + | ||
114 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
115 | + | } | |
116 | + | let result = makeString(res, "*") | |
117 | + | throw(result) | |
118 | + | } | |
119 | + | ||
48 | 120 |
github/deemru/w8io/169f3d6 32.14 ms ◑