tx · 6Wz5EEnKDyXkcdgShmSwswPVks8U5kR5EZthz2XumizB 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r: -0.04000000 Waves 2022.02.11 03:35 [1918242] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves
{ "type": 13, "id": "6Wz5EEnKDyXkcdgShmSwswPVks8U5kR5EZthz2XumizB", "fee": 4000000, "feeAssetId": null, "timestamp": 1644539696055, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "2E1B5sVKhWoooZVzzAFdioKE1Y6s5WnZe6zYoqgiykyfb2a1kcqayXcrJMShacneKNST12Se5jgGRnMPeSeqJvC9" ], "script": "base64:AAIFAAAAAAAAAA4IAhIFCgMICAESAwoBCAAAAAQAAAAAEmhvbGRpbmdzQWRkcmVzc1N0cgIAAAAjM045Ujd1NDQ5WjFiNzZRcEpwOXUzZ3pQak1ZUVlucDNWN3IAAAAAEWhvbGRpbmdzUHVibGljS2V5AQAAACDl3SFFs6PsR+lqN3lF13al6d4vKwj2w7NM+AGJl9DbbwAAAAAPaG9sZGluZ3NBZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAABFob2xkaW5nc1B1YmxpY0tleQAAAAAPdHJhbnNmZXJDb3N0UGN0AAAAAAAAAAAoAAAAAgAAAAFpAQAAABFhZGRPd25lckFuZEFtb3VudAAAAAMAAAAHb3duZXJJZAAAAAdhc3NldElkAAAABmFtb3VudAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFc2FsZV8FAAAAB2Fzc2V0SWQCAAAADl9vcmlnaW5hbE93bmVyBQAAAAdvd25lcklkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAEs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1BheW1lbnQgYW5kIGFtb3VudCBkbyBub3QgbWF0Y2guIFRoaXMgYXNzZXRzIGNvc3RzIAkAAaQAAAABBQAAAAZhbW91bnQCAAAADWJ1dCB5b3Ugc2VudCAJAAGkAAAAAQUAAAANcGF5bWVudEFtb3VudAQAAAAIdHJhbnNmZXIJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyAAAAAAAAAAABCQACWQAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAMJAQAAAAIhPQAAAAIFAAAAB293bmVySWQFAAAAEmhvbGRpbmdzQWRkcmVzc1N0cgQAAAAYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzCQAAaQAAAAIFAAAADXBheW1lbnRBbW91bnQFAAAAD3RyYW5zZmVyQ29zdFBjdAQAAAAXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIJAABlAAAAAgUAAAANcGF5bWVudEFtb3VudAUAAAAYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzBAAAAAxvd25lckFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQkAAlkAAAABBQAAAAdvd25lcklkCQAETgAAAAIFAAAACHRyYW5zZmVyCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADG93bmVyQWRkcmVzcwUAAAAXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIFAAAABHVuaXQFAAAAA25pbAUAAAAIdHJhbnNmZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABvcGmfM=", "height": 1918242, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6NZdgrg9xY4bMyuc9dB4f1bxSbrirGmzws3XiEKccUR4 Next: GZNh7stpDxDM5mwNxvciDHfiEQmmavNbw4MFksP4oAEg Diff:
Old | New | Differences | |
---|---|---|---|
46 | 46 | if ((ownerId != holdingsAddressStr)) | |
47 | 47 | then { | |
48 | 48 | let amountToRemainInHoldings = (paymentAmount / transferCostPct) | |
49 | - | throw(((((("paymentAmount " + toString(paymentAmount)) + " | amountToRemainInHoldings ") + toString(amountToRemainInHoldings)) + " | transferCostPct ") + toString((transferCostPct / 1000)))) | |
49 | + | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
50 | + | let ownerAddress = Address(fromBase58String(ownerId)) | |
51 | + | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
50 | 52 | } | |
51 | 53 | else transfer | |
52 | 54 | } |
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 = 40 | |
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 | 18 | func buyFromHoldings (assetId) = { | |
19 | 19 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
20 | 20 | case _: Unit => | |
21 | 21 | "unset" | |
22 | 22 | case x: String => | |
23 | 23 | x | |
24 | 24 | case _ => | |
25 | 25 | throw("Match error") | |
26 | 26 | } | |
27 | 27 | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
28 | 28 | let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) { | |
29 | 29 | case _: Unit => | |
30 | 30 | 0 | |
31 | 31 | case x: Int => | |
32 | 32 | x | |
33 | 33 | case _ => | |
34 | 34 | throw("Match error") | |
35 | 35 | } | |
36 | 36 | if (if ((ownerId == "unset")) | |
37 | 37 | then true | |
38 | 38 | else (ownerId == "")) | |
39 | 39 | then throw("Original owner not found ") | |
40 | 40 | else if (if ((amount == 0)) | |
41 | 41 | then true | |
42 | 42 | else (amount > paymentAmount)) | |
43 | 43 | then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount))) | |
44 | 44 | else { | |
45 | 45 | let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
46 | 46 | if ((ownerId != holdingsAddressStr)) | |
47 | 47 | then { | |
48 | 48 | let amountToRemainInHoldings = (paymentAmount / transferCostPct) | |
49 | - | throw(((((("paymentAmount " + toString(paymentAmount)) + " | amountToRemainInHoldings ") + toString(amountToRemainInHoldings)) + " | transferCostPct ") + toString((transferCostPct / 1000)))) | |
49 | + | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
50 | + | let ownerAddress = Address(fromBase58String(ownerId)) | |
51 | + | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
50 | 52 | } | |
51 | 53 | else transfer | |
52 | 54 | } | |
53 | 55 | } | |
54 | 56 | ||
55 | 57 | ||
56 | 58 | @Verifier(tx) | |
57 | 59 | func verify () = true | |
58 | 60 |
github/deemru/w8io/169f3d6 29.63 ms ◑