tx · CUahchGiQ9oRpA47fRASZhCKziRQPNtpyXptfu3VyJAF

3N6s7QBCvgnCNbR7r4rajA9DsejGtshaLLa:  -0.01000000 Waves

2019.12.14 11:33 [808303] smart account 3N6s7QBCvgnCNbR7r4rajA9DsejGtshaLLa > SELF 0.00000000 Waves

{ "type": 13, "id": "CUahchGiQ9oRpA47fRASZhCKziRQPNtpyXptfu3VyJAF", "fee": 1000000, "feeAssetId": null, "timestamp": 1576312161405, "version": 1, "sender": "3N6s7QBCvgnCNbR7r4rajA9DsejGtshaLLa", "senderPublicKey": "5wpzgifs7AQAB2xctYK9m7gDenQv4yCCiLcTgKQTcz9Z", "proofs": [ "5698Q71YkzwKxBJMRMMn2TuF575hhm2YCygCqz3Lw8MAxAVkDXcgb6s7TAKJ631FdZ8175EqCYPwEQqH2CcQV7k5" ], "script": "base64:AAIDAAAAAAAAABIIARIECgIBARIDCgEIEgMKAQgAAAABAAAAAA9hdWN0aW9uRHVyYXRpb24AAAAAAAAAAAIAAAADAAAAAWkBAAAADGJlZ2luQXVjdGlvbgAAAAIAAAAIbWluUHJpY2UAAAAIZHVyYXRpb24DCQAAZgAAAAIFAAAACGR1cmF0aW9uBQAAAA9hdWN0aW9uRHVyYXRpb24JAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABNTcGVjaWZpZWQgZHVyYXRpb24oCQABpAAAAAEFAAAACGR1cmF0aW9uAgAAAB8pIGV4Y2VlZHMgdGhlIG1heGltdW0gZHVyYXRpb24oCQABpAAAAAEFAAAAD2F1Y3Rpb25EdXJhdGlvbgIAAAABKQQAAAAJYXVjdGlvbklkCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAAB2VuZFRpbWUJAABkAAAAAggFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQFAAAACGR1cmF0aW9uBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAkBAAAACFdyaX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CQABLAAAAAIFAAAACWF1Y3Rpb25JZAIAAAAHX3N0YXR1cwYFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABFoaWdoZXN0QmlkZGVyQWRkcgAAAAAAAAAAAQEAAAAGVB9aghjxCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAACW93bmVyQWRkcgUAAAANaGlnaGVzdEJpZEFtdAUAAAAEdW5pdAUAAAADbmlsAAAAADw6adE=", "chainId": 84, "height": 808303, "spentComplexity": 0 } View: original | compacted Prev: none Next: 2KW5QtyBwXUn6ntLobPS7Lb6CCzoRpkohxmcGdhPLhPS Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let auctionDuration = 2
5+
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)
21+func bid (auctionId) = {
22+ let pmt = extract(i.payment)
23+ let callerAddress = toBase58String(i.caller.bytes)
24+ let endTime = getIntegerValue(this, (auctionId + "_endTime"))
25+ let minPrice = getIntegerValue(this, (auctionId + "_minPrice"))
26+ let highestBidAmt = getInteger(this, (auctionId + "_highestBidAmt"))
27+ let highestBidder = getString(this, (auctionId + "_highestBidder"))
28+ let bidFromTheSameUser = if (isDefined(highestBidder))
29+ then (value(highestBidder) == callerAddress)
30+ else false
31+ let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
32+ then value(highestBidAmt)
33+ else 0))
34+ if (!(isDefined(getString(this, auctionId))))
35+ then throw("Auction Id not found")
36+ else if ((lastBlock.height >= endTime))
37+ then throw("Auction Completed")
38+ else if (if (if (!(isDefined(highestBidAmt)))
39+ then (minPrice >= totalBidAmount)
40+ else false)
41+ then true
42+ else if (isDefined(highestBidAmt))
43+ then (value(highestBidAmt) >= totalBidAmount)
44+ else false)
45+ then throw(("Bid must be more then " + (if (!(isDefined(highestBidAmt)))
46+ then toString(minPrice)
47+ else toString(value(highestBidAmt)))))
48+ else if (!(isDefined(highestBidder)))
49+ then WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)])
50+ else if (bidFromTheSameUser)
51+ then WriteSet([DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)])
52+ else {
53+ let previousBidder = addressFromStringValue(value(highestBidder))
54+ ScriptResult(WriteSet([DataEntry((auctionId + "_highestBidder"), callerAddress), DataEntry((auctionId + "_highestBidAmt"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidder, value(highestBidAmt), unit)]))
55+ }
56+ }
57+
58+
59+
60+@Callable(i)
61+func withdraw (auctionId) = {
62+ let pmt = extract(i.payment)
63+ let callerAddress = toBase58String(i.caller.bytes)
64+ let endTime = getIntegerValue(this, (auctionId + "_endTime"))
65+ let owner = getStringValue(this, (auctionId + "_owner"))
66+ let highestBidder = getString(this, (auctionId + "_highestBidder"))
67+ let itemId = getStringValue(this, (auctionId + "_itemId"))
68+ let highestBidAmt = getIntegerValue(this, (auctionId + "_highestBidAmt"))
69+ let highestBidderAddr = addressFromStringValue(value(highestBidder))
70+ let ownerAddr = addressFromStringValue(value(owner))
71+ let itemAddr = addressFromStringValue(value(itemId))
72+ if ((endTime > lastBlock.height))
73+ then throw("Auction is not finished yet")
74+ else if (!(isDefined(highestBidder)))
75+ then if (!(isDefined(getBoolean(this, (auctionId + "_status")))))
76+ then throw("Owner already withdrawn the item")
77+ else ScriptResult(WriteSet([DataEntry((auctionId + "_status"), true)]), TransferSet([ScriptTransfer(ownerAddr, 1, base58'itemAddr')]))
78+ else if (isDefined(getBoolean(this, (auctionId + "_status"))))
79+ then throw("The item is transfered to the highest bidder and the bid amount is transfered to the owner")
80+ else ScriptResult(WriteSet([DataEntry((auctionId + "_status"), true)]), TransferSet([ScriptTransfer(highestBidderAddr, 1, base58'itemAddr'), ScriptTransfer(ownerAddr, highestBidAmt, unit)]))
81+ }
82+
83+

github/deemru/w8io/169f3d6 
19.40 ms