tx · 3jZCjrdiD3B2M5AY7H6p8CXLTWPgR7fz5npy5akyrsUM

3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo:  -0.01000000 Waves

2022.12.02 14:54 [2342696] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves

{ "type": 13, "id": "3jZCjrdiD3B2M5AY7H6p8CXLTWPgR7fz5npy5akyrsUM", "fee": 1000000, "feeAssetId": null, "timestamp": 1669982007170, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "4kUKpkwRpCLgyGuT8SsBugGzc2Aoi5tZ5fEuy2H6oeF9m1AqHmbeBDdEGpy31cdBTtFVEBAPfbrtLQdyJkuGd358" ], "script": "base64:BgIKCAISBAoCAQESAAACAWkBDHN0YXJ0QXVjdGlvbgIIZHVyYXRpb24Kc3RhcnRQcmljZQQJYXVjdGlvbklkCQDYBAEIBQFpDXRyYW5zYWN0aW9uSWQEA3BtdAkBBXZhbHVlAQkAkQMCCAUBaQhwYXltZW50cwAACQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgpfb3JnYW5pemVyCQDYBAEICAUBaQZjYWxsZXIFYnl0ZXMJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgdfYW1vdW50CAUDcG10BmFtb3VudAkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICBQlhdWN0aW9uSWQCC19zdGFydFByaWNlBQpzdGFydFByaWNlBQNuaWwBaQEDYmlkAAQJYXVjdGlvbklkCQDYBAEIBQFpDXRyYW5zYWN0aW9uSWQEA3BtdAkBBXZhbHVlAQkAkQMCCAUBaQhwYXltZW50cwAABA1wbXRBc3NldElkU3RyAwkBCWlzRGVmaW5lZAEIBQNwbXQHYXNzZXRJZAkA2AQBCQEFdmFsdWU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EBIQEJAQlpc0RlZmluZWQBBQZ3aW5uZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQlhdWN0aW9uSWQCB193aW5uZXIFEGNhbGxlckFkZHJlc3NTdHIJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgpfd2luQW1vdW50BQ50b3RhbEJpZEFtb3VudAUDbmlsBBJwcmV2aW91c0JpZGRlckFkZHIJARFAZXh0ck5hdGl2ZSgxMDYyKQEJAQV2YWx1ZQEFBndpbm5lcgQKcHJpY2VBc3NldAMDCQAAAgUMcHJpY2VBc3NldElkAgVXQVZFUwYJAAACBQxwcmljZUFzc2V0SWQCAAUEdW5pdAkA2QQBBQxwcmljZUFzc2V0SWQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQlhdWN0aW9uSWQCB193aW5uZXIFEGNhbGxlckFkZHJlc3NTdHIJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgpfd2luQW1vdW50BQ50b3RhbEJpZEFtb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDBRJwcmV2aW91c0JpZGRlckFkZHIJAQV2YWx1ZQEFCXdpbkFtb3VudAUKcHJpY2VBc3NldAUDbmlsAEBfdyY=", "height": 2342696, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FUfA6PJyTfKPvBZN2Npwh4DF2EzGLYdyLQRCbLn2fvRP Next: 91R6WV5PTyPjx6qWAWaLzZ8jk7Hip8HQjEfDapQpxKJp Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxAuctionDuration = 7
4+
55
66 @Callable(i)
77 func startAuction (duration,startPrice) = {
88 let auctionId = toBase58String(i.transactionId)
9- let endHeight = (lastBlock.height + duration)
109 let pmt = value(i.payments[0])
11- if ((duration > maxAuctionDuration))
12- then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration)))
13- else [IntegerEntry(auctionId, endHeight), StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
14- then toBase58String(value(pmt.assetId))
15- else "WAVES"), IntegerEntry((auctionId + "_lot_amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)]
10+[StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), IntegerEntry((auctionId + "_amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)]
1611 }
1712
1813
2520 then toBase58String(value(pmt.assetId))
2621 else "WAVES"
2722 let callerAddressStr = toBase58String(i.caller.bytes)
28- let endHeight = getIntegerValue(this, auctionId)
2923 let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
3024 let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
3125 let winAmount = getInteger(this, (auctionId + "_winAmount"))
3630 let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
3731 then value(winAmount)
3832 else 0))
39- if ((lastBlock.height >= endHeight))
40- then throw("Auction already finished")
41- else if ((priceAssetId != pmtAssetIdStr))
42- then throw((("Bid must be in asset '" + priceAssetId) + "'"))
43- else if (if (if (isDefined(winAmount))
44- then (value(winAmount) >= totalBidAmount)
33+ if ((priceAssetId != pmtAssetIdStr))
34+ then throw((("Bid must be in asset '" + priceAssetId) + "'"))
35+ else if (if (if (isDefined(winAmount))
36+ then (value(winAmount) >= totalBidAmount)
37+ else false)
38+ then true
39+ else if (!(isDefined(winAmount)))
40+ then (startPrice >= totalBidAmount)
4541 else false)
42+ then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
43+ then value(winAmount)
44+ else startPrice)))
45+ else if (if (bidFromTheSameUser)
4646 then true
47- else if (!(isDefined(winAmount)))
48- then (startPrice >= totalBidAmount)
49- else false)
50- then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
51- then value(winAmount)
52- else startPrice)))
53- else if (if (bidFromTheSameUser)
54- then true
55- else !(isDefined(winner)))
56- then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
57- else {
58- let previousBidderAddr = addressFromStringValue(value(winner))
59- let priceAsset = if (if ((priceAssetId == "WAVES"))
60- then true
61- else (priceAssetId == ""))
62- then unit
63- else fromBase58String(priceAssetId)
47+ else !(isDefined(winner)))
48+ then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
49+ else {
50+ let previousBidderAddr = addressFromStringValue(value(winner))
51+ let priceAsset = if (if ((priceAssetId == "WAVES"))
52+ then true
53+ else (priceAssetId == ""))
54+ then unit
55+ else fromBase58String(priceAssetId)
6456 [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]
65- }
66- }
67-
68-
69-
70-@Callable(i)
71-func withdraw (auctionId) = {
72- let pmt = value(i.payments[0])
73- let pmtAssetIdStr = if (isDefined(pmt.assetId))
74- then toBase58String(value(pmt.assetId))
75- else "WAVES"
76- let callerAddressStr = toBase58String(i.caller.bytes)
77- let endHeight = getIntegerValue(this, auctionId)
78- let organizer = getStringValue(this, (auctionId + "_organizer"))
79- let winner = getString(this, (auctionId + "_winner"))
80- let lotAssetId = getStringValue(this, (auctionId + "_lot_assetId"))
81- let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount"))
82- let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
83- let winAmount = getIntegerValue(this, (auctionId + "_winAmount"))
84- let lotAsset = if ((lotAssetId == "WAVES"))
85- then unit
86- else fromBase58String(lotAssetId)
87- let priceAsset = if (if ((priceAssetId == "WAVES"))
88- then true
89- else (priceAssetId == ""))
90- then unit
91- else fromBase58String(priceAssetId)
92- let winnerAddr = addressFromStringValue(value(winner))
93- let organizerAddr = addressFromStringValue(value(organizer))
94- let betAmount = getInteger(this, ((auctionId + "_bidder_") + callerAddressStr))
95- if ((endHeight > lastBlock.height))
96- then throw("Auction is not finished yet")
97- else if (!(isDefined(winner)))
98- then if (isDefined(getString(this, (auctionId + "_lot_passed"))))
99- then throw("Organizer has already got his lot back")
100- else [StringEntry((auctionId + "_lot_passed"), organizer), ScriptTransfer(organizerAddr, lotAmount, lotAsset)]
101- else if (isDefined(getString(this, (auctionId + "_lot_passed"))))
102- then throw("Lot is already passed to the winner, and organizer got his reward")
103- else [StringEntry((auctionId + "_lot_passed"), toBase58String(winnerAddr.bytes)), ScriptTransfer(winnerAddr, lotAmount, lotAsset), ScriptTransfer(organizerAddr, winAmount, priceAsset)]
57+ }
10458 }
10559
10660
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxAuctionDuration = 7
4+
55
66 @Callable(i)
77 func startAuction (duration,startPrice) = {
88 let auctionId = toBase58String(i.transactionId)
9- let endHeight = (lastBlock.height + duration)
109 let pmt = value(i.payments[0])
11- if ((duration > maxAuctionDuration))
12- then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration)))
13- else [IntegerEntry(auctionId, endHeight), StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), StringEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId))
14- then toBase58String(value(pmt.assetId))
15- else "WAVES"), IntegerEntry((auctionId + "_lot_amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)]
10+[StringEntry((auctionId + "_organizer"), toBase58String(i.caller.bytes)), IntegerEntry((auctionId + "_amount"), pmt.amount), IntegerEntry((auctionId + "_startPrice"), startPrice)]
1611 }
1712
1813
1914
2015 @Callable(i)
2116 func bid () = {
2217 let auctionId = toBase58String(i.transactionId)
2318 let pmt = value(i.payments[0])
2419 let pmtAssetIdStr = if (isDefined(pmt.assetId))
2520 then toBase58String(value(pmt.assetId))
2621 else "WAVES"
2722 let callerAddressStr = toBase58String(i.caller.bytes)
28- let endHeight = getIntegerValue(this, auctionId)
2923 let startPrice = getIntegerValue(this, (auctionId + "_startPrice"))
3024 let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
3125 let winAmount = getInteger(this, (auctionId + "_winAmount"))
3226 let winner = getString(this, (auctionId + "_winner"))
3327 let bidFromTheSameUser = if (isDefined(winner))
3428 then (value(winner) == callerAddressStr)
3529 else false
3630 let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser)
3731 then value(winAmount)
3832 else 0))
39- if ((lastBlock.height >= endHeight))
40- then throw("Auction already finished")
41- else if ((priceAssetId != pmtAssetIdStr))
42- then throw((("Bid must be in asset '" + priceAssetId) + "'"))
43- else if (if (if (isDefined(winAmount))
44- then (value(winAmount) >= totalBidAmount)
33+ if ((priceAssetId != pmtAssetIdStr))
34+ then throw((("Bid must be in asset '" + priceAssetId) + "'"))
35+ else if (if (if (isDefined(winAmount))
36+ then (value(winAmount) >= totalBidAmount)
37+ else false)
38+ then true
39+ else if (!(isDefined(winAmount)))
40+ then (startPrice >= totalBidAmount)
4541 else false)
42+ then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
43+ then value(winAmount)
44+ else startPrice)))
45+ else if (if (bidFromTheSameUser)
4646 then true
47- else if (!(isDefined(winAmount)))
48- then (startPrice >= totalBidAmount)
49- else false)
50- then throw(("Bid must be more then " + toString(if (isDefined(winAmount))
51- then value(winAmount)
52- else startPrice)))
53- else if (if (bidFromTheSameUser)
54- then true
55- else !(isDefined(winner)))
56- then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
57- else {
58- let previousBidderAddr = addressFromStringValue(value(winner))
59- let priceAsset = if (if ((priceAssetId == "WAVES"))
60- then true
61- else (priceAssetId == ""))
62- then unit
63- else fromBase58String(priceAssetId)
47+ else !(isDefined(winner)))
48+ then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)]
49+ else {
50+ let previousBidderAddr = addressFromStringValue(value(winner))
51+ let priceAsset = if (if ((priceAssetId == "WAVES"))
52+ then true
53+ else (priceAssetId == ""))
54+ then unit
55+ else fromBase58String(priceAssetId)
6456 [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)]
65- }
66- }
67-
68-
69-
70-@Callable(i)
71-func withdraw (auctionId) = {
72- let pmt = value(i.payments[0])
73- let pmtAssetIdStr = if (isDefined(pmt.assetId))
74- then toBase58String(value(pmt.assetId))
75- else "WAVES"
76- let callerAddressStr = toBase58String(i.caller.bytes)
77- let endHeight = getIntegerValue(this, auctionId)
78- let organizer = getStringValue(this, (auctionId + "_organizer"))
79- let winner = getString(this, (auctionId + "_winner"))
80- let lotAssetId = getStringValue(this, (auctionId + "_lot_assetId"))
81- let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount"))
82- let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId"))
83- let winAmount = getIntegerValue(this, (auctionId + "_winAmount"))
84- let lotAsset = if ((lotAssetId == "WAVES"))
85- then unit
86- else fromBase58String(lotAssetId)
87- let priceAsset = if (if ((priceAssetId == "WAVES"))
88- then true
89- else (priceAssetId == ""))
90- then unit
91- else fromBase58String(priceAssetId)
92- let winnerAddr = addressFromStringValue(value(winner))
93- let organizerAddr = addressFromStringValue(value(organizer))
94- let betAmount = getInteger(this, ((auctionId + "_bidder_") + callerAddressStr))
95- if ((endHeight > lastBlock.height))
96- then throw("Auction is not finished yet")
97- else if (!(isDefined(winner)))
98- then if (isDefined(getString(this, (auctionId + "_lot_passed"))))
99- then throw("Organizer has already got his lot back")
100- else [StringEntry((auctionId + "_lot_passed"), organizer), ScriptTransfer(organizerAddr, lotAmount, lotAsset)]
101- else if (isDefined(getString(this, (auctionId + "_lot_passed"))))
102- then throw("Lot is already passed to the winner, and organizer got his reward")
103- else [StringEntry((auctionId + "_lot_passed"), toBase58String(winnerAddr.bytes)), ScriptTransfer(winnerAddr, lotAmount, lotAsset), ScriptTransfer(organizerAddr, winAmount, priceAsset)]
57+ }
10458 }
10559
10660

github/deemru/w8io/169f3d6 
201.40 ms