tx · oVoD2rc8jChjWeW9JQNHrTekHjWpMk1cwTYKeVoyBSg 3MvyLTBj2k8xayyFD5CePoXu5ybKPEX84Au: -0.01000000 Waves 2022.10.22 15:33 [2283609] smart account 3MvyLTBj2k8xayyFD5CePoXu5ybKPEX84Au > SELF 0.00000000 Waves
{ "type": 13, "id": "oVoD2rc8jChjWeW9JQNHrTekHjWpMk1cwTYKeVoyBSg", "fee": 1000000, "feeAssetId": null, "timestamp": 1666442011128, "version": 2, "chainId": 84, "sender": "3MvyLTBj2k8xayyFD5CePoXu5ybKPEX84Au", "senderPublicKey": "Gfk22xNMNYFvTwifWwCzLx4Vewoy8Y5ijhtGEoyNuYFD", "proofs": [ "4xwwZjkhgdTRg3EtphS2Sj37CYA2in9C7gJgMKXznxW5eYULtw2NcxTKgTYjc23PE3t4qDnaY42nMf1dnsPGBv94" ], "script": "base64:AAIDAAAAAAAAAA4IARIFCgMIAQESAwoBCAAAAAQAAAAABm9yYWNsZQkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAAA8kT1JBQ0xFX0FERFJFU1MAAAAABm1pbkJldAAAAAAAAvrwgAAAAAAJbWF4U3VtQmV0AAAAAAA7msoAAQAAAA1jYWxjV2luQW1vdW50AAAAAwAAAAR0aGlzAAAAA2tleQAAAAVrb2VmZgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAkAAGgAAAACBQAAAAFhBQAAAAVrb2VmZgAAAAAAAAAAAAAAAAIAAAABaQEAAAADYmV0AAAAAwAAAAVyb3VuZAAAAAlndWVzc1R5cGUAAAAKZ3Vlc3NWYWx1ZQQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkC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UAAAAEdGhpcwkAASwAAAACCQABLAAAAAIFAAAACmJldEtleVBhcnQCAAAAA18zXwkAAaQAAAABBQAAAAt3aW5EZXNrSGFsZgAAAAAAAAAAAgkBAAAADWNhbGNXaW5BbW91bnQAAAADBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgUAAAAKYmV0S2V5UGFydAIAAAADXzRfCQABpAAAAAEFAAAADHdpbkRlc2tUaGlyZAAAAAAAAAAAAwkBAAAADWNhbGNXaW5BbW91bnQAAAADBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgUAAAAKYmV0S2V5UGFydAIAAAADXzVfCQABpAAAAAEFAAAABndpblJvdwAAAAAAAAAAAwMJAAAAAAAAAgUAAAAJd2luQW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAGllvdSB3b24gbm90aGluZyB0aGlzIHJvdW5kCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAALd2l0aGRyYXdLZXkFAAAACXdpbkFtb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAJd2luQW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAEAAAAg2AGRxriAuyMT3c9AcH6CQ43JiN5WSLBSu4r1qoLU0WKqOYr1", "height": 2283609, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let oracle = extract(addressFromString("$ORACLE_ADDRESS")) | |
5 | + | ||
6 | + | let minBet = 50000000 | |
7 | + | ||
8 | + | let maxSumBet = 1000000000 | |
9 | + | ||
10 | + | func calcWinAmount (this,key,koeff) = match getInteger(this, key) { | |
11 | + | case a: Int => | |
12 | + | (a * koeff) | |
13 | + | case _ => | |
14 | + | 0 | |
15 | + | } | |
16 | + | ||
17 | + | ||
18 | + | @Callable(i) | |
19 | + | func bet (round,guessType,guessValue) = { | |
20 | + | let pmt = extract(i.payment) | |
21 | + | if (isDefined(pmt.assetId)) | |
22 | + | then throw("Bets only in Waves supported") | |
23 | + | else if ((minBet > pmt.amount)) | |
24 | + | then throw(("Your Bet amount is less then minimal bet " + toString(minBet))) | |
25 | + | else if (if (isDefined(getBoolean(oracle, (round + "_stop")))) | |
26 | + | then true | |
27 | + | else isDefined(getString(oracle, round))) | |
28 | + | then throw("This round is already played") | |
29 | + | else { | |
30 | + | let roundBetsKey = (round + "_sumBets") | |
31 | + | let curSumBets = match getInteger(this, roundBetsKey) { | |
32 | + | case a: Int => | |
33 | + | a | |
34 | + | case _ => | |
35 | + | 0 | |
36 | + | } | |
37 | + | let newSumBets = (curSumBets + pmt.amount) | |
38 | + | if ((newSumBets > maxSumBet)) | |
39 | + | then throw(((("Maximum amount of bets for round " + toString(maxSumBet)) + ". With your bet it's ") + toString(newSumBets))) | |
40 | + | else { | |
41 | + | let betKey = ((((((toBase58String(i.caller.bytes) + "_") + round) + "_") + toString(guessType)) + "_") + toString(guessValue)) | |
42 | + | let curBetAmount = match getInteger(this, betKey) { | |
43 | + | case a: Int => | |
44 | + | a | |
45 | + | case _ => | |
46 | + | 0 | |
47 | + | } | |
48 | + | let newBetAmount = (curBetAmount + pmt.amount) | |
49 | + | WriteSet([DataEntry(betKey, newBetAmount), DataEntry(roundBetsKey, newSumBets)]) | |
50 | + | } | |
51 | + | } | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | @Callable(i) | |
57 | + | func withdraw (round) = { | |
58 | + | let betKeyPart = ((toBase58String(i.caller.bytes) + "_") + round) | |
59 | + | let withdrawKey = (betKeyPart + "_withdraw") | |
60 | + | if (isDefined(getInteger(this, withdrawKey))) | |
61 | + | then throw("You have already got your prize") | |
62 | + | else { | |
63 | + | let valComplex = getStringValue(oracle, round) | |
64 | + | let winNum = parseIntValue(drop(take(valComplex, 2), 0)) | |
65 | + | let winRedBlack = parseIntValue(drop(take(valComplex, 3), 2)) | |
66 | + | let winEvenOdd = parseIntValue(drop(take(valComplex, 4), 3)) | |
67 | + | let winDeskHalf = parseIntValue(drop(take(valComplex, 5), 4)) | |
68 | + | let winDeskThird = parseIntValue(drop(take(valComplex, 6), 5)) | |
69 | + | let winRow = parseIntValue(drop(take(valComplex, 7), 6)) | |
70 | + | let winAmount = (((((calcWinAmount(this, ((betKeyPart + "_0_") + toString(winNum)), 36) + calcWinAmount(this, ((betKeyPart + "_1_") + toString(winRedBlack)), 2)) + calcWinAmount(this, ((betKeyPart + "_2_") + toString(winEvenOdd)), 2)) + calcWinAmount(this, ((betKeyPart + "_3_") + toString(winDeskHalf)), 2)) + calcWinAmount(this, ((betKeyPart + "_4_") + toString(winDeskThird)), 3)) + calcWinAmount(this, ((betKeyPart + "_5_") + toString(winRow)), 3)) | |
71 | + | if ((winAmount == 0)) | |
72 | + | then throw("You won nothing this round") | |
73 | + | else ScriptResult(WriteSet([DataEntry(withdrawKey, winAmount)]), TransferSet([ScriptTransfer(i.caller, winAmount, unit)])) | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | @Verifier(tx) | |
79 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], base58'FYCT9GxhR2igEeyf9SWGi85bebBVaTAf9WUihEQnnBa9') | |
80 | + |
github/deemru/w8io/026f985 20.18 ms ◑