tx · 7jeRSzsPDVemfDwZ8otZRLZsTWdkTtieY4ioB8ybmwXz 3Mytb3VCj8DZHoLi79gYgdBebhSzear4bcv: -0.01000000 Waves 2022.05.16 11:16 [2053979] smart account 3Mytb3VCj8DZHoLi79gYgdBebhSzear4bcv > SELF 0.00000000 Waves
{ "type": 13, "id": "7jeRSzsPDVemfDwZ8otZRLZsTWdkTtieY4ioB8ybmwXz", "fee": 1000000, "feeAssetId": null, "timestamp": 1652689039690, "version": 2, "chainId": 84, "sender": "3Mytb3VCj8DZHoLi79gYgdBebhSzear4bcv", "senderPublicKey": "8B7i8HQWLc9Wv2DgoTSyf8RT8xizHECxGY9kvtm5h8zY", "proofs": [ "NXbtKSs9xGrA4NAJbrPgouVaiwwHjQbMfxBh9s6M2NU8Cbobhung2fUajMAkoK6itoXCqVUfQ5CJTZ9426ekTwu" ], "script": "base64:AAIFAAAAAAAAAA0IAhIECgIICBIDCgEIAAAACAAAAAAKc2hpbnl3Z2dpZAEAAAAgiWnPAv+2urnUcZbXebiZdiawdNB3efRzbobw9HOfBiYAAAAAD3RyZWFzdXJ5QWRkcmVzcwEAAAAaAVRl+PAWCwTAWUJwGp5IjJf/ftwcYvLdu/0AAAAADm5hdGlvbnNBZGRyZXNzAQAAABoBVE2F6N70+ERrWRA7cF/Dt7llDlH1REZtoAAAAAASbWFya2V0cGxhY2VBZGRyZXNzAQAAABoBVB0huZPx/BjDpxtJcRZDllF066xULiW87wAAAAALYWRtaW5XYWxsZXQJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNNcE50aVBTUlNxNk5uYVFZazM4QmZXU3paY2dBWVR5clE5AQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAAAQAAAA10cnlHZXRJbnRlZ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HJlYXN1cmVLZXkEAAAABW93bmVkCQEAAAAMdHJ5R2V0U3RyaW5nAAAAAQkAASwAAAACBQAAAAt0cmVhc3VyZUtleQIAAAAHX1JlZGVlbQMJAQAAAAIhPQAAAAIFAAAABW93bmVkCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgkAAAIAAAABAgAAADNUaGlzIHRyZWFzdXJlIGhhcyBiZWVuIGRpc2NvdmVyZWQgYnkgYW5vdGhlciBwbGF5ZXIEAAAAC3RyZWFzdXJlVmFsCQEAAAANdHJ5R2V0SW50ZWdlcgAAAAEFAAAAC3RyZWFzdXJlS2V5CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALdHJlYXN1cmVWYWwFAAAACnNoaW55d2dnaWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACBQAAAAt0cmVhc3VyZUtleQIAAAAHX1JlZGVlbQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAAt0cmVhc3VyZUtleQUAAAADbmlsAAAAALmSFog=", "height": 2053979, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 46TNtkKzc2XpdgU9jbLLhdbyiSGG2QwXwAvVG1nCPzkR 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 nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
9 | + | ||
10 | + | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
11 | + | ||
12 | + | let adminWallet = 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 checkAdmin (caller) = if (if (if (if ((caller == adminWallet)) | |
31 | + | then true | |
32 | + | else (caller == this)) | |
33 | + | then true | |
34 | + | else (caller.bytes == nationsAddress)) | |
35 | + | then true | |
36 | + | else (caller.bytes == treasuryAddress)) | |
37 | + | then true | |
38 | + | else (caller.bytes == marketplaceAddress) | |
39 | + | ||
40 | + | ||
41 | + | @Callable(i) | |
42 | + | func discoverTreasure (treasureKey,toAddr) = if (!(checkAdmin(i.caller))) | |
43 | + | then throw("You are not authorized to perform this operation") | |
44 | + | else { | |
45 | + | let owned = tryGetString((treasureKey + "_Redeem")) | |
46 | + | if ((owned != "")) | |
47 | + | then throw("This treasure has been discovered by another player") | |
48 | + | else [StringEntry((treasureKey + "_Redeem"), toAddr)] | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(i) | |
54 | + | func redeemTreasure (treasureKey) = { | |
55 | + | let owned = tryGetString((treasureKey + "_Redeem")) | |
56 | + | if ((owned != toString(i.caller))) | |
57 | + | then throw("This treasure has been discovered by another player") | |
58 | + | else { | |
59 | + | let treasureVal = tryGetInteger(treasureKey) | |
60 | + | [ScriptTransfer(i.caller, treasureVal, shinywggid), DeleteEntry((treasureKey + "_Redeem")), DeleteEntry(treasureKey)] | |
61 | + | } | |
62 | + | } | |
63 | + | ||
64 | + |
github/deemru/w8io/026f985 17.72 ms ◑