tx · FBFkzHV3S1QYVS3HuPtFvWJaJCGh4MSeQLbZ4DrjMzhP 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r: -0.04000000 Waves 2022.02.15 03:39 [1924032] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves
{ "type": 13, "id": "FBFkzHV3S1QYVS3HuPtFvWJaJCGh4MSeQLbZ4DrjMzhP", "fee": 4000000, "feeAssetId": null, "timestamp": 1644885671482, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "ggd3aKUrLrbrFxUyeBnyjWi3hwHuyjHoSSRgkjWM8Q9b1qpy2QiVEEDbNdke3nt9RqszdDftC9s5nkUr9dSLG9G" ], "script": "base64:AAIFAAAAAAAAABMIAhIFCgMICAESAwoBCBIDCgEIAAAABAAAAAASaG9sZGluZ3NBZGRyZXNzU3RyAgAAACMzTjlSN3U0NDlaMWI3NlFwSnA5dTNnelBqTVlRWW5wM1Y3cgAAAAARaG9sZGluZ3NQdWJsaWNLZXkBAAAAIOXdIUWzo+xH6Wo3eUXXdqXp3i8rCPbDs0z4AYmX0NtvAAAAAA9ob2xkaW5nc0FkZHJlc3MJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAAEWhvbGRpbmdzUHVibGljS2V5AAAAAA90cmFuc2ZlckNvc3RQY3QAAAAAAAAAADIAAAADAAAAAWkBAAAAEWFkZE93bmVyQW5kQW1vdW50AAAAAwAAAAdvd25lcklkAAAAB2Fzc2V0SWQAAAAGYW1vdW50CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAVzYWxlXwUAAAAHYXNzZXRJZAIAAAAOX29yaWdpbmFsT3duZXIFAAAAB293bmVySWQJAARMAAAAAgkBAAAADEludGVnZXJFb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LAAAAAIJAAEsAAAAAgIAAAAFc2FsZV8FAAAAB2Fzc2V0SWQCAAAAB19hbW91bnQAAAAAAAAAAAAFAAAAA25pbAMJAQAAAAIhPQAAAAIFAAAAB293bmVySWQFAAAAEmhvbGRpbmdzQWRkcmVzc1N0cgQAAAAYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzCQAAaQAAAAIFAAAADXBheW1lbnRBbW91bnQFAAAAD3RyYW5zZmVyQ29zdFBjdAQAAAAXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIJAABlAAAAAgUAAAANcGF5bWVudEFtb3VudAUAAAAYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzBAAAAAxvd25lckFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQkAAlkAAAABBQAAAAdvd25lcklkCQAETgAAAAIFAAAACHRyYW5zZmVyCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADG93bmVyQWRkcmVzcwUAAAAXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIFAAAABHVuaXQFAAAAA25pbAUAAAAIdHJhbnNmZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABu4++44=", "height": 1924032, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3y8JopqfPXXGyjWpykJ9f8yDTkoA66Qw1W7nrbboYmf5 Next: GogCgj5geErfEwGCbWqwpq6E72SLtFhzDLrQzWVEikyr Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | ||
16 | 16 | ||
17 | 17 | @Callable(i) | |
18 | - | func | |
18 | + | func revokeForSale (assetId) = { | |
19 | 19 | let callerId = toBase58String(i.caller.bytes) | |
20 | 20 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
21 | 21 | case _: Unit => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r" | |
5 | 5 | ||
6 | 6 | let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY' | |
7 | 7 | ||
8 | 8 | let holdingsAddress = addressFromPublicKey(holdingsPublicKey) | |
9 | 9 | ||
10 | 10 | let transferCostPct = 50 | |
11 | 11 | ||
12 | 12 | @Callable(i) | |
13 | 13 | func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), IntegerEntry((("sale_" + assetId) + "_amount"), amount)] | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | ||
17 | 17 | @Callable(i) | |
18 | - | func | |
18 | + | func revokeForSale (assetId) = { | |
19 | 19 | let callerId = toBase58String(i.caller.bytes) | |
20 | 20 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
21 | 21 | case _: Unit => | |
22 | 22 | "unset" | |
23 | 23 | case x: String => | |
24 | 24 | x | |
25 | 25 | case _ => | |
26 | 26 | throw("Match error") | |
27 | 27 | } | |
28 | 28 | if ((callerId != ownerId)) | |
29 | 29 | then throw("Owners do not match") | |
30 | 30 | else [ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func buyFromHoldings (assetId) = { | |
37 | 37 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
38 | 38 | case _: Unit => | |
39 | 39 | "unset" | |
40 | 40 | case x: String => | |
41 | 41 | x | |
42 | 42 | case _ => | |
43 | 43 | throw("Match error") | |
44 | 44 | } | |
45 | 45 | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
46 | 46 | let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) { | |
47 | 47 | case _: Unit => | |
48 | 48 | 0 | |
49 | 49 | case x: Int => | |
50 | 50 | x | |
51 | 51 | case _ => | |
52 | 52 | throw("Match error") | |
53 | 53 | } | |
54 | 54 | if (if ((ownerId == "unset")) | |
55 | 55 | then true | |
56 | 56 | else (ownerId == "")) | |
57 | 57 | then throw("Original owner not found ") | |
58 | 58 | else if (if ((amount == 0)) | |
59 | 59 | then true | |
60 | 60 | else (amount > paymentAmount)) | |
61 | 61 | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
62 | 62 | else { | |
63 | 63 | let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0)] | |
64 | 64 | if ((ownerId != holdingsAddressStr)) | |
65 | 65 | then { | |
66 | 66 | let amountToRemainInHoldings = (paymentAmount / transferCostPct) | |
67 | 67 | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
68 | 68 | let ownerAddress = Address(fromBase58String(ownerId)) | |
69 | 69 | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
70 | 70 | } | |
71 | 71 | else transfer | |
72 | 72 | } | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | @Verifier(tx) | |
77 | 77 | func verify () = true | |
78 | 78 |
github/deemru/w8io/169f3d6 26.47 ms ◑