tx · 6hcPGEQJXW6DGcZgaKqid1gEGxZHS6jNi6yUN49LqTaC

3MvoQ3q8wFnquWFPSZuBGunTnE1fphumBxd:  -0.01400000 Waves

2019.08.11 11:09 [626124] smart account 3MvoQ3q8wFnquWFPSZuBGunTnE1fphumBxd > SELF 0.00000000 Waves

{ "type": 13, "id": "6hcPGEQJXW6DGcZgaKqid1gEGxZHS6jNi6yUN49LqTaC", "fee": 1400000, "feeAssetId": null, "timestamp": 1565511045221, "version": 1, "sender": "3MvoQ3q8wFnquWFPSZuBGunTnE1fphumBxd", "senderPublicKey": "D7SkqDbPr1pTQ9McD2XsJyvNqjRakMoWERXwKVzCGTWj", "proofs": [ "qGm3jRCJciXDpLmrWLkRGDg1K5KGtfgu89oWZYUzwtqxCgKLfGrVFLQ6SroNdHKAZYUP4z1hahYg7XczD5Baq7e" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAABJtYXhBdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAHgAAAAAOcmV2ZWFsRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAABwEAAAAKaGFzaFN0cmluZwAAAAEAAAAEZGF0YQQAAAAGcmVzdWx0CQACWgAAAAEJAAH3AAAAAQkAAZsAAAABBQAAAARkYXRhBQAAAAZyZXN1bHQAAAADAAAAAWkBAAAADHN0YXJ0QXVjdGlvbgAAAAQAAAAIZHVyYXRpb24AAAAKc3RhcnRQcmljZQAAAAxwcmljZUFzc2V0SWQAAAAHZGVwb3NpdAQAAAAJYXVjdGlvbklkCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQEAAAAC3JldmVhbFN0YXJ0CQAAZAAAAAIIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0BQAAAAhkdXJhdGlvbgQAAAAMY2xvc2luZ1N0YXJ0CQAAZAAAAAIFAAAAC3JldmVhbFN0YXJ0BQAAAA5yZXZlYWxEdXJhdGlvbgQAAAADc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AAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACWF1Y3Rpb25JZAIAAAAKX3RvcF9wcmljZQUAAAAJdG9wUHJpY2UyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACWF1Y3Rpb25JZAIAAAANX3NlY29uZF9wcmljZQUAAAAMc2Vjb25kUHJpY2UyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACWF1Y3Rpb25JZAIAAAAHX3dpbm5lcgUAAAAHd2lubmVyMgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAlhdWN0aW9uSWQCAAAACV9yZXZlYWxlZAcFAAAAA25pbAAAAADIOQrX", "chainId": 84, "height": 626124, "spentComplexity": 0 } View: original | compacted Prev: BFUn6gmBcfyvRkFsJrfAtFwgEV5JvpFQu3DUdn6fzdmQ Next: Dwp4xjwncMN53t6hEunK3DwZU9sB6wqLuHTKVnRCE9hU Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxAuctionDuration = (1440 * 30)
55
66 let revealDuration = (1440 * 7)
77
88 func hashString (data) = {
99 let result = toBase64String(sha256(toBytes(data)))
1010 result
1111 }
1212
1313
1414 @Callable(i)
1515 func startAuction (duration,startPrice,priceAssetId,deposit) = {
1616 let auctionId = toBase58String(i.transactionId)
1717 let revealStart = (lastBlock.height + duration)
1818 let closingStart = (revealStart + revealDuration)
1919 let pmt = extract(i.payment)
2020 if ((duration > maxAuctionDuration))
2121 then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration)))
2222 else if (!(isDefined(pmt.assetId)))
2323 then throw("Payment currency should not be in WAVES")
2424 else if ((pmt.amount != 1))
2525 then throw("Payment amount should be only one NFT")
2626 else if ((0 >= startPrice))
2727 then throw("Start price should be > 0")
2828 else if ((startPrice >= deposit))
2929 then throw((("Start price should be < deposit (" + toString(deposit)) + ")"))
3030 else if ((0 >= duration))
3131 then throw("Duration should be > 0")
3232 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"), toBase58String(i.caller.bytes)), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
3333 then toBase58String(value(pmt.assetId))
3434 else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId)])
3535 }
3636
3737
3838
3939 @Callable(i)
4040 func bid (auctionId,hashBidAmount) = {
4141 let pmt = extract(i.payment)
4242 let pmtAssetIdStr = if (isDefined(pmt.assetId))
4343 then toBase58String(value(pmt.assetId))
4444 else "WAVES"
4545 let callerAddressStr = toBase58String(i.caller.bytes)
4646 let endHeight = getIntegerValue(this, auctionId)
4747 let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
4848 let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
4949 let organizer = getStringValue(this, (auctionId + "_organizer"))
5050 let deposit = getIntegerValue(this, (auctionId + "_deposit"))
5151 let unrevealedCount = getIntegerValue(this, (auctionId + "_unrevealed_count"))
5252 let bidder = getString(this, (callerAddressStr + "_bidder"))
5353 let bidFromTheSameUser = isDefined(getString(this, ((auctionId + callerAddressStr) + "bid_hash")))
5454 if ((lastBlock.height >= endHeight))
5555 then throw("Auction already finished")
5656 else if (if (!(bidFromTheSameUser))
5757 then (priceAssetId != pmtAssetIdStr)
5858 else false)
5959 then throw((("Bid must be in asset '" + priceAssetId) + "'"))
6060 else if (!(isDefined(organizer)))
6161 then throw("Organizer should be defined")
6262 else if (if (!(bidFromTheSameUser))
6363 then (pmt.amount != deposit)
6464 else false)
6565 then throw("Payment should be equel to deposit")
6666 else {
6767 let inc = if (bidFromTheSameUser)
6868 then 0
6969 else 1
7070 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))
7171 then value(bidder)
7272 else "") + " ") + auctionId))])
7373 }
7474 }
7575
7676
7777
7878 @Callable(i)
7979 func reveal (auctionId,bidAmount,salt) = {
8080 let callerAddressStr = toBase58String(i.caller.bytes)
8181 let organizer = getStringValue(this, (auctionId + "_organizer"))
8282 let bidHash = getStringValue(this, (callerAddressStr + "_bid_hash"))
8383 let revealed = getBooleanValue(this, (callerAddressStr + "_revealed"))
8484 let revealStart = getIntegerValue(this, (auctionId + "_reveal_start"))
8585 let closingStart = getIntegerValue(this, (auctionId + "_closing_start"))
8686 let topPrice = getIntegerValue(this, (auctionId + "_top_price"))
8787 let secondPrice = getIntegerValue(this, (auctionId + "_second_price"))
8888 let winner = getStringValue(this, (auctionId + "_winner"))
8989 if (!(isDefined(organizer)))
9090 then throw("Organizer is not defined")
9191 else if (!(isDefined(bidHash)))
9292 then throw("Bid is not defined")
9393 else if (if ((revealStart > lastBlock.height))
9494 then true
9595 else (lastBlock.height > closingStart))
9696 then throw("Auction should be revealed between reveal and closing times")
9797 else if (if (isDefined(extract(i.payment)))
9898 then (extract(i.payment).amount > 0)
9999 else false)
100100 then throw("Payment shoud not exist")
101101 else if ((hashString((salt + toString(bidAmount))) != bidHash))
102102 then throw("Bid hash from bidMount and sault is not equel with hash from the caller bid")
103103 else if ((revealed == true))
104104 then throw("The bid has been already revealed")
105105 else {
106106 let topPrice2 = if ((bidAmount > topPrice))
107107 then value(bidAmount)
108108 else value(topPrice)
109109 let secondPrice2 = if ((bidAmount > topPrice))
110110 then value(topPrice)
111111 else if ((bidAmount > secondPrice))
112112 then bidAmount
113113 else secondPrice
114114 let winner2 = if ((bidAmount > topPrice))
115115 then callerAddressStr
116116 else winner
117117 WriteSet([DataEntry((auctionId + "_top_price"), topPrice2), DataEntry((auctionId + "_second_price"), secondPrice2), DataEntry((auctionId + "_winner"), winner2), DataEntry((auctionId + "_revealed"), false)])
118118 }
119119 }
120120
121121

github/deemru/w8io/026f985 
34.93 ms