tx · FyUiMgrDR899JgkyHJNsKXGvjgCwNKrzrHsw2cQMLdqS 3NAyEmf6LcDGEDPTPdRS5Tmw7gHM5eYT282: -0.01000000 Waves 2022.08.15 22:16 [2185987] smart account 3NAyEmf6LcDGEDPTPdRS5Tmw7gHM5eYT282 > SELF 0.00000000 Waves
{ "type": 13, "id": "FyUiMgrDR899JgkyHJNsKXGvjgCwNKrzrHsw2cQMLdqS", "fee": 1000000, "feeAssetId": null, "timestamp": 1660591058362, "version": 2, "chainId": 84, "sender": "3NAyEmf6LcDGEDPTPdRS5Tmw7gHM5eYT282", "senderPublicKey": "41UVTJkibkjYf8R9TYLpLhyBumYYDk22tQNQXEZtAqMH", "proofs": [ "3VZoRv3M62wMRvo9RWHXmzyHWfo22PyBa2cZs2Gfz9EAqnxpRqNLn5HLQdpWQn7ykRDPZQQx8nfZbXtruWjeCny1" ], "script": "base64:BgIiCAISAwoBCBIAEgUKAwgIARIDCgEIEgASBQoDCAgIEgASABEABXdhdmVzAIDC1y8ADnRpY2tldFByaWNlSW50AMCEPQALdGlja2V0UHJpY2UFDnRpY2tldFByaWNlSW50AAZpbnZGZWUAoMIeABJ3aXRoZHJhd0ZlZVBlcmNlbnQABQAWZmVlQ29sbGVjdG9yQWRkcmVzc0tleQITZmVlQ29sbGVjdG9yQWRkcmVzcwAOZGVwb3NpdEFzc2V0SWQCLDV1ZTFmaXVWNmo2VUJyNlhmMjhRbXM2eTVGcXpLdHF2YXh4aHd1N2hUUTU4AQ10cnlHZXRJbnRlZ2VyAQNrZXkEByRtYXRjaDAJAJoIAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACA0ludAQBYgUHJG1hdGNoMAUBYgAAARJnZXRUaWNrZXRzQ291bnRLZXkBDWFkZHJlc3NTdHJpbmcJAKwCAgUNYWRkcmVzc1N0cmluZwINX3RpY2tldHNDb3VudAENZ2FtZVdpbm5lcktleQEGZ2FtZUlkCQCsAgIFBmdhbWVJZAIHX3dpbm5lcgEYYWRkcmVz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BWJ5dGVzBBNjdXJyZW50VGlja2V0c0NvdW50CQENdHJ5R2V0SW50ZWdlcgEJARJnZXRUaWNrZXRzQ291bnRLZXkBBQ1jYWxsZXJBZGRyU3RyCQCUCgIJAMwIAgkBDEludGVnZXJFbnRyeQIJARJnZXRUaWNrZXRzQ291bnRLZXkBBQ1jYWxsZXJBZGRyU3RyCQBkAgUTY3VycmVudFRpY2tldHNDb3VudAABBQNuaWwAAQECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXl3M7wF", "height": 2185987, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = 100000000 | |
5 | + | ||
6 | + | let b = 1000000 | |
7 | + | ||
8 | + | let c = b | |
9 | + | ||
10 | + | let d = 500000 | |
11 | + | ||
12 | + | let e = 5 | |
13 | + | ||
14 | + | let f = "feeCollectorAddress" | |
15 | + | ||
16 | + | let g = "5ue1fiuV6j6UBr6Xf28Qms6y5FqzKtqvaxxhwu7hTQ58" | |
17 | + | ||
18 | + | func h (i) = { | |
19 | + | let j = getInteger(this, i) | |
20 | + | if ($isInstanceOf(j, "Int")) | |
21 | + | then { | |
22 | + | let k = j | |
23 | + | k | |
24 | + | } | |
25 | + | else 0 | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | func l (m) = (m + "_ticketsCount") | |
30 | + | ||
31 | + | ||
32 | + | func n (o) = (o + "_winner") | |
33 | + | ||
34 | + | ||
35 | + | func p (q) = (q + "_availableFunds") | |
36 | + | ||
37 | + | ||
38 | + | func r (q) = (q + "_totalLockedFunds") | |
39 | + | ||
40 | + | ||
41 | + | func s (q) = (q + "_lockedFundsTotalHistory") | |
42 | + | ||
43 | + | ||
44 | + | func t (q,o) = ((q + "_lockedFunds_") + o) | |
45 | + | ||
46 | + | ||
47 | + | func u (q) = (q + "_availableRewards") | |
48 | + | ||
49 | + | ||
50 | + | func v (m) = h(l(m)) | |
51 | + | ||
52 | + | ||
53 | + | func w (x) = { | |
54 | + | let y = v(x) | |
55 | + | let z = (y - 1) | |
56 | + | if ((0 > z)) | |
57 | + | then 0 | |
58 | + | else z | |
59 | + | } | |
60 | + | ||
61 | + | ||
62 | + | @Callable(A) | |
63 | + | func setFeeCollectorAddress (B) = if ((A.caller != this)) | |
64 | + | then throw("Admin Only") | |
65 | + | else [StringEntry(f, B)] | |
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | @Callable(A) | |
70 | + | func depositFunds () = { | |
71 | + | let C = if ((size(A.payments) == 1)) | |
72 | + | then A.payments[0] | |
73 | + | else throw("Please attach exactly one payment") | |
74 | + | if ((C.assetId != fromBase58String(g))) | |
75 | + | then throw("You can only deposit USDN") | |
76 | + | else { | |
77 | + | let D = toBase58String(A.caller.bytes) | |
78 | + | let E = h(p(D)) | |
79 | + | $Tuple2([IntegerEntry(p(D), (E + C.amount))], 1) | |
80 | + | } | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | @Callable(A) | |
86 | + | func playerExitGame (o,x,F) = if ((A.caller != this)) | |
87 | + | then throw("Admin Only") | |
88 | + | else { | |
89 | + | let G = h(r(x)) | |
90 | + | let H = h(t(x, o)) | |
91 | + | $Tuple2([IntegerEntry(r(x), (G - H)), IntegerEntry(t(x, o), 0), ScriptTransfer(A.caller, F, fromBase58String(g))], 1) | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(A) | |
97 | + | func lockFundsForGame (o) = { | |
98 | + | let C = if ((size(A.payments) == 1)) | |
99 | + | then A.payments[0] | |
100 | + | else throw("Please attach exactly one payment") | |
101 | + | if ((C.assetId != fromBase58String(g))) | |
102 | + | then throw("You can only deposit USDN") | |
103 | + | else { | |
104 | + | let D = toBase58String(A.caller.bytes) | |
105 | + | let G = h(r(D)) | |
106 | + | let I = h(s(D)) | |
107 | + | $Tuple2([IntegerEntry(r(D), (G + C.amount)), IntegerEntry(s(D), (I + C.amount)), IntegerEntry(t(D, o), C.amount)], 1) | |
108 | + | } | |
109 | + | } | |
110 | + | ||
111 | + | ||
112 | + | ||
113 | + | @Callable(A) | |
114 | + | func withdrawFunds () = { | |
115 | + | let D = toBase58String(A.caller.bytes) | |
116 | + | let J = addressFromStringValue(getStringValue(f)) | |
117 | + | let E = h(p(D)) | |
118 | + | let K = fraction(E, e, 100) | |
119 | + | let L = (E - K) | |
120 | + | if ((0 >= L)) | |
121 | + | then throw("No available funds to withdraw") | |
122 | + | else [IntegerEntry(p(D), 0), ScriptTransfer(A.caller, L, fromBase58String(g)), ScriptTransfer(J, K, fromBase58String(g))] | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | @Callable(A) | |
128 | + | func setWinnerHeadsUp (o,M,N) = if ((A.caller != this)) | |
129 | + | then throw("Admin Only") | |
130 | + | else { | |
131 | + | let O = u(M) | |
132 | + | let P = h(O) | |
133 | + | let Q = w(M) | |
134 | + | let R = w(N) | |
135 | + | [StringEntry(n(o), M), IntegerEntry(O, (P + (c * 2))), IntegerEntry(l(M), Q), IntegerEntry(l(N), R)] | |
136 | + | } | |
137 | + | ||
138 | + | ||
139 | + | ||
140 | + | @Callable(A) | |
141 | + | func withdrawRewards () = { | |
142 | + | let D = toBase58String(A.caller.bytes) | |
143 | + | let J = addressFromStringValue(getStringValue(f)) | |
144 | + | let P = h(u(D)) | |
145 | + | let K = fraction(P, e, 100) | |
146 | + | let S = ((P - d) - K) | |
147 | + | if ((0 >= P)) | |
148 | + | then throw("No available rewards to withdraw") | |
149 | + | else [IntegerEntry(u(D), 0), ScriptTransfer(A.caller, S, unit), ScriptTransfer(J, K, unit)] | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(A) | |
155 | + | func buyTickets () = { | |
156 | + | let C = if ((size(A.payments) == 1)) | |
157 | + | then A.payments[0] | |
158 | + | else throw("Please attach exactly one payment") | |
159 | + | if (isDefined(C.assetId)) | |
160 | + | then throw("Tickets can only ibe purchased in Waves") | |
161 | + | else if ((C.amount != c)) | |
162 | + | then throw((("The payment must be of exactly " + toString(b)) + " waves")) | |
163 | + | else { | |
164 | + | let D = toBase58String(A.caller.bytes) | |
165 | + | let T = h(l(D)) | |
166 | + | $Tuple2([IntegerEntry(l(D), (T + 1))], 1) | |
167 | + | } | |
168 | + | } | |
169 | + | ||
170 | + | ||
171 | + | @Verifier(U) | |
172 | + | func V () = sigVerify(U.bodyBytes, U.proofs[0], U.senderPublicKey) | |
173 | + |
github/deemru/w8io/026f985 23.25 ms ◑