tx · G148PL3j2GbrSs6go1b4RZfbopEtcDCx9D7KoBVppm65 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs: -0.01000000 Waves 2023.08.14 15:48 [2710253] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves
{ "type": 13, "id": "G148PL3j2GbrSs6go1b4RZfbopEtcDCx9D7KoBVppm65", "fee": 1000000, "feeAssetId": null, "timestamp": 1692017330974, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "3awUKPXtmw2z2xgAV5TGsCwfn6hKj2LTkfcu2NH9ihHHdW4gfwVv7jURuTxYcuNha5tw6kxouzTqNrMeSxn69vCn" ], "script": "base64:BgIMCAISABIECgIIARIABQAObG90dGVyeUFzc2V0SUQJANkEAQIsM0x6MjNtU1V2VDFFc3djQm4yc1VSWUpHMmF0OHJHNWFGdVVyVEF3YVBNNlEACnRpY2tldFNpemUAgMLXLwECbWsBAXgJALkJAgUBeAIBXwECZ3MBA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFBHRoaXMFA2tleQkAuQkCCQDMCAICAScJAMwIAgUDa2V5CQDMCAICDycga2V5IG5vdCBmb3VuZAUDbmlsAgABAmdpAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQR0aGlzBQNrZXkJALkJAgkAzAgCAgEnCQDMCAIFA2tleQkAzAgCAg8nIGtleSBub3QgZm91bmQFA25pbAIAAwFpAQVzdGFrZQADCQECIT0CCQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMCEGxvdHRlcnlJc1N0YXJ0ZWQHBgkAAgECG0xvdHRlcnkgaGFzIG5vdCBzdGFydGVkIHlldAQLbG90dGVyeU5hbWUJAQJncwECEmN1cnJlbnRMb3R0ZXJ5TmFtZQQ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SW50ZWdlckVudHJ5AgkBAm1rAQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCAhJsb3R0ZXJ5RmluYWxIZWlnaHQFA25pbAUSbG90dGVyeUZpbmFsSGVpZ2h0CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQECbWsBCQDMCAIFC2xvdHRlcnlOYW1lCQDMCAICB3BvaW50ZXIFA25pbAAABQNuaWwBaQEEY2FsbAAEBWFzc2V0CQDDCAcCBUFzc2V0AgAAAQAABgUEdW5pdAAABAdhc3NldElkCQC4CAEFBWFzc2V0CQDMCAIJAQtCaW5hcnlFbnRyeQICA2JpbgEACQDMCAIJAQxCb29sZWFuRW50cnkCAgRib29sBgkAzAgCCQEMSW50ZWdlckVudHJ5AgIDaW50AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgIDc3RyAgAJAMwIAgkBC0RlbGV0ZUVudHJ5AQIDc3RyCQDMCAIFBWFzc2V0CQDMCAIJAQdSZWlzc3VlAwUHYXNzZXRJZAABBwkAzAgCCQEEQnVybgIFB2Fzc2V0SWQAAQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleX2kaXc=", "height": 2710253, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Boa9G9QRNyvkj2WqMT1sgLHrN1RM4u6WnJYS4Xm576fD Next: C19BQ5MzffCJG4HmoE3h3waLdqBJooZeSFpj6EJfekKR Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | else { | |
32 | 32 | let k = h.payments[0].amount | |
33 | 33 | let l = (k / b) | |
34 | + | if ((k == 0)) | |
35 | + | then throw("Not enough to buy at least one ticket") | |
36 | + | else { | |
37 | + | let m = c([i, "pointer"]) | |
34 | 38 | [ScriptTransfer(h.caller, (k - (l * b)), a)] | |
39 | + | } | |
35 | 40 | } | |
36 | 41 | } | |
37 | 42 | ||
40 | 45 | @Callable(h) | |
41 | 46 | func initLottery (i,j) = if ((h.caller != this)) | |
42 | 47 | then throw("admin only") | |
43 | - | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", i), IntegerEntry( | |
48 | + | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", i), IntegerEntry(c([i, "lotteryFinalHeight"]), j), IntegerEntry(c([i, "pointer"]), 0)] | |
44 | 49 | ||
45 | 50 | ||
46 | 51 | ||
47 | 52 | @Callable(h) | |
48 | 53 | func call () = { | |
49 | - | let | |
50 | - | let | |
51 | - | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), | |
54 | + | let n = Issue("Asset", "", 1, 0, true, unit, 0) | |
55 | + | let o = calculateAssetId(n) | |
56 | + | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), n, Reissue(o, 1, false), Burn(o, 1), ScriptTransfer(h.caller, 1, o)] | |
52 | 57 | } | |
53 | 58 | ||
54 | 59 | ||
55 | - | @Verifier( | |
56 | - | func | |
60 | + | @Verifier(p) | |
61 | + | func q () = sigVerify(p.bodyBytes, p.proofs[0], p.senderPublicKey) | |
57 | 62 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q") | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | 8 | func c (d) = makeString(d, "_") | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func e (f) = valueOrErrorMessage(getString(this, f), makeString(["'", f, "' key not found"], "")) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func g (f) = valueOrErrorMessage(getInteger(this, f), makeString(["'", f, "' key not found"], "")) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | @Callable(h) | |
18 | 18 | func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true)) | |
19 | 19 | then throw("Lottery has not started yet") | |
20 | 20 | else { | |
21 | 21 | let i = e("currentLotteryName") | |
22 | 22 | let j = g(c([i, "lotteryFinalHeight"])) | |
23 | 23 | if (((height - 1) >= j)) | |
24 | 24 | then throw("Lottery has not started yet") | |
25 | 25 | else if ((size(h.payments) == 0)) | |
26 | 26 | then throw("No payment added") | |
27 | 27 | else if ((size(h.payments) != 1)) | |
28 | 28 | then throw("Too many payments added") | |
29 | 29 | else if ((h.payments[0].assetId != a)) | |
30 | 30 | then throw("Wrong payment assetId") | |
31 | 31 | else { | |
32 | 32 | let k = h.payments[0].amount | |
33 | 33 | let l = (k / b) | |
34 | + | if ((k == 0)) | |
35 | + | then throw("Not enough to buy at least one ticket") | |
36 | + | else { | |
37 | + | let m = c([i, "pointer"]) | |
34 | 38 | [ScriptTransfer(h.caller, (k - (l * b)), a)] | |
39 | + | } | |
35 | 40 | } | |
36 | 41 | } | |
37 | 42 | ||
38 | 43 | ||
39 | 44 | ||
40 | 45 | @Callable(h) | |
41 | 46 | func initLottery (i,j) = if ((h.caller != this)) | |
42 | 47 | then throw("admin only") | |
43 | - | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", i), IntegerEntry( | |
48 | + | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", i), IntegerEntry(c([i, "lotteryFinalHeight"]), j), IntegerEntry(c([i, "pointer"]), 0)] | |
44 | 49 | ||
45 | 50 | ||
46 | 51 | ||
47 | 52 | @Callable(h) | |
48 | 53 | func call () = { | |
49 | - | let | |
50 | - | let | |
51 | - | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), | |
54 | + | let n = Issue("Asset", "", 1, 0, true, unit, 0) | |
55 | + | let o = calculateAssetId(n) | |
56 | + | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), n, Reissue(o, 1, false), Burn(o, 1), ScriptTransfer(h.caller, 1, o)] | |
52 | 57 | } | |
53 | 58 | ||
54 | 59 | ||
55 | - | @Verifier( | |
56 | - | func | |
60 | + | @Verifier(p) | |
61 | + | func q () = sigVerify(p.bodyBytes, p.proofs[0], p.senderPublicKey) | |
57 | 62 |
github/deemru/w8io/169f3d6 25.97 ms ◑