tx · Au7C4tfS1VXCaFmudDKXRFvAnFyBmddbvAnvZm7hQUJT 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r: -0.04000000 Waves 2022.03.29 20:36 [1985522] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves
{ "type": 13, "id": "Au7C4tfS1VXCaFmudDKXRFvAnFyBmddbvAnvZm7hQUJT", "fee": 4000000, "feeAssetId": null, "timestamp": 1648575399687, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "4ayRAJfew1UBNktUGjKQvuQJNAuGm8dpNwiDBaJC37FM2Di2pK1np6beC7ETS3765CPhJNJw38HwdavCwVPJq5ov" ], "script": "base64:AAIFAAAAAAAAABMIAhIFCgMICAESAwoBCBIDCgEIAAAABwAAAAAOZEFwcEFkZHJlc3NTdHICAAAAIzNONHZxVVhXdzh0ZjIzTERXRGJTRXBKWkg2ZGVudDNFVEZ1AAAAAA1kQXBwUHVibGljS2V5AQAAACCzTPDXKuB0zaBQL2OyxsOCbI4Rkb6W1CjA/1Wz1uFLVwAAAAALZEFwcEFkZHJlc3MJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAADWRBcHBQdWJsaWNLZXkAAAAAEmhvbGRpbmdzQWRkcmVzc1N0cgIAAAAjM045Ujd1NDQ5WjFiNzZRcEpwOXUzZ3pQak1ZUVlucDNWN3IAAAAAEWhvbGRpbmdzUHVibGljS2V5AQAAACDl3SFFs6PsR+lqN3lF13al6d4vKwj2w7NM+AGJl9DbbwAAAAAPaG9sZGluZ3NBZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAABFob2xkaW5nc1B1YmxpY0tleQAAAAAPdHJhbnNmZXJDb3N0UGN0AAAAAAAAAAAyAAAAAwAAAAFpAQA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AYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzBAAAAAxvd25lckFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQkAAlkAAAABBQAAAAdvd25lcklkCQAETgAAAAIFAAAACHRyYW5zZmVyCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADG93bmVyQWRkcmVzcwUAAAAXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIFAAAABHVuaXQFAAAAA25pbAUAAAAIdHJhbnNmZXIJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAMDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQYJAAAAAAAAAgkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQUAAAAPaG9sZGluZ3NBZGRyZXNzBgkAAAAAAAACCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABCAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BQAAAAtkQXBwQWRkcmVzc1NatY0=", "height": 1985522, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EauHYAnjvbPtrTwbGfq1r2jbjsMFZUEMEkNiSFXihXzD Next: none Diff:
Old | New | Differences | |
---|---|---|---|
33 | 33 | } | |
34 | 34 | if ((callerId != ownerId)) | |
35 | 35 | then throw("Owners do not match") | |
36 | - | else { | |
37 | - | let res = invoke(holdingsAddress, "addOwnerAndAmount", ["", assetId, 0], [AttachedPayment(unit, 0)]) | |
38 | - | if ((res == res)) | |
39 | - | then [ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
40 | - | else throw("Strict value is not equal to itself.") | |
41 | - | } | |
36 | + | else [StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0), ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
42 | 37 | } | |
43 | 38 | ||
44 | 39 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let dAppAddressStr = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu" | |
5 | 5 | ||
6 | 6 | let dAppPublicKey = base58'D4v2S9mjah7eEEmuQVBNd4WipC3scs8V4PjuDBweWatE' | |
7 | 7 | ||
8 | 8 | let dAppAddress = addressFromPublicKey(dAppPublicKey) | |
9 | 9 | ||
10 | 10 | let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r" | |
11 | 11 | ||
12 | 12 | let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY' | |
13 | 13 | ||
14 | 14 | let holdingsAddress = addressFromPublicKey(holdingsPublicKey) | |
15 | 15 | ||
16 | 16 | let transferCostPct = 50 | |
17 | 17 | ||
18 | 18 | @Callable(i) | |
19 | 19 | func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), IntegerEntry((("sale_" + assetId) + "_amount"), amount)] | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | 24 | func revokeForSale (assetId) = { | |
25 | 25 | let callerId = toBase58String(i.caller.bytes) | |
26 | 26 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
27 | 27 | case _: Unit => | |
28 | 28 | "unset" | |
29 | 29 | case x: String => | |
30 | 30 | x | |
31 | 31 | case _ => | |
32 | 32 | throw("Match error") | |
33 | 33 | } | |
34 | 34 | if ((callerId != ownerId)) | |
35 | 35 | then throw("Owners do not match") | |
36 | - | else { | |
37 | - | let res = invoke(holdingsAddress, "addOwnerAndAmount", ["", assetId, 0], [AttachedPayment(unit, 0)]) | |
38 | - | if ((res == res)) | |
39 | - | then [ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
40 | - | else throw("Strict value is not equal to itself.") | |
41 | - | } | |
36 | + | else [StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0), ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
42 | 37 | } | |
43 | 38 | ||
44 | 39 | ||
45 | 40 | ||
46 | 41 | @Callable(i) | |
47 | 42 | func buyFromHoldings (assetId) = { | |
48 | 43 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
49 | 44 | case _: Unit => | |
50 | 45 | "unset" | |
51 | 46 | case x: String => | |
52 | 47 | x | |
53 | 48 | case _ => | |
54 | 49 | throw("Match error") | |
55 | 50 | } | |
56 | 51 | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
57 | 52 | let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) { | |
58 | 53 | case _: Unit => | |
59 | 54 | 0 | |
60 | 55 | case x: Int => | |
61 | 56 | x | |
62 | 57 | case _ => | |
63 | 58 | throw("Match error") | |
64 | 59 | } | |
65 | 60 | if (if ((ownerId == "unset")) | |
66 | 61 | then true | |
67 | 62 | else (ownerId == "")) | |
68 | 63 | then throw("Original owner not found ") | |
69 | 64 | else if (if ((amount == 0)) | |
70 | 65 | then true | |
71 | 66 | else (amount > paymentAmount)) | |
72 | 67 | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
73 | 68 | else { | |
74 | 69 | let callerId = toBase58String(i.caller.bytes) | |
75 | 70 | let res = invoke(dAppAddress, "finalizeSale", [assetId, callerId], [AttachedPayment(unit, 0)]) | |
76 | 71 | if ((res == res)) | |
77 | 72 | then { | |
78 | 73 | let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0)] | |
79 | 74 | if ((ownerId != holdingsAddressStr)) | |
80 | 75 | then { | |
81 | 76 | let amountToRemainInHoldings = (paymentAmount / transferCostPct) | |
82 | 77 | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
83 | 78 | let ownerAddress = Address(fromBase58String(ownerId)) | |
84 | 79 | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
85 | 80 | } | |
86 | 81 | else transfer | |
87 | 82 | } | |
88 | 83 | else throw("Strict value is not equal to itself.") | |
89 | 84 | } | |
90 | 85 | } | |
91 | 86 | ||
92 | 87 | ||
93 | 88 | @Verifier(tx) | |
94 | 89 | func verify () = if (if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
95 | 90 | then true | |
96 | 91 | else (addressFromPublicKey(tx.senderPublicKey) == holdingsAddress)) | |
97 | 92 | then true | |
98 | 93 | else (addressFromPublicKey(tx.senderPublicKey) == dAppAddress) | |
99 | 94 |
github/deemru/w8io/169f3d6 34.43 ms ◑