tx · 4WqTPsAurkDKw5Pw24HKqiqe5NAqsYYxzrQYnp7YWWFq 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo: -0.01000000 Waves 2022.12.02 12:16 [2342534] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves
{ "type": 13, "id": "4WqTPsAurkDKw5Pw24HKqiqe5NAqsYYxzrQYnp7YWWFq", "fee": 1000000, "feeAssetId": null, "timestamp": 1669972582758, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "AYsewqp78B66LqbKJU6qLkrjhjyEpZGXGdS5ER69XGSrEmYKLJQsvJaEyxRqvSxnPhM1SN8qWcDLtXqDSmRDgDu" ], "script": "base64:BgIHCAISAwoBCAABAWkBA2JpZAEJYXVjdGlvbklkBANwbXQJAQV2YWx1ZQEJAJEDAggFAWkIcGF5bWVudHMAAAQNcG10QXNzZXRJZFN0cgMJAQlpc0RlZmluZWQBCAUDcG10B2Fzc2V0SWQJANgEAQkBBXZhbHVlAQgFA3BtdAdhc3NldElkAgVXQVZFUwQQY2FsbGVyQWRkcmVzc1N0cgkA2AQBCAgFAWkGY2FsbGVyBWJ5dGVzBAllbmRIZWlnaHQJARFAZXh0ck5hdGl2ZSgxMDUwKQIFBHRoaXMFCWF1Y3Rpb25JZAQKc3RhcnRQcmljZQkBEUBleHRyTmF0aXZlKDEwNTApAgUEdGhpcwkArAICBQlhdWN0aW9uSWQCC19zdGFydFByaWNlBAxwcmljZUFzc2V0SWQJARFAZXh0ck5hdGl2ZSgxMDUzKQIFBHRoaXMJAKwCAgUJYXVjdGlvbklkAg1fcHJpY2VBc3NldElkBAl3aW5BbW91bnQJAJoIAgUEdGhpcwkArAICBQlhdWN0aW9uSWQCCl93aW5BbW91bnQEBndpbm5lcgkAnQgCBQR0aGlzCQCsAgIFCWF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uZXIECnByaWNlQXNzZXQDAwkAAAIFDHByaWNlQXNzZXRJZAIFV0FWRVMGCQAAAgUMcHJpY2VBc3NldElkAgAFBHVuaXQJANkEAQUMcHJpY2VBc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUJYXVjdGlvbklkAgdfd2lubmVyBRBjYWxsZXJBZGRyZXNzU3RyCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFCWF1Y3Rpb25JZAIKX3dpbkFtb3VudAUOdG90YWxCaWRBbW91bnQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUScHJldmlvdXNCaWRkZXJBZGRyCQEFdmFsdWUBBQl3aW5BbW91bnQFCnByaWNlQXNzZXQFA25pbAAfrYLF", "height": 2342534, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J7GbVs4iwNig74pvzgHJemegPjyxxHpEMzUyaeT7Joz8 Next: 7At5dpMZZ2gyjnm6wrSaFSGoMBVj4pBV1azMnTVPAwZd Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func bid (auctionId) = { | |
8 | 8 | let pmt = value(i.payments[0]) | |
9 | 9 | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
10 | 10 | then toBase58String(value(pmt.assetId)) | |
11 | 11 | else "WAVES" | |
12 | 12 | let callerAddressStr = toBase58String(i.caller.bytes) | |
13 | 13 | let endHeight = getIntegerValue(this, auctionId) | |
14 | 14 | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
15 | 15 | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
16 | 16 | let winAmount = getInteger(this, (auctionId + "_winAmount")) | |
17 | 17 | let winner = getString(this, (auctionId + "_winner")) | |
18 | 18 | let bidFromTheSameUser = if (isDefined(winner)) | |
19 | 19 | then (value(winner) == callerAddressStr) | |
20 | 20 | else false | |
21 | 21 | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
22 | 22 | then value(winAmount) | |
23 | 23 | else 0)) | |
24 | 24 | if ((lastBlock.height >= endHeight)) | |
25 | 25 | then throw("Auction already finished") | |
26 | 26 | else if ((priceAssetId != pmtAssetIdStr)) | |
27 | 27 | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
28 | 28 | else if (if (if (isDefined(winAmount)) | |
29 | 29 | then (value(winAmount) >= totalBidAmount) | |
30 | 30 | else false) | |
31 | 31 | then true | |
32 | 32 | else if (!(isDefined(winAmount))) | |
33 | 33 | then (startPrice >= totalBidAmount) | |
34 | 34 | else false) | |
35 | 35 | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
36 | 36 | then value(winAmount) | |
37 | 37 | else startPrice))) | |
38 | 38 | else if (if (bidFromTheSameUser) | |
39 | 39 | then true | |
40 | 40 | else !(isDefined(winner))) | |
41 | 41 | then [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount)] | |
42 | 42 | else { | |
43 | 43 | let previousBidderAddr = addressFromStringValue(value(winner)) | |
44 | 44 | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
45 | 45 | then true | |
46 | 46 | else (priceAssetId == "")) | |
47 | 47 | then unit | |
48 | 48 | else fromBase58String(priceAssetId) | |
49 | 49 | [StringEntry((auctionId + "_winner"), callerAddressStr), IntegerEntry((auctionId + "_winAmount"), totalBidAmount), ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)] | |
50 | 50 | } | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 |
github/deemru/w8io/026f985 25.96 ms ◑