tx · AND3yuGwTZHnG2ogkkesA8Sum8YnZKZnHzManXpPFyNN 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM: -0.01500000 Waves 2019.12.14 09:42 [808189] smart account 3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM > SELF 0.00000000 Waves
{ "type": 13, "id": "AND3yuGwTZHnG2ogkkesA8Sum8YnZKZnHzManXpPFyNN", "fee": 1500000, "feeAssetId": null, "timestamp": 1576305802782, "version": 1, "sender": "3MvU8vDCk4NkA1Ag4vE3mETA4U9ioFh6VEM", "senderPublicKey": "LknnJnwRo6xRdriHmjgVbRDgpexijZFTYBU3Lw4HBS1", "proofs": [ "BsSWsPbpLRZM7Xu1RC9akvNsKToeMhuoNhCyTWJmqBvn6WKSNiTLEYdKfnCyCKTQgeUFS4VdcTs5CCbKgMggkCs" ], "script": "base64:AAIDAAAAAAAAABIIARIECgIBARIDCgEIEgMKAQgAAAABAAAAAA9hdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAAQAAAAMAAAABaQEAAAAMYmVnaW5BdWN0aW9uAAAAAgAAAAhtaW5QcmljZQAAAAhkdXJhdGlvbgMJAABmAAAAAgUAAAAIZHVyYXRpb24FAAAAD2F1Y3Rpb25EdXJhdGlvbgkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAE1NwZWNpZmllZCBkdXJhdGlvbigJAAGkAAAAAQUAAAAIZHVyYXRpb24CAAAAHykgZXhjZWVkcyB0aGUgbWF4aW11bSBkdXJhdGlvbigJAAGkAAAAAQUAAAAPYXVjdGlvbkR1cmF0aW9uAgAAAAEpBAAAAAlhdWN0aW9uSWQJAAJYAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAQAAAAHZW5kVGltZQkAAGQAAAACCAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAUAAAAIZHVyYXRpb24EAAAAA3BtdAkBAAAAB2V4dHJhY3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AAB19zdGF0dXMGBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAARaGlnaGVzdEJpZGRlckFkZHIAAAAAAAAAAAEBAAAABlQfWoIY8QkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlvd25lckFkZHIFAAAADWhpZ2hlc3RCaWRBbXQFAAAABHVuaXQFAAAAA25pbAAAAACWpL/d", "chainId": 84, "height": 808189, "spentComplexity": 0 } View: original | compacted Prev: 2jwkjsnqP3zaLdpLUH7xqg9teYSeBcw4Bs74PZ1mAKUJ Next: CAVVBiWYDsZPeCuDfqHbPZsz7ucTjeQq8C2dCxsHkGLW Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | let auctionDuration = (1440 * 1) | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | + | func beginAuction (minPrice,duration) = if ((duration > auctionDuration)) | |
8 | + | then throw((((("Specified duration(" + toString(duration)) + ") exceeds the maximum duration(") + toString(auctionDuration)) + ")")) | |
9 | + | else { | |
10 | + | let auctionId = toBase58String(i.transactionId) | |
11 | + | let endTime = (lastBlock.height + duration) | |
12 | + | let pmt = extract(i.payment) | |
13 | + | WriteSet([DataEntry(auctionId, auctionId), DataEntry((auctionId + "_endTime"), endTime), DataEntry((auctionId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_itemId"), if (isDefined(pmt.assetId)) | |
14 | + | then toBase58String(value(pmt.assetId)) | |
15 | + | else throw("Item not atached")), DataEntry((auctionId + "_minPrice"), minPrice)]) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | @Callable(i) | |
7 | 21 | func bid (auctionId) = { | |
8 | - | let pmt = extract(i.payment) | |
9 | 22 | let callerAddress = toBase58String(i.caller.bytes) | |
10 | 23 | let endTime = getIntegerValue(this, (auctionId + "_endTime")) | |
11 | 24 | let minPrice = getIntegerValue(this, (auctionId + "_minPrice")) | |
14 | 27 | let bidFromTheSameUser = if (isDefined(highestBidder)) | |
15 | 28 | then (value(highestBidder) == callerAddress) | |
16 | 29 | else false | |
17 | - | let totalBidAmount = ( | |
30 | + | let totalBidAmount = (1000000 + (if (bidFromTheSameUser) | |
18 | 31 | then value(highestBidAmt) | |
19 | 32 | else 0)) | |
20 | 33 | if (!(isDefined(getIntegerValue(this, auctionId)))) | |
42 | 55 | } | |
43 | 56 | ||
44 | 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 | + | func beginAuction (minPrice,duration) = if ((duration > auctionDuration)) | |
8 | + | then throw((((("Specified duration(" + toString(duration)) + ") exceeds the maximum duration(") + toString(auctionDuration)) + ")")) | |
9 | + | else { | |
10 | + | let auctionId = toBase58String(i.transactionId) | |
11 | + | let endTime = (lastBlock.height + duration) | |
12 | + | let pmt = extract(i.payment) | |
13 | + | WriteSet([DataEntry(auctionId, auctionId), DataEntry((auctionId + "_endTime"), endTime), DataEntry((auctionId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_itemId"), if (isDefined(pmt.assetId)) | |
14 | + | then toBase58String(value(pmt.assetId)) | |
15 | + | else throw("Item not atached")), DataEntry((auctionId + "_minPrice"), minPrice)]) | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | @Callable(i) | |
7 | 21 | func bid (auctionId) = { | |
8 | - | let pmt = extract(i.payment) | |
9 | 22 | let callerAddress = toBase58String(i.caller.bytes) | |
10 | 23 | let endTime = getIntegerValue(this, (auctionId + "_endTime")) | |
11 | 24 | let minPrice = getIntegerValue(this, (auctionId + "_minPrice")) | |
12 | 25 | let highestBidAmt = getInteger(this, (auctionId + "_highestBidAmt")) | |
13 | 26 | let highestBidder = getString(this, (auctionId + "_highestBidder")) | |
14 | 27 | let bidFromTheSameUser = if (isDefined(highestBidder)) | |
15 | 28 | then (value(highestBidder) == callerAddress) | |
16 | 29 | else false | |
17 | - | let totalBidAmount = ( | |
30 | + | let totalBidAmount = (1000000 + (if (bidFromTheSameUser) | |
18 | 31 | then value(highestBidAmt) | |
19 | 32 | else 0)) | |
20 | 33 | if (!(isDefined(getIntegerValue(this, auctionId)))) | |
21 | 34 | then throw("Auction Id not found") | |
22 | 35 | else if ((lastBlock.height >= endTime)) | |
23 | 36 | then throw("Auction Completed") | |
24 | 37 | else if (if (if (!(isDefined(highestBidAmt))) | |
25 | 38 | then (minPrice >= totalBidAmount) | |
26 | 39 | else false) | |
27 | 40 | then true | |
28 | 41 | else if (isDefined(highestBidAmt)) | |
29 | 42 | then (value(highestBidAmt) >= totalBidAmount) | |
30 | 43 | else false) | |
31 | 44 | then throw(("Bid must be more then " + (if (!(isDefined(highestBidAmt))) | |
32 | 45 | then toString(minPrice) | |
33 | 46 | else toString(value(highestBidAmt))))) | |
34 | 47 | else if (!(isDefined(highestBidder))) | |
35 | 48 | then WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]) | |
36 | 49 | else if (bidFromTheSameUser) | |
37 | 50 | then WriteSet([DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]) | |
38 | 51 | else { | |
39 | 52 | let previousBidder = addressFromStringValue(value(highestBidder)) | |
40 | 53 | ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, value(highestBidAmt), unit)])) | |
41 | 54 | } | |
42 | 55 | } | |
43 | 56 | ||
44 | 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/026f985 43.51 ms ◑