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