tx · DzCd7V7HAQVDTTyduKdnwjAS2zSTaiji9XSasPhbtJbV 3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9: -0.01400000 Waves 2022.01.10 19:17 [1873057] smart account 3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9 > SELF 0.00000000 Waves
{ "type": 13, "id": "DzCd7V7HAQVDTTyduKdnwjAS2zSTaiji9XSasPhbtJbV", "fee": 1400000, "feeAssetId": null, "timestamp": 1641831473116, "version": 2, "chainId": 84, "sender": "3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9", "senderPublicKey": "HwnFy5MZJ9eyVKF9GSXN8nuA5uT2rcvnVqHw9vCv3DNn", "proofs": [ "6nby6j8guRjNBV548WUNT8RBcgupQSKvtSzy9AfherPbFijWKqen4nJmsZJeqEdJu6DEUr3WYou8gQu2E9Vaqag" ], "script": "base64:AAIFAAAAAAAAAiMIAhIAEgMKAQgSAwoBBBIAEgAaFAoBQRIPYWxyZWFkeVJlc2VydmVkGhQKAUISD3JlbWFpbmluZ1Rva2VucxoPCgFDEgpyZXNlcnZhYmxlGhUKAUQSEHJlbWFpbmluZ1Rva2VuczIaDQoBRRIIdG9SZWRlZW0aDgoBRhIJcmVtYWluaW5nGg8KAWESCnNoaW55d2dnaWQaEQoBYhIMYWRtaW5BZGRyZXNzGhcKAWMSEnByZXNhbGV0b2tlbmFtb3VudBoYCgFkEhNtYXhUb2tlbnNwZXJBZGRyZXNzGgkKAWUSBHVzZE4aEgoBZhINdHJ5R2V0SW50ZWdlchoICgFnEgNrZXkaDAoBaBIHJG1hdGNoMBoGCgFpEgFiGhIKAWoSDXRyeUdldEJvb2xlYW4aEgoBaxINaXNHYW1lU3RhcnRlZBoSCgFsEg1pc1doaXRlTGlzdGVkGg8KAW0SCmFkZHJlc3NTdHIaFgoBbhIRY2FsY1Rva2VudG9SZWRlZW0aCQoBbxIEYW1udBoQCgFwEgtzdGFydEhlaWdodBoNCgFxEghyZWRlZW1lZBoN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AAAFxBQAAAAFhBQAAAANuaWwJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAAE3lvdSBjYW4gcmVkZWVtIG1heCAJAAGkAAAAAQUAAAABRgIAAAAGIFNIRUdHAAAAAGSlcsc=", "height": 1873057, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3tRD2kAddgKNrytVnVoi34vvRXNYXURj4i7rW77UksbD Next: 4iL5jmBbxnik4VbSWPCxUqr4SVsA1XTdQ7679zgtn3s2 Diff:
Old | New | Differences | |
---|---|---|---|
140 | 140 | else { | |
141 | 141 | let E = n(z, m) | |
142 | 142 | let F = (z - q) | |
143 | - | if (( | |
143 | + | if ((F >= E)) | |
144 | 144 | then [IntegerEntry((m + "_Redeemed"), (q + E)), ScriptTransfer(t.caller, q, a)] | |
145 | 145 | else throw((("you can redeem max " + toString(F)) + " SHEGG")) | |
146 | 146 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | 5 | ||
6 | 6 | let b = addressFromStringValue("3N2fmsxjTetfnJBXEUpnALKcAQeNR4EizQQ") | |
7 | 7 | ||
8 | 8 | let c = 50000000000000 | |
9 | 9 | ||
10 | 10 | let d = 10000 | |
11 | 11 | ||
12 | 12 | let e = unit | |
13 | 13 | ||
14 | 14 | func f (g) = { | |
15 | 15 | let h = getInteger(this, g) | |
16 | 16 | if ($isInstanceOf(h, "Int")) | |
17 | 17 | then { | |
18 | 18 | let i = h | |
19 | 19 | i | |
20 | 20 | } | |
21 | 21 | else 0 | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func j (g) = { | |
26 | 26 | let h = getBoolean(this, g) | |
27 | 27 | if ($isInstanceOf(h, "Boolean")) | |
28 | 28 | then { | |
29 | 29 | let i = h | |
30 | 30 | i | |
31 | 31 | } | |
32 | 32 | else false | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func k () = j("Game_Started") | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func l (m) = j((m + "_whiteListed")) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func n (o,m) = { | |
43 | 43 | let p = f("Start_Height") | |
44 | 44 | let q = f((m + "_Redeemed")) | |
45 | 45 | if ((p == 0)) | |
46 | 46 | then throw("Redeem time not started") | |
47 | 47 | else { | |
48 | 48 | let r = (1440 * 180) | |
49 | 49 | if ((lastBlock.height > (p + r))) | |
50 | 50 | then (o - q) | |
51 | 51 | else { | |
52 | 52 | let s = fraction(o, 1, r) | |
53 | 53 | (((lastBlock.height - p) * s) - q) | |
54 | 54 | } | |
55 | 55 | } | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(t) | |
60 | 60 | func init () = [IntegerEntry("Remaining_Tokens", c)] | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(t) | |
65 | 65 | func addToWhiteList (m) = if ((t.caller != this)) | |
66 | 66 | then throw("you are not authorized to perform this operation") | |
67 | 67 | else [BooleanEntry((m + "_whiteListed"), true)] | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | ||
71 | 71 | @Callable(t) | |
72 | 72 | func setStartGame (u) = if ((t.caller != this)) | |
73 | 73 | then throw("you are not authorized to perform this operation") | |
74 | 74 | else [BooleanEntry("Game_Started", u), IntegerEntry("Start_Height", lastBlock.height)] | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | 78 | @Callable(t) | |
79 | 79 | func reserveTokens () = { | |
80 | 80 | let m = toString(t.caller) | |
81 | 81 | let v = l(m) | |
82 | 82 | if (!(v)) | |
83 | 83 | then throw("you are not whitelisted!") | |
84 | 84 | else { | |
85 | 85 | let w = t.payments[0] | |
86 | 86 | if ((w == w)) | |
87 | 87 | then { | |
88 | 88 | let x = value(t.payments[0].amount) | |
89 | 89 | if ((x == x)) | |
90 | 90 | then { | |
91 | 91 | let y = w.assetId | |
92 | 92 | if ((y == y)) | |
93 | 93 | then { | |
94 | 94 | let z = x | |
95 | 95 | if ((z == z)) | |
96 | 96 | then { | |
97 | 97 | let A = f((m + "_Reserved")) | |
98 | 98 | if ((A == A)) | |
99 | 99 | then { | |
100 | 100 | let B = f("Remaining_Tokens") | |
101 | 101 | if ((y != e)) | |
102 | 102 | then throw("ONLY USDN ALLOWED") | |
103 | 103 | else if ((0 >= B)) | |
104 | 104 | then throw("Presale is out of stock!") | |
105 | 105 | else if ((z > B)) | |
106 | 106 | then throw((("You can reserve only" + toString(B)) + " SHEGG")) | |
107 | 107 | else { | |
108 | 108 | let C = (d - A) | |
109 | 109 | if ((A > C)) | |
110 | 110 | then throw((("You can reserve max " + toString(C)) + " SHEGG")) | |
111 | 111 | else { | |
112 | 112 | let D = (B - z) | |
113 | 113 | [IntegerEntry((m + "_Reserved"), (z + A)), IntegerEntry("Remaining_Tokens", D), ScriptTransfer(b, x, e)] | |
114 | 114 | } | |
115 | 115 | } | |
116 | 116 | } | |
117 | 117 | else throw("Strict value is not equal to itself.") | |
118 | 118 | } | |
119 | 119 | else throw("Strict value is not equal to itself.") | |
120 | 120 | } | |
121 | 121 | else throw("Strict value is not equal to itself.") | |
122 | 122 | } | |
123 | 123 | else throw("Strict value is not equal to itself.") | |
124 | 124 | } | |
125 | 125 | else throw("Strict value is not equal to itself.") | |
126 | 126 | } | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | @Callable(t) | |
132 | 132 | func redeem () = if (!(k())) | |
133 | 133 | then throw("Cannot redeem anything before the game starts!") | |
134 | 134 | else { | |
135 | 135 | let m = toString(t.caller) | |
136 | 136 | let z = f((m + "_Reserved")) | |
137 | 137 | let q = f((m + "_Redeemed")) | |
138 | 138 | if ((z == 0)) | |
139 | 139 | then throw("Nothing to redeem") | |
140 | 140 | else { | |
141 | 141 | let E = n(z, m) | |
142 | 142 | let F = (z - q) | |
143 | - | if (( | |
143 | + | if ((F >= E)) | |
144 | 144 | then [IntegerEntry((m + "_Redeemed"), (q + E)), ScriptTransfer(t.caller, q, a)] | |
145 | 145 | else throw((("you can redeem max " + toString(F)) + " SHEGG")) | |
146 | 146 | } | |
147 | 147 | } | |
148 | 148 | ||
149 | 149 |
github/deemru/w8io/026f985 26.03 ms ◑