tx · F4LhcqZYvbaG74MnUZNpdS4iM6rMcfBaF5c3ZLTdKpyM 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx: -0.01000000 Waves 2023.02.17 09:28 [2453257] smart account 3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx > SELF 0.00000000 Waves
{ "type": 13, "id": "F4LhcqZYvbaG74MnUZNpdS4iM6rMcfBaF5c3ZLTdKpyM", "fee": 1000000, "feeAssetId": null, "timestamp": 1676615324744, "version": 2, "chainId": 84, "sender": "3Mr7HCJPTazuYjJbfbbpRMvZX8xrNTjT1Kx", "senderPublicKey": "D35PGQCSSdrp9pvujggj7b2DaCK1BhcU3kho7tikKJYs", "proofs": [ "2igQPWLaTEBBa3kwt8sunk3ER45KhjbpGJqro42jU1hyFnrQKvzDsYQgv8L23wG59fhmyd31GjN2Z4UnD1TmHmX7" ], "script": "base64:BgIaCAISABIDCgEBEgQKAhgREgQKAggBEgMKAQgBAAR0VVNEASCrJEpqtkJG69L843mwYbrDrmlXTVJ6ykUcp0AdEbApDgUBaQEHZGVwb3NpdAAEA3BtdAkAkQMCCQEFdmFsdWUBCAUBaQhwYXltZW50cwAAAwkBCWlzRGVmaW5lZAEIBQNwbXQHYXNzZXRJZAkAAgECIWNhbiBob2RsIHdhdmVzIG9ubHkgYXQgdGhlIG1vbWVudAMJAQIhPQIIBQNwbXQHYXNzZXRJZAUEdFVTRAkAAgECF2hvbGRlZCBwYXltZW50IG5vdCB0VVNEBApjdXJyZW50S2V5CQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMEDWN1cnJlbnRBbW91bnQEByRtYXRjaDAJAJoIAgUEdGhpcwUKY3VycmVudEtleQMJAAECBQckbWF0Y2gwAgNJbnQEAWEFByRtYXRjaDAFAWEAAAQJbmV3QW1vdW50CQBkAgUNY3VycmVudEFtb3VudAgFA3BtdAZhbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIFCmN1cnJlbnRLZXkFCW5ld0Ftb3VudAU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ded", "spentComplexity": 0 } View: original | compacted Prev: 63b8Fc3aNNDxvaPTY4FtDMpRAJHiuKqHjkNN3y4qUHe2 Next: 4q1xdM2iyqiSDxLytspKghbxdJXXWkhaA3hbPT1wRMqD Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | ||
4 | + | let tUSD = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85' | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func deposit () = { | |
8 | 8 | let pmt = value(i.payments)[0] | |
9 | 9 | if (isDefined(pmt.assetId)) | |
10 | 10 | then throw("can hodl waves only at the moment") | |
11 | - | else { | |
12 | - | let currentKey = toBase58String(i.caller.bytes) | |
13 | - | let currentAmount = match getInteger(this, currentKey) { | |
14 | - | case a: Int => | |
15 | - | a | |
16 | - | case _ => | |
17 | - | 0 | |
18 | - | } | |
19 | - | let newAmount = (currentAmount + pmt.amount) | |
11 | + | else if ((pmt.assetId != tUSD)) | |
12 | + | then throw("holded payment not tUSD") | |
13 | + | else { | |
14 | + | let currentKey = toBase58String(i.caller.bytes) | |
15 | + | let currentAmount = match getInteger(this, currentKey) { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | let newAmount = (currentAmount + pmt.amount) | |
20 | 22 | [IntegerEntry(currentKey, newAmount)] | |
21 | - | } | |
23 | + | } | |
22 | 24 | } | |
23 | 25 | ||
24 | 26 | ||
57 | 59 | throw("Match error") | |
58 | 60 | } | |
59 | 61 | func addStringEntry (accum,nextValue) = { | |
60 | - | let $ | |
61 | - | let result = $ | |
62 | - | let j = $ | |
62 | + | let $t026292652 = accum | |
63 | + | let result = $t026292652._1 | |
64 | + | let j = $t026292652._2 | |
63 | 65 | $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1)) | |
64 | 66 | } | |
65 | 67 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | ||
4 | + | let tUSD = base58'CX4p6XcuSBUvv44r1avCqYka5PYAVzBK5hSXaT7maU85' | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func deposit () = { | |
8 | 8 | let pmt = value(i.payments)[0] | |
9 | 9 | if (isDefined(pmt.assetId)) | |
10 | 10 | then throw("can hodl waves only at the moment") | |
11 | - | else { | |
12 | - | let currentKey = toBase58String(i.caller.bytes) | |
13 | - | let currentAmount = match getInteger(this, currentKey) { | |
14 | - | case a: Int => | |
15 | - | a | |
16 | - | case _ => | |
17 | - | 0 | |
18 | - | } | |
19 | - | let newAmount = (currentAmount + pmt.amount) | |
11 | + | else if ((pmt.assetId != tUSD)) | |
12 | + | then throw("holded payment not tUSD") | |
13 | + | else { | |
14 | + | let currentKey = toBase58String(i.caller.bytes) | |
15 | + | let currentAmount = match getInteger(this, currentKey) { | |
16 | + | case a: Int => | |
17 | + | a | |
18 | + | case _ => | |
19 | + | 0 | |
20 | + | } | |
21 | + | let newAmount = (currentAmount + pmt.amount) | |
20 | 22 | [IntegerEntry(currentKey, newAmount)] | |
21 | - | } | |
23 | + | } | |
22 | 24 | } | |
23 | 25 | ||
24 | 26 | ||
25 | 27 | ||
26 | 28 | @Callable(i) | |
27 | 29 | func withdraw (amount) = { | |
28 | 30 | let currentKey = toBase58String(i.caller.bytes) | |
29 | 31 | let currentAmount = match getInteger(this, currentKey) { | |
30 | 32 | case a: Int => | |
31 | 33 | a | |
32 | 34 | case _ => | |
33 | 35 | 0 | |
34 | 36 | } | |
35 | 37 | let newAmount = (currentAmount - amount) | |
36 | 38 | if ((0 > amount)) | |
37 | 39 | then throw("Can't withdraw negative amount") | |
38 | 40 | else if ((0 > newAmount)) | |
39 | 41 | then throw("Not enough balance") | |
40 | 42 | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
41 | 43 | } | |
42 | 44 | ||
43 | 45 | ||
44 | 46 | ||
45 | 47 | @Callable(i) | |
46 | 48 | func setOptions (opts,vals) = { | |
47 | 49 | let opt_size = size(opts) | |
48 | 50 | if ((100 >= opt_size)) | |
49 | 51 | then { | |
50 | 52 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
51 | 53 | let adminList = match getString(options_addr, "admin_list") { | |
52 | 54 | case _: Unit => | |
53 | 55 | "unset" | |
54 | 56 | case x: String => | |
55 | 57 | x | |
56 | 58 | case _ => | |
57 | 59 | throw("Match error") | |
58 | 60 | } | |
59 | 61 | func addStringEntry (accum,nextValue) = { | |
60 | - | let $ | |
61 | - | let result = $ | |
62 | - | let j = $ | |
62 | + | let $t026292652 = accum | |
63 | + | let result = $t026292652._1 | |
64 | + | let j = $t026292652._2 | |
63 | 65 | $Tuple2((result :+ IntegerEntry(opts[j], nextValue)), (j + 1)) | |
64 | 66 | } | |
65 | 67 | ||
66 | 68 | let r = { | |
67 | 69 | let $l = vals | |
68 | 70 | let $s = size($l) | |
69 | 71 | let $acc0 = $Tuple2(nil, 0) | |
70 | 72 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
71 | 73 | then $a | |
72 | 74 | else addStringEntry($a, $l[$i]) | |
73 | 75 | ||
74 | 76 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
75 | 77 | then $a | |
76 | 78 | else throw("List size exceeds 100") | |
77 | 79 | ||
78 | 80 | $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($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), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
79 | 81 | } | |
80 | 82 | let callerAddressStr = toString(i.caller) | |
81 | 83 | if ((adminList != "unset")) | |
82 | 84 | then { | |
83 | 85 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
84 | 86 | let isAdmin = match test { | |
85 | 87 | case x: String => | |
86 | 88 | x | |
87 | 89 | case _: Unit => | |
88 | 90 | "no admin" | |
89 | 91 | case _ => | |
90 | 92 | throw("Match error") | |
91 | 93 | } | |
92 | 94 | func add_elm (options) = { | |
93 | 95 | let opt = split(options, "|") | |
94 | 96 | StringEntry(opt[0], opt[1]) | |
95 | 97 | } | |
96 | 98 | ||
97 | 99 | if ((isAdmin != "no admin")) | |
98 | 100 | then r | |
99 | 101 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
100 | 102 | } | |
101 | 103 | else throw("Unset admin list") | |
102 | 104 | } | |
103 | 105 | else throw("The number of list elements must not exceed 100") | |
104 | 106 | } | |
105 | 107 | ||
106 | 108 | ||
107 | 109 | ||
108 | 110 | @Callable(i) | |
109 | 111 | func setOption (variable,value) = { | |
110 | 112 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
111 | 113 | let adminList = match getString(options_addr, "admin_list") { | |
112 | 114 | case _: Unit => | |
113 | 115 | "unset" | |
114 | 116 | case x: String => | |
115 | 117 | x | |
116 | 118 | case _ => | |
117 | 119 | throw("Match error") | |
118 | 120 | } | |
119 | 121 | let callerAddressStr = toString(i.caller) | |
120 | 122 | if ((adminList != "unset")) | |
121 | 123 | then { | |
122 | 124 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
123 | 125 | let isAdmin = match test { | |
124 | 126 | case x: String => | |
125 | 127 | x | |
126 | 128 | case _: Unit => | |
127 | 129 | "no admin" | |
128 | 130 | case _ => | |
129 | 131 | throw("Match error") | |
130 | 132 | } | |
131 | 133 | if ((isAdmin != "no admin")) | |
132 | 134 | then $Tuple2([IntegerEntry(variable, value)], unit) | |
133 | 135 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
134 | 136 | } | |
135 | 137 | else throw("Unset admin list") | |
136 | 138 | } | |
137 | 139 | ||
138 | 140 | ||
139 | 141 | ||
140 | 142 | @Callable(i) | |
141 | 143 | func delOption (variable) = { | |
142 | 144 | let options_addr = Address(base58'3MusfsY6PqDh1YnF7YyTi5ffVT16Dm2bqf6') | |
143 | 145 | let adminList = match getString(options_addr, "admin_list") { | |
144 | 146 | case _: Unit => | |
145 | 147 | "unset" | |
146 | 148 | case x: String => | |
147 | 149 | x | |
148 | 150 | case _ => | |
149 | 151 | throw("Match error") | |
150 | 152 | } | |
151 | 153 | let callerAddressStr = toString(i.caller) | |
152 | 154 | if ((adminList != "unset")) | |
153 | 155 | then { | |
154 | 156 | let test = getString(addressFromStringValue(adminList), callerAddressStr) | |
155 | 157 | let isAdmin = match test { | |
156 | 158 | case x: String => | |
157 | 159 | x | |
158 | 160 | case _: Unit => | |
159 | 161 | "no admin" | |
160 | 162 | case _ => | |
161 | 163 | throw("Match error") | |
162 | 164 | } | |
163 | 165 | if ((isAdmin != "no admin")) | |
164 | 166 | then $Tuple2([DeleteEntry(variable)], unit) | |
165 | 167 | else throw((((((("You not admin: " + adminList) + ", isAdmin: ") + isAdmin) + ", callerAddressStr: ") + callerAddressStr) + ", ")) | |
166 | 168 | } | |
167 | 169 | else throw("Unset admin list") | |
168 | 170 | } | |
169 | 171 | ||
170 | 172 | ||
171 | 173 | @Verifier(tx) | |
172 | 174 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
173 | 175 |
github/deemru/w8io/169f3d6 37.41 ms ◑