tx · Ey3ZWzYzuzkJAcvQnXGipFFh1yTNLp4JeBufdCW5cjzM 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep: -0.01400000 Waves 2019.07.11 13:27 [580915] smart account 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep > SELF 0.00000000 Waves
{ "type": 13, "id": "Ey3ZWzYzuzkJAcvQnXGipFFh1yTNLp4JeBufdCW5cjzM", "fee": 1400000, "feeAssetId": null, "timestamp": 1562840903173, "version": 1, "sender": "3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep", "senderPublicKey": "BJAeTqNbDSA5FiYihZZaSWvD6XL5XjpqVXbTGerBJjRK", "proofs": [ "5LRYWKchVwZwLUhBkXKkkyJXBuZsow84CXfiDj71CCUbZa4imq47WrCrvmGH5B2RFoof5jMsjeQXDB9m3njQKykk" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAQAAABJ1c2VySGFzQWRtaW5BY2Nlc3MAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwAAAAMAAAABaQEAAAADYmV0AAAAAAQAAAAWc3RhcnRUcmFuc2FjdGlvbkhlaWdodAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAFc3RhcnQEAAAACXRpbWVEZWx0YQkAAGUAAAACBQAAAAZoZWlnaHQFAAAAFnN0YXJ0VHJhbnNhY3Rpb25IZWlnaHQEAAAABm1heEJldAkBAAAAB2V4dHJhY3QAAAABCQAEGgAAAAIFAAAABHRoaXMCAAAABm1heEJldAQAAAALbWF4QmV0T3duZXIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEJAAGbAAAAAQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAALbWF4QmV0T3duZXIEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkAAGYAAAACBQAAAAl0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udHJ5AAAAAgIAAAAGbWF4QmV0BQAAAApzdGFydFByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAttYXhCZXRPd25lcgkAAlgAAAABCAUAAAABaQAAAA9jYWxsZXJQdWJsaWNLZXkFAAAAA25pbAAAAAFpAQAAAAZmaW5pc2gAAAAAAwkBAAAAASEAAAABCQEAAAASdXNlckhhc0FkbWluQWNjZXNzAAAAAQgFAAAAAWkAAAAGY2FsbGVyCQAAAgAAAAECAAAAE1lvdSBoYXZlIG5vIGFjY2VzcyEEAAAAC21heEJldE93bmVyCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABCQABmwAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAAC21heEJldE93bmVyCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFc3RhcnQAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAttYXhCZXRPd25lcgAAAAAAAAAAAQkAAZsAAAABAgAAACxCMXh3V25CTEI3ejc5VlByNHNxMWpCYjVHRHFzOFRlVDVqSG9qVGRpd3hmRQUAAAADbmlsAAAAAI7OZk0=", "chainId": 84, "height": 580915, "spentComplexity": 0 } View: original | compacted Prev: 9EWDLMLN7FrDzmQYSTQWefWAVhGotwyt59SbDuhKHJNA Next: 9gwjCMJYVeUAQ9k64jja42jBFM8mephMhApvLJ4tuqf7 Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice), DataEntry("maxBetOwner", toBase58String(i.callerPublicKey))]) | |
32 | 32 | ||
33 | 33 | ||
34 | + | ||
35 | + | @Callable(i) | |
36 | + | func finish () = if (!(userHasAdminAccess(i.caller))) | |
37 | + | then throw("You have no access!") | |
38 | + | else { | |
39 | + | let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, "maxBetOwner"))) | |
40 | + | ScriptResult(WriteSet([DataEntry("start", 0)]), TransferSet([ScriptTransfer(maxBetOwner, 1, toBytes("B1xwWnBLB7z79VPr4sq1jBb5GDqs8TeT5jHojTdiwxfE"))])) | |
41 | + | } | |
42 | + | ||
43 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func userHasAdminAccess (address) = (address == this) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | @Callable(i) | |
8 | 8 | func bet () = { | |
9 | 9 | let startTransactionHeight = getIntegerValue(this, "start") | |
10 | 10 | let timeDelta = (height - startTransactionHeight) | |
11 | 11 | let maxBet = extract(getInteger(this, "maxBet")) | |
12 | 12 | let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, "maxBetOwner"))) | |
13 | 13 | let pmt = extract(i.payment) | |
14 | 14 | if ((timeDelta > 2000)) | |
15 | 15 | then throw("The betting was closed") | |
16 | 16 | else if (!(isDefined(pmt.assetId))) | |
17 | 17 | then { | |
18 | 18 | let price = pmt.amount | |
19 | 19 | if ((price > maxBet)) | |
20 | 20 | then ScriptResult(WriteSet([DataEntry("maxBet", price), DataEntry("maxBetOwner", toBase58String(i.callerPublicKey)), DataEntry(toBase58String(i.callerPublicKey), price)]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)])) | |
21 | 21 | else throw("Your bet isn't the max bet") | |
22 | 22 | } | |
23 | 23 | else throw("You need to place a bet using waves currency") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func start (startPrice) = if (!(userHasAdminAccess(i.caller))) | |
30 | 30 | then throw("You have no access!") | |
31 | 31 | else WriteSet([DataEntry("start", height), DataEntry("maxBet", startPrice), DataEntry("maxBetOwner", toBase58String(i.callerPublicKey))]) | |
32 | 32 | ||
33 | 33 | ||
34 | + | ||
35 | + | @Callable(i) | |
36 | + | func finish () = if (!(userHasAdminAccess(i.caller))) | |
37 | + | then throw("You have no access!") | |
38 | + | else { | |
39 | + | let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, "maxBetOwner"))) | |
40 | + | ScriptResult(WriteSet([DataEntry("start", 0)]), TransferSet([ScriptTransfer(maxBetOwner, 1, toBytes("B1xwWnBLB7z79VPr4sq1jBb5GDqs8TeT5jHojTdiwxfE"))])) | |
41 | + | } | |
42 | + | ||
43 | + |
github/deemru/w8io/169f3d6 36.08 ms ◑