tx · 5cnrbEwjRJSpQFMjXT8psszopyha9XTBYdCXKStfb1AY

3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r:  -0.04000000 Waves

2022.01.13 17:29 [1877301] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves

{ "type": 13, "id": "5cnrbEwjRJSpQFMjXT8psszopyha9XTBYdCXKStfb1AY", "fee": 4000000, "feeAssetId": null, "timestamp": 1642084194153, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "4i9wwDFAeS3VjpwUD6nBaxKs2unX8HdenfJyDd2TRZSpmciCFtbZrj5xEEJ31xwjCKETGbpa9hed9SqjRVPc3q8" ], "script": "base64:AAIFAAAAAAAAASUIAhIFCgMICAgSAwoBCBoWCgFhEhFob2xkaW5nc1B1YmxpY0tleRoUCgFiEg9ob2xkaW5nc0FkZHJlc3MaFAoBYxIPdHJhbnNmZXJDb3N0UGN0GgYKAWQSAWkaDAoBZRIHb3duZXJJZBoMCgFmEgdhc3NldElkGgsKAWcSBmFtb3VudBoQCgFoEgtvd25lcklkRGF0YRoMCgFpEgckbWF0Y2gwGgYKAWoSAXgaEgoBaxINcGF5bWVudEFtb3VudBodCgFsEhhhbW91bnRUb1JlbWFpbkluSG9sZGluZ3MaHAoBbRIXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIaEQoBbhIMb3duZXJBZGRyZXNzGgcKAW8SAnR4GgsKAXASBnZlcmlmeQAAAAMAAAAAAWEBAAAAIOXdIUWzo+xH6Wo3eUXXdqXp3i8rCPbDs0z4AYmX0NtvAAAAAAFiCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAFhAAAAAAFjAAAAAAAAAAAZAAAAAgAAAAFkAQAAABFhZGRPd25lckFuZEFtb3VudAAAAAMAAAABZQAAAA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gUAAAABaAIAAAAHbm90aGluZwMDCQAAAAAAAAIFAAAAAWcAAAAAAAAAAAAGCQAAZgAAAAIFAAAAAWcFAAAAAWsJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAzUGF5bWVudCBhbmQgYW1vdW50IGRvIG5vdCBtYXRjaC4gVGhpcyBhc3NldHMgY29zdHMgCQABpAAAAAEFAAAAAWcCAAAADWJ1dCB5b3Ugc2VudCAJAAGkAAAAAQUAAAABawQAAAABbAkAAGgAAAACBQAAAAFrCQAAaQAAAAIFAAAAAWMAAAAAAAAAA+gEAAAAAW0JAABlAAAAAgUAAAABawUAAAABbAQAAAABbgkBAAAAB0FkZHJlc3MAAAABCQABmwAAAAEFAAAAAWUJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWQAAAAGY2FsbGVyAAAAAAAAAAABCQACWQAAAAEFAAAAAWYJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAABbgUAAAABbQUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAFvAQAAAAFwAAAAAAkAAfQAAAADCAUAAAABbwAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAW8AAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAABbwAAAA9zZW5kZXJQdWJsaWNLZXlrICSy", "height": 1877301, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C1AZcjvKCf1xw3vAhKY7KyP48cjTTcyd6utuYEFxna6v Next: HhqFXZzuydjAad3oFCbkTC72rNiyrtN7iCYAjGL5fA1k Diff:
OldNewDifferences
1414
1515 @Callable(i)
1616 func buyFromHoldings (assetId) = {
17- let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
17+ let ownerIdData = getString(this, (("sale_" + assetId) + "_originalOwner"))
18+ let ownerId = match ownerIdData {
1819 case _: Unit =>
1920 "unset"
2021 case x: String =>
3233 throw("Match error")
3334 }
3435 if ((ownerId == "unset"))
35- then throw(("Original owner not found " + ownerId))
36+ then throw(("Original owner not found " + valueOrElse(ownerIdData, "nothing")))
3637 else if (if ((amount == 0))
3738 then true
3839 else (amount > paymentAmount))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let holdingsPublicKey = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY'
55
66 let holdingsAddress = addressFromPublicKey(holdingsPublicKey)
77
88 let transferCostPct = 25
99
1010 @Callable(i)
1111 func addOwnerAndAmount (ownerId,assetId,amount) = [StringEntry((("sale_" + assetId) + "_originalOwner"), ownerId), StringEntry((("sale_" + assetId) + "_amount"), amount)]
1212
1313
1414
1515 @Callable(i)
1616 func buyFromHoldings (assetId) = {
17- let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
17+ let ownerIdData = getString(this, (("sale_" + assetId) + "_originalOwner"))
18+ let ownerId = match ownerIdData {
1819 case _: Unit =>
1920 "unset"
2021 case x: String =>
2122 "unset"
2223 case _ =>
2324 throw("Match error")
2425 }
2526 let paymentAmount = valueOrElse(i.payments[0].amount, 0)
2627 let amount = match getString(this, (("sale_" + assetId) + "_amount")) {
2728 case _: Unit =>
2829 0
2930 case x: String =>
3031 (valueOrElse(parseInt(x), 0) * 100000000)
3132 case _ =>
3233 throw("Match error")
3334 }
3435 if ((ownerId == "unset"))
35- then throw(("Original owner not found " + ownerId))
36+ then throw(("Original owner not found " + valueOrElse(ownerIdData, "nothing")))
3637 else if (if ((amount == 0))
3738 then true
3839 else (amount > paymentAmount))
3940 then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount)))
4041 else {
4142 let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000))
4243 let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
4344 let ownerAddress = Address(toBytes(ownerId))
4445 [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]
4546 }
4647 }
4748
4849
4950 @Verifier(tx)
5051 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5152

github/deemru/w8io/169f3d6 
40.09 ms