tx · 7Pr4zFa9z1dXyWFQ8VMRN6jiRJPjP6TKZPB4hGCQZoBH 3MqnKFCPYSFqTyMrLUvGmn9wNh1cvqsBvV4: -0.04000000 Waves 2020.10.03 00:59 [1203504] smart account 3MqnKFCPYSFqTyMrLUvGmn9wNh1cvqsBvV4 > SELF 0.00000000 Waves
{ "type": 13, "id": "7Pr4zFa9z1dXyWFQ8VMRN6jiRJPjP6TKZPB4hGCQZoBH", "fee": 4000000, "feeAssetId": null, "timestamp": 1601675996646, "version": 2, "chainId": 84, "sender": "3MqnKFCPYSFqTyMrLUvGmn9wNh1cvqsBvV4", "senderPublicKey": "7QzpPMPE9EBjsL8KjTqA6co5svTSPeCJKxMjtXd6vURP", "proofs": [ "2mjq9HSA4aFVUztDmSBASR4s3a8X72fxpax2vttiJ1Pc3AkAGHFezkVhCLFDxFFySqBQ286toDb8yux6n1mE3ppf" ], "script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAgEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0UGxheQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAMV2F2ZXNMb3R0b1YyCQAAAgAAAAECAAAAC01hdGNoIGVycm9yBAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgUAAAAIbGFzdFBsYXkIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAAAA2ludgAAAA9jYWxsZXJQdWJsaWNLZXkIBQAAAAlsYXN0QmxvY2sAAAATZ2VuZXJhdGlvblNpZ25hdHVyZQkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAkAAZoAAAABCAUAAAAJbGFzdE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AAA+gJAQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAA13cml0ZUxhc3RQbGF5BQAAAAt3aW5UcmFuc2ZlcgkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAADXdyaXRlTGFzdFBsYXkJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAEAAAADaW52AQAAAAdMb3R0ZXJ5AAAAAAkBAAAACnN0YXJ0TG90dG8AAAABBQAAAANpbnYAAAAAjavxMA==", "height": 1203504, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2uEKpyPAUZeAqC4Vzku2agEsuYbRT1kLfjynwGSKsZ6z Next: none Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | ||
37 | 37 | ||
38 | 38 | @Callable(inv) | |
39 | - | func | |
39 | + | func Lottery () = startLotto(inv) | |
40 | 40 | ||
41 | 41 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func randomizer (inv) = { | |
5 | 5 | let lastPlay = match getBinary(this, "lastPlay") { | |
6 | 6 | case s: ByteVector => | |
7 | 7 | s | |
8 | 8 | case _: Unit => | |
9 | 9 | base58'2ee4oFDYriWJ9EMeR' | |
10 | 10 | case _ => | |
11 | 11 | throw("Match error") | |
12 | 12 | } | |
13 | 13 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
14 | 14 | sha256(rand) | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func startLotto (inv) = { | |
19 | 19 | let playLimit = (wavesBalance(this) / 100) | |
20 | 20 | let payment = extract(inv.payment) | |
21 | 21 | if (!(isDefined(inv.payment))) | |
22 | 22 | then throw("Should be with Payment in Waves") | |
23 | 23 | else if (isDefined(payment.assetId)) | |
24 | 24 | then throw("Payment should be in Waves") | |
25 | 25 | else if ((payment.amount > playLimit)) | |
26 | 26 | then throw(("Payment should be less than " + toString(playLimit))) | |
27 | 27 | else { | |
28 | 28 | let randhash = randomizer(inv) | |
29 | 29 | let winTransfer = TransferSet([ScriptTransfer(inv.caller, ((payment.amount * 190) / 100), unit)]) | |
30 | 30 | let writeLastPlay = WriteSet([DataEntry("lastPlay", randhash)]) | |
31 | 31 | if ((500 > (toInt(randhash) % 1000))) | |
32 | 32 | then ScriptResult(writeLastPlay, winTransfer) | |
33 | 33 | else ScriptResult(writeLastPlay, TransferSet(nil)) | |
34 | 34 | } | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | @Callable(inv) | |
39 | - | func | |
39 | + | func Lottery () = startLotto(inv) | |
40 | 40 | ||
41 | 41 |
github/deemru/w8io/169f3d6 25.11 ms ◑