tx · 6n8xxwoN5cu5DJQQ77kUaFKvF7y7nvhv1zkcEHonAHGA 3NCzUsFn22SqL6SiuFpRSo8VRj6XpBzNCTK: -0.00800000 Waves 2022.06.27 19:13 [2115064] smart account 3NCzUsFn22SqL6SiuFpRSo8VRj6XpBzNCTK > SELF 0.00000000 Waves
{ "type": 13, "id": "6n8xxwoN5cu5DJQQ77kUaFKvF7y7nvhv1zkcEHonAHGA", "fee": 800000, "feeAssetId": null, "timestamp": 1656346400021, "version": 2, "chainId": 84, "sender": "3NCzUsFn22SqL6SiuFpRSo8VRj6XpBzNCTK", "senderPublicKey": "8tc6RQVnwQMdDY1k9GxP7EvBttrJT2a6GeBMQHEsKnW7", "proofs": [ "5vQzMixmkMcSi3UTs5MuGiTXJT1F9S6XoVTzPAESavWBfjSi9h46jmiNDra3Sb85JaS5DLWejB8MBXndterGsVis" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAIAAAAAAVmYXJtcwkABEwAAAACAgAAAARiZXRhCQAETAAAAAICAAAABG1ldGEJAARMAAAAAgIAAAAEemV0YQUAAAADbmlsAQAAAAZnZXRTdHIAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAAAQAAAAZnZXRJbnQAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAEAAAAFc3Rha2UAAAACAAAABGZhcm0AAAAGYW1vdW50BAAAAAdhc3NldElkCQACWQAAAAEJAQAAAAZnZXRTdHIAAAABCQABLAAAAAIFAAAABGZhcm0CAAAAA19pZAQAAAAEZEFwcAkBAAAABmdldFN0cgAAAAEJAAEsAAAAAgUA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GYwXzEAAAACCQEAAAAFJGYwXzEAAAACCQEAAAAFJGYwXzEAAAACBQAAAAUkYWNjMAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAgAAAAAAAAAAAwkAAAIAAAABAgAAACBQcml2YXRlIEZhcm0uIEFjY2VzcyBwcm9oaWJpdGVkIQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5ilPU0Q==", "height": 2115064, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J7y1yAku4bVWHWGktE21QGsWY8JNsp8PA4Ru6wjkSsTc Next: none Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | let dApp = getStr((farm + "_st")) | |
37 | 37 | let balance = assetBalance(this, assetId) | |
38 | 38 | if ((amount == -1)) | |
39 | - | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [false], | |
39 | + | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [-1, false], nil) | |
40 | 40 | else if ((balance >= amount)) | |
41 | - | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [false], | |
41 | + | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [amount, false], nil) | |
42 | 42 | else throw(((("Low balance: " + toString(balance)) + " and need: ") + toString(amount))) | |
43 | 43 | } | |
44 | 44 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let farms = ["beta", "meta", "zeta"] | |
5 | 5 | ||
6 | 6 | func getStr (key) = match getString(this, key) { | |
7 | 7 | case b: String => | |
8 | 8 | b | |
9 | 9 | case _ => | |
10 | 10 | "" | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func getInt (key) = match getInteger(this, key) { | |
15 | 15 | case b: Int => | |
16 | 16 | b | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func stake (farm,amount) = { | |
23 | 23 | let assetId = fromBase58String(getStr((farm + "_id"))) | |
24 | 24 | let dApp = getStr((farm + "_st")) | |
25 | 25 | let balance = assetBalance(this, assetId) | |
26 | 26 | if ((amount == -1)) | |
27 | 27 | then invoke(Address(fromBase58String(dApp)), "stakeFarmTokens", [false], [AttachedPayment(assetId, balance)]) | |
28 | 28 | else if ((balance >= amount)) | |
29 | 29 | then invoke(Address(fromBase58String(dApp)), "stakeFarmTokens", [false], [AttachedPayment(assetId, amount)]) | |
30 | 30 | else throw(((("Low balance: " + toString(balance)) + " and need: ") + toString(amount))) | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func unstake (farm,amount) = { | |
35 | 35 | let assetId = fromBase58String(getStr((farm + "_id"))) | |
36 | 36 | let dApp = getStr((farm + "_st")) | |
37 | 37 | let balance = assetBalance(this, assetId) | |
38 | 38 | if ((amount == -1)) | |
39 | - | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [false], | |
39 | + | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [-1, false], nil) | |
40 | 40 | else if ((balance >= amount)) | |
41 | - | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [false], | |
41 | + | then invoke(Address(fromBase58String(dApp)), "withdrawFarmTokens", [amount, false], nil) | |
42 | 42 | else throw(((("Low balance: " + toString(balance)) + " and need: ") + toString(amount))) | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func check (pbk) = { | |
47 | 47 | let pbk_st = toBase58String(pbk) | |
48 | 48 | let points = getStringValue("points") | |
49 | 49 | contains(points, pbk_st) | |
50 | 50 | } | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func iterStake (acc,farm) = { | |
54 | 54 | let rez = stake(farm, -1) | |
55 | 55 | match rez { | |
56 | 56 | case t: ScriptTransfer => | |
57 | 57 | (acc ++ [rez]) | |
58 | 58 | case _ => | |
59 | 59 | acc | |
60 | 60 | } | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func iterUnstake (acc,farm) = { | |
65 | 65 | let rez = unstake(farm, -1) | |
66 | 66 | match rez { | |
67 | 67 | case t: ScriptTransfer => | |
68 | 68 | (acc ++ [rez]) | |
69 | 69 | case _ => | |
70 | 70 | acc | |
71 | 71 | } | |
72 | 72 | } | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | @Callable(i) | |
76 | 76 | func StakeAndClaimAll () = if (check(i.callerPublicKey)) | |
77 | 77 | then { | |
78 | 78 | let $l = farms | |
79 | 79 | let $s = size($l) | |
80 | 80 | let $acc0 = nil | |
81 | 81 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
82 | 82 | then $a | |
83 | 83 | else iterStake($a, $l[$i]) | |
84 | 84 | ||
85 | 85 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
86 | 86 | then $a | |
87 | 87 | else throw("List size exceeds 3") | |
88 | 88 | ||
89 | 89 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
90 | 90 | } | |
91 | 91 | else throw("Private Farm. Access prohibited!") | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | @Callable(i) | |
96 | 96 | func UnstakeAll () = if (check(i.callerPublicKey)) | |
97 | 97 | then { | |
98 | 98 | let $l = farms | |
99 | 99 | let $s = size($l) | |
100 | 100 | let $acc0 = nil | |
101 | 101 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
102 | 102 | then $a | |
103 | 103 | else iterUnstake($a, $l[$i]) | |
104 | 104 | ||
105 | 105 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
106 | 106 | then $a | |
107 | 107 | else throw("List size exceeds 3") | |
108 | 108 | ||
109 | 109 | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
110 | 110 | } | |
111 | 111 | else throw("Private Farm. Access prohibited!") | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Verifier(tx) | |
115 | 115 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
116 | 116 |
github/deemru/w8io/169f3d6 28.18 ms ◑