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:BgIMCAISABIECgIIARIABQAObG90dGVyeUFzc2V0SUQJANkEAQIsM0x6MjNtU1V2VDFFc3djQm4yc1VSWUpHMmF0OHJHNWFGdVVyVEF3YVBNNlEACnRpY2tldFNpemUAgMLXLwECbWsBAXgJALkJAgUBeAIBXwECZ3MBA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFBHRoaXMFA2tleQkAuQkCCQDMCAICAScJAMwIAgUDa2V5CQDMCAICDycga2V5IG5vdCBmb3VuZAUDbmlsAgABAmdpAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQR0aGlzBQNrZXkJALkJAgkAzAgCAgEnCQDMCAIFA2tleQkAzAgCAg8nIGtleSBub3QgZm91bmQFA25pbAIAAwFpAQVzdGFrZQADCQECIT0CCQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMCEGxvdHRlcnlJc1N0YXJ0ZWQHBgkAAgECG0xvdHRlcnkgaGFzIG5vdCBzdGFydGVkIHlldAQLbG90dGVyeU5hbWUJAQJncwECEmN1cnJlbnRMb3R0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EEY2FsbAAEBWFzc2V0CQDDCAcCBUFzc2V0AgAAAQAABgUEdW5pdAAABAdhc3NldElkCQC4CAEFBWFzc2V0CQDMCAIJAQtCaW5hcnlFbnRyeQICA2JpbgEACQDMCAIJAQxCb29sZWFuRW50cnkCAgRib29sBgkAzAgCCQEMSW50ZWdlckVudHJ5AgIDaW50AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgIDc3RyAgAJAMwIAgkBC0RlbGV0ZUVudHJ5AQIDc3RyCQDMCAIFBWFzc2V0CQDMCAIJAQdSZWlzc3VlAwUHYXNzZXRJZAABBwkAzAgCCQEEQnVybgIFB2Fzc2V0SWQAAQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tlecCYRFI=", "height": 2710239, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3LqjGX6MqULSyNeuek8CE5ZfV33HgyyskZA8ZZzqL9vg Next: G148PL3j2GbrSs6go1b4RZfbopEtcDCx9D7KoBVppm65 Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let lotteryAssetID = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q")
5+
6+let ticketSize = 100000000
7+
48 func mk (x) = makeString(x, "_")
59
610
1216
1317 @Callable(i)
1418 func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true))
15- then throw("lottery has not started yet")
19+ then throw("Lottery has not started yet")
1620 else {
1721 let lotteryName = gs("currentLotteryName")
1822 let lotteryFinalHeight = gi(mk([lotteryName, "lotteryFinalHeight"]))
1923 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+ }
2236 }
2337
2438
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let lotteryAssetID = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q")
5+
6+let ticketSize = 100000000
7+
48 func mk (x) = makeString(x, "_")
59
610
711 func gs (key) = valueOrErrorMessage(getString(this, key), makeString(["'", key, "' key not found"], ""))
812
913
1014 func gi (key) = valueOrErrorMessage(getInteger(this, key), makeString(["'", key, "' key not found"], ""))
1115
1216
1317 @Callable(i)
1418 func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true))
15- then throw("lottery has not started yet")
19+ then throw("Lottery has not started yet")
1620 else {
1721 let lotteryName = gs("currentLotteryName")
1822 let lotteryFinalHeight = gi(mk([lotteryName, "lotteryFinalHeight"]))
1923 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+ }
2236 }
2337
2438
2539
2640 @Callable(i)
2741 func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this))
2842 then throw("admin only")
2943 else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(makeString([lotteryName, "lotteryFinalHeight"], "_"), lotteryFinalHeight)]
3044
3145
3246
3347 @Callable(i)
3448 func call () = {
3549 let asset = Issue("Asset", "", 1, 0, true, unit, 0)
3650 let assetId = calculateAssetId(asset)
3751 [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)]
3852 }
3953
4054
4155 @Verifier(tx)
4256 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
4357

github/deemru/w8io/169f3d6 
21.68 ms