tx · CAVVBiWYDsZPeCuDfqHbPZsz7ucTjeQq8C2dCxsHkGLW 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM: -0.01500000 Waves 2019.12.14 09:50 [808197] smart account 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM > SELF 0.00000000 Waves
{ "type": 13, "id": "CAVVBiWYDsZPeCuDfqHbPZsz7ucTjeQq8C2dCxsHkGLW", "fee": 1500000, "feeAssetId": null, "timestamp": 1576306276279, "version": 1, "sender": "3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM", "senderPublicKey": "LknnJnwRo6xRdriHmjgVbRDgpexijZFTYBU3Lw4HBS1", "proofs": [ "6WL8ema4di7ULz1TxdcVMVYzoNLkdUzZks4oi4bxiyQ6i3LgqtqU4kbrjyQeQni674AcMUZ7dfcwcp82KMJ9kfL" ], "script": "base64:AAIDAAAAAAAAAA0IARIECgIBARIDCgEIAAAAAQAAAAAPYXVjdGlvbkR1cmF0aW9uCQAAaAAAAAIAAAAAAAAABaAAAAAAAAAAAAEAAAACAAAAAWkBAAAADGJlZ2luQXVjdGlvbgAAAAIAAAAIbWluUHJpY2UAAAAIZHVyYXRpb24DCQAAZgAAAAIFAAAACGR1cmF0aW9uBQAAAA9hdWN0aW9uRHVyYXRpb24JAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABNTcGVjaWZpZWQgZHVyYXRpb24oCQABpAAAAAEFAAAACGR1cmF0aW9uAgAAAB8pIGV4Y2VlZHMgdGhlIG1heGltdW0gZHVyYXRpb24oCQABpAAAAAEFAAAAD2F1Y3Rpb25EdXJhdGlvbgIAAAABKQQAAAAJYXVjdGlvbklkCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAAB2VuZFRpbWUJAABkAAAAAggFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQFAAAACGR1cmF0aW9uBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAA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ZlcgAAAAMFAAAADnByZXZpb3VzQmlkZGVyCQEAAAAFdmFsdWUAAAABBQAAAA1oaWdoZXN0QmlkQW10BQAAAAR1bml0BQAAAANuaWwAAAAAuHB2kA==", "chainId": 84, "height": 808197, "spentComplexity": 0 } View: original | compacted Prev: AND3yuGwTZHnG2ogkkesA8Sum8YnZKZnHzManXpPFyNN Next: DsA5wkGXy1LjT5oo7FkcwxEdFWabYsb5aqsWhATYgNPh Diff:
Old | New | Differences | |
---|---|---|---|
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | - | ||
59 | - | @Callable(i) | |
60 | - | func withdraw (auctionId) = { | |
61 | - | let pmt = extract(i.payment) | |
62 | - | let callerAddress = toBase58String(i.caller.bytes) | |
63 | - | let endTime = getIntegerValue(this, (auctionId + "_endTime")) | |
64 | - | let owner = getStringValue(this, (auctionId + "_owner")) | |
65 | - | let highestBidder = getString(this, (auctionId + "_highestBidder")) | |
66 | - | let itemId = getStringValue(this, (auctionId + "_itemId")) | |
67 | - | let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt")) | |
68 | - | let highestBidderAddr = addressFromStringValue(value(highestBidder)) | |
69 | - | let ownerAddr = addressFromStringValue(value(owner)) | |
70 | - | let itemAddr = addressFromStringValue(value(itemId)) | |
71 | - | if ((endTime > lastBlock.height)) | |
72 | - | then throw("Auction is not finished yet") | |
73 | - | else if (!(isDefined(highestBidder))) | |
74 | - | then if (!(isDefined(getBoolean(this, (auctionId + "_status"))))) | |
75 | - | then throw("Owner already withdrawn the item") | |
76 | - | else ScriptResult(WriteSet([DataEntry((auctionId + "_status"), true)]), TransferSet([ScriptTransfer(ownerAddr, 1, base58'itemAddr')])) | |
77 | - | else if (isDefined(getBoolean(this, (auctionId + "_status")))) | |
78 | - | then throw("The item is transfered to the highest bidder and the bid amount is transfered to the owner") | |
79 | - | else ScriptResult(WriteSet([DataEntry((auctionId + "_status"), true)]), TransferSet([ScriptTransfer(highestBidderAddr, 1, base58'itemAddr'), ScriptTransfer(ownerAddr, highestBidAmt, unit)])) | |
80 | - | } | |
81 | - | ||
82 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let auctionDuration = (1440 * 1) | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func beginAuction (minPrice,duration) = if ((duration > auctionDuration)) | |
8 | 8 | then throw((((("Specified duration(" + toString(duration)) + ") exceeds the maximum duration(") + toString(auctionDuration)) + ")")) | |
9 | 9 | else { | |
10 | 10 | let auctionId = toBase58String(i.transactionId) | |
11 | 11 | let endTime = (lastBlock.height + duration) | |
12 | 12 | let pmt = extract(i.payment) | |
13 | 13 | WriteSet([DataEntry(auctionId, auctionId), DataEntry((auctionId + "_endTime"), endTime), DataEntry((auctionId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_itemId"), if (isDefined(pmt.assetId)) | |
14 | 14 | then toBase58String(value(pmt.assetId)) | |
15 | 15 | else throw("Item not atached")), DataEntry((auctionId + "_minPrice"), minPrice)]) | |
16 | 16 | } | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | 20 | @Callable(i) | |
21 | 21 | func bid (auctionId) = { | |
22 | 22 | let callerAddress = toBase58String(i.caller.bytes) | |
23 | 23 | let endTime = getIntegerValue(this, (auctionId + "_endTime")) | |
24 | 24 | let minPrice = getIntegerValue(this, (auctionId + "_minPrice")) | |
25 | 25 | let highestBidAmt = getInteger(this, (auctionId + "_highestBidAmt")) | |
26 | 26 | let highestBidder = getString(this, (auctionId + "_highestBidder")) | |
27 | 27 | let bidFromTheSameUser = if (isDefined(highestBidder)) | |
28 | 28 | then (value(highestBidder) == callerAddress) | |
29 | 29 | else false | |
30 | 30 | let totalBidAmount = (1000000 + (if (bidFromTheSameUser) | |
31 | 31 | then value(highestBidAmt) | |
32 | 32 | else 0)) | |
33 | 33 | if (!(isDefined(getIntegerValue(this, auctionId)))) | |
34 | 34 | then throw("Auction Id not found") | |
35 | 35 | else if ((lastBlock.height >= endTime)) | |
36 | 36 | then throw("Auction Completed") | |
37 | 37 | else if (if (if (!(isDefined(highestBidAmt))) | |
38 | 38 | then (minPrice >= totalBidAmount) | |
39 | 39 | else false) | |
40 | 40 | then true | |
41 | 41 | else if (isDefined(highestBidAmt)) | |
42 | 42 | then (value(highestBidAmt) >= totalBidAmount) | |
43 | 43 | else false) | |
44 | 44 | then throw(("Bid must be more then " + (if (!(isDefined(highestBidAmt))) | |
45 | 45 | then toString(minPrice) | |
46 | 46 | else toString(value(highestBidAmt))))) | |
47 | 47 | else if (!(isDefined(highestBidder))) | |
48 | 48 | then WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]) | |
49 | 49 | else if (bidFromTheSameUser) | |
50 | 50 | then WriteSet([DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]) | |
51 | 51 | else { | |
52 | 52 | let previousBidder = addressFromStringValue(value(highestBidder)) | |
53 | 53 | ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, value(highestBidAmt), unit)])) | |
54 | 54 | } | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | - | ||
59 | - | @Callable(i) | |
60 | - | func withdraw (auctionId) = { | |
61 | - | let pmt = extract(i.payment) | |
62 | - | let callerAddress = toBase58String(i.caller.bytes) | |
63 | - | let endTime = getIntegerValue(this, (auctionId + "_endTime")) | |
64 | - | let owner = getStringValue(this, (auctionId + "_owner")) | |
65 | - | let highestBidder = getString(this, (auctionId + "_highestBidder")) | |
66 | - | let itemId = getStringValue(this, (auctionId + "_itemId")) | |
67 | - | let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt")) | |
68 | - | let highestBidderAddr = addressFromStringValue(value(highestBidder)) | |
69 | - | let ownerAddr = addressFromStringValue(value(owner)) | |
70 | - | let itemAddr = addressFromStringValue(value(itemId)) | |
71 | - | if ((endTime > lastBlock.height)) | |
72 | - | then throw("Auction is not finished yet") | |
73 | - | else if (!(isDefined(highestBidder))) | |
74 | - | then if (!(isDefined(getBoolean(this, (auctionId + "_status"))))) | |
75 | - | then throw("Owner already withdrawn the item") | |
76 | - | else ScriptResult(WriteSet([DataEntry((auctionId + "_status"), true)]), TransferSet([ScriptTransfer(ownerAddr, 1, base58'itemAddr')])) | |
77 | - | else if (isDefined(getBoolean(this, (auctionId + "_status")))) | |
78 | - | then throw("The item is transfered to the highest bidder and the bid amount is transfered to the owner") | |
79 | - | else ScriptResult(WriteSet([DataEntry((auctionId + "_status"), true)]), TransferSet([ScriptTransfer(highestBidderAddr, 1, base58'itemAddr'), ScriptTransfer(ownerAddr, highestBidAmt, unit)])) | |
80 | - | } | |
81 | - | ||
82 | - |
github/deemru/w8io/169f3d6 41.04 ms ◑