tx · 5RXWrbztUp6nBYhN45fz2AdgMfbcx7weFuE7RTCQkwbJ 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b: -0.01400000 Waves 2021.02.05 04:51 [1384239] smart account 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b > SELF 0.00000000 Waves
{ "type": 13, "id": "5RXWrbztUp6nBYhN45fz2AdgMfbcx7weFuE7RTCQkwbJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1612489927162, "version": 2, "chainId": 84, "sender": "3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b", "senderPublicKey": "3BKFQLeo5ExZ5Y1pt9Ftzsno7aRwzD96zoYVHP3tcLgV", "proofs": [ "4VsutNWnAw4cQV52pFe3zxs4chfnzfekdKkmxQynDeXYFEKdKuutxipMuCEsR31kTbkNQqzsNcgVJNV87rYrjHv1" ], "script": "base64:AAIDAAAAAAAAABAIARIGCgQBAQEIEgQKAggIAAAABQAAAAAPbG90dGVyeXBvb2xuYW1lAgAAABVfbG90dGVyeV9hbW91bnRfcG9vbF8AAAAAFmxvdHRlcnlwb29scHJvYmFiaWxpdHkCAAAADl9sb3R0ZXJ5X3Byb2JfAAAAABBsb3R0ZXJ5cG9vbHByaWNlAgAAAA9fbG90dGVyeV9wcmljZV8AAAAADWxvdHRlcnlwcmljZXMCAAAAEF9sb3R0ZXJ5X3ByaWNlc18BAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAEcmFuZAkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCAUAAAADaW52AAAADXRyYW5zYWN0aW9uSWQIBQAAAANpbnYAAAAPY2FsbGVyUHVibGljS2V5CAUAAAAJbGFzdEJsb2NrAAAAE2dlbmVyYXRpb25TaWduYXR1cmUJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQJAAH3AAAAAQUAAAAEcmFuZAAAA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GV0QWRkcmVzcwUAAAADbmlsCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgUAAAAJd3JpdGVTZXRzBQAAAAt3aW5UcmFuc2ZlcgQAAAAJd3JpdGVTZXRzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAADWNhbGxlckFkZHJlc3MCAAAADV93aW5fYXNzZXRJZF8CAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAA1jYWxsZXJBZGRyZXNzAgAAAAxfd2luX3RpY2tldF8IBQAAAAdwYXltZW50AAAABmFtb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAA1jYWxsZXJBZGRyZXNzAgAAAAVfd2luXwUAAAANd2FsbGV0QWRkcmVzcwUAAAADbmlsCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgUAAAAJd3JpdGVTZXRzCQEAAAALVHJhbnNmZXJTZXQAAAABBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24GCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlectn5gU=", "height": 1384239, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CZfimHdTpKbbRf6p5RjDKymmspQoGZbpNGmLLAvru1Ao Next: 9uiJUWn94y6aqigMwskTpKi55wDAKz3JV7buSvNGUGS5 Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | - | func getLotteryPrices () = match getString(this, lotteryprices) { | |
19 | - | case a: String => | |
20 | - | a | |
21 | - | case _ => | |
22 | - | "" | |
23 | - | } | |
24 | - | ||
25 | - | ||
26 | 18 | @Callable(i) | |
27 | 19 | func updateprobability (probability,amount,poolprice,token) = { | |
28 | - | let tempValue = getLotteryPrices() | |
29 | - | let newValue = (token + ",") | |
20 | + | let tempValue = match getString(this, lotteryprices) { | |
21 | + | case a: String => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | "empty" | |
25 | + | } | |
26 | + | let newValue = ((tempValue + token) + ",") | |
30 | 27 | let updateLotteryPool = WriteSet([DataEntry((lotterypoolname + token), amount), DataEntry((lotterypoolprobability + token), probability), DataEntry((lotterypoolprice + token), poolprice), DataEntry(lotteryprices, newValue)]) | |
31 | 28 | ScriptResult(updateLotteryPool, TransferSet(nil)) | |
32 | 29 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lotterypoolname = "_lottery_amount_pool_" | |
5 | 5 | ||
6 | 6 | let lotterypoolprobability = "_lottery_prob_" | |
7 | 7 | ||
8 | 8 | let lotterypoolprice = "_lottery_price_" | |
9 | 9 | ||
10 | 10 | let lotteryprices = "_lottery_prices_" | |
11 | 11 | ||
12 | 12 | func randomizer (inv) = { | |
13 | 13 | let rand = ((((inv.transactionId + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
14 | 14 | sha256(rand) | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | - | func getLotteryPrices () = match getString(this, lotteryprices) { | |
19 | - | case a: String => | |
20 | - | a | |
21 | - | case _ => | |
22 | - | "" | |
23 | - | } | |
24 | - | ||
25 | - | ||
26 | 18 | @Callable(i) | |
27 | 19 | func updateprobability (probability,amount,poolprice,token) = { | |
28 | - | let tempValue = getLotteryPrices() | |
29 | - | let newValue = (token + ",") | |
20 | + | let tempValue = match getString(this, lotteryprices) { | |
21 | + | case a: String => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | "empty" | |
25 | + | } | |
26 | + | let newValue = ((tempValue + token) + ",") | |
30 | 27 | let updateLotteryPool = WriteSet([DataEntry((lotterypoolname + token), amount), DataEntry((lotterypoolprobability + token), probability), DataEntry((lotterypoolprice + token), poolprice), DataEntry(lotteryprices, newValue)]) | |
31 | 28 | ScriptResult(updateLotteryPool, TransferSet(nil)) | |
32 | 29 | } | |
33 | 30 | ||
34 | 31 | ||
35 | 32 | ||
36 | 33 | @Callable(i) | |
37 | 34 | func startlotto (token,walletAddress) = { | |
38 | 35 | let callerAddress = toBase58String(i.caller.bytes) | |
39 | 36 | let recipientaddress = addressFromStringValue(walletAddress) | |
40 | 37 | let storedToken = getInteger(this, (lotterypoolname + token)) | |
41 | 38 | let prob = getInteger(this, (lotterypoolprobability + token)) | |
42 | 39 | let price = getInteger(this, (lotterypoolprice + token)) | |
43 | 40 | let payment = extract(i.payment) | |
44 | 41 | let randhash = randomizer(i) | |
45 | 42 | let aggPrice = ((payment.amount * 190) / 100) | |
46 | 43 | let hasWin = false | |
47 | 44 | let winTransfer = TransferSet([ScriptTransfer(recipientaddress, aggPrice, unit)]) | |
48 | 45 | if ((500 > (toInt(randhash) % 1000))) | |
49 | 46 | then { | |
50 | 47 | let writeSets = WriteSet([DataEntry((callerAddress + "_win_ticket_"), payment.amount), DataEntry((callerAddress + "_win_"), walletAddress)]) | |
51 | 48 | ScriptResult(writeSets, winTransfer) | |
52 | 49 | } | |
53 | 50 | else { | |
54 | 51 | let writeSets = WriteSet([DataEntry((callerAddress + "_win_assetId_"), ""), DataEntry((callerAddress + "_win_ticket_"), payment.amount), DataEntry((callerAddress + "_win_"), walletAddress)]) | |
55 | 52 | ScriptResult(writeSets, TransferSet(nil)) | |
56 | 53 | } | |
57 | 54 | } | |
58 | 55 | ||
59 | 56 | ||
60 | 57 | @Verifier(tx) | |
61 | 58 | func verify () = match tx { | |
62 | 59 | case _: DataTransaction => | |
63 | 60 | true | |
64 | 61 | case _: SetScriptTransaction => | |
65 | 62 | true | |
66 | 63 | case _ => | |
67 | 64 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
68 | 65 | } | |
69 | 66 |
github/deemru/w8io/169f3d6 39.33 ms ◑