tx · 7dMDtT6L4yyeRuXyuu16FJLvBBSKkoP5FhVq4YamCtFD

3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r:  -0.04000000 Waves

2022.01.13 17:26 [1877298] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves

{ "type": 13, "id": "7dMDtT6L4yyeRuXyuu16FJLvBBSKkoP5FhVq4YamCtFD", "fee": 4000000, "feeAssetId": null, "timestamp": 1642083993491, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "45Q6NWUfmeTGRHMzC7aRgANcqKwd5SiTzswjVDfkrATTRf9nC8a1yNN21zo9PaDeL1kPJiFTKVfqTNsyAWfFz86a" ], "script": "base64:AAIFAAAAAAAAARMIAhIFCgMICAgSAwoBCBoWCgFhEhFob2xkaW5nc1B1YmxpY0tleRoUCgFiEg9ob2xkaW5nc0FkZHJlc3MaFAoBYxIPdHJhbnNmZXJDb3N0UGN0GgYKAWQSAWkaDAoBZRIHb3duZXJJZBoMCgFmEgdhc3NldElkGgsKAWcSBmFtb3VudBoMCgFoEgckbWF0Y2gwGgYKAWkSAXgaEgoBahINcGF5bWVudEFtb3VudBodCgFrEhhhbW91bnRUb1JlbWFpbkluSG9sZGluZ3MaHAoBbBIXYW1vdW50VG9UcmFuc2ZlclRvT3duZXIaEQoBbRIMb3duZXJBZGRyZXNzGgcKAW4SAnR4GgsKAW8SBnZlcmlmeQAAAAMAAAAAAWEBAAAAIOXdIUWzo+xH6Wo3eUXXdqXp3i8rCPbDs0z4AYmX0NtvAAAAAAFiCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAFhAAAAAAFjAAAAAAAAAAAZAAAAAgAAAAFkAQAAABFhZGRPd25lckFuZEFtb3VudAAAAAMAAAABZQAAAAFmAAAAAWcJAARMAA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CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAADNQYXltZW50IGFuZCBhbW91bnQgZG8gbm90IG1hdGNoLiBUaGlzIGFzc2V0cyBjb3N0cyAJAAGkAAAAAQUAAAABZwIAAAANYnV0IHlvdSBzZW50IAkAAaQAAAABBQAAAAFqBAAAAAFrCQAAaAAAAAIFAAAAAWoJAABpAAAAAgUAAAABYwAAAAAAAAAD6AQAAAABbAkAAGUAAAACBQAAAAFqBQAAAAFrBAAAAAFtCQEAAAAHQWRkcmVzcwAAAAEJAAGbAAAAAQUAAAABZQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABZAAAAAZjYWxsZXIAAAAAAAAAAAEJAAJZAAAAAQUAAAABZgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAFtBQAAAAFsBQAAAAR1bml0BQAAAANuaWwAAAABAAAAAW4BAAAAAW8AAAAACQAB9AAAAAMIBQAAAAFuAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABbgAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFuAAAAD3NlbmRlclB1YmxpY0tleeiQbrE=", "height": 1877298, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 41MPodqb7XTBRA6PZu8xvsZenKJoieXyZTEdUYFg3f8g Next: CrRaeNfF6h2xFQubBKjKttb6NqBVfGwUpBLEKLb6CKxL Diff:
OldNewDifferences
2727 case _: Unit =>
2828 0
2929 case x: String =>
30- valueOrElse(parseInt(x), 0)
30+ (valueOrElse(parseInt(x), 0) * 100000000)
3131 case _ =>
3232 throw("Match error")
3333 }
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) = {
1717 let ownerId = match getString(this, (("sale_" + assetId) + "_originalOwner")) {
1818 case _: Unit =>
1919 "unset"
2020 case x: String =>
2121 x
2222 case _ =>
2323 throw("Match error")
2424 }
2525 let paymentAmount = valueOrElse(i.payments[0].amount, 0)
2626 let amount = match getString(this, (("sale_" + assetId) + "_amount")) {
2727 case _: Unit =>
2828 0
2929 case x: String =>
30- valueOrElse(parseInt(x), 0)
30+ (valueOrElse(parseInt(x), 0) * 100000000)
3131 case _ =>
3232 throw("Match error")
3333 }
3434 if ((ownerId == "unset"))
3535 then throw("Original owner not found")
3636 else if (if ((amount == 0))
3737 then true
3838 else (paymentAmount >= amount))
3939 then throw(((("Payment and amount do not match. This assets costs " + toString(amount)) + "but you sent ") + toString(paymentAmount)))
4040 else {
4141 let amountToRemainInHoldings = (paymentAmount * (transferCostPct / 1000))
4242 let amountToTransferToOwner = (paymentAmount - amountToRemainInHoldings)
4343 let ownerAddress = Address(toBytes(ownerId))
4444 [ScriptTransfer(i.caller, 1, fromBase58String(assetId)), ScriptTransfer(ownerAddress, amountToTransferToOwner, unit)]
4545 }
4646 }
4747
4848
4949 @Verifier(tx)
5050 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5151

github/deemru/w8io/169f3d6 
74.33 ms