tx · 41MPodqb7XTBRA6PZu8xvsZenKJoieXyZTEdUYFg3f8g 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r: -0.04000000 Waves 2022.01.13 17:24 [1877296] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves
{ "type": 13, "id": "41MPodqb7XTBRA6PZu8xvsZenKJoieXyZTEdUYFg3f8g", "fee": 4000000, "feeAssetId": null, "timestamp": 1642083865433, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "38YZgkLfhjSCu1HYbPoojh2FBYrRhRsnogRf3tkgRQVdJPGBgnKsQ83VxE9C5wmAP7yBBMuWa1eh46ZFSh5T4N7R" ], "script": "base64:AAIFAAAAAAAAARMIAhIFCgMICAgSAwoBCBoWCgFhEhFob2xkaW5nc1B1YmxpY0tleRoUCgFiEg9ob2xkaW5nc0FkZHJlc3MaFAoBYxIPdHJhbnNmZXJDb3N0UGN0GgYKAWQSAWkaDAoBZRIHb3duZXJJZBoMCgFmEgdhc3NldElkGgsKAWcSBmFtb3VudBoMCgFoEgckbWF0Y2gwGgYKAWkSAXgaEgoBahINcGF5bWVudEFtb3VudBodCgFrEhhhbW91bnRUb1JlbWFpbkluSG9sZGluZ3MaHAoBbBIXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIaEQoBbRIMb3duZXJBZGRyZXNzGgcKAW4SAnR4GgsKAW8SBnZlcmlmeQAAAAMAAAAAAWEBAAAAIOXdIUWzo+xH6Wo3eUXXdqXp3i8rCPbDs0z4AYmX0NtvAAAAAAFiCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAFhAAAAAAFjAAAAAAAAAAAZAAAAAgAAAAFkAQAAABFhZGRPd25lckFuZEFtb3VudAAAAAMAAAABZQAAAAFmAAAAAWcJAARMAAAAA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EsAAAAAgIAAAAzUGF5bWVudCBhbmQgYW1vdW50IGRvIG5vdCBtYXRjaC4gVGhpcyBhc3NldHMgY29zdHMgCQABpAAAAAEFAAAAAWcCAAAADWJ1dCB5b3Ugc2VudCAJAAGkAAAAAQUAAAABagQAAAABawkAAGgAAAACBQAAAAFqCQAAaQAAAAIFAAAAAWMAAAAAAAAAA+gEAAAAAWwJAABlAAAAAgUAAAABagUAAAABawQAAAABbQkBAAAAB0FkZHJlc3MAAAABCQABmwAAAAEFAAAAAWUJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWQAAAAGY2FsbGVyAAAAAAAAAAABCQACWQAAAAEFAAAAAWYJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAABbQUAAAABbAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAFuAQAAAAFvAAAAAAkAAfQAAAADCAUAAAABbgAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAW4AAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAABbgAAAA9zZW5kZXJQdWJsaWNLZXmLuN+p", "height": 1877296, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: QR5T2nUnButNsjdMZGHtteBoBa62TQ8TREZnqJGF5js Next: 7dMDtT6L4yyeRuXyuu16FJLvBBSKkoP5FhVq4YamCtFD Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | else if (if ((amount == 0)) | |
37 | 37 | then true | |
38 | 38 | else (paymentAmount >= amount)) | |
39 | - | then throw(("Payment and amount do not match. This assets costs " + toString(amount))) | |
39 | + | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
40 | 40 | else { | |
41 | 41 | let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000)) | |
42 | 42 | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY' | |
5 | 5 | ||
6 | 6 | let holdingsAddress = addressFromPublicKey(holdingsPublicKey) | |
7 | 7 | ||
8 | 8 | let transferCostPct = 25 | |
9 | 9 | ||
10 | 10 | @Callable(i) | |
11 | 11 | func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), StringEntry((("sale_" + assetId) + "_amount"), amount)] | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | 15 | @Callable(i) | |
16 | 16 | func buyFromHoldings (assetId) = { | |
17 | 17 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
18 | 18 | case _: Unit => | |
19 | 19 | "unset" | |
20 | 20 | case x: String => | |
21 | 21 | x | |
22 | 22 | case _ => | |
23 | 23 | throw("Match error") | |
24 | 24 | } | |
25 | 25 | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
26 | 26 | let amount = match getString(this, (("sale_" + assetId) + "_amount")) { | |
27 | 27 | case _: Unit => | |
28 | 28 | 0 | |
29 | 29 | case x: String => | |
30 | 30 | valueOrElse(parseInt(x), 0) | |
31 | 31 | case _ => | |
32 | 32 | throw("Match error") | |
33 | 33 | } | |
34 | 34 | if ((ownerId == "unset")) | |
35 | 35 | then throw("Original owner not found") | |
36 | 36 | else if (if ((amount == 0)) | |
37 | 37 | then true | |
38 | 38 | else (paymentAmount >= amount)) | |
39 | - | then throw(("Payment and amount do not match. This assets costs " + toString(amount))) | |
39 | + | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
40 | 40 | else { | |
41 | 41 | let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000)) | |
42 | 42 | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
43 | 43 | let ownerAddress = Address(toBytes(ownerId)) | |
44 | 44 | [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)] | |
45 | 45 | } | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | @Verifier(tx) | |
50 | 50 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
51 | 51 |
github/deemru/w8io/169f3d6 27.95 ms ◑