tx · Aad4hQWXYVbtVfmKtxEXVDjdX9r6wPmi2nzyNG4MBtBK

3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r:  -0.04000000 Waves

2022.01.14 04:53 [1877990] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves

{ "type": 13, "id": "Aad4hQWXYVbtVfmKtxEXVDjdX9r6wPmi2nzyNG4MBtBK", "fee": 4000000, "feeAssetId": null, "timestamp": 1642125274087, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "4mGCJCMPbTSZwFgRnjKQAwuYNWaLm7yoTko9bNHnv5sT63NkeKCg23YmCv4PsSoQqBuFJF8qzVUTDcWxjtouX8Eg" ], "script": "base64:AAIFAAAAAAAAAXQIAhIFCgMICAgSAwoBCBoQCgFhEgtkYXBwQWRkcmVzcxoXCgFiEhJob2xkaW5nc0FkZHJlc3NTdHIaFgoBYxIRaG9sZGluZ3NQdWJsaWNLZXkaFAoBZBIPaG9sZGluZ3NBZGRyZXNzGhQKAWUSD3RyYW5zZmVyQ29zdFBjdBoGCgFmEgFpGgwKAWcSB293bmVySWQaDAoBaBIHYXNzZXRJZBoLCgFpEgZhbW91bnQaDAoBahIHJG1hdGNoMBoGCgFrEgF4GhIKAWwSDXBheW1lbnRBbW91bnQaDwoBbRIKZEFwcFVwZGF0ZRoMCgFuEgdkYXRhS2V5GgYKAW8SAWEaDQoBcBIIdHJhbnNmZXIaHQoBcRIYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzGhwKAXISF2Ftb3VudFRvVHJhbnNmZXJUb093bmVyGhEKAXMSDG93bmVyQWRkcmVzcxoHCgF0EgJ0eBoLCgF1EgZ2ZXJpZnkAAAAFAAAAAAFhAgAAACMzTjR2cVVYV3c4dGYyM0xEV0RiU0VwSlpINmRlbnQzRVRGdQ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AAAAXMJAQAAAAdBZGRyZXNzAAAAAQkAAlkAAAABBQAAAAFnCQAETgAAAAIFAAAAAXAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAABcwUAAAABcgUAAAAEdW5pdAUAAAADbmlsBQAAAAFwCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAABdAEAAAABdQAAAAAJAAH0AAAAAwgFAAAAAXQAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAF0AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAXQAAAAPc2VuZGVyUHVibGljS2V5ZvyhBQ==", "height": 1877990, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DT1QFW3cn7yjMrqJAARvMdkh2ww2LpMqqrK9zcfR1ndp Next: 4QzDetcMM3TWoDSczY5Foq3ZdoJNuK1yYf6jWVNFyw2z Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let dappAddress = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu"
5+
46 let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r"
57
68 let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY'
4042 else (amount > paymentAmount))
4143 then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount)))
4244 else {
43- let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000))
44- let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
45- let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId))]
46- if ((ownerId != holdingsAddressStr))
45+ let dAppUpdate = invoke(Address(fromBase58String(dappAddress)), "finalizeSale", [assetId, ownerId], [AttachedPayment(unit, 1000000)])
46+ if ((dAppUpdate == dAppUpdate))
4747 then {
48- let ownerAddress = Address(fromBase58String(ownerId))
49- (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)])
48+ let dataKey = match dAppUpdate {
49+ case a: String =>
50+ a
51+ case _ =>
52+ throw("Unexpected result from finalizing purcahse")
5053 }
51- else transfer
54+ let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId))]
55+ if ((ownerId != holdingsAddressStr))
56+ then {
57+ let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000))
58+ let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
59+ let ownerAddress = Address(fromBase58String(ownerId))
60+ (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)])
61+ }
62+ else transfer
63+ }
64+ else throw("Strict value is not equal to itself.")
5265 }
5366 }
5467
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let dappAddress = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu"
5+
46 let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r"
57
68 let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY'
79
810 let holdingsAddress = addressFromPublicKey(holdingsPublicKey)
911
1012 let transferCostPct = 25
1113
1214 @Callable(i)
1315 func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), StringEntry((("sale_" + assetId) + "_amount"), amount)]
1416
1517
1618
1719 @Callable(i)
1820 func buyFromHoldings (assetId) = {
1921 let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
2022 case _: Unit =>
2123 "unset"
2224 case x: String =>
2325 x
2426 case _ =>
2527 throw("Match error")
2628 }
2729 let paymentAmount = valueOrElse(i.payments[0].amount, 0)
2830 let amount = match getString(this, (("sale_" + assetId) + "_amount")) {
2931 case _: Unit =>
3032 0
3133 case x: String =>
3234 (valueOrElse(parseInt(x), 0) * 100000000)
3335 case _ =>
3436 throw("Match error")
3537 }
3638 if ((ownerId == "unset"))
3739 then throw("Original owner not found ")
3840 else if (if ((amount == 0))
3941 then true
4042 else (amount > paymentAmount))
4143 then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount)))
4244 else {
43- let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000))
44- let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
45- let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId))]
46- if ((ownerId != holdingsAddressStr))
45+ let dAppUpdate = invoke(Address(fromBase58String(dappAddress)), "finalizeSale", [assetId, ownerId], [AttachedPayment(unit, 1000000)])
46+ if ((dAppUpdate == dAppUpdate))
4747 then {
48- let ownerAddress = Address(fromBase58String(ownerId))
49- (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)])
48+ let dataKey = match dAppUpdate {
49+ case a: String =>
50+ a
51+ case _ =>
52+ throw("Unexpected result from finalizing purcahse")
5053 }
51- else transfer
54+ let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId))]
55+ if ((ownerId != holdingsAddressStr))
56+ then {
57+ let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000))
58+ let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
59+ let ownerAddress = Address(fromBase58String(ownerId))
60+ (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)])
61+ }
62+ else transfer
63+ }
64+ else throw("Strict value is not equal to itself.")
5265 }
5366 }
5467
5568
5669 @Verifier(tx)
5770 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5871

github/deemru/w8io/169f3d6 
25.73 ms