tx · hhN8p2FpPA4LwMb3w76DCYgGcUrc5gMohdKxWekjiN5

3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs:  -0.01000000 Waves

2023.08.29 08:59 [2731594] smart account 3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs > SELF 0.00000000 Waves

{ "type": 13, "id": "hhN8p2FpPA4LwMb3w76DCYgGcUrc5gMohdKxWekjiN5", "fee": 1000000, "feeAssetId": null, "timestamp": 1693288816744, "version": 2, "chainId": 84, "sender": "3N4Kzbxu521DHPxcgrmZ4XUqN2kF6TqLTzs", "senderPublicKey": "8yQuxvQ2qLzXJrgbKZHbsfnNNjuU5wfHheyVujdALGsF", "proofs": [ "3xPW36e5tRhZmfKW6ikHKc1t1msP31xfw1A3jDPaTDdB9XyYY1cUa9xDXZMSQeifbf7npCE3odseudiKvKdnEPCa" ], "script": "base64:BgIOCAISABIAEgQKAggBEgAKAA5sb3R0ZXJ5QXNzZXRJRAkA2QQBAiwzTHoyM21TVXZUMUVzd2NCbjJzVVJZSkcyYXQ4ckc1YUZ1VXJUQXdhUE02UQAKdGlja2V0U2l6ZQCAwtcvARBnZXRJbnRlZ2VyT3JFbHNlAgNrZXkDdmFsCQELdmFsdWVPckVsc2UCCQCfCAEFA2tleQUDdmFsAQJtawEBeAkAuQkCBQF4AgFfARFrZXlBZHJUb3RhbFN0YWtlZAEDYWRyCQECbWsBCQDMCAIFA2FkcgkAzAgCAgt0b3RhbFN0YWtlZAUDbmlsARVrZXlMb3R0ZXJ5VG90YWxTdGFrZWQBC2xvdHRlcnlOYW1lCQECbWsBCQDMCAIFC2xvdHRlcnlOYW1lCQDMCAICEmxvdHRlcnlUb3RhbFN0YWtlZAUDbmlsARhrZXlBZHJMb3R0ZXJ5VG90YWxTdGFrZWQCC2xvdHRlcnlOYW1lA2FkcgkBAm1rAQkAzAgCBQtsb3R0ZXJ5TmFtZQkAzAgCBQNhZHIJAMwIAgILdG90YWxTdGFrZWQFA25pbAEVa2V5T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dlckVudHJ5AgIDaW50AAEJAMwIAgkBC1N0cmluZ0VudHJ5AgIDc3RyAgAJAMwIAgkBC0RlbGV0ZUVudHJ5AQIDc3RyCQDMCAIFBWFzc2V0CQDMCAIJAQdSZWlzc3VlAwUHYXNzZXRJZAABBwkAzAgCCQEEQnVybgIFB2Fzc2V0SWQAAQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQUHYXNzZXRJZAUDbmlsAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tlecLzI2I=", "height": 2731594, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BvGb3AiKngy5DaVxLBf6WFEVvNCQ5xoeHGKsuHZm3qnQ Next: HVfyQ7ZFzmEiYwLyjZRY6BBzUYzs4VMSK5PGZVLwvgXa Diff:
OldNewDifferences
7373 func claim () = {
7474 let lotteryName = activeLotteryNameOrFalse()
7575 let stakedInActiveLottery = if ((lotteryName == false))
76- then 0
76+ then 20
7777 else 10
7878 [IntegerEntry("temp", stakedInActiveLottery)]
7979 }
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 getIntegerOrElse (key,val) = valueOrElse(getInteger(key), val)
99
1010
1111 func mk (x) = makeString(x, "_")
1212
1313
1414 func keyAdrTotalStaked (adr) = mk([adr, "totalStaked"])
1515
1616
1717 func keyLotteryTotalStaked (lotteryName) = mk([lotteryName, "lotteryTotalStaked"])
1818
1919
2020 func keyAdrLotteryTotalStaked (lotteryName,adr) = mk([lotteryName, adr, "totalStaked"])
2121
2222
2323 func keyLotteryFinalHeight (lotteryName) = mk([lotteryName, "lotteryFinalHeight"])
2424
2525
2626 func getLotteryName () = getStringValue("currentLotteryName")
2727
2828
2929 func activeLotteryNameOrFalse () = if ((valueOrElse(getBoolean("lotteryIsStarted"), false) != true))
3030 then false
3131 else {
3232 let lotteryName = getLotteryName()
3333 lotteryName
3434 }
3535
3636
3737 @Callable(i)
3838 func stake () = if ((valueOrElse(getBoolean("lotteryIsStarted"), false) != true))
3939 then throw("Lottery not active")
4040 else {
4141 let lotteryName = getLotteryName()
4242 let lotteryFinalHeight = getIntegerValue(keyLotteryFinalHeight(lotteryName))
4343 if (((height - 1) >= lotteryFinalHeight))
4444 then throw("Lottery not active")
4545 else if ((size(i.payments) == 0))
4646 then throw("No payment added")
4747 else if ((size(i.payments) != 1))
4848 then throw("Too many payments added")
4949 else if ((i.payments[0].assetId != lotteryAssetID))
5050 then throw("Wrong payment assetId")
5151 else {
5252 let amount = i.payments[0].amount
5353 let ticketAmount = (amount / ticketSize)
5454 if ((ticketAmount == 0))
5555 then throw("Not enough to buy at least one ticket")
5656 else {
5757 let callerAddress = toString(i.caller)
5858 let _lotteryTotalStaked = keyLotteryTotalStaked(lotteryName)
5959 let lotteryTotalStaked = getIntegerValue(_lotteryTotalStaked)
6060 let _owner = mk([lotteryName, toString(lotteryTotalStaked), toString(((lotteryTotalStaked + ticketAmount) - 1)), "Owner"])
6161 let _adrTotalStaked = keyAdrTotalStaked(callerAddress)
6262 let adrTotalStaked = getIntegerOrElse(_adrTotalStaked, 0)
6363 let _adrLotteryTotalStaked = keyAdrLotteryTotalStaked(lotteryName, callerAddress)
6464 let adrLotteryTotalStaked = getIntegerOrElse(_adrLotteryTotalStaked, 0)
6565 [ScriptTransfer(i.caller, (amount - (ticketAmount * ticketSize)), lotteryAssetID), IntegerEntry(_lotteryTotalStaked, (lotteryTotalStaked + ticketAmount)), StringEntry(_owner, callerAddress), IntegerEntry(_adrTotalStaked, (adrTotalStaked + ticketAmount)), IntegerEntry(_adrLotteryTotalStaked, (adrLotteryTotalStaked + ticketAmount))]
6666 }
6767 }
6868 }
6969
7070
7171
7272 @Callable(i)
7373 func claim () = {
7474 let lotteryName = activeLotteryNameOrFalse()
7575 let stakedInActiveLottery = if ((lotteryName == false))
76- then 0
76+ then 20
7777 else 10
7878 [IntegerEntry("temp", stakedInActiveLottery)]
7979 }
8080
8181
8282
8383 @Callable(i)
8484 func initLottery (lotteryName,lotteryFinalHeight) = if ((i.caller != this))
8585 then throw("admin only")
8686 else [BooleanEntry("lotteryIsStarted", true), StringEntry("currentLotteryName", lotteryName), IntegerEntry(keyLotteryFinalHeight(lotteryName), lotteryFinalHeight), IntegerEntry(keyLotteryTotalStaked(lotteryName), 0)]
8787
8888
8989
9090 @Callable(i)
9191 func call () = {
9292 let asset = Issue("Asset", "", 1, 0, true, unit, 0)
9393 let assetId = calculateAssetId(asset)
9494 [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)]
9595 }
9696
9797
9898 @Verifier(tx)
9999 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
100100

github/deemru/w8io/026f985 
27.65 ms