tx · WK7g5BecQbCG5zyV4zfZMjhRpbVv46QzQ8mAudy3gRA 3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8: -0.01100000 Waves 2022.08.26 04:29 [2200787] smart account 3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8 > SELF 0.00000000 Waves
{ "type": 13, "id": "WK7g5BecQbCG5zyV4zfZMjhRpbVv46QzQ8mAudy3gRA", "fee": 1100000, "feeAssetId": null, "timestamp": 1661477372859, "version": 2, "chainId": 84, "sender": "3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8", "senderPublicKey": "2MhVDhjG7eJ6SY8og2HRd4Bam75FsCSg2Vude8gutmZe", "proofs": [ "3XnFEQF5YqcUAhZSSQaHtHnBwiJoi3UnegKqCbp1QBbh31ErAmKjFBR1MuHAkUbhExQWB4CUAx4p6Y1tWEdtH6Za" ], "script": "base64:AAIFAAAAAAAAAB4IAhIDCgEIEgoKCAEBAQEICAgBEgASABIFCgMBCAgAAAAPAAAAAAJwcwIAAAANUFJFU0FMRV9TVEFSVAAAAAACcGQCAAAAEFBSRVNBTEVfRFVSQVRJT04AAAAAAmNzAgAAAAtDTEFJTV9TVEFSVAAAAAACY2QCAAAADkNMQUlNX0RVUkFUSU9OAAAAAAFwAgAAAAlQUklDRV9JRE8AAAAABHAxSUQCAAAAEFBSSUNFXzFfQVNTRVRfSUQAAAAABHAySUQCAAAAEFBSSUNFXzJfQVNTRVRfSUQAAAAABHAzSUQCAAAAEFBSSUNFXzNfQVNTRVRfSUQAAAAAA21pYQIAAAARTUlOX0FNT1VOVF9JTlZFU1QAAAAABW1haW5hAgAAAApNQUlOX0FTU0VUAAAAAAdmb3JTYWxlAgAAAA5UT1RBTF9GT1JfU0FMRQAAAAAJdG90YWxTYWxlAgAAAApUT1RBTF9TQUxFAAAAAAd0aW52ZXN0AgAAAA1UT1RBTF9JTlZFU1RfAAAAAAVkaXNkdQIAAAAVRElTVFJJQlVUSU9OX0RVUkFUSU9OAQAA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AAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXl2+Rsg", "height": 2200787, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A7GZty8U4QHxT9dV6KUQYSYTaWs4sBfu3sM5CxPML9eH Next: 92FsFgCi6vH5Z4FYgsCMFsvx9oV53K6etmeWdYjhZN7U Diff:
Old | New | Differences | |
---|---|---|---|
100 | 100 | then throw("Amount less than the minimum to be invested.") | |
101 | 101 | else { | |
102 | 102 | let M = ((I / v) * 100000000) | |
103 | - | [IntegerEntry(l, (J + M) | |
103 | + | [IntegerEntry(l, (J + M)), BooleanEntry((((m + toBase58String(q.caller.bytes)) + "__") + H), true)] | |
104 | 104 | } | |
105 | 105 | } | |
106 | 106 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "PRESALE_START" | |
5 | 5 | ||
6 | 6 | let b = "PRESALE_DURATION" | |
7 | 7 | ||
8 | 8 | let c = "CLAIM_START" | |
9 | 9 | ||
10 | 10 | let d = "CLAIM_DURATION" | |
11 | 11 | ||
12 | 12 | let e = "PRICE_IDO" | |
13 | 13 | ||
14 | 14 | let f = "PRICE_1_ASSET_ID" | |
15 | 15 | ||
16 | 16 | let g = "PRICE_2_ASSET_ID" | |
17 | 17 | ||
18 | 18 | let h = "PRICE_3_ASSET_ID" | |
19 | 19 | ||
20 | 20 | let i = "MIN_AMOUNT_INVEST" | |
21 | 21 | ||
22 | 22 | let j = "MAIN_ASSET" | |
23 | 23 | ||
24 | 24 | let k = "TOTAL_FOR_SALE" | |
25 | 25 | ||
26 | 26 | let l = "TOTAL_SALE" | |
27 | 27 | ||
28 | 28 | let m = "TOTAL_INVEST_" | |
29 | 29 | ||
30 | 30 | let n = "DISTRIBUTION_DURATION" | |
31 | 31 | ||
32 | 32 | func o (p) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(p))).id, (("Asset Id: " + p) + " is invalid."))) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(q) | |
36 | 36 | func addAdmin (r) = if ((q.caller == this)) | |
37 | 37 | then [BinaryEntry("admin", fromBase58String(r))] | |
38 | 38 | else throw("Only the Admin itself can invoke this function") | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(q) | |
43 | 43 | func constructor (s,t,u,v,w,x,y,z) = { | |
44 | 44 | let A = o(w) | |
45 | 45 | let B = o(x) | |
46 | 46 | let C = o(y) | |
47 | 47 | if (if ((q.caller == this)) | |
48 | 48 | then true | |
49 | 49 | else (q.caller == Address(getBinaryValue(this, "admin")))) | |
50 | 50 | then if ((t >= s)) | |
51 | 51 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
52 | 52 | else if ((z > v)) | |
53 | 53 | then throw("minInvestAmount can't be bigger than price") | |
54 | 54 | else if (if (if ((A == B)) | |
55 | 55 | then true | |
56 | 56 | else (A == C)) | |
57 | 57 | then true | |
58 | 58 | else (B == C)) | |
59 | 59 | then throw("Each Asset must be different from the other.") | |
60 | 60 | else if ((size(q.payments) != 1)) | |
61 | 61 | then throw("exactly 1 payment must be attached") | |
62 | 62 | else [BinaryEntry(j, value(q.payments[0].assetId)), StringEntry(f, w), StringEntry(g, x), StringEntry(h, y), IntegerEntry(a, s), IntegerEntry(b, t), IntegerEntry(e, v), IntegerEntry(i, z), IntegerEntry(k, value(q.payments[0]).amount), IntegerEntry(l, 0), IntegerEntry(n, u)] | |
63 | 63 | else throw("Only the Admin itself can invoke this function") | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(q) | |
69 | 69 | func invest () = { | |
70 | 70 | let D = getBinaryValue(this, j) | |
71 | 71 | let s = getIntegerValue(this, a) | |
72 | 72 | let t = getIntegerValue(this, b) | |
73 | 73 | let E = (s + t) | |
74 | 74 | let v = getIntegerValue(this, e) | |
75 | 75 | let F = height | |
76 | 76 | let G = value(q.payments[0]) | |
77 | 77 | let H = toBase58String(value(G.assetId)) | |
78 | 78 | let I = G.amount | |
79 | 79 | let A = getStringValue(this, f) | |
80 | 80 | let B = getStringValue(this, g) | |
81 | 81 | let C = getStringValue(this, h) | |
82 | 82 | let J = getIntegerValue(this, l) | |
83 | 83 | let K = getIntegerValue(this, k) | |
84 | 84 | let L = getIntegerValue(this, i) | |
85 | 85 | if ((s >= F)) | |
86 | 86 | then throw("presale has not been started yet") | |
87 | 87 | else if ((F >= E)) | |
88 | 88 | then throw("presale has been already ended") | |
89 | 89 | else if ((size(q.payments) != 1)) | |
90 | 90 | then throw("exactly 1 payment is expected") | |
91 | 91 | else if (if (if ((H != A)) | |
92 | 92 | then (H != B) | |
93 | 93 | else false) | |
94 | 94 | then (H != C) | |
95 | 95 | else false) | |
96 | 96 | then throw(((("invalid payment asset id:" + H) + " Expected:") + A)) | |
97 | 97 | else if ((J >= K)) | |
98 | 98 | then throw("Pre-sale asset has been - sold consider to use smaller payment") | |
99 | 99 | else if ((L > I)) | |
100 | 100 | then throw("Amount less than the minimum to be invested.") | |
101 | 101 | else { | |
102 | 102 | let M = ((I / v) * 100000000) | |
103 | - | [IntegerEntry(l, (J + M) | |
103 | + | [IntegerEntry(l, (J + M)), BooleanEntry((((m + toBase58String(q.caller.bytes)) + "__") + H), true)] | |
104 | 104 | } | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(q) | |
110 | 110 | func claimPresale () = { | |
111 | 111 | let N = (getIntegerValue(this, b) + getIntegerValue(this, a)) | |
112 | 112 | let u = getIntegerValue(this, n) | |
113 | 113 | let O = (N + u) | |
114 | 114 | let D = getBinaryValue(this, j) | |
115 | 115 | let F = height | |
116 | 116 | let v = getIntegerValue(this, e) | |
117 | 117 | if ((N >= F)) | |
118 | 118 | then throw("The Presale is still happening.") | |
119 | 119 | else { | |
120 | 120 | let P = if ((F > O)) | |
121 | 121 | then 100 | |
122 | 122 | else (F / O) | |
123 | 123 | let Q = valueOrErrorMessage(getIntegerValue(this, (m + toBase58String(q.caller.bytes))), "You were not part of the presale") | |
124 | 124 | let M = ((Q * P) / 100) | |
125 | 125 | let R = (Q - M) | |
126 | 126 | if ((valueOrElse(getIntegerValue(this, ("OLD_TOTAL_" + toBase58String(q.caller.bytes))), 0) == 0)) | |
127 | 127 | then [IntegerEntry((m + toBase58String(q.caller.bytes)), R), ScriptTransfer(q.caller, M, D), IntegerEntry(("OLD_TOTAL_" + toBase58String(q.caller.bytes)), Q)] | |
128 | 128 | else [IntegerEntry((m + toBase58String(q.caller.bytes)), R), ScriptTransfer(q.caller, M, D)] | |
129 | 129 | } | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | 134 | @Callable(q) | |
135 | 135 | func adminV (S,r,p) = if (if ((q.caller == this)) | |
136 | 136 | then true | |
137 | 137 | else (q.caller == Address(getBinaryValue(this, "admin")))) | |
138 | 138 | then [ScriptTransfer(Address(fromBase58String(r)), S, fromBase58String(p))] | |
139 | 139 | else throw("Only the Admin itself can invoke this function") | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | @Verifier(T) | |
143 | 143 | func U () = sigVerify(T.bodyBytes, T.proofs[0], T.senderPublicKey) | |
144 | 144 |
github/deemru/w8io/169f3d6 37.78 ms ◑