tx · 4QzDetcMM3TWoDSczY5Foq3ZdoJNuK1yYf6jWVNFyw2z 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r: -0.04000000 Waves 2022.01.15 04:31 [1879413] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves
{ "type": 13, "id": "4QzDetcMM3TWoDSczY5Foq3ZdoJNuK1yYf6jWVNFyw2z", "fee": 4000000, "feeAssetId": null, "timestamp": 1642210337235, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "3K9BtG15zCkwKkiuysQqRku2w9zFemE8dCGC757dzQs5TfXGw1Z7AhzxgrUdhtKjtfePjHciGspSrhpyjLBDfaYj" ], "script": "base64:AAIFAAAAAAAAAXQIAhIFCgMICAgSAwoBCBoQCgFhEgtkYXBwQWRkcmVzcxoXCgFiEhJob2xkaW5nc0FkZHJlc3NTdHIaFgoBYxIRaG9sZGluZ3NQdWJsaWNLZXkaFAoBZBIPaG9sZGluZ3NBZGRyZXNzGhQKAWUSD3RyYW5zZmVyQ29zdFBjdBoGCgFmEgFpGgwKAWcSB293bmVySWQaDAoBaBIHYXNzZXRJZBoLCgFpEgZhbW91bnQaDAoBahIHJG1hdGNoMBoGCgFrEgF4GhIKAWwSDXBheW1lbnRBbW91bnQaDwoBbRIKZEFwcFVwZGF0ZRoMCgFuEgdkYXRhS2V5GgYKAW8SAWEaDQoBcBIIdHJhbnNmZXIaHQoBcRIYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzGhwKAXISF2Ftb3VudFRvVHJhbnNmZXJUb093bmVyGhEKAXMSDG93bmVyQWRkcmVzcxoHCgF0EgJ0eBoLCgF1EgZ2ZXJpZnkAAAAFAAAAAAFhAgAAACMzTjR2cVVYV3c4dGYyM0xEV0RiU0VwSlpINmRlbnQzRVRGdQAAAAABYg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QWRkcmVzcwAAAAEJAAJZAAAAAQUAAAABZwkABE4AAAACBQAAAAFwCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAAXMFAAAAAXIFAAAABHVuaXQFAAAAA25pbAUAAAABcAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAXQBAAAAAXUAAAAACQAB9AAAAAMIBQAAAAF0AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABdAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAF0AAAAD3NlbmRlclB1YmxpY0tleWz5pLY=", "height": 1879413, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Aad4hQWXYVbtVfmKtxEXVDjdX9r6wPmi2nzyNG4MBtBK Next: J4Jf4gZR4uP67JtLGLaEAEAsskbowD5dR5FdhPdEGfXm Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY' | |
9 | 9 | ||
10 | - | let holdingsAddress = | |
10 | + | let holdingsAddress = Address(fromBase58String(holdingsAddressStr)) | |
11 | 11 | ||
12 | 12 | let transferCostPct = 25 | |
13 | 13 | ||
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 | - | let dAppUpdate = invoke(Address(fromBase58String(dappAddress)), "finalizeSale", [assetId, ownerId], [AttachedPayment(unit, | |
45 | + | let dAppUpdate = invoke(Address(fromBase58String(dappAddress)), "finalizeSale", [assetId, ownerId], [AttachedPayment(unit, 0)]) | |
46 | 46 | if ((dAppUpdate == dAppUpdate)) | |
47 | 47 | then { | |
48 | 48 | let dataKey = match dAppUpdate { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let dappAddress = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu" | |
5 | 5 | ||
6 | 6 | let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r" | |
7 | 7 | ||
8 | 8 | let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY' | |
9 | 9 | ||
10 | - | let holdingsAddress = | |
10 | + | let holdingsAddress = Address(fromBase58String(holdingsAddressStr)) | |
11 | 11 | ||
12 | 12 | let transferCostPct = 25 | |
13 | 13 | ||
14 | 14 | @Callable(i) | |
15 | 15 | func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), StringEntry((("sale_" + assetId) + "_amount"), amount)] | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | 19 | @Callable(i) | |
20 | 20 | func buyFromHoldings (assetId) = { | |
21 | 21 | let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) { | |
22 | 22 | case _: Unit => | |
23 | 23 | "unset" | |
24 | 24 | case x: String => | |
25 | 25 | x | |
26 | 26 | case _ => | |
27 | 27 | throw("Match error") | |
28 | 28 | } | |
29 | 29 | let paymentAmount = valueOrElse(i.payments[0].amount, 0) | |
30 | 30 | let amount = match getString(this, (("sale_" + assetId) + "_amount")) { | |
31 | 31 | case _: Unit => | |
32 | 32 | 0 | |
33 | 33 | case x: String => | |
34 | 34 | (valueOrElse(parseInt(x), 0) * 100000000) | |
35 | 35 | case _ => | |
36 | 36 | throw("Match error") | |
37 | 37 | } | |
38 | 38 | if ((ownerId == "unset")) | |
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 | - | let dAppUpdate = invoke(Address(fromBase58String(dappAddress)), "finalizeSale", [assetId, ownerId], [AttachedPayment(unit, | |
45 | + | let dAppUpdate = invoke(Address(fromBase58String(dappAddress)), "finalizeSale", [assetId, ownerId], [AttachedPayment(unit, 0)]) | |
46 | 46 | if ((dAppUpdate == dAppUpdate)) | |
47 | 47 | then { | |
48 | 48 | let dataKey = match dAppUpdate { | |
49 | 49 | case a: String => | |
50 | 50 | a | |
51 | 51 | case _ => | |
52 | 52 | throw("Unexpected result from finalizing purcahse") | |
53 | 53 | } | |
54 | 54 | let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId))] | |
55 | 55 | if ((ownerId != holdingsAddressStr)) | |
56 | 56 | then { | |
57 | 57 | let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000)) | |
58 | 58 | let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings) | |
59 | 59 | let ownerAddress = Address(fromBase58String(ownerId)) | |
60 | 60 | (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]) | |
61 | 61 | } | |
62 | 62 | else transfer | |
63 | 63 | } | |
64 | 64 | else throw("Strict value is not equal to itself.") | |
65 | 65 | } | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Verifier(tx) | |
70 | 70 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
71 | 71 |
github/deemru/w8io/169f3d6 87.49 ms ◑