tx · 2Nqme25Yr4F2MmrW5dtBssQdcXofhoDQdsHCS5aEFtoy

3N1PPoNT4epUSgdGwx1eNePsZjeYp5RUAcj:  -0.01400000 Waves

2019.06.22 21:07 [553590] smart account 3N1PPoNT4epUSgdGwx1eNePsZjeYp5RUAcj > SELF 0.00000000 Waves

{ "type": 13, "id": "2Nqme25Yr4F2MmrW5dtBssQdcXofhoDQdsHCS5aEFtoy", "fee": 1400000, "feeAssetId": null, "timestamp": 1561226824705, "version": 1, "sender": "3N1PPoNT4epUSgdGwx1eNePsZjeYp5RUAcj", "senderPublicKey": "AomFdZHmK72gCbitdy7X2sUvNueScd3LhY9g2m7DJdo4", "proofs": [ "2L1zg5n2XEJFvt4GiB38sfC4iV7hzmRaWkDsJ8jexJykBm85g5ZUgDoSUdsDycgDFRqozmWPGhXwqK6rgBAH4RM" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAABJtYXhBdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAHgAAAAMAAAABaQEAAAAMc3RhcnRBdWN0aW9uAAAAAwAAAAhkdXJhdGlvbgAAAApzdGFydFByaWNlAAAADHByaWNlQXNzZXRJZAQAAAAJYXVjdGlvbklkCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAAEGF1Y3Rpb25FbmRIZWlnaHQJAABkAAAAAggFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQFAAAACGR1cmF0aW9uBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAABmAAAAAgUAAAAIZHVyYXRpb24FAAAAEm1heEF1Y3Rpb25EdXJhdGlvbgkAAAIAAAABCQABLAAAAAICAAAAKER1cmF0aW9uIGlzIHRvbyBsb25nLiBNdXN0IGJlIGxlc3MgdGhhbiAJAAGkAAAAAQUAAAASbWF4QXVjdGlvbkR1cmF0aW9uCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQA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AABaQAAAAZjYWxsZXIJAQAAAAV2YWx1ZQAAAAEFAAAACWJldEFtb3VudAUAAAARYXVjdGlvblByaWNlQXNzZXQFAAAAA25pbAAAAAAWljL3", "chainId": 84, "height": 553590, "spentComplexity": 0 } View: original | compacted Prev: none Next: A3Q56WArTCQ5ySw86X9oFBwetu6TzVFrg8su9vrhHFzR Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let maxAuctionDuration = (1440 * 30)
5+
6+@Callable(i)
7+func startAuction (duration,startPrice,priceAssetId) = {
8+ let auctionId = toBase58String(i.transactionId)
9+ let auctionEndHeight = (lastBlock.height + duration)
10+ let pmt = extract(i.payment)
11+ if ((duration > maxAuctionDuration))
12+ then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration)))
13+ else WriteSet([DataEntry(auctionId, auctionEndHeight), DataEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
14+ then toBase58String(value(pmt.assetId))
15+ else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)])
16+ }
17+
18+
19+
20+@Callable(i)
21+func bid (auctionId) = {
22+ let pmt = extract(i.payment)
23+ let pmtAssetIdStr = if (isDefined(pmt.assetId))
24+ then toBase58String(value(pmt.assetId))
25+ else "WAVES"
26+ let callerAddressStr = toBase58String(i.caller.bytes)
27+ let auctionEndHeight = getIntegerValue(this, auctionId)
28+ let auctionPriceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
29+ let auctionWinAmount = getInteger(this, (auctionId + "_winAmount"))
30+ if ((lastBlock.height >= auctionEndHeight))
31+ then throw("Auction already finished")
32+ else if ((auctionPriceAssetId != pmtAssetIdStr))
33+ then throw((("Bid must be in asset '" + auctionPriceAssetId) + "'"))
34+ else if (if (isDefined(auctionWinAmount))
35+ then (value(auctionWinAmount) >= pmt.amount)
36+ else false)
37+ then throw(("Bid must be more then " + toString(pmt.amount)))
38+ else WriteSet([DataEntry(((auctionId + "_bidder_") + callerAddressStr), pmt.amount), DataEntry((auctionId + "_winner"), callerAddressStr), DataEntry((auctionId + "_winAmount"), pmt.amount)])
39+ }
40+
41+
42+
43+@Callable(i)
44+func withdraw (auctionId) = {
45+ let pmt = extract(i.payment)
46+ let pmtAssetIdStr = if (isDefined(pmt.assetId))
47+ then toBase58String(value(pmt.assetId))
48+ else "WAVES"
49+ let callerAddressStr = toBase58String(i.caller.bytes)
50+ let auctionEndHeight = getIntegerValue(this, auctionId)
51+ let auctionOrganizer = getStringValue(this, (auctionId + "_organizer"))
52+ let auctionWinner = getString(this, (auctionId + "_winner"))
53+ let auctionLotAssetId = getStringValue(this, (auctionId + "_lot_assetId"))
54+ let auctionLotAmount = getIntegerValue(this, (auctionId + "_lot_amount"))
55+ let auctionPriceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
56+ let auctionWinAmount = getIntegerValue(this, (auctionId + "_winAmount"))
57+ let auctionLotAsset = if ((auctionLotAssetId == "WAVES"))
58+ then unit
59+ else fromBase58String(auctionLotAssetId)
60+ let auctionPriceAsset = if (if ((auctionPriceAssetId == "WAVES"))
61+ then true
62+ else (auctionPriceAssetId == ""))
63+ then unit
64+ else fromBase58String(auctionPriceAssetId)
65+ let auctionWinnerAddr = addressFromStringValue(value(auctionWinner))
66+ let auctionOrganizerAddr = addressFromStringValue(value(auctionOrganizer))
67+ let betAmount = getInteger(this, ((auctionId + "_bidder_") + callerAddressStr))
68+ if ((auctionEndHeight > lastBlock.height))
69+ then throw("Auction is not finished yet")
70+ else if (!(isDefined(auctionWinner)))
71+ then if ((callerAddressStr == auctionOrganizer))
72+ then if (!(isDefined(getBoolean(this, (auctionId + "_lot_passed")))))
73+ then throw("You have already got your lot back")
74+ else ScriptResult(WriteSet([DataEntry((auctionId + "_lot_passed"), true)]), TransferSet([ScriptTransfer(i.caller, auctionLotAmount, auctionLotAsset)]))
75+ else throw("You haven't participate in this auction")
76+ else if (if ((callerAddressStr == auctionOrganizer))
77+ then true
78+ else (callerAddressStr == auctionWinner))
79+ then if (isDefined(getBoolean(this, (auctionId + "_lot_passed"))))
80+ then throw("Lot is already passed to the winner, and organizer got his reward")
81+ else ScriptResult(WriteSet([DataEntry((auctionId + "_lot_passed"), true)]), TransferSet([ScriptTransfer(auctionWinnerAddr, auctionLotAmount, auctionLotAsset), ScriptTransfer(auctionOrganizerAddr, auctionWinAmount, auctionPriceAsset)]))
82+ else if (!(isDefined(betAmount)))
83+ then throw("You didn't bid anything")
84+ else if (isDefined(getBoolean(this, (((auctionId + "_bidder_") + callerAddressStr) + "_return"))))
85+ then throw("You have already got your bid back")
86+ else ScriptResult(WriteSet([DataEntry((((auctionId + "_bidder_") + callerAddressStr) + "_return"), true)]), TransferSet([ScriptTransfer(i.caller, value(betAmount), auctionPriceAsset)]))
87+ }
88+
89+

github/deemru/w8io/169f3d6 
20.38 ms