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