tx · Boa9G9QRNyvkj2WqMT1sgLHrN1RM4u6WnJYS4Xm576fD 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs: -0.01000000 Waves 2023.08.14 15:35 [2710239] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves
{ "type": 13, "id": "Boa9G9QRNyvkj2WqMT1sgLHrN1RM4u6WnJYS4Xm576fD", "fee": 1000000, "feeAssetId": null, "timestamp": 1692016566628, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "3KDtvpJeqsGqfmC2krRftyBd7VaegVriq8WwR6Vm6WnLBJG3kB8FLHZWLfHjikQ4eVTkF2jNR24FHuXLGYn2NEoN" ], "script": "base64:BgIMCAISABIECgIIARIABQAObG90dGVyeUFzc2V0SUQJANkEAQIsM0x6MjNtU1V2VDFFc3djQm4yc1VSWUpHMmF0OHJHNWFGdVVyVEF3YVBNNlEACnRpY2tldFNpemUAgMLXLwECbWsBAXgJALkJAgUBeAIBXwECZ3MBA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFBHRoaXMFA2tleQkAuQkCCQDMCAICAScJAMwIAgUDa2V5CQDMCAICDycga2V5IG5vdCBmb3VuZAUDbmlsAgABAmdpAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQR0aGlzBQNrZXkJALkJAgkAzAgCAgEnCQDMCAIFA2tleQkAzAgCAg8nIGtleSBub3QgZm91bmQFA25pbAIAAwFpAQVzdGFrZQADCQECIT0CCQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMCEGxvdHRlcnlJc1N0YXJ0ZWQHBgkAAgECG0xvdHRlcnkgaGFzIG5vdCBzdGFydGVkIHlldAQLbG90dGVyeU5hbWUJAQJncwECEmN1cnJlbnRMb3R0Z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EY2FsbAAEBWFzc2V0CQDDCAcCBUFzc2V0AgAAAQAABgUEdW5pdAAABAdhc3NldElkCQC4CAEFBWFzc2V0CQDMCAIJAQtCaW5hcnlFbnRyeQICA2JpbgEACQDMCAIJAQxCb29sZWFuRW50cnkCAgRib29sBgkAzAgCCQEMSW50ZWdlckVudHJ5AgIDaW50AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgIDc3RyAgAJAMwIAgkBC0RlbGV0ZUVudHJ5AQIDc3RyCQDMCAIFBWFzc2V0CQDMCAIJAQdSZWlzc3VlAwUHYXNzZXRJZAABBwkAzAgCCQEEQnVybgIFB2Fzc2V0SWQAAQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tlecCYRFI=", "height": 2710239, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3LqjGX6MqULSyNeuek8CE5ZfV33HgyyskZA8ZZzqL9vg Next: G148PL3j2GbrSs6go1b4RZfbopEtcDCx9D7KoBVppm65 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let lotteryAssetID = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q") | |
5 | + | ||
6 | + | let ticketSize = 100000000 | |
7 | + | ||
4 | 8 | func mk (x) = makeString(x, "_") | |
5 | 9 | ||
6 | 10 | ||
12 | 16 | ||
13 | 17 | @Callable(i) | |
14 | 18 | func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true)) | |
15 | - | then throw(" | |
19 | + | then throw("Lottery has not started yet") | |
16 | 20 | else { | |
17 | 21 | let lotteryName = gs("currentLotteryName") | |
18 | 22 | let lotteryFinalHeight = gi(mk([lotteryName, "lotteryFinalHeight"])) | |
19 | 23 | if (((height - 1) >= lotteryFinalHeight)) | |
20 | - | then throw("lottery has not started yet") | |
21 | - | else [BooleanEntry("tmp", true)] | |
24 | + | then throw("Lottery has not started yet") | |
25 | + | else if ((size(i.payments) == 0)) | |
26 | + | then throw("No payment added") | |
27 | + | else if ((size(i.payments) != 1)) | |
28 | + | then throw("Too many payments added") | |
29 | + | else if ((i.payments[0].assetId != lotteryAssetID)) | |
30 | + | then throw("Wrong payment assetId") | |
31 | + | else { | |
32 | + | let amount = i.payments[0].amount | |
33 | + | let ticketAmount = (amount / ticketSize) | |
34 | + | [ScriptTransfer(i.caller, (amount - (ticketAmount * ticketSize)), lotteryAssetID)] | |
35 | + | } | |
22 | 36 | } | |
23 | 37 | ||
24 | 38 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let lotteryAssetID = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q") | |
5 | + | ||
6 | + | let ticketSize = 100000000 | |
7 | + | ||
4 | 8 | func mk (x) = makeString(x, "_") | |
5 | 9 | ||
6 | 10 | ||
7 | 11 | func gs (key) = valueOrErrorMessage(getString(this, key), makeString(["'", key, "' key not found"], "")) | |
8 | 12 | ||
9 | 13 | ||
10 | 14 | func gi (key) = valueOrErrorMessage(getInteger(this, key), makeString(["'", key, "' key not found"], "")) | |
11 | 15 | ||
12 | 16 | ||
13 | 17 | @Callable(i) | |
14 | 18 | func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true)) | |
15 | - | then throw(" | |
19 | + | then throw("Lottery has not started yet") | |
16 | 20 | else { | |
17 | 21 | let lotteryName = gs("currentLotteryName") | |
18 | 22 | let lotteryFinalHeight = gi(mk([lotteryName, "lotteryFinalHeight"])) | |
19 | 23 | if (((height - 1) >= lotteryFinalHeight)) | |
20 | - | then throw("lottery has not started yet") | |
21 | - | else [BooleanEntry("tmp", true)] | |
24 | + | then throw("Lottery has not started yet") | |
25 | + | else if ((size(i.payments) == 0)) | |
26 | + | then throw("No payment added") | |
27 | + | else if ((size(i.payments) != 1)) | |
28 | + | then throw("Too many payments added") | |
29 | + | else if ((i.payments[0].assetId != lotteryAssetID)) | |
30 | + | then throw("Wrong payment assetId") | |
31 | + | else { | |
32 | + | let amount = i.payments[0].amount | |
33 | + | let ticketAmount = (amount / ticketSize) | |
34 | + | [ScriptTransfer(i.caller, (amount - (ticketAmount * ticketSize)), lotteryAssetID)] | |
35 | + | } | |
22 | 36 | } | |
23 | 37 | ||
24 | 38 | ||
25 | 39 | ||
26 | 40 | @Callable(i) | |
27 | 41 | func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this)) | |
28 | 42 | then throw("admin only") | |
29 | 43 | else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(makeString([lotteryName, "lotteryFinalHeight"], "_"), lotteryFinalHeight)] | |
30 | 44 | ||
31 | 45 | ||
32 | 46 | ||
33 | 47 | @Callable(i) | |
34 | 48 | func call () = { | |
35 | 49 | let asset = Issue("Asset", "", 1, 0, true, unit, 0) | |
36 | 50 | let assetId = calculateAssetId(asset) | |
37 | 51 | [BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset, Reissue(assetId, 1, false), Burn(assetId, 1), ScriptTransfer(i.caller, 1, assetId)] | |
38 | 52 | } | |
39 | 53 | ||
40 | 54 | ||
41 | 55 | @Verifier(tx) | |
42 | 56 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
43 | 57 |
github/deemru/w8io/026f985 45.07 ms ◑