tx · 43Dd97N6KbfN7PzKzcxvAKGhDL9iYjLGbyyvwUdKYe2U 3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A: -0.01000000 Waves 2022.05.12 12:01 [2048255] smart account 3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A > SELF 0.00000000 Waves
{ "type": 13, "id": "43Dd97N6KbfN7PzKzcxvAKGhDL9iYjLGbyyvwUdKYe2U", "fee": 1000000, "feeAssetId": null, "timestamp": 1652346107689, "version": 2, "chainId": 84, "sender": "3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A", "senderPublicKey": "HTEmPgvFxYj3ixqqyCZYUX15Z31rMbac2vWaQw8vrPRj", "proofs": [ "j4AGXRrR93x8jvBcA1d8TBpcLSD18HS3Rc84c3EFq25sF79RdB9xqTZ3D7KYwAt3kfFArsFzHzxWbnvg31xxLDM" ], "script": "base64:AAIFAAAAAAAAABMIAhIFCgMIAQESAwoBCBIDCgEIAAAACQAAAAAKc2hpbnl3Z2dpZAEAAAAgiWnPAv+2urnUcZbXebiZdiawdNB3efRzbobw9HOfBiYAAAAAD3RyZWFzdXJ5QWRkcmVzcwEAAAAaAVRl+PAWCwTAWUJwGp5IjJf/ftwcYvLdu/0AAAAADWFzc2V0c0FkZHJlc3MBAAAAGgFUy+a0wXfXHSctaxYQS8qRSOspiwoalaeaAAAAAA5uYXRpb25zQWRkcmVzcwEAAAAaAVRNheje9PhEa1kQO3Bfw7e5ZQ5R9URGbaAAAAAADGFkbWluQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01wTnRpUFNSU3E2Tm5hUVlrMzhCZldTelpjZ0FZVHlyUTkBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgA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bAMJAAAAAAAAAgUAAAAHdG9hc3NldAUAAAAFb3duZXIJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAFmdldEFzc2V0T3duZXJLZXlTdHJpbmcAAAABBQAAAAdhc3NldElkCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAABZnZXRBc3NldFByaWNlS2V5U3RyaW5nAAAAAQUAAAAHYXNzZXRJZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAAdhc3NldElkBQAAAANuaWwJAAACAAAAAQIAAAAsRXJyb3IgcmVtb3ZpbmcgdGhlIGl0ZW0gZnJvbSB0aGUgbWFya2V0cGxhY2UAAAAAAeXt0A==", "height": 2048255, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: H972JVnSr1wqKgGResq7VNiXKvV1xMjVzAWKUCkZut4M Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | + | ||
6 | + | let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ' | |
7 | + | ||
8 | + | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | + | ||
10 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
11 | + | ||
12 | + | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
13 | + | ||
14 | + | func tryGetString (key) = match getString(this, key) { | |
15 | + | case b: String => | |
16 | + | b | |
17 | + | case _ => | |
18 | + | "" | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
23 | + | case b: Int => | |
24 | + | b | |
25 | + | case _ => | |
26 | + | 0 | |
27 | + | } | |
28 | + | ||
29 | + | ||
30 | + | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
31 | + | ||
32 | + | ||
33 | + | func getAssetPriceKeyString (assetId) = (assetId + "_Price") | |
34 | + | ||
35 | + | ||
36 | + | @Callable(i) | |
37 | + | func putOnSale (assetId,assetSheg,sellPrice) = { | |
38 | + | let strCaller = toString(i.originCaller) | |
39 | + | $Tuple2([StringEntry(getAssetOwnerKeyString(assetId), strCaller), IntegerEntry(getAssetPriceKeyString(assetId), sellPrice), IntegerEntry(assetId, assetSheg)], sellPrice) | |
40 | + | } | |
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | @Callable(i) | |
45 | + | func buyItem (assetId) = { | |
46 | + | let owner = tryGetString(getAssetOwnerKeyString(assetId)) | |
47 | + | let assetPrice = tryGetInteger(getAssetPriceKeyString(assetId)) | |
48 | + | let amountIn = value(i.payments[0].amount) | |
49 | + | if ((assetPrice > amountIn)) | |
50 | + | then throw("You provided less $heg than the needed cost for buying this Item") | |
51 | + | else if ((i.payments[0].assetId != shinywggid)) | |
52 | + | then throw("Only $HEG payments allowed") | |
53 | + | else { | |
54 | + | let assetsheg = tryGetInteger(assetId) | |
55 | + | let toasset = invoke(Address(assetsAddress), "AddAssetFromMarkeplace", [assetId, owner, assetsheg], nil) | |
56 | + | if ((toasset == owner)) | |
57 | + | then { | |
58 | + | let transfer = invoke(Address(assetsAddress), "transferOwnership", [assetId, toString(i.caller)], nil) | |
59 | + | if ((transfer == toString(i.caller))) | |
60 | + | then [ScriptTransfer(addressFromStringValue(owner), amountIn, shinywggid), DeleteEntry(getAssetOwnerKeyString(assetId)), DeleteEntry(getAssetPriceKeyString(assetId)), DeleteEntry(assetId)] | |
61 | + | else throw("Error transferring the ownership of the item") | |
62 | + | } | |
63 | + | else throw("Error removing the item from the marketplace") | |
64 | + | } | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | @Callable(i) | |
70 | + | func removeFromSale (assetId) = { | |
71 | + | let owner = tryGetString(getAssetOwnerKeyString(assetId)) | |
72 | + | if ((toString(i.caller) != owner)) | |
73 | + | then throw("Only the owner of the Item can remove it from the marketplace") | |
74 | + | else { | |
75 | + | let assetsheg = tryGetInteger(assetId) | |
76 | + | let toasset = invoke(Address(assetsAddress), "AddAssetFromMarkeplace", [assetId, owner, assetsheg], nil) | |
77 | + | if ((toasset == owner)) | |
78 | + | then [DeleteEntry(getAssetOwnerKeyString(assetId)), DeleteEntry(getAssetPriceKeyString(assetId)), DeleteEntry(assetId)] | |
79 | + | else throw("Error removing the item from the marketplace") | |
80 | + | } | |
81 | + | } | |
82 | + | ||
83 | + |
github/deemru/w8io/026f985 18.01 ms ◑