tx · 9rriWfiy6jC4FbpEXCPhYR1qwL1ZU48KagRHnJAcNt3v 3MvoQ3q8wFnquWFPSZuBGunTnE1fphumBxd: -0.01400000 Waves 2019.08.11 12:13 [626187] smart account 3MvoQ3q8wFnquWFPSZuBGunTnE1fphumBxd > SELF 0.00000000 Waves
{ "type": 13, "id": "9rriWfiy6jC4FbpEXCPhYR1qwL1ZU48KagRHnJAcNt3v", "fee": 1400000, "feeAssetId": null, "timestamp": 1565514839298, "version": 1, "sender": "3MvoQ3q8wFnquWFPSZuBGunTnE1fphumBxd", "senderPublicKey": "D7SkqDbPr1pTQ9McD2XsJyvNqjRakMoWERXwKVzCGTWj", "proofs": [ "3YpmnNLXKLXLCfaAgULtvsLqMxfw8DE5gkpsJzHdUTzV4NSSBToqLdwfQMCmTmT2NQwZTTMvC4jj1wMkd3H7cMpz" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAABJtYXhBdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAHgAAAAAOcmV2ZWFsRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAABwEAAAAKaGFzaFN0cmluZwAAAAEAAAAEZGF0YQQAAAAGcmVzdWx0CQACWgAAAAEJAAH3AAAAAQkAAZsAAAABBQAAAARkYXRhBQAAAAZyZXN1bHQBAAAACWFkZFRvTGlzdAAAAAIAAAAEbGlzdAAAAAl3aGF0VG9BZGQEAAAABnJlc3VsdAkAASwAAAACCQABLAAAAAIFAAAABGxpc3QCAAAAASAFAAAACXdoYXRUb0FkZAUAAAAGcmVzdWx0AAAAAwAAAAFpAQAAAAxzdGFydEF1Y3Rpb24AAAAEAAAACGR1cmF0aW9uAAAACnN0YXJ0UHJpY2UAAAAMcHJpY2VBc3NldElkAAAAB2RlcG9zaXQEAAAACWF1Y3Rpb25JZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBAAAAAtyZXZlYWxTdGFydAkAAGQAAAACCAUAA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: original | compacted Prev: 4unf2wmt2kcB1T7363gQ9if5Nf6juhSYoqJ8dxdeuzDM Next: GgJm87udZbki3YUS6mHQDpgDC1TNMtornQ7PtDAH84US Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | + | func addToList (list,whatToAdd) = { | |
15 | + | let result = ((list + " ") + whatToAdd) | |
16 | + | result | |
17 | + | } | |
18 | + | ||
19 | + | ||
14 | 20 | @Callable(i) | |
15 | 21 | func startAuction (duration,startPrice,priceAssetId,deposit) = { | |
16 | 22 | let auctionId = toBase58String(i.transactionId) | |
17 | 23 | let revealStart = (lastBlock.height + duration) | |
18 | 24 | let closingStart = (revealStart + revealDuration) | |
25 | + | let organizer = toBase58String(i.caller.bytes) | |
26 | + | let organizerKey = (organizer + "_organizer") | |
27 | + | let maybeOrganizerList = getString(this, organizerKey) | |
28 | + | let organizerList = if (isDefined(maybeOrganizerList)) | |
29 | + | then value(maybeOrganizerList) | |
30 | + | else "" | |
31 | + | let newOrganizerList = addToList(organizerList, organizer) | |
19 | 32 | let pmt = extract(i.payment) | |
20 | 33 | if ((duration > maxAuctionDuration)) | |
21 | 34 | then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration))) | |
29 | 42 | then throw((("Start price should be < deposit (" + toString(deposit)) + ")")) | |
30 | 43 | else if ((0 >= duration)) | |
31 | 44 | then throw("Duration should be > 0") | |
32 | - | else WriteSet([DataEntry((auctionId + "_reveal_start"), revealStart), DataEntry((auctionId + "_deposit"), deposit), DataEntry((auctionId + "_unrevealed_count"), 0), DataEntry((auctionId + "_top_price"), 0), DataEntry((auctionId + "_second_price"), 0), DataEntry((auctionId + "_settle"), false), DataEntry((auctionId + "_closing_start"), closingStart), DataEntry((auctionId + "_organizer"), | |
45 | + | else WriteSet([DataEntry((auctionId + "_reveal_start"), revealStart), DataEntry((auctionId + "_deposit"), deposit), DataEntry((auctionId + "_unrevealed_count"), 0), DataEntry((auctionId + "_top_price"), 0), DataEntry((auctionId + "_second_price"), 0), DataEntry((auctionId + "_settle"), false), DataEntry((auctionId + "_closing_start"), closingStart), DataEntry((auctionId + "_organizer"), organizer), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId)) | |
33 | 46 | then toBase58String(value(pmt.assetId)) | |
34 | - | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)]) | |
47 | + | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId), DataEntry(organizerKey, organizerList)]) | |
35 | 48 | } | |
36 | 49 | ||
37 | 50 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let maxAuctionDuration = (1440 * 30) | |
5 | 5 | ||
6 | 6 | let revealDuration = (1440 * 7) | |
7 | 7 | ||
8 | 8 | func hashString (data) = { | |
9 | 9 | let result = toBase64String(sha256(toBytes(data))) | |
10 | 10 | result | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | + | func addToList (list,whatToAdd) = { | |
15 | + | let result = ((list + " ") + whatToAdd) | |
16 | + | result | |
17 | + | } | |
18 | + | ||
19 | + | ||
14 | 20 | @Callable(i) | |
15 | 21 | func startAuction (duration,startPrice,priceAssetId,deposit) = { | |
16 | 22 | let auctionId = toBase58String(i.transactionId) | |
17 | 23 | let revealStart = (lastBlock.height + duration) | |
18 | 24 | let closingStart = (revealStart + revealDuration) | |
25 | + | let organizer = toBase58String(i.caller.bytes) | |
26 | + | let organizerKey = (organizer + "_organizer") | |
27 | + | let maybeOrganizerList = getString(this, organizerKey) | |
28 | + | let organizerList = if (isDefined(maybeOrganizerList)) | |
29 | + | then value(maybeOrganizerList) | |
30 | + | else "" | |
31 | + | let newOrganizerList = addToList(organizerList, organizer) | |
19 | 32 | let pmt = extract(i.payment) | |
20 | 33 | if ((duration > maxAuctionDuration)) | |
21 | 34 | then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration))) | |
22 | 35 | else if (!(isDefined(pmt.assetId))) | |
23 | 36 | then throw("Payment currency should not be in WAVES") | |
24 | 37 | else if ((pmt.amount != 1)) | |
25 | 38 | then throw("Payment amount should be only one NFT") | |
26 | 39 | else if ((0 >= startPrice)) | |
27 | 40 | then throw("Start price should be > 0") | |
28 | 41 | else if ((startPrice >= deposit)) | |
29 | 42 | then throw((("Start price should be < deposit (" + toString(deposit)) + ")")) | |
30 | 43 | else if ((0 >= duration)) | |
31 | 44 | then throw("Duration should be > 0") | |
32 | - | else WriteSet([DataEntry((auctionId + "_reveal_start"), revealStart), DataEntry((auctionId + "_deposit"), deposit), DataEntry((auctionId + "_unrevealed_count"), 0), DataEntry((auctionId + "_top_price"), 0), DataEntry((auctionId + "_second_price"), 0), DataEntry((auctionId + "_settle"), false), DataEntry((auctionId + "_closing_start"), closingStart), DataEntry((auctionId + "_organizer"), | |
45 | + | else WriteSet([DataEntry((auctionId + "_reveal_start"), revealStart), DataEntry((auctionId + "_deposit"), deposit), DataEntry((auctionId + "_unrevealed_count"), 0), DataEntry((auctionId + "_top_price"), 0), DataEntry((auctionId + "_second_price"), 0), DataEntry((auctionId + "_settle"), false), DataEntry((auctionId + "_closing_start"), closingStart), DataEntry((auctionId + "_organizer"), organizer), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId)) | |
33 | 46 | then toBase58String(value(pmt.assetId)) | |
34 | - | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)]) | |
47 | + | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId), DataEntry(organizerKey, organizerList)]) | |
35 | 48 | } | |
36 | 49 | ||
37 | 50 | ||
38 | 51 | ||
39 | 52 | @Callable(i) | |
40 | 53 | func bid (auctionId,hashBidAmount) = { | |
41 | 54 | let pmt = extract(i.payment) | |
42 | 55 | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
43 | 56 | then toBase58String(value(pmt.assetId)) | |
44 | 57 | else "WAVES" | |
45 | 58 | let callerAddressStr = toBase58String(i.caller.bytes) | |
46 | 59 | let endHeight = getIntegerValue(this, auctionId) | |
47 | 60 | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
48 | 61 | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
49 | 62 | let organizer = getStringValue(this, (auctionId + "_organizer")) | |
50 | 63 | let deposit = getIntegerValue(this, (auctionId + "_deposit")) | |
51 | 64 | let unrevealedCount = getIntegerValue(this, (auctionId + "_unrevealed_count")) | |
52 | 65 | let bidder = getString(this, (callerAddressStr + "_bidder")) | |
53 | 66 | let bidFromTheSameUser = isDefined(getString(this, ((auctionId + callerAddressStr) + "bid_hash"))) | |
54 | 67 | if ((lastBlock.height >= endHeight)) | |
55 | 68 | then throw("Auction already finished") | |
56 | 69 | else if (if (!(bidFromTheSameUser)) | |
57 | 70 | then (priceAssetId != pmtAssetIdStr) | |
58 | 71 | else false) | |
59 | 72 | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
60 | 73 | else if (!(isDefined(organizer))) | |
61 | 74 | then throw("Organizer should be defined") | |
62 | 75 | else if (if (!(bidFromTheSameUser)) | |
63 | 76 | then (pmt.amount != deposit) | |
64 | 77 | else false) | |
65 | 78 | then throw("Payment should be equel to deposit") | |
66 | 79 | else { | |
67 | 80 | let inc = if (bidFromTheSameUser) | |
68 | 81 | then 0 | |
69 | 82 | else 1 | |
70 | 83 | WriteSet([DataEntry(((auctionId + callerAddressStr) + "_revealed"), false), DataEntry(((auctionId + callerAddressStr) + "_bid_hash"), hashBidAmount), DataEntry(((auctionId + callerAddressStr) + "_settle"), false), DataEntry((auctionId + "_unrevealed_cont"), (unrevealedCount + inc)), DataEntry((callerAddressStr + "_bidder"), (((if (isDefined(bidder)) | |
71 | 84 | then value(bidder) | |
72 | 85 | else "") + " ") + auctionId))]) | |
73 | 86 | } | |
74 | 87 | } | |
75 | 88 | ||
76 | 89 | ||
77 | 90 | ||
78 | 91 | @Callable(i) | |
79 | 92 | func reveal (auctionId,bidAmount,salt) = { | |
80 | 93 | let callerAddressStr = toBase58String(i.caller.bytes) | |
81 | 94 | let organizer = getStringValue(this, (auctionId + "_organizer")) | |
82 | 95 | let bidHash = getStringValue(this, (callerAddressStr + "_bid_hash")) | |
83 | 96 | let revealed = getBooleanValue(this, (callerAddressStr + "_revealed")) | |
84 | 97 | let revealStart = getIntegerValue(this, (auctionId + "_reveal_start")) | |
85 | 98 | let closingStart = getIntegerValue(this, (auctionId + "_closing_start")) | |
86 | 99 | let topPrice = getIntegerValue(this, (auctionId + "_top_price")) | |
87 | 100 | let secondPrice = getIntegerValue(this, (auctionId + "_second_price")) | |
88 | 101 | let winner = getStringValue(this, (auctionId + "_winner")) | |
89 | 102 | if (!(isDefined(organizer))) | |
90 | 103 | then throw("Organizer is not defined") | |
91 | 104 | else if (!(isDefined(bidHash))) | |
92 | 105 | then throw("Bid is not defined") | |
93 | 106 | else if (if ((revealStart > lastBlock.height)) | |
94 | 107 | then true | |
95 | 108 | else (lastBlock.height > closingStart)) | |
96 | 109 | then throw("Auction should be revealed between reveal and closing times") | |
97 | 110 | else if (if (isDefined(extract(i.payment))) | |
98 | 111 | then (extract(i.payment).amount > 0) | |
99 | 112 | else false) | |
100 | 113 | then throw("Payment shoud not exist") | |
101 | 114 | else if ((hashString((salt + toString(bidAmount))) != bidHash)) | |
102 | 115 | then throw("Bid hash from bidMount and sault is not equel with hash from the caller bid") | |
103 | 116 | else if ((revealed == true)) | |
104 | 117 | then throw("The bid has been already revealed") | |
105 | 118 | else { | |
106 | 119 | let topPrice2 = if ((bidAmount > topPrice)) | |
107 | 120 | then value(bidAmount) | |
108 | 121 | else value(topPrice) | |
109 | 122 | let secondPrice2 = if ((bidAmount > topPrice)) | |
110 | 123 | then value(topPrice) | |
111 | 124 | else if ((bidAmount > secondPrice)) | |
112 | 125 | then bidAmount | |
113 | 126 | else secondPrice | |
114 | 127 | let winner2 = if ((bidAmount > topPrice)) | |
115 | 128 | then callerAddressStr | |
116 | 129 | else winner | |
117 | 130 | WriteSet([DataEntry((auctionId + "_top_price"), topPrice2), DataEntry((auctionId + "_second_price"), secondPrice2), DataEntry((auctionId + "_winner"), winner2), DataEntry((auctionId + "_revealed"), false)]) | |
118 | 131 | } | |
119 | 132 | } | |
120 | 133 | ||
121 | 134 |
github/deemru/w8io/169f3d6 56.98 ms ◑