tx · 82NT1QmfYEz2z7y1D1ZTNzknuiJ9cwR8A3rdPZTLcGAk 3N88RCNRRqH1tr96V7DQBnafuHZLfA2jVTR: -0.01400000 Waves 2021.05.31 17:37 [1549979] smart account 3N88RCNRRqH1tr96V7DQBnafuHZLfA2jVTR > SELF 0.00000000 Waves
{ "type": 13, "id": "82NT1QmfYEz2z7y1D1ZTNzknuiJ9cwR8A3rdPZTLcGAk", "fee": 1400000, "feeAssetId": null, "timestamp": 1622471884491, "version": 2, "chainId": 84, "sender": "3N88RCNRRqH1tr96V7DQBnafuHZLfA2jVTR", "senderPublicKey": "2oN6nNjjqGRnqgNMW7yk2Vx5d8sifvdgjcoKoAHiDZDy", "proofs": [ "63hgKMfSdZNDDofLXqxcSvbB7es1SuLCcZazYcqj564tSWM8xiZCxFkNgm2Mh92nWtVXz9JfGwEcGyXNQ8cGVDDm" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAAAAAAAEAAAABaQEAAAADYmlkAAAAAQAAAAVuZnRpZAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAADXBtdEFzc2V0SWRTdHIDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQACWAAAAAEJAQAAAAV2YWx1ZQAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAIAAAAFV0FWRVMEAAAAEGNhbGxlckFkZHJlc3NTdHIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAKc3RhcnRQcmljZQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAVuZnRpZAIAAAAGX3ZhbHVlBAAAAAxwcmljZUFzc2V0SWQJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAADHByaWNlQXNzZXRJZAQAAAAJd2luQW1vdW50CQAEGgAAAAIFAAAABHRoaXM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aXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAVuZnRpZAIAAAAHX3dpbm5lcgUAAAAQY2FsbGVyQWRkcmVzc1N0cgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAVuZnRpZAIAAAAKX3dpbkFtb3VudAUAAAAOdG90YWxCaWRBbW91bnQFAAAAA25pbAQAAAAScHJldmlvdXNCaWRkZXJBZGRyCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEJAQAAAAV2YWx1ZQAAAAEFAAAABndpbm5lcgQAAAAKcHJpY2VBc3NldAMDCQAAAAAAAAIFAAAADHByaWNlQXNzZXRJZAIAAAAFV0FWRVMGCQAAAAAAAAIFAAAADHByaWNlQXNzZXRJZAIAAAAABQAAAAR1bml0CQACWQAAAAEFAAAADHByaWNlQXNzZXRJZAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAFbmZ0aWQCAAAAB193aW5uZXIFAAAAEGNhbGxlckFkZHJlc3NTdHIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAFbmZ0aWQCAAAACl93aW5BbW91bnQFAAAADnRvdGFsQmlkQW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAScHJldmlvdXNCaWRkZXJBZGRyCQEAAAAFdmFsdWUAAAABBQAAAAl3aW5BbW91bnQFAAAACnByaWNlQXNzZXQFAAAAA25pbAAAAAAeoyyt", "height": 1549979, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 2KTK1dv28eZZf1mkB7iCMaT3Q5rXGLmTuQkvHfR6CSfD Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func bid (nftid) = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
10 | + | then toBase58String(value(pmt.assetId)) | |
11 | + | else "WAVES" | |
12 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
13 | + | let startPrice = getIntegerValue(this, (nftid + "_value")) | |
14 | + | let priceAssetId = getStringValue(this, "priceAssetId") | |
15 | + | let winAmount = getInteger(this, (nftid + "_winAmount")) | |
16 | + | let winner = getString(this, (nftid + "_winner")) | |
17 | + | let bidFromTheSameUser = if (isDefined(winner)) | |
18 | + | then (value(winner) == callerAddressStr) | |
19 | + | else false | |
20 | + | let totalBidAmount = (pmt.amount + (if (bidFromTheSameUser) | |
21 | + | then value(winAmount) | |
22 | + | else 0)) | |
23 | + | if ((priceAssetId != pmtAssetIdStr)) | |
24 | + | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
25 | + | else if (if (if (isDefined(winAmount)) | |
26 | + | then (value(winAmount) >= totalBidAmount) | |
27 | + | else false) | |
28 | + | then true | |
29 | + | else if (!(isDefined(winAmount))) | |
30 | + | then (startPrice >= totalBidAmount) | |
31 | + | else false) | |
32 | + | then throw(("Bid must be more then " + toString(if (isDefined(winAmount)) | |
33 | + | then value(winAmount) | |
34 | + | else startPrice))) | |
35 | + | else if (if (bidFromTheSameUser) | |
36 | + | then true | |
37 | + | else !(isDefined(winner))) | |
38 | + | then WriteSet([DataEntry((nftid + "_winner"), callerAddressStr), DataEntry((nftid + "_winAmount"), totalBidAmount)]) | |
39 | + | else { | |
40 | + | let previousBidderAddr = addressFromStringValue(value(winner)) | |
41 | + | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
42 | + | then true | |
43 | + | else (priceAssetId == "")) | |
44 | + | then unit | |
45 | + | else fromBase58String(priceAssetId) | |
46 | + | ScriptResult(WriteSet([DataEntry((nftid + "_winner"), callerAddressStr), DataEntry((nftid + "_winAmount"), totalBidAmount)]), TransferSet([ScriptTransfer(previousBidderAddr, value(winAmount), priceAsset)])) | |
47 | + | } | |
48 | + | } | |
49 | + | ||
50 | + |
github/deemru/w8io/026f985 15.30 ms ◑