tx · VQV5R8KRoH4yAMtbYb8vBWN23QRHRAN7ktgZiWYfh1d 3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv: -0.05000000 Waves 2020.06.21 20:30 [1053675] smart account 3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv > SELF 0.00000000 Waves
{ "type": 13, "id": "VQV5R8KRoH4yAMtbYb8vBWN23QRHRAN7ktgZiWYfh1d", "fee": 5000000, "feeAssetId": null, "timestamp": 1592760657516, "version": 1, "sender": "3NCTUyjM4SX4hK2kaFTkYv4J2fzcQHtvSjv", "senderPublicKey": "CCEAkP4AnTM1HmKyRheQLmgNxPKACsL5hcH72JUeCiDJ", "proofs": [ "5Hwav1bhrWhByzes93HHYN1XKDRaAMADLTPmyaetZ9KmsdX9gL4q9t3q3HLBiwxtWLKNYsxpmgabQLA2ZT8EGBxh" ], "script": "base64:AAIDAAAAAAAAABoIARIHCgUIAQEICBIDCgEIEgMKAQgSAwoBCAAAAAMAAAAADm93bmVyUHVibGljS2V5AQAAACCmUNWS0Pf/tmct+/B/I05Ro9F4HTOauOin2of4SgTvNQEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAARyYW5kCQAAywAAAAIJAADLAAAAAgkAAMsAAAACCQAAywAAAAIIBQAAAANpbnYAAAANdHJhbnNhY3Rpb25JZAgFAAAAA2ludgAAAA9jYWxsZXJQdWJsaWNLZXkIBQAAAAlsYXN0QmxvY2sAAAATZ2VuZXJhdGlvblNpZ25hdHVyZQkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAkAAZoAAAABCAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAkAAfcAAAABBQAAAARyYW5kAQAAABFvZmZlckVycm9ySGFuZGxlcgAAAAYAAAAFdG9rZW4AAAAGYW1vdW50AAAABXByaWNlAAAABHR5cGUAAAAFYXNzZXQAAAADaW52AwMDAwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQUAAAAFdG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VzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkHQfENtg==", "chainId": 84, "height": 1053675, "spentComplexity": 0 } View: original | compacted Prev: 8Ki9Sw9fBhno7Vn69bcV5qvK4haFH64Wak4xrUR74XoA Next: FQP5FC2gcvqdEmJiAEiiy4WDdiou9dS4wz8Vp1cDYWcM Diff:
Old | New | Differences | |
---|---|---|---|
78 | 78 | let x = getStringValue(this, (r + "_secondParty")) | |
79 | 79 | let s = getString(this, (r + "_type")) | |
80 | 80 | let g = getIntegerValue(this, (r + "_amount")) | |
81 | - | let u = getStringValue(this, (r + "_ | |
81 | + | let u = getStringValue(this, (r + "_assetId")) | |
82 | 82 | if ((t == "accepted")) | |
83 | 83 | then if ((w != toBase58String(l.caller.bytes))) | |
84 | 84 | then throw("User not allowed to sign") | |
85 | 85 | else if ((s == "buy")) | |
86 | 86 | then ScriptResult(WriteSet([DataEntry(r, "closed")]), TransferSet([ScriptTransfer(l.caller, g, toBytes(u))])) | |
87 | 87 | else if ((s == "sell")) | |
88 | - | then WriteSet([DataEntry( | |
88 | + | then ScriptResult(WriteSet([DataEntry(r, "closed")]), TransferSet([ScriptTransfer(addressFromStringValue(x), g, toBytes(u))])) | |
89 | 89 | else throw("Offer Type Error") | |
90 | 90 | else throw("Wrong offer status - forbidden") | |
91 | 91 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'CCEAkP4AnTM1HmKyRheQLmgNxPKACsL5hcH72JUeCiDJ' | |
5 | 5 | ||
6 | 6 | func b (c) = { | |
7 | 7 | let d = ((((c.transactionId + c.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
8 | 8 | sha256(d) | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func e (f,g,h,i,j,c) = if (if (if (if (!(isDefined(f))) | |
13 | 13 | then true | |
14 | 14 | else !(isDefined(g))) | |
15 | 15 | then true | |
16 | 16 | else !(isDefined(h))) | |
17 | 17 | then true | |
18 | 18 | else !(isDefined(i))) | |
19 | 19 | then throw("Invalid Transaction") | |
20 | 20 | else if (if ((i == "sell")) | |
21 | 21 | then !(isDefined(c.payment)) | |
22 | 22 | else false) | |
23 | 23 | then throw("No payment attached") | |
24 | 24 | else if (if ((i == "sell")) | |
25 | 25 | then isDefined(c.payment) | |
26 | 26 | else false) | |
27 | 27 | then { | |
28 | 28 | let k = extract(c.payment) | |
29 | 29 | if ((k.amount != g)) | |
30 | 30 | then throw("Payment amount insufficient") | |
31 | 31 | else if ((toBase58String(value(k.assetId)) != j)) | |
32 | 32 | then throw("AssetId invalid") | |
33 | 33 | else true | |
34 | 34 | } | |
35 | 35 | else true | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | @Callable(l) | |
39 | 39 | func postOffer (m,n,o,p,q) = if (e(m, n, o, p, q, l)) | |
40 | 40 | then { | |
41 | 41 | let r = toBase64String(b(l)) | |
42 | 42 | WriteSet([DataEntry(r, "open"), DataEntry((r + "_tokenId"), m), DataEntry((r + "_amount"), n), DataEntry((r + "_price"), o), DataEntry((r + "_type"), p), DataEntry((r + "_firstParty"), toBase58String(l.caller.bytes)), DataEntry((r + "_assetId"), toBytes(q))]) | |
43 | 43 | } | |
44 | 44 | else throw("Conditions not met") | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(l) | |
49 | 49 | func acceptOffer (r) = { | |
50 | 50 | let s = getString(this, (r + "_type")) | |
51 | 51 | let t = getString(this, r) | |
52 | 52 | let u = getString(this, (r + "_assetId")) | |
53 | 53 | let v = getInteger(this, (r + "_amount")) | |
54 | 54 | if ((t == "open")) | |
55 | 55 | then if ((s == "buy")) | |
56 | 56 | then if (!(isDefined(l.payment))) | |
57 | 57 | then throw("Payment needed for buy offer") | |
58 | 58 | else { | |
59 | 59 | let k = extract(l.payment) | |
60 | 60 | if ((k.amount != v)) | |
61 | 61 | then throw("Insufficient Payment Amount") | |
62 | 62 | else if ((k.assetId != u)) | |
63 | 63 | then throw("AssetId invalid") | |
64 | 64 | else WriteSet([DataEntry(r, "accepted"), DataEntry((r + "_secondParty"), toBase58String(l.caller.bytes))]) | |
65 | 65 | } | |
66 | 66 | else if ((s == "sell")) | |
67 | 67 | then WriteSet([DataEntry(r, "accepted"), DataEntry((r + "_secondParty"), toBase58String(l.caller.bytes))]) | |
68 | 68 | else throw("Offer Type Error") | |
69 | 69 | else throw("Wrong offer status - forbidden") | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Callable(l) | |
75 | 75 | func signOffer (r) = { | |
76 | 76 | let t = getString(this, r) | |
77 | 77 | let w = getString(this, (r + "_firstParty")) | |
78 | 78 | let x = getStringValue(this, (r + "_secondParty")) | |
79 | 79 | let s = getString(this, (r + "_type")) | |
80 | 80 | let g = getIntegerValue(this, (r + "_amount")) | |
81 | - | let u = getStringValue(this, (r + "_ | |
81 | + | let u = getStringValue(this, (r + "_assetId")) | |
82 | 82 | if ((t == "accepted")) | |
83 | 83 | then if ((w != toBase58String(l.caller.bytes))) | |
84 | 84 | then throw("User not allowed to sign") | |
85 | 85 | else if ((s == "buy")) | |
86 | 86 | then ScriptResult(WriteSet([DataEntry(r, "closed")]), TransferSet([ScriptTransfer(l.caller, g, toBytes(u))])) | |
87 | 87 | else if ((s == "sell")) | |
88 | - | then WriteSet([DataEntry( | |
88 | + | then ScriptResult(WriteSet([DataEntry(r, "closed")]), TransferSet([ScriptTransfer(addressFromStringValue(x), g, toBytes(u))])) | |
89 | 89 | else throw("Offer Type Error") | |
90 | 90 | else throw("Wrong offer status - forbidden") | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | @Callable(l) | |
96 | 96 | func deleteOffer (r) = { | |
97 | 97 | let w = getString(this, (r + "_firstParty")) | |
98 | 98 | if ((w != toBase58String(l.caller.bytes))) | |
99 | 99 | then throw("User not allowed to sign") | |
100 | 100 | else WriteSet([DataEntry(r, "deleted")]) | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Verifier(y) | |
105 | 105 | func z () = { | |
106 | 106 | let A = y | |
107 | 107 | if ($isInstanceOf(A, "SetScriptTransaction")) | |
108 | 108 | then sigVerify(y.bodyBytes, y.proofs[0], a) | |
109 | 109 | else if ($isInstanceOf(A, "InvokeScriptTransaction")) | |
110 | 110 | then sigVerify(y.bodyBytes, y.proofs[0], y.senderPublicKey) | |
111 | 111 | else false | |
112 | 112 | } | |
113 | 113 |
github/deemru/w8io/169f3d6 32.23 ms ◑