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