tx · 8WBzB2Bc7YQqu9F7FEuX4Hrgxzq68tq9WJ1PCdmdrRjL 3N9b7vExDf2qqZt2xG9FUsca7iwLVuih1Ta: -0.01000000 Waves 2023.12.01 18:54 [2867788] smart account 3N9b7vExDf2qqZt2xG9FUsca7iwLVuih1Ta > SELF 0.00000000 Waves
{ "type": 13, "id": "8WBzB2Bc7YQqu9F7FEuX4Hrgxzq68tq9WJ1PCdmdrRjL", "fee": 1000000, "feeAssetId": null, "timestamp": 1701446125066, "version": 2, "chainId": 84, "sender": "3N9b7vExDf2qqZt2xG9FUsca7iwLVuih1Ta", "senderPublicKey": "4rSYGN3SSXzknh6jLyLqqGdGor584DXdjdP2BAbz7kgt", "proofs": [ "DA1Qk125eKDAJDLEyCuJM8AVUhTtor8GfbGu9ri3PVWNSo7PTHTcFQnunKrJTYVeoFswJ62iJGzmjAwn9FFnC4k" ], "script": "base64:AAIFAAAAAAAAABcIAhIGCgQIAQgBEgMKAQgSBgoECAgBAQAAAAsAAAAACWRldmVsb3BlcgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01wNlRUaHZiYjh6OW5wcXo0QUszQnlxQWJ2czdkWVM4dVIBAAAACmtleVBhcnRuZXIAAAABAAAAB2FkZHJlc3MJAAEsAAAAAgIAAAAPJXMlc19fcGFydG5lcl9fBQAAAAdhZGRyZXNzAQAAABBrZXlXYW50ZWRBc3NldElkAAAAAQAAAAdhZGRyZXNzCQABLAAAAAICAAAAFSVzJXNfX3dhbnRlZEFzc2V0SWRfXwUAAAAHYWRkcmVzcwEAAAAPa2V5V2FudGVkQW1vdW50AAAAAQAAAAdhZGRyZXNzCQABLAAAAAICAAAAFCVzJXNfX3dhbnRlZEFtb3VudF9fBQAAAAdhZGRyZXNzAQAAAAprZXlBc3NldElkAAAAAQAAAAdvcmRlcklkCQABLAAAAAICAAAADyVzJXNfX2Fzc2V0SWRfXwUAAAAHb3JkZXJJZAEAAAAJa2V5QW1vdW50AAAAAQAAAAdvc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XJJZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAKa2V5T3JkZXJJZAAAAAEFAAAAB29yZGVySWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAACmtleUFzc2V0SWQAAAABBQAAAAdvcmRlcklkBQAAAANuaWwJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAHYWRkcmVzcwUAAAAGYW1vdW50CQEAAAAHZnJvbVN0cgAAAAEFAAAACmFzc2V0SWRTdHIJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAACWtleUFtb3VudAAAAAEFAAAAB29yZGVySWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAAAlrZXlBbW91bnQAAAABBQAAAAdvcmRlcklkBQAAAApyZXN0QW1vdW50BQAAAANuaWwAAAAA4ilP5g==", "height": 2867788, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ga8M349XXYJwVGRnNtEXPgEaWq8czAHxyAhe7RPiUJVi Next: CnnFS95brwB4C8T4Eo9gTJzUYd99oMkpu1wBs49ipfiG Diff:
Old | New | Differences | |
---|---|---|---|
61 | 61 | then throw(("You don't have an order with this id: " + orderId)) | |
62 | 62 | else { | |
63 | 63 | let restAmount = toBytes(value(keyAmount(orderId))) | |
64 | - | let assetIdKey = keyAssetId( | |
64 | + | let assetIdKey = keyAssetId(orderId) | |
65 | 65 | let assetIdRaw = getString(this, assetIdKey) | |
66 | 66 | let assetIdStr = value(assetIdRaw) | |
67 | 67 | [ScriptTransfer(i.caller, toInt(restAmount), fromStr(assetIdStr)), ScriptTransfer(developer, toInt(toBytes(value(keyServiceFee(orderId)))), fromStr(assetIdStr)), DeleteEntry(keyServiceFee(orderId)), DeleteEntry(keyAmount(orderId)), DeleteEntry(keyOrderId(orderId)), DeleteEntry(keyAssetId(orderId))] | |
76 | 76 | then throw("The transaction cannot be executed because the seller does not have enough funds") | |
77 | 77 | else { | |
78 | 78 | let restAmount = (toInt(toBytes(value(keyAmount(orderId)))) - amount) | |
79 | - | let assetIdKey = keyAssetId( | |
79 | + | let assetIdKey = keyAssetId(orderId) | |
80 | 80 | let assetIdRaw = getString(this, assetIdKey) | |
81 | 81 | let assetIdStr = value(assetIdRaw) | |
82 | 82 | if ((minAmount > restAmount)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let developer = addressFromStringValue("3Mp6TThvbb8z9npqz4AK3ByqAbvs7dYS8uR") | |
5 | 5 | ||
6 | 6 | func keyPartner (address) = ("%s%s__partner__" + address) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyWantedAssetId (address) = ("%s%s__wantedAssetId__" + address) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func keyWantedAmount (address) = ("%s%s__wantedAmount__" + address) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func keyAssetId (orderId) = ("%s%s__assetId__" + orderId) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func keyAmount (orderId) = ("%s%s__amount__" + orderId) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func keyOrderId (orderId) = ("%s%s__orderId__" + orderId) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyServiceFee (orderId) = ("%s%s__serviceFee__" + orderId) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func toStr (assetId) = if ((assetId == unit)) | |
28 | 28 | then "WAVES" | |
29 | 29 | else toBase58String(value(assetId)) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func fromStr (assetIdStr) = if ((assetIdStr == "WAVES")) | |
33 | 33 | then unit | |
34 | 34 | else fromBase58String(assetIdStr) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func checkAsset (assetId) = { | |
38 | 38 | let asset = fromStr(assetId) | |
39 | 39 | if (if ((asset != unit)) | |
40 | 40 | then (assetInfo(value(asset)) == unit) | |
41 | 41 | else false) | |
42 | 42 | then throw("Invalid assetId: assetInfo missing") | |
43 | 43 | else toStr(asset) | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func escrow (orderId,amount,assetId,developerFee) = if (isDefined(getString(this, keyOrderId(orderId)))) | |
49 | 49 | then throw(("You already have an order with this id: " + orderId)) | |
50 | 50 | else if ((0 >= amount)) | |
51 | 51 | then throw("Non-positive order amount") | |
52 | 52 | else { | |
53 | 53 | let orderAmount = (amount - developerFee) | |
54 | 54 | [IntegerEntry(keyServiceFee(orderId), developerFee), IntegerEntry(keyAmount(orderId), orderAmount), StringEntry(keyOrderId(orderId), orderId), StringEntry(keyAssetId(orderId), assetId)] | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(i) | |
60 | 60 | func cancel (orderId) = if (!(isDefined(keyOrderId(orderId)))) | |
61 | 61 | then throw(("You don't have an order with this id: " + orderId)) | |
62 | 62 | else { | |
63 | 63 | let restAmount = toBytes(value(keyAmount(orderId))) | |
64 | - | let assetIdKey = keyAssetId( | |
64 | + | let assetIdKey = keyAssetId(orderId) | |
65 | 65 | let assetIdRaw = getString(this, assetIdKey) | |
66 | 66 | let assetIdStr = value(assetIdRaw) | |
67 | 67 | [ScriptTransfer(i.caller, toInt(restAmount), fromStr(assetIdStr)), ScriptTransfer(developer, toInt(toBytes(value(keyServiceFee(orderId)))), fromStr(assetIdStr)), DeleteEntry(keyServiceFee(orderId)), DeleteEntry(keyAmount(orderId)), DeleteEntry(keyOrderId(orderId)), DeleteEntry(keyAssetId(orderId))] | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | 72 | @Callable(i) | |
73 | 73 | func deal (orderId,address,amount,minAmount) = if (!(isDefined(keyOrderId(orderId)))) | |
74 | 74 | then throw(("You don't have an order with this id: " + orderId)) | |
75 | 75 | else if ((amount > toInt(toBytes(value(keyAmount(orderId)))))) | |
76 | 76 | then throw("The transaction cannot be executed because the seller does not have enough funds") | |
77 | 77 | else { | |
78 | 78 | let restAmount = (toInt(toBytes(value(keyAmount(orderId)))) - amount) | |
79 | - | let assetIdKey = keyAssetId( | |
79 | + | let assetIdKey = keyAssetId(orderId) | |
80 | 80 | let assetIdRaw = getString(this, assetIdKey) | |
81 | 81 | let assetIdStr = value(assetIdRaw) | |
82 | 82 | if ((minAmount > restAmount)) | |
83 | 83 | then [ScriptTransfer(addressFromStringValue(address), amount, fromStr(assetIdStr)), ScriptTransfer(i.caller, restAmount, fromStr(assetIdStr)), ScriptTransfer(developer, toInt(toBytes(value(keyServiceFee(orderId)))), fromStr(assetIdStr)), DeleteEntry(keyServiceFee(orderId)), DeleteEntry(keyAmount(orderId)), DeleteEntry(keyOrderId(orderId)), DeleteEntry(keyAssetId(orderId))] | |
84 | 84 | else [ScriptTransfer(addressFromStringValue(address), amount, fromStr(assetIdStr)), DeleteEntry(keyAmount(orderId)), IntegerEntry(keyAmount(orderId), restAmount)] | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 |
github/deemru/w8io/169f3d6 52.72 ms ◑