tx · 63fsQqUnUJ8USs1LshB7vdFco9srdbdbrqP9ssdWUNwx 3MsfPLcgQY8V3SpQss9hw5ydZ3SdoooQ9xy: -0.00700000 Waves 2022.09.29 20:20 [2250690] smart account 3MsfPLcgQY8V3SpQss9hw5ydZ3SdoooQ9xy > SELF 0.00000000 Waves
{ "type": 13, "id": "63fsQqUnUJ8USs1LshB7vdFco9srdbdbrqP9ssdWUNwx", "fee": 700000, "feeAssetId": null, "timestamp": 1664472107446, "version": 2, "chainId": 84, "sender": "3MsfPLcgQY8V3SpQss9hw5ydZ3SdoooQ9xy", "senderPublicKey": "4mZ3UeajXYuJVqUiK9DfeKYAVuR279UJFfMQi4WBbBnf", "proofs": [ "29SQGMA59PiZ5GAAnUE1xMnJnKeyuVz6DwqZz5xvSLUAjFE8fovdxwxXzVBR2MZkmpJ8PS3d4gRaUAqj2jaB5Ypn" ], "script": "base64:AAIFAAAAAAAAAAwIAhIICgYICAgICAEAAAAGAAAAAAVydWxlcgIAAAAsQmd4cENtNHd4Ylc4U0tMUEtabmY0S1UyRDZaVTI5b3Y4TWdacmthU0FxcFkAAAAACGJvYm1hX2lkAgAAACw1eHlyVW9KdVhKY1l4YzhSZnJvV2o0UWVMYXc2eGhCZkFkU3JlU3RZQ1JNbgAAAAAIYnVnZ3NfaWQCAAAALEg1VVV1UEo3V0JYempnNloxYWhCVXhqN1ZXb1ZGRmZHM0JNenlBQW5SV3Q2AQAAAA5nZXRBc3NldFN0cmluZwAAAAEAAAAHYXNzZXRJZAQAAAAHJG1hdGNoMAUAAAAHYXNzZXRJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABYgUAAAAHJG1hdGNoMAkAAlgAAAABBQAAAAFiAgAAAAVXQVZFUwEAAAANZ2V0QXNzZXRCeXRlcwAAAAEAAAAHYXNzZXRJZAMJAAAAAAAAAgUAAAAHYXNzZXRJZAIAAAAFV0FWRVMFAAAABHVuaXQJAAJZAAAAAQUAAAAHY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xmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmmuT8s", "height": 2250690, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: yoFPvLMMopFFiAQ5DvX1yShyQckP82qGHgCoMfSXvC8 Next: EQYtbrER7LU2hQWivWvfLM7Bm2Pu4ejNYVYNR7krUMfK Diff:
Old | New | Differences | |
---|---|---|---|
45 | 45 | let nb = myBalance(getAssetBytes(a)) | |
46 | 46 | if ((nb == nb)) | |
47 | 47 | then { | |
48 | - | let entry2 = if (( | |
48 | + | let entry2 = if ((p2t == "p")) | |
49 | 49 | then invoke(Address(fromBase58String(p2)), "swap", [assetIn, 0], [AttachedPayment(getAssetBytes(a), nb)]) | |
50 | 50 | else invoke(Address(fromBase58String(p2)), "exchange", [0], [AttachedPayment(getAssetBytes(a), nb)]) | |
51 | 51 | if ((entry2 == entry2)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ruler = "BgxpCm4wxbW8SKLPKZnf4KU2D6ZU29ov8MgZrkaSAqpY" | |
5 | 5 | ||
6 | 6 | let bobma_id = "5xyrUoJuXJcYxc8RfroWj4QeLaw6xhBfAdSreStYCRMn" | |
7 | 7 | ||
8 | 8 | let buggs_id = "H5UUuPJ7WBXzjg6Z1ahBUxj7VWoVFFfG3BMzyAAnRWt6" | |
9 | 9 | ||
10 | 10 | func getAssetString (assetId) = match assetId { | |
11 | 11 | case b: ByteVector => | |
12 | 12 | toBase58String(b) | |
13 | 13 | case _ => | |
14 | 14 | "WAVES" | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func getAssetBytes (assetId) = if ((assetId == "WAVES")) | |
19 | 19 | then unit | |
20 | 20 | else fromBase58String(assetId) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func myBalance (assetId) = match assetId { | |
24 | 24 | case b: ByteVector => | |
25 | 25 | assetBalance(this, b) | |
26 | 26 | case _ => | |
27 | 27 | wavesBalance(this).available | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(i) | |
32 | 32 | func trade (a,p1,p1t,p2,p2t,min) = { | |
33 | 33 | let callerPbk = toBase58String(i.callerPublicKey) | |
34 | 34 | if ((callerPbk != ruler)) | |
35 | 35 | then throw("No-no-no") | |
36 | 36 | else { | |
37 | 37 | let pmt = i.payments[0] | |
38 | 38 | let assetIn = value(pmt.assetId) | |
39 | 39 | let amountIn = value(pmt.amount) | |
40 | 40 | let entry1 = if ((p1t == "p")) | |
41 | 41 | then invoke(Address(fromBase58String(p1)), "swap", [a, 0], [AttachedPayment(assetIn, amountIn)]) | |
42 | 42 | else invoke(Address(fromBase58String(p1)), "exchange", [0], [AttachedPayment(assetIn, amountIn)]) | |
43 | 43 | if ((entry1 == entry1)) | |
44 | 44 | then { | |
45 | 45 | let nb = myBalance(getAssetBytes(a)) | |
46 | 46 | if ((nb == nb)) | |
47 | 47 | then { | |
48 | - | let entry2 = if (( | |
48 | + | let entry2 = if ((p2t == "p")) | |
49 | 49 | then invoke(Address(fromBase58String(p2)), "swap", [assetIn, 0], [AttachedPayment(getAssetBytes(a), nb)]) | |
50 | 50 | else invoke(Address(fromBase58String(p2)), "exchange", [0], [AttachedPayment(getAssetBytes(a), nb)]) | |
51 | 51 | if ((entry2 == entry2)) | |
52 | 52 | then { | |
53 | 53 | let nb2 = myBalance(assetIn) | |
54 | 54 | if ((nb2 == nb2)) | |
55 | 55 | then if ((nb2 > amountIn)) | |
56 | 56 | then [ScriptTransfer(i.caller, nb2, assetIn)] | |
57 | 57 | else throw(("Ooops, " + toString(nb2))) | |
58 | 58 | else throw("Strict value is not equal to itself.") | |
59 | 59 | } | |
60 | 60 | else throw("Strict value is not equal to itself.") | |
61 | 61 | } | |
62 | 62 | else throw("Strict value is not equal to itself.") | |
63 | 63 | } | |
64 | 64 | else throw("Strict value is not equal to itself.") | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Verifier(tx) | |
70 | 70 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
71 | 71 |
github/deemru/w8io/026f985 29.39 ms ◑