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+AGJl9DbbwAAAAAPaG9sZGluZ3NBZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAABFob2xkaW5nc1B1YmxpY0tleQAAAAAPdHJhbnNmZXJDb3N0UGN0AAAAAAAAAAAyAAAAAwAAAAFpAQ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AAYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzBAAAAAxvd25lckFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQkAAlkAAAABBQAAAAdvd25lcklkCQAETgAAAAIFAAAACHRyYW5zZmVyCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADG93bmVyQWRkcmVzcwUAAAAXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIFAAAABHVuaXQFAAAAA25pbAUAAAAIdHJhbnNmZXIJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAMDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQYJAAAAAAAAAgkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQUAAAAPaG9sZGluZ3NBZGRyZXNzBgkAAAAAAAACCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABCAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BQAAAAtkQXBwQWRkcmVzc1NatY0=", "height": 1985522, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EauHYAnjvbPtrTwbGfq1r2jbjsMFZUEMEkNiSFXihXzD Next: none Diff:
OldNewDifferences
3333 }
3434 if ((callerId != ownerId))
3535 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))]
4237 }
4338
4439
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let dAppAddressStr = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu"
55
66 let dAppPublicKey = base58'D4v2S9mjah7eEEmuQVBNd4WipC3scs8V4PjuDBweWatE'
77
88 let dAppAddress = addressFromPublicKey(dAppPublicKey)
99
1010 let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r"
1111
1212 let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY'
1313
1414 let holdingsAddress = addressFromPublicKey(holdingsPublicKey)
1515
1616 let transferCostPct = 50
1717
1818 @Callable(i)
1919 func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), IntegerEntry((("sale_" + assetId) + "_amount"), amount)]
2020
2121
2222
2323 @Callable(i)
2424 func revokeForSale (assetId) = {
2525 let callerId = toBase58String(i.caller.bytes)
2626 let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
2727 case _: Unit =>
2828 "unset"
2929 case x: String =>
3030 x
3131 case _ =>
3232 throw("Match error")
3333 }
3434 if ((callerId != ownerId))
3535 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))]
4237 }
4338
4439
4540
4641 @Callable(i)
4742 func buyFromHoldings (assetId) = {
4843 let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
4944 case _: Unit =>
5045 "unset"
5146 case x: String =>
5247 x
5348 case _ =>
5449 throw("Match error")
5550 }
5651 let paymentAmount = valueOrElse(i.payments[0].amount, 0)
5752 let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) {
5853 case _: Unit =>
5954 0
6055 case x: Int =>
6156 x
6257 case _ =>
6358 throw("Match error")
6459 }
6560 if (if ((ownerId == "unset"))
6661 then true
6762 else (ownerId == ""))
6863 then throw("Original owner not found ")
6964 else if (if ((amount == 0))
7065 then true
7166 else (amount > paymentAmount))
7267 then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount)))
7368 else {
7469 let callerId = toBase58String(i.caller.bytes)
7570 let res = invoke(dAppAddress, "finalizeSale", [assetId, callerId], [AttachedPayment(unit, 0)])
7671 if ((res == res))
7772 then {
7873 let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0)]
7974 if ((ownerId != holdingsAddressStr))
8075 then {
8176 let amountToRemainInHoldings = (paymentAmount / transferCostPct)
8277 let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
8378 let ownerAddress = Address(fromBase58String(ownerId))
8479 (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)])
8580 }
8681 else transfer
8782 }
8883 else throw("Strict value is not equal to itself.")
8984 }
9085 }
9186
9287
9388 @Verifier(tx)
9489 func verify () = if (if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
9590 then true
9691 else (addressFromPublicKey(tx.senderPublicKey) == holdingsAddress))
9792 then true
9893 else (addressFromPublicKey(tx.senderPublicKey) == dAppAddress)
9994

github/deemru/w8io/169f3d6 
34.43 ms