tx · 6GuwfUiDWFgUSiNJmohG8oD4NqnT4CqYxMoac4nv5Zcf 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep: -0.01400000 Waves 2019.07.12 13:42 [582404] smart account 3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep > SELF 0.00000000 Waves
{ "type": 13, "id": "6GuwfUiDWFgUSiNJmohG8oD4NqnT4CqYxMoac4nv5Zcf", "fee": 1400000, "feeAssetId": null, "timestamp": 1562928166335, "version": 1, "sender": "3N2icgpJnXhcYab7KQrwqWsV4LwSF25C1Ep", "senderPublicKey": "BJAeTqNbDSA5FiYihZZaSWvD6XL5XjpqVXbTGerBJjRK", "proofs": [ "3J66XjvuotiuRfsRnanntDGnguH8J8Wz5VSTh6z372t844g1c3y8g4USS9kMbi8JTs1CgpQ2o3TBbbJjGxDjAx9v" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAp0b2tlbklkRGVmAQAAACCU1B7l35UfeySUCJ5Oe8nTMKHr4huFqp+vPk8CQCqTZQEAAAASdXNlckhhc0FkbWluQWNjZXNzAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAABGFkZHIAAAACAAAAB3Rva2VuSWQAAAADcGFyCQABLAAAAAIJAAEsAAAAAgkAAlgAAAABBQAAAAd0b2tlbklkAgAAAAFfBQAAAANwYXIBAAAABXNhZGRyAAAAAgAAAAd0b2tlbklkAAAAA3BhcgkAASwAAAACCQABLAAAAAIFAAAAB3Rva2VuSWQCAAAAAV8FAAAAA3BhcgAAAAMAAAABaQEAAAADYmV0AAAAAQAAAA10b2tlbklkU3RyaW5nBAAAABZzdGFydFRyYW5zYWN0aW9uSGVpZ2h0CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzCQEAAAAFc2FkZHIAAAACBQAAAA10b2tlbklkU3RyaW5nAgAAAAVzdGFydAQAAAAJdGltZURlbHRhCQAAZQAAAAIFAAAAB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FAAAAB3Rva2VuSWQCAAAABXN0YXJ0BQAAAAZoZWlnaHQEAAAABWRlbHRhCQAAZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMJAQAAAARhZGRyAAAAAgUAAAAHdG9rZW5JZAIAAAAIZHVyYXRpb24FAAAABmxlbmd0aAMJAABmAAAAAgUAAAAFZGVsdGEAAAAAAAAAAAAJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAAJFRoZSBhdWN0aW9uIGNhbm5vdCBiZSBmaW5pc2hlZCB5ZXQhIAkAAaQAAAABBQAAAAVkZWx0YQIAAAASIG1pbnV0ZXMgcmVtYWluaW5nBAAAAAttYXhCZXRPd25lcgkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQkAAZsAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzCQEAAAAEYWRkcgAAAAIFAAAAB3Rva2VuSWQCAAAAC21heEJldE93bmVyCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAABGFkZHIAAAACBQAAAAd0b2tlbklkAgAAAAVzdGFydAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAC21heEJldE93bmVyAAAAAAAAAAABBQAAAAd0b2tlbklkBQAAAANuaWwAAAAAoUdKJQ==", "chainId": 84, "height": 582404, "spentComplexity": 0 } View: original | compacted Prev: BwE16QDFubJDYmNhmWhHByY3ywxGN7wyXpWWXn1TkfcX Next: 96xi7Diav6ZmeAvFsNFDf1YnDqRnifyxbcdUv1zJzEme Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | func addr (tokenId,par) = ((toBase58String(tokenId) + "_") + par) | |
10 | 10 | ||
11 | 11 | ||
12 | + | func saddr (tokenId,par) = ((tokenId + "_") + par) | |
13 | + | ||
14 | + | ||
12 | 15 | @Callable(i) | |
13 | 16 | func bet (tokenIdString) = { | |
14 | - | let tokenId = toBytes(tokenIdString) | |
15 | - | throw(toBase58String(tokenId)) | |
17 | + | let startTransactionHeight = getIntegerValue(this, saddr(tokenIdString, "start")) | |
18 | + | let timeDelta = (height - startTransactionHeight) | |
19 | + | let maxBet = extract(getInteger(this, saddr(tokenIdString, "maxBet"))) | |
20 | + | let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, saddr(tokenIdString, "maxBetOwner")))) | |
21 | + | let pmt = extract(i.payment) | |
22 | + | if ((timeDelta > 20000)) | |
23 | + | then throw("The betting was closed") | |
24 | + | else if (!(isDefined(pmt.assetId))) | |
25 | + | then { | |
26 | + | let price = pmt.amount | |
27 | + | if ((price > maxBet)) | |
28 | + | then ScriptResult(WriteSet([DataEntry(saddr(tokenIdString, "maxBet"), price), DataEntry(saddr(tokenIdString, "maxBetOwner"), toBase58String(i.callerPublicKey))]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)])) | |
29 | + | else throw("Your bet isn't the max bet") | |
30 | + | } | |
31 | + | else throw("You need to place a bet using waves currency") | |
16 | 32 | } | |
17 | 33 | ||
18 | 34 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let tokenIdDef = base58'B1xwWnBLB7z79VPr4sq1jBb5GDqs8TeT5jHojTdiwxfE' | |
5 | 5 | ||
6 | 6 | func userHasAdminAccess (address) = (address == this) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func addr (tokenId,par) = ((toBase58String(tokenId) + "_") + par) | |
10 | 10 | ||
11 | 11 | ||
12 | + | func saddr (tokenId,par) = ((tokenId + "_") + par) | |
13 | + | ||
14 | + | ||
12 | 15 | @Callable(i) | |
13 | 16 | func bet (tokenIdString) = { | |
14 | - | let tokenId = toBytes(tokenIdString) | |
15 | - | throw(toBase58String(tokenId)) | |
17 | + | let startTransactionHeight = getIntegerValue(this, saddr(tokenIdString, "start")) | |
18 | + | let timeDelta = (height - startTransactionHeight) | |
19 | + | let maxBet = extract(getInteger(this, saddr(tokenIdString, "maxBet"))) | |
20 | + | let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, saddr(tokenIdString, "maxBetOwner")))) | |
21 | + | let pmt = extract(i.payment) | |
22 | + | if ((timeDelta > 20000)) | |
23 | + | then throw("The betting was closed") | |
24 | + | else if (!(isDefined(pmt.assetId))) | |
25 | + | then { | |
26 | + | let price = pmt.amount | |
27 | + | if ((price > maxBet)) | |
28 | + | then ScriptResult(WriteSet([DataEntry(saddr(tokenIdString, "maxBet"), price), DataEntry(saddr(tokenIdString, "maxBetOwner"), toBase58String(i.callerPublicKey))]), TransferSet([ScriptTransfer(maxBetOwner, maxBet, unit)])) | |
29 | + | else throw("Your bet isn't the max bet") | |
30 | + | } | |
31 | + | else throw("You need to place a bet using waves currency") | |
16 | 32 | } | |
17 | 33 | ||
18 | 34 | ||
19 | 35 | ||
20 | 36 | @Callable(i) | |
21 | 37 | func start (startPrice,auctionDuration) = { | |
22 | 38 | let pmt = extract(i.payment) | |
23 | 39 | let tokenId = extract(pmt.assetId) | |
24 | 40 | if (isDefined(tokenId)) | |
25 | 41 | then WriteSet([DataEntry(addr(tokenId, "start"), height), DataEntry(addr(tokenId, "startPrice"), startPrice), DataEntry(addr(tokenId, "duration"), auctionDuration), DataEntry(addr(tokenId, "maxBetOwner"), toBase58String(i.callerPublicKey))]) | |
26 | 42 | else throw("You can't sell waves using the auction") | |
27 | 43 | } | |
28 | 44 | ||
29 | 45 | ||
30 | 46 | ||
31 | 47 | @Callable(i) | |
32 | 48 | func finish (tokenId) = { | |
33 | 49 | let length = (getIntegerValue(this, addr(tokenId, "start")) - height) | |
34 | 50 | let delta = (getIntegerValue(this, addr(tokenId, "duration")) - length) | |
35 | 51 | if ((delta > 0)) | |
36 | 52 | then throw((("The auction cannot be finished yet! " + toString(delta)) + " minutes remaining")) | |
37 | 53 | else { | |
38 | 54 | let maxBetOwner = addressFromPublicKey(toBytes(getStringValue(this, addr(tokenId, "maxBetOwner")))) | |
39 | 55 | ScriptResult(WriteSet([DataEntry(addr(tokenId, "start"), 0)]), TransferSet([ScriptTransfer(maxBetOwner, 1, tokenId)])) | |
40 | 56 | } | |
41 | 57 | } | |
42 | 58 | ||
43 | 59 |
github/deemru/w8io/169f3d6 38.26 ms ◑