tx · 8XJLysmDCv7vi7bN3mN2rFaZTPiFCFWCPMzY1vKLNjFB

3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo:  -0.01000000 Waves

2022.12.02 14:04 [2342642] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves

{ "type": 13, "id": "8XJLysmDCv7vi7bN3mN2rFaZTPiFCFWCPMzY1vKLNjFB", "fee": 1000000, "feeAssetId": null, "timestamp": 1669979080845, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "4U1QDBTPYR4a1kUnKs87ZRbeNDcMPXDd2LQHE3aMBy1mRDwnchBs8h2VvpYLqE7A5dcXcDvg17y6d1LsRt3Voenz" ], "script": "base64:BgINCAISBAoCAQESAwoBCAACAWkBDHN0YXJ0QXVjdGlvbgIIZHVyYXRpb24Kc3RhcnRQcmljZQQJYXVjdGlvbklkCQDYBAEIBQFpDXRyYW5zYWN0aW9uSWQEA3BtdAkBBXZhbHVlAQkAkQMCCAUBaQhwYXltZW50cwAACQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgpfb3JnYW5pemVyCQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgZhbW91bnQIBQNwbXQGYW1vdW50CQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAILX3N0YXJ0UHJpY2UFCnN0YXJ0UHJpY2UFA25pbAFpAQNiaWQBCWF1Y3Rpb25JZAQDcG10CQEFdmFsdWUBCQCRAwIIBQFpCHBheW1lbnRzAAAEDXBtdEFzc2V0SWRTdHIDCQEJaXNEZWZpbmVkAQgFA3BtdAdhc3NldElkCQDYBAEJAQV2YWx1ZQEIBQNwbXQHYXNzZ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G11c3QgYmUgbW9yZSB0aGVuIAkApAMBAwkBCWlzRGVmaW5lZAEFCXdpbkFtb3VudAkBBXZhbHVlAQUJd2luQW1vdW50BQpzdGFydFByaWNlAwMFEmJpZEZyb21UaGVTYW1lVXNlcgYJAQEhAQkBCWlzRGVmaW5lZAEFBndpbm5lcgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAIHX3dpbm5lcgUQY2FsbGVyQWRkcmVzc1N0cgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQlhdWN0aW9uSWQCCl93aW5BbW91bnQFDnRvdGFsQmlkQW1vdW50BQNuaWwEEnByZXZpb3VzQmlkZGVyQWRkcgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUGd2lubmVyBApwcmljZUFzc2V0AwMJAAACBQxwcmljZUFzc2V0SWQCBVdBVkVTBgkAAAIFDHByaWNlQXNzZXRJZAIABQR1bml0CQDZBAEFDHByaWNlQXNzZXRJZAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAIHX3dpbm5lcgUQY2FsbGVyQWRkcmVzc1N0cgkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQlhdWN0aW9uSWQCCl93aW5BbW91bnQFDnRvdGFsQmlkQW1vdW50CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFEnByZXZpb3VzQmlkZGVyQWRkcgkBBXZhbHVlAQUJd2luQW1vdW50BQpwcmljZUFzc2V0BQNuaWwAwh3XtA==", "height": 2342642, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G3G1banHWFwqcEJfppQW9jvyWcRru7TkFi9VcnNTKrco Next: FUfA6PJyTfKPvBZN2Npwh4DF2EzGLYdyLQRCbLn2fvRP Diff:
OldNewDifferences
1111 }
1212
1313
14+
15+@Callable(i)
16+func bid (auctionId) = {
17+ let pmt = value(i.payments[0])
18+ let pmtAssetIdStr = if (isDefined(pmt.assetId))
19+ then toBase58String(value(pmt.assetId))
20+ else "WAVES"
21+ let callerAddressStr = toBase58String(i.caller.bytes)
22+ let endHeight = getIntegerValue(this, auctionId)
23+ let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
24+ let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
25+ let winAmount = getInteger(this, (auctionId + "_winAmount"))
26+ let winner = getString(this, (auctionId + "_winner"))
27+ let bidFromTheSameUser = if (isDefined(winner))
28+ then (value(winner) == callerAddressStr)
29+ else false
30+ let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
31+ then value(winAmount)
32+ else 0))
33+ if ((lastBlock.height >= endHeight))
34+ then throw("Auction already finished")
35+ else if ((priceAssetId != pmtAssetIdStr))
36+ then throw((("Bid must be in asset '" + priceAssetId) + "'"))
37+ else if (if (if (isDefined(winAmount))
38+ then (value(winAmount) >= totalBidAmount)
39+ else false)
40+ then true
41+ else if (!(isDefined(winAmount)))
42+ then (startPrice >= totalBidAmount)
43+ else false)
44+ then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
45+ then value(winAmount)
46+ else startPrice)))
47+ else if (if (bidFromTheSameUser)
48+ then true
49+ else !(isDefined(winner)))
50+ then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
51+ else {
52+ let previousBidderAddr = addressFromStringValue(value(winner))
53+ let priceAsset = if (if ((priceAssetId == "WAVES"))
54+ then true
55+ else (priceAssetId == ""))
56+ then unit
57+ else fromBase58String(priceAssetId)
58+[StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]
59+ }
60+ }
61+
62+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func startAuction (duration,startPrice) = {
88 let auctionId = toBase58String(i.transactionId)
99 let pmt = value(i.payments[0])
1010 [StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), IntegerEntry((auctionId + "amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)]
1111 }
1212
1313
14+
15+@Callable(i)
16+func bid (auctionId) = {
17+ let pmt = value(i.payments[0])
18+ let pmtAssetIdStr = if (isDefined(pmt.assetId))
19+ then toBase58String(value(pmt.assetId))
20+ else "WAVES"
21+ let callerAddressStr = toBase58String(i.caller.bytes)
22+ let endHeight = getIntegerValue(this, auctionId)
23+ let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
24+ let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
25+ let winAmount = getInteger(this, (auctionId + "_winAmount"))
26+ let winner = getString(this, (auctionId + "_winner"))
27+ let bidFromTheSameUser = if (isDefined(winner))
28+ then (value(winner) == callerAddressStr)
29+ else false
30+ let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
31+ then value(winAmount)
32+ else 0))
33+ if ((lastBlock.height >= endHeight))
34+ then throw("Auction already finished")
35+ else if ((priceAssetId != pmtAssetIdStr))
36+ then throw((("Bid must be in asset '" + priceAssetId) + "'"))
37+ else if (if (if (isDefined(winAmount))
38+ then (value(winAmount) >= totalBidAmount)
39+ else false)
40+ then true
41+ else if (!(isDefined(winAmount)))
42+ then (startPrice >= totalBidAmount)
43+ else false)
44+ then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
45+ then value(winAmount)
46+ else startPrice)))
47+ else if (if (bidFromTheSameUser)
48+ then true
49+ else !(isDefined(winner)))
50+ then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
51+ else {
52+ let previousBidderAddr = addressFromStringValue(value(winner))
53+ let priceAsset = if (if ((priceAssetId == "WAVES"))
54+ then true
55+ else (priceAssetId == ""))
56+ then unit
57+ else fromBase58String(priceAssetId)
58+[StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]
59+ }
60+ }
61+
62+

github/deemru/w8io/026f985 
20.72 ms