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+AGJl9DbbwAAAAAPaG9sZGluZ3NBZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAABFob2xkaW5nc1B1YmxpY0tleQAAAAAPdHJhbnNmZXJDb3N0UGN0AAAAAAAAAAAyAAAAAwAAAAFpAQ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vdW50VG9UcmFuc2ZlclRvT3duZXIFAAAABHVuaXQFAAAAA25pbAUAAAAIdHJhbnNmZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABjOTC9I=", "height": 1924108, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FBFkzHV3S1QYVS3HuPtFvWJaJCGh4MSeQLbZ4DrjMzhP Next: FVFJBeiCVa4Qz8kaAY1GxYSehi3i8zeaohgRBDTDSPGF Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let dAppAddressStr = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu"
5+
6+let dAppPublicKey = base58'D4v2S9mjah7eEEmuQVBNd4WipC3scs8V4PjuDBweWatE'
7+
8+let dAppAddress = addressFromPublicKey(dAppPublicKey)
9+
410 let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r"
511
612 let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY'
2733 }
2834 if ((callerId != ownerId))
2935 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+ }
3142 }
3243
3344
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let dAppAddressStr = "3N4vqUXWw8tf23LDWDbSEpJZH6dent3ETFu"
5+
6+let dAppPublicKey = base58'D4v2S9mjah7eEEmuQVBNd4WipC3scs8V4PjuDBweWatE'
7+
8+let dAppAddress = addressFromPublicKey(dAppPublicKey)
9+
410 let holdingsAddressStr = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r"
511
612 let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY'
713
814 let holdingsAddress = addressFromPublicKey(holdingsPublicKey)
915
1016 let transferCostPct = 50
1117
1218 @Callable(i)
1319 func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), IntegerEntry((("sale_" + assetId) + "_amount"), amount)]
1420
1521
1622
1723 @Callable(i)
1824 func revokeForSale (assetId) = {
1925 let callerId = toBase58String(i.caller.bytes)
2026 let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
2127 case _: Unit =>
2228 "unset"
2329 case x: String =>
2430 x
2531 case _ =>
2632 throw("Match error")
2733 }
2834 if ((callerId != ownerId))
2935 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+ }
3142 }
3243
3344
3445
3546 @Callable(i)
3647 func buyFromHoldings (assetId) = {
3748 let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
3849 case _: Unit =>
3950 "unset"
4051 case x: String =>
4152 x
4253 case _ =>
4354 throw("Match error")
4455 }
4556 let paymentAmount = valueOrElse(i.payments[0].amount, 0)
4657 let amount = match getInteger(this, (("sale_" + assetId) + "_amount")) {
4758 case _: Unit =>
4859 0
4960 case x: Int =>
5061 x
5162 case _ =>
5263 throw("Match error")
5364 }
5465 if (if ((ownerId == "unset"))
5566 then true
5667 else (ownerId == ""))
5768 then throw("Original owner not found ")
5869 else if (if ((amount == 0))
5970 then true
6071 else (amount > paymentAmount))
6172 then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount)))
6273 else {
6374 let transfer = [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), StringEntry((("sale_" + assetId) + "_originalOwner"), ""), IntegerEntry((("sale_" + assetId) + "_amount"), 0)]
6475 if ((ownerId != holdingsAddressStr))
6576 then {
6677 let amountToRemainInHoldings = (paymentAmount / transferCostPct)
6778 let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
6879 let ownerAddress = Address(fromBase58String(ownerId))
6980 (transfer ++ [ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)])
7081 }
7182 else transfer
7283 }
7384 }
7485
7586
7687 @Verifier(tx)
7788 func verify () = true
7889

github/deemru/w8io/169f3d6 
40.19 ms