tx · ExZR2xhnEgygsYiR5QuXDwh1VSi7tH3NMEfBesLxUhcP 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b: -0.01400000 Waves 2021.02.06 06:44 [1385798] smart account 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b > SELF 0.00000000 Waves
{ "type": 13, "id": "ExZR2xhnEgygsYiR5QuXDwh1VSi7tH3NMEfBesLxUhcP", "fee": 1400000, "feeAssetId": null, "timestamp": 1612583083164, "version": 2, "chainId": 84, "sender": "3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b", "senderPublicKey": "3BKFQLeo5ExZ5Y1pt9Ftzsno7aRwzD96zoYVHP3tcLgV", "proofs": [ "wpkYKFpWK78WgdrfafQwrYxVsVDEhdWBhbKjvjWtq481uxXBU6kxb8A1GxfZ4s1PfDeS2fYjGZy3Xd2wLw8Fnqw" ], "script": "base64:AAIDAAAAAAAAABAIARIGCgQBAQEIEgQKAggIAAAABQAAAAAPbG90dGVyeXBvb2xuYW1lAgAAABVfbG90dGVyeV9hbW91bnRfcG9vbF8AAAAAFmxvdHRlcnlwb29scHJvYmFiaWxpdHkCAAAADl9sb3R0ZXJ5X3Byb2JfAAAAABBsb3R0ZXJ5cG9vbHByaWNlAgAAAA9fbG90dGVyeV9wcmljZV8AAAAADWxvdHRlcnlwcmljZXMCAAAAEF9sb3R0ZXJ5X3ByaWNlc18BAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAEcmFuZAkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCAUAAAADaW52AAAADXRyYW5zYWN0aW9uSWQIBQAAAANpbnYAAAAPY2FsbGVyUHVibGljS2V5CAUAAAAJbGFzdEJsb2NrAAAAE2dlbmVyYXRpb25TaWduYXR1cmUJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQJAAH3AAAAAQUAAAAEcmF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pemVQcmljZUVudHJ5BQAAAANuaWwJAQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAAl3cml0ZVNldHMJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24GAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5cwieHQ==", "height": 1385798, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3vuPNGKmspC1HeKWzA3MsejQEphVaPx4aDAoZXSRJdsx Next: 3cgtNvRSD8FpnhdyfhRTCr74Ybu36DhEgUTwowQNc1rM Diff:
Old | New | Differences | |
---|---|---|---|
56 | 56 | let winTransfer = TransferSet([ScriptTransfer(recipientaddress, aggPrice, unit)]) | |
57 | 57 | if ((500 > (toInt(randhash) % 1000))) | |
58 | 58 | then { | |
59 | - | let writeSets = WriteSet([DataEntry((callerAddress + "_win_ticket_"), payment.amount)]) | |
59 | + | let writeSets = WriteSet([DataEntry((callerAddress + "_win_ticket_"), payment.amount), datSizePriceEntry]) | |
60 | 60 | ScriptResult(writeSets, winTransfer) | |
61 | 61 | } | |
62 | 62 | else { | |
63 | - | let writeSets = WriteSet([DataEntry((callerAddress + "_win_assetId_"), ""), DataEntry((callerAddress + "_win_ticket_"), payment.amount), DataEntry((callerAddress + "_win_"), walletAddress)]) | |
63 | + | let writeSets = WriteSet([DataEntry((callerAddress + "_win_assetId_"), ""), DataEntry((callerAddress + "_win_ticket_"), payment.amount), DataEntry((callerAddress + "_win_"), walletAddress), datSizePriceEntry]) | |
64 | 64 | ScriptResult(writeSets, TransferSet(nil)) | |
65 | 65 | } | |
66 | 66 | } |
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 | 18 | @Callable(i) | |
19 | 19 | func updateprobability (probability,amount,poolprice,token) = { | |
20 | 20 | let tempValue = match getString(this, lotteryprices) { | |
21 | 21 | case a: String => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | "" | |
25 | 25 | } | |
26 | 26 | let containKey = indexOf(tempValue, token) | |
27 | 27 | let finalValue = match containKey { | |
28 | 28 | case _: Unit => | |
29 | 29 | ((tempValue + token) + ",") | |
30 | 30 | case x: Int => | |
31 | 31 | tempValue | |
32 | 32 | case _ => | |
33 | 33 | throw("Match error") | |
34 | 34 | } | |
35 | 35 | let updateLotteryPool = WriteSet([DataEntry((lotterypoolname + token), amount), DataEntry((lotterypoolprobability + token), probability), DataEntry((lotterypoolprice + token), poolprice), DataEntry(lotteryprices, finalValue)]) | |
36 | 36 | ScriptResult(updateLotteryPool, TransferSet(nil)) | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(i) | |
42 | 42 | func startlotto (token,walletAddress) = { | |
43 | 43 | let callerAddress = toBase58String(i.caller.bytes) | |
44 | 44 | let recipientaddress = addressFromStringValue(walletAddress) | |
45 | 45 | let storedToken = getInteger(this, (lotterypoolname + token)) | |
46 | 46 | let prob = getInteger(this, (lotterypoolprobability + token)) | |
47 | 47 | let price = getInteger(this, (lotterypoolprice + token)) | |
48 | 48 | let payment = extract(i.payment) | |
49 | 49 | let randhash = randomizer(i) | |
50 | 50 | let aggPrice = ((payment.amount * 190) / 100) | |
51 | 51 | let tempPrices = extract(getString(this, lotteryprices)) | |
52 | 52 | let isTempPricesDefined = isDefined(tempPrices) | |
53 | 53 | let pricesArray = split(tempPrices, ",") | |
54 | 54 | let sizeTempPrice = size(pricesArray) | |
55 | 55 | let datSizePriceEntry = DataEntry((callerAddress + "_winprices_size_"), sizeTempPrice) | |
56 | 56 | let winTransfer = TransferSet([ScriptTransfer(recipientaddress, aggPrice, unit)]) | |
57 | 57 | if ((500 > (toInt(randhash) % 1000))) | |
58 | 58 | then { | |
59 | - | let writeSets = WriteSet([DataEntry((callerAddress + "_win_ticket_"), payment.amount)]) | |
59 | + | let writeSets = WriteSet([DataEntry((callerAddress + "_win_ticket_"), payment.amount), datSizePriceEntry]) | |
60 | 60 | ScriptResult(writeSets, winTransfer) | |
61 | 61 | } | |
62 | 62 | else { | |
63 | - | let writeSets = WriteSet([DataEntry((callerAddress + "_win_assetId_"), ""), DataEntry((callerAddress + "_win_ticket_"), payment.amount), DataEntry((callerAddress + "_win_"), walletAddress)]) | |
63 | + | let writeSets = WriteSet([DataEntry((callerAddress + "_win_assetId_"), ""), DataEntry((callerAddress + "_win_ticket_"), payment.amount), DataEntry((callerAddress + "_win_"), walletAddress), datSizePriceEntry]) | |
64 | 64 | ScriptResult(writeSets, TransferSet(nil)) | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Verifier(tx) | |
70 | 70 | func verify () = match tx { | |
71 | 71 | case _: DataTransaction => | |
72 | 72 | true | |
73 | 73 | case _: SetScriptTransaction => | |
74 | 74 | true | |
75 | 75 | case _ => | |
76 | 76 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
77 | 77 | } | |
78 | 78 |
github/deemru/w8io/169f3d6 36.51 ms ◑