tx · 8mvjCJpdqrjTbXqXWgADL3k8PhTEu1FiiHkcPWyUMJk9 3MzcHAM4DcpYKt1ZAMibQmqU69pKQ6qz3i4: -0.00200000 Waves 2023.03.26 00:47 [2506081] smart account 3MzcHAM4DcpYKt1ZAMibQmqU69pKQ6qz3i4 > SELF 0.00000000 Waves
{ "type": 13, "id": "8mvjCJpdqrjTbXqXWgADL3k8PhTEu1FiiHkcPWyUMJk9", "fee": 200000, "feeAssetId": null, "timestamp": 1679780859805, "version": 2, "chainId": 84, "sender": "3MzcHAM4DcpYKt1ZAMibQmqU69pKQ6qz3i4", "senderPublicKey": "DoAid1WtwHRuonKq6xKkbxijk1QQhXG75vdyuUM7n7NN", "proofs": [ "4TLfEgw2ShivVcVyJT89S9FvjViGcZxbvU1RTbTcx3Wtp7z3X3UmTzS1sKfuHxA7CiGeCgdJWWCuA9qXdo6c31yr" ], "script": "base64:BgIKCAISBAoCCAgSABIABmFkbWluMQIsRjF5akRkaG9XY3RHUDl5bUdyQmtUZE5IbUVmUHF2TXRpQ0ZYbU43aVhOZ3IABmFkbWluMgIAAApwdXp6bGVNaW50AiMzUEZRampETWlaS1FaZHU1SnFUSEQ3SHdnU1h5cDlSdzlCeQAWa2V5X2Zhcm1OZnRfbmV4dE51bWJlcgISZmFybU5mdF9uZXh0TnVtYmVyABBrZXlfZmFybU5mdF9uYW1lAgxmYXJtTmZ0X25hbWUAF2tleV9mYXJtTmZ0X2Rlc2NyaXB0aW9uAhNmYXJtTmZ0X2Rlc2NyaXB0aW9uABZrZXlfZmFybU5mdF9jb2xsZWN0aW9uAhJmYXJtTmZ0X2NvbGxlY3Rpb24AEWtleV9mYXJtTmZ0X2ltYWdlAg1mYXJtTmZ0X2ltYWdlAA9rZXlfY293TmZ0X25hbWUCC2Nvd05mdF9uYW1lABZrZXlfY293TmZ0X2Rlc2NyaXB0aW9uAhJjb3dOZnRfZGVzY3JpcHRpb24AFWtleV9jb3dOZnRfY29sbGVjdGlvbgIRY293TmZ0X2N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ZBAEFCnB1enpsZU1pbnQCBG1pbnQFA25pbAUDbmlsAwkAAQIFAUACBlN0cmluZwUBQAkAAgEJAKwCAgkAAwEFAUACGyBjb3VsZG4ndCBiZSBjYXN0IHRvIFN0cmluZwkAlAoCCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFCXJlY2lwaWVudAABCQDZBAEFAmlkCQDMCAIJAQxJbnRlZ2VyRW50cnkCBRZrZXlfZmFybU5mdF9uZXh0TnVtYmVyCQBkAgUHbmV4dE51bQABCQDMCAIJAQxCb29sZWFuRW50cnkCCQCsAgIJAKwCAgIFZmFybV8FB2FkZHJlc3MCB19zdGF0dXMGCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICAgVmYXJtXwUHYWRkcmVzcwIFX25hbWUFCGZhcm1OYW1lCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICAgVmYXJtXwUHYWRkcmVzcwIJX2xvY2F0aW9uBQxmYXJtTG9jYXRpb24FA25pbAkAlQoDBQduZXh0TnVtBQhmYXJtTmFtZQUMZmFybUxvY2F0aW9uCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQISTm90IGFsbG93ZWQgY2FsbGVyAWkBBGluaXQABAljYWxsZXJQYmsJANgEAQgFAWkPY2FsbGVyUHVibGljS2V5AwkBBWFsbG93AQUJY2FsbGVyUGJrBAduZXh0TnVtCQENdHJ5R2V0SW50ZWdlcgEFFmtleV9mYXJtTmZ0X25leHROdW1iZXIDCQECIT0CBQduZXh0TnVtAAAJAAIBAh9Db250cmFjdCBpcyBhbHJlYWR5IGluaXRpYWxpemVkCQDMCAIJAQxJbnRlZ2VyRW50cnkCBRZrZXlfZmFybU5mdF9uZXh0TnVtYmVyAAEFA25pbAkAAgECEk5vdCBhbGxvd2VkIGNhbGxlcgAhJI/G", "height": 2506081, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DaAdLE1piJi4mhdZybbk3vALHm1owdBuyLEW5d9mh1V7 Next: HyEKm4VgkbAaatJ6VAELgFN8v47Ger9vQv88udPSC2f6 Diff:
Old | New | Differences | |
---|---|---|---|
69 | 69 | then { | |
70 | 70 | let farmNftName = (tryGetString(key_farmNft_name) + toString(nextNum)) | |
71 | 71 | let farmNftDescription = tryGetString(key_farmNft_description) | |
72 | - | let issue = Issue(farmNftName, farmNftDescription, 1, 0, false) | |
73 | - | let id = calculateAssetId(issue) | |
74 | - | $Tuple2([issue, ScriptTransfer(recipient, 1, id), IntegerEntry(key_farmNft_nextNumber, (nextNum + 1)), BooleanEntry((("farm_" + address) + "_status"), true), StringEntry((("farm_" + address) + "_name"), farmName), StringEntry((("farm_" + address) + "_location"), farmLocation)], $Tuple3(nextNum, farmName, farmLocation)) | |
72 | + | let id = { | |
73 | + | let @ = invoke(Address(fromBase58String(puzzleMint)), "mint", nil, nil) | |
74 | + | if ($isInstanceOf(@, "String")) | |
75 | + | then @ | |
76 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
77 | + | } | |
78 | + | $Tuple2([ScriptTransfer(recipient, 1, fromBase58String(id)), IntegerEntry(key_farmNft_nextNumber, (nextNum + 1)), BooleanEntry((("farm_" + address) + "_status"), true), StringEntry((("farm_" + address) + "_name"), farmName), StringEntry((("farm_" + address) + "_location"), farmLocation)], $Tuple3(nextNum, farmName, farmLocation)) | |
75 | 79 | } | |
76 | 80 | else throw("Strict value is not equal to itself.") | |
77 | 81 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let admin1 = "F1yjDdhoWctGP9ymGrBkTdNHmEfPqvMtiCFXmN7iXNgr" | |
5 | 5 | ||
6 | 6 | let admin2 = "" | |
7 | 7 | ||
8 | 8 | let puzzleMint = "3PFQjjDMiZKQZdu5JqTHD7HwgSXyp9Rw9By" | |
9 | 9 | ||
10 | 10 | let key_farmNft_nextNumber = "farmNft_nextNumber" | |
11 | 11 | ||
12 | 12 | let key_farmNft_name = "farmNft_name" | |
13 | 13 | ||
14 | 14 | let key_farmNft_description = "farmNft_description" | |
15 | 15 | ||
16 | 16 | let key_farmNft_collection = "farmNft_collection" | |
17 | 17 | ||
18 | 18 | let key_farmNft_image = "farmNft_image" | |
19 | 19 | ||
20 | 20 | let key_cowNft_name = "cowNft_name" | |
21 | 21 | ||
22 | 22 | let key_cowNft_description = "cowNft_description" | |
23 | 23 | ||
24 | 24 | let key_cowNft_collection = "cowNft_collection" | |
25 | 25 | ||
26 | 26 | let key_cowNft_image = "cowNft_image" | |
27 | 27 | ||
28 | 28 | let live = "ACTIVE" | |
29 | 29 | ||
30 | 30 | let dead = "INACTIVE" | |
31 | 31 | ||
32 | 32 | let fatten = "FATTEN" | |
33 | 33 | ||
34 | 34 | func tryGetInteger (key) = match getInteger(this, key) { | |
35 | 35 | case b: Int => | |
36 | 36 | b | |
37 | 37 | case _ => | |
38 | 38 | 0 | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func tryGetString (key) = match getString(this, key) { | |
43 | 43 | case a: String => | |
44 | 44 | a | |
45 | 45 | case _ => | |
46 | 46 | "" | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func allow (callerPbk) = if (if ((callerPbk == admin1)) | |
51 | 51 | then true | |
52 | 52 | else (callerPbk == admin2)) | |
53 | 53 | then true | |
54 | 54 | else false | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func registerFarm (address,params) = { | |
59 | 59 | let callerPbk = toBase58String(i.callerPublicKey) | |
60 | 60 | if (allow(callerPbk)) | |
61 | 61 | then { | |
62 | 62 | let recipient = addressFromStringValue(address) | |
63 | 63 | let p_arr = split_4C(params, "|") | |
64 | 64 | let $t017441795 = $Tuple2(p_arr[0], p_arr[1]) | |
65 | 65 | let farmName = $t017441795._1 | |
66 | 66 | let farmLocation = $t017441795._2 | |
67 | 67 | let nextNum = tryGetInteger(key_farmNft_nextNumber) | |
68 | 68 | if ((nextNum == nextNum)) | |
69 | 69 | then { | |
70 | 70 | let farmNftName = (tryGetString(key_farmNft_name) + toString(nextNum)) | |
71 | 71 | let farmNftDescription = tryGetString(key_farmNft_description) | |
72 | - | let issue = Issue(farmNftName, farmNftDescription, 1, 0, false) | |
73 | - | let id = calculateAssetId(issue) | |
74 | - | $Tuple2([issue, ScriptTransfer(recipient, 1, id), IntegerEntry(key_farmNft_nextNumber, (nextNum + 1)), BooleanEntry((("farm_" + address) + "_status"), true), StringEntry((("farm_" + address) + "_name"), farmName), StringEntry((("farm_" + address) + "_location"), farmLocation)], $Tuple3(nextNum, farmName, farmLocation)) | |
72 | + | let id = { | |
73 | + | let @ = invoke(Address(fromBase58String(puzzleMint)), "mint", nil, nil) | |
74 | + | if ($isInstanceOf(@, "String")) | |
75 | + | then @ | |
76 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
77 | + | } | |
78 | + | $Tuple2([ScriptTransfer(recipient, 1, fromBase58String(id)), IntegerEntry(key_farmNft_nextNumber, (nextNum + 1)), BooleanEntry((("farm_" + address) + "_status"), true), StringEntry((("farm_" + address) + "_name"), farmName), StringEntry((("farm_" + address) + "_location"), farmLocation)], $Tuple3(nextNum, farmName, farmLocation)) | |
75 | 79 | } | |
76 | 80 | else throw("Strict value is not equal to itself.") | |
77 | 81 | } | |
78 | 82 | else throw("Not allowed caller") | |
79 | 83 | } | |
80 | 84 | ||
81 | 85 | ||
82 | 86 | ||
83 | 87 | @Callable(i) | |
84 | 88 | func init () = { | |
85 | 89 | let callerPbk = toBase58String(i.callerPublicKey) | |
86 | 90 | if (allow(callerPbk)) | |
87 | 91 | then { | |
88 | 92 | let nextNum = tryGetInteger(key_farmNft_nextNumber) | |
89 | 93 | if ((nextNum != 0)) | |
90 | 94 | then throw("Contract is already initialized") | |
91 | 95 | else [IntegerEntry(key_farmNft_nextNumber, 1)] | |
92 | 96 | } | |
93 | 97 | else throw("Not allowed caller") | |
94 | 98 | } | |
95 | 99 | ||
96 | 100 |
github/deemru/w8io/026f985 31.77 ms ◑