tx · 39yvcRfmHYPnTCvJ2LPt3zL5P5ZMge42LYtogVu5taBz 3NCcj24tXPAQ6NGTdBRJc6L4zjFHNh923zt: -0.01000000 Waves 2022.07.31 02:19 [2163206] smart account 3NCcj24tXPAQ6NGTdBRJc6L4zjFHNh923zt > SELF 0.00000000 Waves
{ "type": 13, "id": "39yvcRfmHYPnTCvJ2LPt3zL5P5ZMge42LYtogVu5taBz", "fee": 1000000, "feeAssetId": null, "timestamp": 1659223178439, "version": 2, "chainId": 84, "sender": "3NCcj24tXPAQ6NGTdBRJc6L4zjFHNh923zt", "senderPublicKey": "7LYrtjDsFoNCKLrAL7vM22FvDYszGSvJ8bv8avBqFWAG", "proofs": [ "ryqEwHd7Gm3TtFYr7NtLXsd1dpbQDq3tG4nvBqNjFEqTiKzibxvGPdAp2pwpP4HfwUQZzooJaNjARLtxvtsAncb" ], "script": "base64:BgIcCAISAwoBCBIAEgQKAggBEgASBQoDCAgIEgASAA8ABXdhdmVzAIDC1y8ADnRpY2tldFByaWNlSW50AMCEPQALdGlja2V0UHJpY2UFDnRpY2tldFByaWNlSW50AAZpbnZGZWUAoMIeABJ3aXRoZHJhd0ZlZVBlcmNlbnQABQAWZmVlQ29sbGVjdG9yQWRkcmVzc0tleQITZmVlQ29sbGVjdG9yQWRkcmVzcwENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAESZ2V0VGlja2V0c0NvdW50S2V5AQ1hZGRyZXNzU3RyaW5nCQCsAgIFDWFkZHJlc3NTdHJpbmcCDV90aWNrZXRzQ291bnQBDWdhbWVXaW5uZXJLZXkBBmdhbWVJZAkArAICBQZnYW1lSWQCB193aW5uZXIBGGFkZHJlc3NBdmFpbGFibGVGdW5kc0tleQEHYWRkcmVzcwkArAICBQdhZGRyZXNzAg9fYXZhaWxhYmxlRnVuZHMBGmFkZHJlc3NUb3RhbExv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ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5+7bZVA==", "height": 2163206, "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 | + | func g (h) = { | |
17 | + | let i = getInteger(this, h) | |
18 | + | if ($isInstanceOf(i, "Int")) | |
19 | + | then { | |
20 | + | let j = i | |
21 | + | j | |
22 | + | } | |
23 | + | else 0 | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | func k (l) = (l + "_ticketsCount") | |
28 | + | ||
29 | + | ||
30 | + | func m (n) = (n + "_winner") | |
31 | + | ||
32 | + | ||
33 | + | func o (p) = (p + "_availableFunds") | |
34 | + | ||
35 | + | ||
36 | + | func q (p) = (p + "_totalLockedFunds") | |
37 | + | ||
38 | + | ||
39 | + | func r (p,n) = ((p + "_lockedFunds_") + n) | |
40 | + | ||
41 | + | ||
42 | + | func s (p) = (p + "_availableRewards") | |
43 | + | ||
44 | + | ||
45 | + | func t (l) = g(k(l)) | |
46 | + | ||
47 | + | ||
48 | + | func u (v) = { | |
49 | + | let w = t(v) | |
50 | + | let x = (w - 1) | |
51 | + | if ((0 > x)) | |
52 | + | then 0 | |
53 | + | else x | |
54 | + | } | |
55 | + | ||
56 | + | ||
57 | + | @Callable(y) | |
58 | + | func setFeeCollectorAddress (z) = if ((y.caller != this)) | |
59 | + | then throw("Admin Only") | |
60 | + | else [StringEntry(f, z)] | |
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | @Callable(y) | |
65 | + | func depositFunds () = { | |
66 | + | let A = if ((size(y.payments) == 1)) | |
67 | + | then y.payments[0] | |
68 | + | else throw("Please attach exactly one payment") | |
69 | + | if (isDefined(A.assetId)) | |
70 | + | then throw("You can only deposit USDN") | |
71 | + | else { | |
72 | + | let B = toBase58String(y.caller.bytes) | |
73 | + | $Tuple2([IntegerEntry(o(B), A.amount)], 1) | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(y) | |
80 | + | func lockFundsForGame (n,C) = { | |
81 | + | let B = toBase58String(y.caller.bytes) | |
82 | + | let D = g(o(B)) | |
83 | + | let E = g(q(B)) | |
84 | + | if ((C > D)) | |
85 | + | then throw("Not enough available funds to lock") | |
86 | + | else $Tuple2([IntegerEntry(o(B), (D - C)), IntegerEntry(q(B), (E + C)), IntegerEntry(r(B, n), C)], 1) | |
87 | + | } | |
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | @Callable(y) | |
92 | + | func withdrawFunds () = { | |
93 | + | let B = toBase58String(y.caller.bytes) | |
94 | + | let F = addressFromStringValue(getStringValue(f)) | |
95 | + | let D = g(o(B)) | |
96 | + | let G = fraction(D, e, 100) | |
97 | + | let H = (D - G) | |
98 | + | if ((0 >= H)) | |
99 | + | then throw("No available funds to withdraw") | |
100 | + | else [IntegerEntry(o(B), 0), ScriptTransfer(y.caller, H, unit), ScriptTransfer(F, G, unit)] | |
101 | + | } | |
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | @Callable(y) | |
106 | + | func setWinnerHeadsUp (n,I,J) = if ((y.caller != this)) | |
107 | + | then throw("Admin Only") | |
108 | + | else { | |
109 | + | let K = s(I) | |
110 | + | let L = g(K) | |
111 | + | let M = u(I) | |
112 | + | let N = u(J) | |
113 | + | [StringEntry(m(n), I), IntegerEntry(K, (L + (c * 2))), IntegerEntry(k(I), M), IntegerEntry(k(J), N)] | |
114 | + | } | |
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | @Callable(y) | |
119 | + | func withdrawRewards () = { | |
120 | + | let B = toBase58String(y.caller.bytes) | |
121 | + | let F = addressFromStringValue(getStringValue(f)) | |
122 | + | let L = g(s(B)) | |
123 | + | let G = fraction(L, e, 100) | |
124 | + | let O = ((L - d) - G) | |
125 | + | if ((0 >= L)) | |
126 | + | then throw("No available rewards to withdraw") | |
127 | + | else [IntegerEntry(s(B), 0), ScriptTransfer(y.caller, O, unit), ScriptTransfer(F, G, unit)] | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | ||
132 | + | @Callable(y) | |
133 | + | func buyTickets () = { | |
134 | + | let A = if ((size(y.payments) == 1)) | |
135 | + | then y.payments[0] | |
136 | + | else throw("Please attach exactly one payment") | |
137 | + | if (isDefined(A.assetId)) | |
138 | + | then throw("Tickets can only ibe purchased in Waves") | |
139 | + | else if ((A.amount != c)) | |
140 | + | then throw((("The payment must be of exactly " + toString(b)) + " waves")) | |
141 | + | else { | |
142 | + | let B = toBase58String(y.caller.bytes) | |
143 | + | let P = g(k(B)) | |
144 | + | $Tuple2([IntegerEntry(k(B), (P + 1))], 1) | |
145 | + | } | |
146 | + | } | |
147 | + | ||
148 | + | ||
149 | + | @Verifier(Q) | |
150 | + | func R () = sigVerify(Q.bodyBytes, Q.proofs[0], Q.senderPublicKey) | |
151 | + |
github/deemru/w8io/169f3d6 25.63 ms ◑