tx · Cs1LU2b3qntDm73RAvniMV7Zo59XeKitaA4bwEU3nQiT 3N7NSGttZdtSoZanmmvFbtbKy81aH3qmCr1: -0.01000000 Waves 2022.10.27 16:13 [2290879] smart account 3N7NSGttZdtSoZanmmvFbtbKy81aH3qmCr1 > SELF 0.00000000 Waves
{ "type": 13, "id": "Cs1LU2b3qntDm73RAvniMV7Zo59XeKitaA4bwEU3nQiT", "fee": 1000000, "feeAssetId": null, "timestamp": 1666876419198, "version": 2, "chainId": 84, "sender": "3N7NSGttZdtSoZanmmvFbtbKy81aH3qmCr1", "senderPublicKey": "DnHWpL2JmrKWWVJgbwq4czBSA7NpfK3MyfsKzKLJbcro", "proofs": [ "5PNXf2a7Cj5T4T3JYEGnHREuoi2TfxhGJhrzDEEEfrTv2vwN91i2U7gGRXLztiKjopR5dUAxkp6a3VRtWHeHCXc5" ], "script": "base64:AAIFAAAAAAAAABYIAhIFCgMICAESBAoCCAISAwoBCBIAAAAADQEAAAAQZ2V0U3RyaW5nT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgCQAEJQAAAAEFAAAAB2FkZHJlc3MBAAAAEWdldEludGVnZXJPclRocm93AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMQ2FuJ3QgcmVhZCAnBQAAAANrZXkCAAAADScgYXQgYWRkcmVzcyAJAAQlAAAAAQUAAAAHYWRkcmVzcwEAAAATcGFyc2VBZGRyZXNzT3JUaHJvdwAAAAEAAAAMbWF5YmVBZG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AAAFdG9rZW4JAAGbAAAAAQUAAAAIdG9rZW5TdHIEAAAACHRyYW5zZmVyCQAD/AAAAAQFAAAABHRoaXMCAAAACHRyYW5zZmVyCQAETAAAAAIFAAAACWNhbGxlclN0cgkABEwAAAACBQAAAAdhc3NldElkBQAAAANuaWwFAAAAA25pbAMJAAAAAAAAAgUAAAAIdHJhbnNmZXIFAAAACHRyYW5zZmVyBAAAAAxyZWdpc3RyYXRpb24JAAP8AAAABAUAAAAJcmVnaXN0cmFyAgAAAAdyZWNsYWltCQAETAAAAAIIBQAAAAVhc3NldAAAAARuYW1lBQAAAANuaWwFAAAAA25pbAMJAAAAAAAAAgUAAAAMcmVnaXN0cmF0aW9uBQAAAAxyZWdpc3RyYXRpb24FAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAIVS3EI=", "height": 2290879, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 475iAjrQqHgtGmJEeaPX1DQfcjxm9kwKdnMkj8hmksLV Next: APjdJWiDLTgULF8KnA6vpDAJCaGSksPP63AqvzkBL6p1 Diff:
Old | New | Differences | |
---|---|---|---|
49 | 49 | func reserve (name) = { | |
50 | 50 | let caller = inv.caller | |
51 | 51 | let callerStr = toString(caller) | |
52 | - | let reservation = invoke(registrar, "register", [name, callerStr, meedusInitTimestamp], nil) | |
53 | - | if ((reservation == reservation)) | |
54 | - | then nil | |
55 | - | else throw("Strict value is not equal to itself.") | |
52 | + | if ((this != caller)) | |
53 | + | then throw("Only self call are allowed") | |
54 | + | else { | |
55 | + | let reservation = invoke(registrar, "register", [name, callerStr, meedusInitTimestamp], nil) | |
56 | + | if ((reservation == reservation)) | |
57 | + | then nil | |
58 | + | else throw("Strict value is not equal to itself.") | |
59 | + | } | |
56 | 60 | } | |
57 | 61 | ||
58 | 62 | ||
59 | 63 | ||
60 | 64 | @Callable(inv) | |
61 | 65 | func exchange () = { | |
62 | - | let caller = inv. | |
66 | + | let caller = inv.caller | |
63 | 67 | let callerStr = toString(caller) | |
64 | 68 | let pmt = inv.payments[0] | |
65 | 69 | let assetId = valueOrErrorMessage(pmt.assetId, "Asset cannot be WAVES") | |
78 | 82 | else { | |
79 | 83 | let tokenStr = getStringOrThrow(registrar, key_Name_token(asset.name)) | |
80 | 84 | let token = toBytes(tokenStr) | |
81 | - | let transfer = invoke(this, "transfer", [callerStr, | |
85 | + | let transfer = invoke(this, "transfer", [callerStr, assetId], nil) | |
82 | 86 | if ((transfer == transfer)) | |
83 | 87 | then { | |
84 | 88 | let registration = invoke(registrar, "reclaim", [asset.name], nil) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func key_Name_token (name) = key_entity("Name", name, "token") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | let key_meedusAddress = "meedusAddress" | |
20 | 20 | ||
21 | 21 | let key_registrarAddress = "registrarAddress" | |
22 | 22 | ||
23 | 23 | let key_meedusInitTimestamp = "meedusInitTimestamp" | |
24 | 24 | ||
25 | 25 | let meedusAddress = getStringOrThrow(this, key_meedusAddress) | |
26 | 26 | ||
27 | 27 | let meedus = parseAddressOrThrow(meedusAddress) | |
28 | 28 | ||
29 | 29 | let registrarAddress = getStringOrThrow(this, key_registrarAddress) | |
30 | 30 | ||
31 | 31 | let registrar = parseAddressOrThrow(registrarAddress) | |
32 | 32 | ||
33 | 33 | let meedusInitTimestamp = getIntegerOrThrow(this, key_meedusInitTimestamp) | |
34 | 34 | ||
35 | 35 | @Callable(inv) | |
36 | 36 | func init (meedusAddress,registrarAddress,meedusInitTimestamp) = [StringEntry(key_meedusAddress, meedusAddress), StringEntry(key_registrarAddress, registrarAddress), IntegerEntry(key_meedusInitTimestamp, meedusInitTimestamp)] | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(inv) | |
41 | 41 | func transfer (addressStr,asset) = { | |
42 | 42 | let address = parseAddressOrThrow(addressStr) | |
43 | 43 | [ScriptTransfer(address, 1, asset)] | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(inv) | |
49 | 49 | func reserve (name) = { | |
50 | 50 | let caller = inv.caller | |
51 | 51 | let callerStr = toString(caller) | |
52 | - | let reservation = invoke(registrar, "register", [name, callerStr, meedusInitTimestamp], nil) | |
53 | - | if ((reservation == reservation)) | |
54 | - | then nil | |
55 | - | else throw("Strict value is not equal to itself.") | |
52 | + | if ((this != caller)) | |
53 | + | then throw("Only self call are allowed") | |
54 | + | else { | |
55 | + | let reservation = invoke(registrar, "register", [name, callerStr, meedusInitTimestamp], nil) | |
56 | + | if ((reservation == reservation)) | |
57 | + | then nil | |
58 | + | else throw("Strict value is not equal to itself.") | |
59 | + | } | |
56 | 60 | } | |
57 | 61 | ||
58 | 62 | ||
59 | 63 | ||
60 | 64 | @Callable(inv) | |
61 | 65 | func exchange () = { | |
62 | - | let caller = inv. | |
66 | + | let caller = inv.caller | |
63 | 67 | let callerStr = toString(caller) | |
64 | 68 | let pmt = inv.payments[0] | |
65 | 69 | let assetId = valueOrErrorMessage(pmt.assetId, "Asset cannot be WAVES") | |
66 | 70 | let asset = valueOrErrorMessage(assetInfo(assetId), "Invalid asset") | |
67 | 71 | let isMeedusNFT = if (if (if ((asset.issuer == meedus)) | |
68 | 72 | then (asset.quantity == 1) | |
69 | 73 | else false) | |
70 | 74 | then (asset.decimals == 0) | |
71 | 75 | else false) | |
72 | 76 | then (asset.reissuable == false) | |
73 | 77 | else false | |
74 | 78 | if (if ((pmt.amount != 1)) | |
75 | 79 | then true | |
76 | 80 | else !(isMeedusNFT)) | |
77 | 81 | then throw("Payment should contain Meedus NFT") | |
78 | 82 | else { | |
79 | 83 | let tokenStr = getStringOrThrow(registrar, key_Name_token(asset.name)) | |
80 | 84 | let token = toBytes(tokenStr) | |
81 | - | let transfer = invoke(this, "transfer", [callerStr, | |
85 | + | let transfer = invoke(this, "transfer", [callerStr, assetId], nil) | |
82 | 86 | if ((transfer == transfer)) | |
83 | 87 | then { | |
84 | 88 | let registration = invoke(registrar, "reclaim", [asset.name], nil) | |
85 | 89 | if ((registration == registration)) | |
86 | 90 | then nil | |
87 | 91 | else throw("Strict value is not equal to itself.") | |
88 | 92 | } | |
89 | 93 | else throw("Strict value is not equal to itself.") | |
90 | 94 | } | |
91 | 95 | } | |
92 | 96 | ||
93 | 97 |
github/deemru/w8io/169f3d6 31.53 ms ◑