tx · BLMP5ftxN92eJxKwSMCwNBp8oaY1Pd5Bairfs5X7KcF9 3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra: -0.01400000 Waves 2021.06.11 20:15 [1565984] smart account 3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra > SELF 0.00000000 Waves
{ "type": 13, "id": "BLMP5ftxN92eJxKwSMCwNBp8oaY1Pd5Bairfs5X7KcF9", "fee": 1400000, "feeAssetId": null, "timestamp": 1623431791360, "version": 2, "chainId": 84, "sender": "3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra", "senderPublicKey": "6hg3zCfLeDbfSrz2QVG7hdax7eXSpabUDqSP1ya8PBVZ", "proofs": [ "2j8PGr41GGfKD2bQFuRDW5z2etzBZchc7AJ9xDYCREHQwtn234mSrfk93i7HjTM474tLqc8VbASfJZ5sK75dhkut" ], "script": "base64:AAIEAAAAAAAAABIIAhIECgIIARIDCgEIEgMKAQgAAAAKAAAAABBrUHJvcG9zZWRBc3NldElkAgAAABNfcHJvcG9zZWRfYXNzZXQxX2lkAAAAABRrUHJvcG9zZWRBc3NldEFtb3VudAIAAAAXX3Byb3Bvc2VkX2Fzc2V0MV9hbW91bnQAAAAAD2tEZXNpcmVkQXNzZXRJZAIAAAASX2Rlc2lyZWRfYXNzZXQxX2lkAAAAAA5rRGVzaXJlZEFtb3VudAIAAAAWX2Rlc2lyZWRfYXNzZXQxX2Ftb3VudAAAAAAHa1N0YXR1cwIAAAAHX3N0YXR1cwAAAAAGa093bmVyAgAAAAZfb3duZXIAAAAACmtDbG9zZVR4SWQCAAAADF9jbG9zZV90eF9pZAAAAAAMc3RhdHVzQWN0aXZlAgAAAAZBY3RpdmUAAAAADnN0YXR1c0NhbmNlbGVkAgAAAAhDYW5jZWxlZAAAAAAKc3RhdHVzRG9uZQIAAAAERG9uZQAAAAMAAAABaQEAAAANcGxhY2VQcm9wb3NhbAAAAAIAAAASZGVzaXJlVG9HZXRBc3NldElkAAAAEW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GlkBAAAABNwcm9wb3NlZEFzc2V0QW1vdW50CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAJpZAUAAAAUa1Byb3Bvc2VkQXNzZXRBbW91bnQCAAAAGVByb3Bvc2VkIGFtb3VudCBub3QgZm91bmQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAJb3duZXJBZGRyBQAAABJkZXNpcmVkQXNzZXRBbW91bnQFAAAADmRlc2lyZWRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAATcHJvcG9zZWRBc3NldEFtb3VudAUAAAAPcHJvcG9zZWRBc3NldElkCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgUAAAACaWQFAAAAB2tTdGF0dXMFAAAACnN0YXR1c0RvbmUJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAAJpZAUAAAAKa0Nsb3NlVHhJZAkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleW/iGfY=", "height": 1565984, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EUUioRic3MvkdU9iV7Y2qsy6r4B5rGYZ6DKxW7YQzxTL Next: FuKAqhWzSzR6W2kR1YWywd3kcH9SiKqzCZVY8jF2bqap Diff:
Old | New | Differences | |
---|---|---|---|
41 | 41 | let ownerAddr = addressFromStringValue(valueOrErrorMessage(getString(this, (id + kOwner)), "owner not set")) | |
42 | 42 | let proposedAssetId = valueOrErrorMessage(getString(this, (id + kProposedAssetId)), "Proposed asset not found") | |
43 | 43 | let proposedAssetAmount = valueOrErrorMessage(getInteger(this, (id + kProposedAssetAmount)), "Proposed amount not found") | |
44 | - | [ScriptTransfer(ownerAddr, proposedAssetAmount, fromBase58String(proposedAssetId)), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), toBase58String(i.transactionId))] | |
44 | + | if ((i.caller != ownerAddr)) | |
45 | + | then throw("Only owner can cancel") | |
46 | + | else [ScriptTransfer(ownerAddr, proposedAssetAmount, fromBase58String(proposedAssetId)), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), toBase58String(i.transactionId))] | |
45 | 47 | } | |
46 | 48 | } | |
47 | 49 | ||
49 | 51 | ||
50 | 52 | @Callable(i) | |
51 | 53 | func acceptProposal (id) = { | |
52 | - | let $ | |
53 | - | let pmtAmount = $ | |
54 | - | let pmtAssetId = $ | |
54 | + | let $t019442027 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
55 | + | let pmtAmount = $t019442027._1 | |
56 | + | let pmtAssetId = $t019442027._2 | |
55 | 57 | let status = valueOrErrorMessage(getString(this, (id + kStatus)), (("Proposal with id '" + id) + "' not found")) | |
56 | 58 | if ((status != statusActive)) | |
57 | 59 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kProposedAssetId = "_proposed_asset1_id" | |
5 | 5 | ||
6 | 6 | let kProposedAssetAmount = "_proposed_asset1_amount" | |
7 | 7 | ||
8 | 8 | let kDesiredAssetId = "_desired_asset1_id" | |
9 | 9 | ||
10 | 10 | let kDesiredAmount = "_desired_asset1_amount" | |
11 | 11 | ||
12 | 12 | let kStatus = "_status" | |
13 | 13 | ||
14 | 14 | let kOwner = "_owner" | |
15 | 15 | ||
16 | 16 | let kCloseTxId = "_close_tx_id" | |
17 | 17 | ||
18 | 18 | let statusActive = "Active" | |
19 | 19 | ||
20 | 20 | let statusCanceled = "Canceled" | |
21 | 21 | ||
22 | 22 | let statusDone = "Done" | |
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func placeProposal (desireToGetAssetId,desireToGetAmount) = { | |
26 | 26 | let $t0525624 = $Tuple2(i.payments[0].amount, toBase58String(value(i.payments[0].assetId))) | |
27 | 27 | let pmtAmount = $t0525624._1 | |
28 | 28 | let pmtAssetId = $t0525624._2 | |
29 | 29 | let id = toBase58String(i.transactionId) | |
30 | 30 | [StringEntry((id + kOwner), toString(i.caller)), StringEntry((id + kProposedAssetId), pmtAssetId), IntegerEntry((id + kProposedAssetAmount), pmtAmount), StringEntry((id + kDesiredAssetId), desireToGetAssetId), IntegerEntry((id + kDesiredAmount), desireToGetAmount), StringEntry((id + kStatus), statusActive)] | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func cancelProposal (id) = { | |
37 | 37 | let status = valueOrErrorMessage(getString(this, (id + kStatus)), (("Proposal with id '" + id) + "' not found")) | |
38 | 38 | if ((status != statusActive)) | |
39 | 39 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
40 | 40 | else { | |
41 | 41 | let ownerAddr = addressFromStringValue(valueOrErrorMessage(getString(this, (id + kOwner)), "owner not set")) | |
42 | 42 | let proposedAssetId = valueOrErrorMessage(getString(this, (id + kProposedAssetId)), "Proposed asset not found") | |
43 | 43 | let proposedAssetAmount = valueOrErrorMessage(getInteger(this, (id + kProposedAssetAmount)), "Proposed amount not found") | |
44 | - | [ScriptTransfer(ownerAddr, proposedAssetAmount, fromBase58String(proposedAssetId)), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), toBase58String(i.transactionId))] | |
44 | + | if ((i.caller != ownerAddr)) | |
45 | + | then throw("Only owner can cancel") | |
46 | + | else [ScriptTransfer(ownerAddr, proposedAssetAmount, fromBase58String(proposedAssetId)), StringEntry((id + kStatus), statusCanceled), StringEntry((id + kCloseTxId), toBase58String(i.transactionId))] | |
45 | 47 | } | |
46 | 48 | } | |
47 | 49 | ||
48 | 50 | ||
49 | 51 | ||
50 | 52 | @Callable(i) | |
51 | 53 | func acceptProposal (id) = { | |
52 | - | let $ | |
53 | - | let pmtAmount = $ | |
54 | - | let pmtAssetId = $ | |
54 | + | let $t019442027 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
55 | + | let pmtAmount = $t019442027._1 | |
56 | + | let pmtAssetId = $t019442027._2 | |
55 | 57 | let status = valueOrErrorMessage(getString(this, (id + kStatus)), (("Proposal with id '" + id) + "' not found")) | |
56 | 58 | if ((status != statusActive)) | |
57 | 59 | then throw(((("Proposal with id '" + id) + "' is not active. Status: ") + status)) | |
58 | 60 | else { | |
59 | 61 | let desiredAssetId = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (id + kDesiredAssetId)), "Desired asset not found")), "Incorrect desired asset id") | |
60 | 62 | let desiredAssetAmount = valueOrErrorMessage(getInteger(this, (id + kDesiredAmount)), "Desired amount not found") | |
61 | 63 | if ((desiredAssetId != pmtAssetId)) | |
62 | 64 | then throw("Atatched asset doesn't match desired") | |
63 | 65 | else if ((desiredAssetAmount != pmtAmount)) | |
64 | 66 | then throw("Attached asset amount doesn't match") | |
65 | 67 | else { | |
66 | 68 | let ownerAddr = addressFromStringValue(valueOrErrorMessage(getString(this, (id + kOwner)), "owner not set")) | |
67 | 69 | let proposedAssetId = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (id + kProposedAssetId)), "Proposed asset not found")), "Incorrect proposed asset id") | |
68 | 70 | let proposedAssetAmount = valueOrErrorMessage(getInteger(this, (id + kProposedAssetAmount)), "Proposed amount not found") | |
69 | 71 | [ScriptTransfer(ownerAddr, desiredAssetAmount, desiredAssetId), ScriptTransfer(i.caller, proposedAssetAmount, proposedAssetId), StringEntry((id + kStatus), statusDone), StringEntry((id + kCloseTxId), toBase58String(i.transactionId))] | |
70 | 72 | } | |
71 | 73 | } | |
72 | 74 | } | |
73 | 75 | ||
74 | 76 | ||
75 | 77 | @Verifier(tx) | |
76 | 78 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
77 | 79 |
github/deemru/w8io/169f3d6 54.92 ms ◑