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:BgIMCAISABIECgIIARIABQAObG90dGVyeUFzc2V0SUQJANkEAQIsM0x6MjNtU1V2VDFFc3djQm4yc1VSWUpHMmF0OHJHNWFGdVVyVEF3YVBNNlEACnRpY2tldFNpemUAgMLXLwECbWsBAXgJALkJAgUBeAIBXwECZ3MBA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFBHRoaXMFA2tleQkAuQkCCQDMCAICAScJAMwIAgUDa2V5CQDMCAICDycga2V5IG5vdCBmb3VuZAUDbmlsAgABAmdpAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAmggCBQR0aGlzBQNrZXkJALkJAgkAzAgCAgEnCQDMCAIFA2tleQkAzAgCAg8nIGtleSBub3QgZm91bmQFA25pbAIAAwFpAQVzdGFrZQADCQECIT0CCQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMCEGxvdHRlcnlJc1N0YXJ0ZWQHBgkAAgECG0xvdHRlcnkgaGFzIG5vdCBzdGFydGVkIHlldAQLbG90dGVyeU5hbWUJAQJncwECEmN1cnJlbnRMb3R0ZXJ5TmFtZQ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MSW50ZWdlckVudHJ5AgkBAm1rAQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCAhJsb3R0ZXJ5RmluYWxIZWlnaHQFA25pbAUSbG90dGVyeUZpbmFsSGVpZ2h0CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQECbWsBCQDMCAIFC2xvdHRlcnlOYW1lCQDMCAICB3BvaW50ZXIFA25pbAAABQNuaWwBaQEEY2FsbAAEBWFzc2V0CQDDCAcCBUFzc2V0AgAAAQAABgUEdW5pdAAABAdhc3NldElkCQC4CAEFBWFzc2V0CQDMCAIJAQtCaW5hcnlFbnRyeQICA2JpbgEACQDMCAIJAQxCb29sZWFuRW50cnkCAgRib29sBgkAzAgCCQEMSW50ZWdlckVudHJ5AgIDaW50AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgIDc3RyAgAJAMwIAgkBC0RlbGV0ZUVudHJ5AQIDc3RyCQDMCAIFBWFzc2V0CQDMCAIJAQdSZWlzc3VlAwUHYXNzZXRJZAABBwkAzAgCCQEEQnVybgIFB2Fzc2V0SWQAAQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleX2kaXc=", "height": 2710253, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Boa9G9QRNyvkj2WqMT1sgLHrN1RM4u6WnJYS4Xm576fD Next: C19BQ5MzffCJG4HmoE3h3waLdqBJooZeSFpj6EJfekKR Diff:
OldNewDifferences
3131 else {
3232 let amount = i.payments[0].amount
3333 let ticketAmount = (amount / ticketSize)
34+ if ((amount == 0))
35+ then throw("Not enough to buy at least one ticket")
36+ else {
37+ let pointerKey = mk([lotteryName, "pointer"])
3438 [ScriptTransfer(i.caller, (amount - (ticketAmount * ticketSize)), lotteryAssetID)]
39+ }
3540 }
3641 }
3742
4045 @Callable(i)
4146 func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this))
4247 then throw("admin only")
43- else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(makeString([lotteryName, "lotteryFinalHeight"], "_"), lotteryFinalHeight)]
48+ else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(mk([lotteryName, "lotteryFinalHeight"]), lotteryFinalHeight), IntegerEntry(mk([lotteryName, "pointer"]), 0)]
4449
4550
4651
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lotteryAssetID = fromBase58String("3Lz23mSUvT1EswcBn2sURYJG2at8rG5aFuUrTAwaPM6Q")
55
66 let ticketSize = 100000000
77
88 func mk (x) = makeString(x, "_")
99
1010
1111 func gs (key) = valueOrErrorMessage(getString(this, key), makeString(["'", key, "' key not found"], ""))
1212
1313
1414 func gi (key) = valueOrErrorMessage(getInteger(this, key), makeString(["'", key, "' key not found"], ""))
1515
1616
1717 @Callable(i)
1818 func stake () = if ((valueOrElse(getBoolean(this, "lotteryIsStarted"), false) != true))
1919 then throw("Lottery has not started yet")
2020 else {
2121 let lotteryName = gs("currentLotteryName")
2222 let lotteryFinalHeight = gi(mk([lotteryName, "lotteryFinalHeight"]))
2323 if (((height - 1) >= lotteryFinalHeight))
2424 then throw("Lottery has not started yet")
2525 else if ((size(i.payments) == 0))
2626 then throw("No payment added")
2727 else if ((size(i.payments) != 1))
2828 then throw("Too many payments added")
2929 else if ((i.payments[0].assetId != lotteryAssetID))
3030 then throw("Wrong payment assetId")
3131 else {
3232 let amount = i.payments[0].amount
3333 let ticketAmount = (amount / ticketSize)
34+ if ((amount == 0))
35+ then throw("Not enough to buy at least one ticket")
36+ else {
37+ let pointerKey = mk([lotteryName, "pointer"])
3438 [ScriptTransfer(i.caller, (amount - (ticketAmount * ticketSize)), lotteryAssetID)]
39+ }
3540 }
3641 }
3742
3843
3944
4045 @Callable(i)
4146 func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this))
4247 then throw("admin only")
43- else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(makeString([lotteryName, "lotteryFinalHeight"], "_"), lotteryFinalHeight)]
48+ else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(mk([lotteryName, "lotteryFinalHeight"]), lotteryFinalHeight), IntegerEntry(mk([lotteryName, "pointer"]), 0)]
4449
4550
4651
4752 @Callable(i)
4853 func call () = {
4954 let asset = Issue("Asset", "", 1, 0, true, unit, 0)
5055 let assetId = calculateAssetId(asset)
5156 [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)]
5257 }
5358
5459
5560 @Verifier(tx)
5661 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5762

github/deemru/w8io/169f3d6 
24.29 ms