tx · 4SPhCUA6ozrCZerbdKFDgWJBmLkZy8AriBeaGLGTExAo

3MuVxxVfgdoobfADVjpHZXLJ2dNse6zQA8o:  -1.40000000 Waves

2019.08.20 11:49 [639232] smart account 3MuVxxVfgdoobfADVjpHZXLJ2dNse6zQA8o > SELF 0.00000000 Waves

{ "type": 13, "id": "4SPhCUA6ozrCZerbdKFDgWJBmLkZy8AriBeaGLGTExAo", "fee": 140000000, "feeAssetId": null, "timestamp": 1566290999065, "version": 1, "sender": "3MuVxxVfgdoobfADVjpHZXLJ2dNse6zQA8o", "senderPublicKey": "J3FHH7LcE3Xj4yGipA2YSxCnR1RZM9tSNFGXeETQQoMd", "proofs": [ "2ZfBL7BTg1jg7yUHZGk1RiXHamgWkJHkqHsY3kpTjX8e3UryPVFtCY3mb9tMtgvHrTdpFaWkKcMh3nZHYhKJ8TJS" ], "script": "base64:AwQAAAAHUHViS2V5MQEAAAAgaQxxSAhSITOlMYdvwKcfK7u/x0yzOg/68EH0ax0QlWUEAAAAB1B1YktleTIBAAAAILb58FcZXTIbjEshMW6ayDB2XcNop87YatlbtNE8j6N0BAAAAARzaWcxAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAB1B1YktleTEAAAAAAAAAAAEAAAAAAAAAAAAEAAAABHNpZzIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAHUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAkAAGYAAAACCQAAZAAAAAIFAAAABHNpZzEFAAAABHNpZzIAAAAAAAAAAADO+UOI", "chainId": 84, "height": 639232, "spentComplexity": 0 } View: original | compacted Prev: DD1guVhY94kzXGWJzptP7ZFxqQpmdsh3Q3KWfuxEM3vp Next: H2kKftb7xmaxDFiMbRutFar2zpfXP49LPJrVVf2y8Gww Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let lastCell = 4
5-
6-let cellsKey = "cells"
7-
8-@Callable(i)
9-func create (name,desc,ticketPrice,ticketAsset) = {
10- let assetId = if ((ticketAsset != "WAVES"))
11- then {
12- let aInfo = valueOrErrorMessage(assetInfo(fromBase58String(ticketAsset)), "There is no asset with specified id")
13- ticketAsset
14- }
15- else ""
16- let pmt = valueOrErrorMessage(i.payment, "Where is prize?")
17- let prizeAsset = if (isDefined(pmt.assetId))
18- then toBase58String(value(pmt.assetId))
19- else ""
20- if (if (if ((name == ""))
21- then true
22- else (desc == ""))
23- then true
24- else (0 > ticketPrice))
25- then throw("Invalid name, description or ticket price")
26- else {
27- let lotteryId = toBase58String(i.transactionId)
28- 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)])
29- }
30- }
31-
32-
33-
34-@Callable(i)
35-func buy (id,cell) = {
36- let cells = valueOrErrorMessage(getInteger(this, (id + "_cells")), "No lottery with specified id")
37- let status = valueOrErrorMessage(getBoolean(this, (id + "_status")), "Invalid status of lottery with specified id")
38- if (!(status))
39- then throw("Specified lottery is over")
40- else if (if ((0 > cell))
41- then true
42- else (cell > lastCell))
43- then throw("Invalid number")
44- else {
45- let ticketPrice = valueOrErrorMessage(getInteger(this, (id + "_ticket_price")), "Invalid ticket price")
46- let ticketAsset = valueOrErrorMessage(getString(this, (id + "_ticket_asset")), "Invalid ticket asset")
47- let pmt = valueOrErrorMessage(i.payment, "Where is payment?")
48- let assetId = if (isDefined(pmt.assetId))
49- then toBase58String(value(pmt.assetId))
50- else ""
51- if (if ((assetId != ticketAsset))
52- then true
53- else (pmt.amount != ticketPrice))
54- then throw("Invalid payment")
55- else if (isDefined(getString(this, ((id + "_cell:") + toString(cell)))))
56- then throw("Already bought")
57- else {
58- let last = (cells == lastCell)
59- let balance = (valueOrErrorMessage(getInteger(this, (id + "_balance")), "Invalid balance") + pmt.amount)
60- if (last)
61- then {
62- let creator = addressFromStringValue(valueOrErrorMessage(getString(this, (id + "_creator")), "Invalid lottery creator"))
63- let prizeAmount = valueOrErrorMessage(getInteger(this, (id + "_prize_amount")), "Invalid prize amount")
64- let prizeAsset = valueOrErrorMessage(getString(this, (id + "_prize_asset")), "Invalid prize asset")
65- let winCell = (toInt(lastBlock.generationSignature) % (lastCell + 1))
66- let winData = valueOrErrorMessage(getString(this, ((id + "_cell:") + toString(winCell))), "Invalid win cell")
67- let winAddress = if ((winCell == cell))
68- then i.caller
69- else value(addressFromString(winData))
70- ScriptResult(WriteSet([DataEntry((id + "_status"), false), DataEntry((id + "_balance"), 0)]), TransferSet([if ((ticketAsset == ""))
71- then ScriptTransfer(creator, balance, unit)
72- else ScriptTransfer(creator, balance, fromBase58String(ticketAsset)), if ((prizeAsset == ""))
73- then ScriptTransfer(winAddress, prizeAmount, unit)
74- else ScriptTransfer(winAddress, prizeAmount, fromBase58String(prizeAsset))]))
75- }
76- else WriteSet([DataEntry(((id + "_cell:") + toString(cell)), toString(i.caller)), DataEntry((id + "_cells"), (cells + 1)), DataEntry((id + "_balance"), balance)])
77- }
78- }
79- }
80-
81-
82-@Verifier(tx)
83-func verify () = true
84-
2+{-# CONTENT_TYPE EXPRESSION #-}
3+let PubKey1 = base58'854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa'
4+let PubKey2 = base58'DKGFPozLrsiR8NM4NJzqQaBYC8NyGYjuw2hDYicQVjco'
5+let sig1 = if (sigVerify(tx.bodyBytes, tx.proofs[0], PubKey1))
6+ then 1
7+ else 0
8+let sig2 = if (sigVerify(tx.bodyBytes, tx.proofs[1], PubKey2))
9+ then 1
10+ else 0
11+((sig1 + sig2) > 0)

github/deemru/w8io/c3f4982 
20.55 ms