tx · Ek6TUAt5C8bPo2ojhgirX7fxgUZrH9YzRSyiV35u26GQ 3MvebeGZYw4DzztAuqcdxyT22s6rB3yMNj7: -0.01000000 Waves 2022.03.13 05:31 [1961582] smart account 3MvebeGZYw4DzztAuqcdxyT22s6rB3yMNj7 > SELF 0.00000000 Waves
{ "type": 13, "id": "Ek6TUAt5C8bPo2ojhgirX7fxgUZrH9YzRSyiV35u26GQ", "fee": 1000000, "feeAssetId": null, "timestamp": 1647138505890, "version": 2, "chainId": 84, "sender": "3MvebeGZYw4DzztAuqcdxyT22s6rB3yMNj7", "senderPublicKey": "J283pC8bzRfJ3j1oxPrgDH8hjUVhFZS2CiRcPTmzQukz", "proofs": [ "3HGq4yb9tfZXjbKhDD6EbtncBWqXGtVUTXkF7KUV9XuiwUmDBspyMNhSX9J2DVHFggt4ZqstwbRTGuq4Tf5fCGHx" ], "script": "base64:AAIDAAAAAAAAAAYIARIAEgAAAAACAQAAAApyYW5kb21pemVyAAAAAQAAAANpbnYEAAAACGxhc3RQbGF5BAAAAAckbWF0Y2gwCQAEHAAAAAIFAAAABHRoaXMCAAAACGxhc3RQbGF5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AQAAAAxXYXZlc0xvdHRvVjIJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2NhbGxlclB1YmxpY0tleQgFAAAACWxhc3RCbG9jawAAABNnZW5lcmF0aW9uU2lnbmF0dXJlCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAGaGV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GFFbnRyeQAAAAICAAAAB3JhbmROdW0FAAAAB3JhbmROdW0FAAAAA25pbAMJAABmAAAAAgAAAAAAAAAB9AUAAAAHcmFuZE51bQkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAADXdyaXRlTGFzdFBsYXkFAAAAC3dpblRyYW5zZmVyCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgUAAAANd3JpdGVMYXN0UGxheQkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAgAAAANpbnYBAAAABWxvdHRvAAAAAAkBAAAACnN0YXJ0TG90dG8AAAABBQAAAANpbnYAAAADaW52AQAAAAdkZWZhdWx0AAAAAAkBAAAACnN0YXJ0TG90dG8AAAABBQAAAANpbnYAAAAAcDdwXQ==", "height": 1961582, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 495BqmV3CWfcGinFiTCBRdRdLEMpqxxpXSj2QL6aP79Z Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func randomizer (inv) = { | |
5 | + | let lastPlay = match getBinary(this, "lastPlay") { | |
6 | + | case s: ByteVector => | |
7 | + | s | |
8 | + | case _: Unit => | |
9 | + | base58'2ee4oFDYriWJ9EMeR' | |
10 | + | case _ => | |
11 | + | throw("Match error") | |
12 | + | } | |
13 | + | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
14 | + | sha256(rand) | |
15 | + | } | |
16 | + | ||
17 | + | ||
18 | + | func startLotto (inv) = { | |
19 | + | let playLimit = (wavesBalance(this) / 100) | |
20 | + | let payment = extract(inv.payment) | |
21 | + | if (!(isDefined(inv.payment))) | |
22 | + | then throw("Should be with Payment in Waves") | |
23 | + | else if (isDefined(payment.assetId)) | |
24 | + | then throw("Payment should be in Waves") | |
25 | + | else if ((payment.amount > playLimit)) | |
26 | + | then throw(("Payment should be less than " + toString(playLimit))) | |
27 | + | else { | |
28 | + | let randhash = randomizer(inv) | |
29 | + | let randNum = (toInt(randhash) % 1000) | |
30 | + | let winTransfer = TransferSet([ScriptTransfer(inv.caller, ((payment.amount * 190) / 100), unit)]) | |
31 | + | let writeLastPlay = WriteSet([DataEntry("lastPlay", randhash), DataEntry("randNum", randNum)]) | |
32 | + | if ((500 > randNum)) | |
33 | + | then ScriptResult(writeLastPlay, winTransfer) | |
34 | + | else ScriptResult(writeLastPlay, TransferSet(nil)) | |
35 | + | } | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | @Callable(inv) | |
40 | + | func lotto () = startLotto(inv) | |
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | @Callable(inv) | |
45 | + | func default () = startLotto(inv) | |
46 | + | ||
47 | + |
github/deemru/w8io/026f985 18.36 ms ◑