tx · 2WvpiufushC34kq6XKQzgVRxkAbxCM8ZfyK4idM9pmLk

3MvcThc2oaRXWLgYxiGhr1jnd4gK5CXBGhE:  -0.01400000 Waves

2019.08.03 23:39 [615186] smart account 3MvcThc2oaRXWLgYxiGhr1jnd4gK5CXBGhE > SELF 0.00000000 Waves

{ "type": 13, "id": "2WvpiufushC34kq6XKQzgVRxkAbxCM8ZfyK4idM9pmLk", "fee": 1400000, "feeAssetId": null, "timestamp": 1564864789956, "version": 1, "sender": "3MvcThc2oaRXWLgYxiGhr1jnd4gK5CXBGhE", "senderPublicKey": "Czmo9kTsBGhSfVm9DSRTG8uoiyrcMQB63vabDwPobjqx", "proofs": [ "2pSZcnGNFT7q6RJ3jMKi1152uSne2q3q4PworAVU27jzDeugx4w8FDWZ36qd7JoffZREnkZArSnmMCVU62v8jQe7" ], "script": "base64:AAIDAAAAAAAAAAAAAAACAAAAAAhsYXN0Q2VsbAAAAAAAAAAABAAAAAAIY2VsbHNLZXkCAAAABWNlbGxzAAAAAgAAAAFpAQAAAAZjcmVhdGUAAAAEAAAABG5hbWUAAAAEZGVzYwAAAAt0aWNrZXRQcmljZQAAAAt0aWNrZXRBc3NldAQAAAAHYXNzZXRJZAMJAQAAAAIhPQAAAAIFAAAAC3RpY2tldEFzc2V0AgAAAAVXQVZFUwQAAAAFYUluZm8JAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkAA+wAAAABCQACWQAAAAEFAAAAC3RpY2tldEFzc2V0AgAAACNUaGVyZSBpcyBubyBhc3NldCB3aXRoIHNwZWNpZmllZCBpZAUAAAALdGlja2V0QXNzZXQCAAAABVdBVkVTBAAAAANwbXQJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAggFAAAAAWkAAAAHcGF5bWVudAIAAAAPV2hlcmUgaXMgcHJpemU/BAAAAApwcml6ZUFzc2V0AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAlgAAAABCQ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W5jZQUAAAAEdW5pdAkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAHY3JlYXRvcgUAAAAHYmFsYW5jZQkAAlkAAAABBQAAAAt0aWNrZXRBc3NldAkABEwAAAACAwkAAAAAAAACBQAAAApwcml6ZUFzc2V0AgAAAAVXQVZFUwkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKd2luQWRkcmVzcwUAAAALcHJpemVBbW91bnQFAAAABHVuaXQJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAACndpbkFkZHJlc3MFAAAAC3ByaXplQW1vdW50CQACWQAAAAEFAAAACnByaXplQXNzZXQFAAAAA25pbAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAAAmlkAgAAAAZfY2VsbDoJAAGkAAAAAQUAAAAEY2VsbAkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAACaWQCAAAABl9jZWxscwkAAGQAAAACBQAAAAVjZWxscwAAAAAAAAAAAQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAbGq0iE", "chainId": 84, "height": 615186, "spentComplexity": 0 } View: original | compacted Prev: DYPPVDVUSd3rBAahYMAQahBUwUCetJRqfuESyEGhL4K7 Next: 2w2Yj2sC3Fizmr2WeYoSHfDp5nzoTEVDyHZVEc8JNagM Diff:
OldNewDifferences
1616 let pmt = valueOrErrorMessage(i.payment, "Where is prize?")
1717 let prizeAsset = if (isDefined(pmt.assetId))
1818 then toBase58String(value(pmt.assetId))
19- else ""
19+ else "WAVES"
2020 if (if (if ((name == ""))
2121 then true
2222 else (desc == ""))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lastCell = 4
55
66 let cellsKey = "cells"
77
88 @Callable(i)
99 func create (name,desc,ticketPrice,ticketAsset) = {
1010 let assetId = if ((ticketAsset != "WAVES"))
1111 then {
1212 let aInfo = valueOrErrorMessage(assetInfo(fromBase58String(ticketAsset)), "There is no asset with specified id")
1313 ticketAsset
1414 }
1515 else "WAVES"
1616 let pmt = valueOrErrorMessage(i.payment, "Where is prize?")
1717 let prizeAsset = if (isDefined(pmt.assetId))
1818 then toBase58String(value(pmt.assetId))
19- else ""
19+ else "WAVES"
2020 if (if (if ((name == ""))
2121 then true
2222 else (desc == ""))
2323 then true
2424 else (0 > ticketPrice))
2525 then throw("Invalid name, description or ticket price")
2626 else {
2727 let lotteryId = toBase58String(i.transactionId)
2828 WriteSet([DataEntry((lotteryId + "_name"), name), DataEntry((lotteryId + "_desc"), desc), DataEntry((lotteryId + "_ticket_price"), ticketPrice), DataEntry((lotteryId + "_ticket_asset"), assetId), DataEntry((lotteryId + "_prize_amount"), pmt.amount), DataEntry((lotteryId + "_prize_asset"), prizeAsset), DataEntry((lotteryId + "_creator"), toBase58String(i.caller.bytes)), DataEntry((lotteryId + "_cells"), 0), DataEntry((lotteryId + "_status"), true), DataEntry((lotteryId + "_balance"), 0)])
2929 }
3030 }
3131
3232
3333
3434 @Callable(i)
3535 func buy (id,cell) = {
3636 let cells = valueOrErrorMessage(getInteger(this, (id + "_cells")), "No lottery with specified id")
3737 let status = getBooleanValue(this, (id + "_status"))
3838 if (!(status))
3939 then throw("Specified lottery is over")
4040 else if (if ((0 > cell))
4141 then true
4242 else (cell > lastCell))
4343 then throw("Invalid number")
4444 else {
4545 let ticketPrice = valueOrErrorMessage(getInteger(this, (id + "_ticket_price")), "Ticket price error")
4646 let ticketAsset = valueOrErrorMessage(getString(this, (id + "_ticket_asset")), "Ticket asset error")
4747 let pmt = valueOrErrorMessage(i.payment, "Where is payment?")
4848 let assetId = if (isDefined(pmt.assetId))
4949 then toBase58String(value(pmt.assetId))
5050 else "WAVES"
5151 if (if ((assetId != ticketAsset))
5252 then true
5353 else (pmt.amount != ticketPrice))
5454 then throw("Invalid payment")
5555 else if (isDefined(getString(this, toString(cell))))
5656 then throw("Already bought")
5757 else {
5858 let last = (cells == lastCell)
5959 if (last)
6060 then {
6161 let creator = addressFromStringValue(valueOrErrorMessage(getString(this, (id + "_creator")), "Creator error"))
6262 let balance = valueOrErrorMessage(getInteger(this, (id + "_balance")), "Balance error")
6363 let prizeAmount = valueOrErrorMessage(getInteger(this, (id + "_prize_amount")), "Prize amount error")
6464 let prizeAsset = valueOrErrorMessage(getString(this, (id + "_prize_asset")), "Prize asset error")
6565 let winCell = (toInt(lastBlock.generationSignature) % (lastCell + 1))
6666 let winAddress = if ((winCell == cell))
6767 then i.caller
6868 else {
6969 let winData = valueOrErrorMessage(getString(this, ((id + "_cell:") + toString(winCell))), "Win data error")
7070 value(addressFromString(winData))
7171 }
7272 ScriptResult(WriteSet([DataEntry((id + "_status"), false), DataEntry((id + "_balance"), 0), DataEntry((id + "_cells"), (cells + 1))]), TransferSet([if ((ticketAsset == "WAVES"))
7373 then ScriptTransfer(creator, balance, unit)
7474 else ScriptTransfer(creator, balance, fromBase58String(ticketAsset)), if ((prizeAsset == "WAVES"))
7575 then ScriptTransfer(winAddress, prizeAmount, unit)
7676 else ScriptTransfer(winAddress, prizeAmount, fromBase58String(prizeAsset))]))
7777 }
7878 else WriteSet([DataEntry(((id + "_cell:") + toString(cell)), toString(i.caller)), DataEntry((id + "_cells"), (cells + 1))])
7979 }
8080 }
8181 }
8282
8383
8484 @Verifier(tx)
8585 func verify () = true
8686

github/deemru/w8io/026f985 
49.59 ms