tx · CKFKmjvtTnEe31yRSn5H1SzxAjxBzit113sNyGDSD2VB 3MzcHAM4DcpYKt1ZAMibQmqU69pKQ6qz3i4: -0.00300000 Waves 2023.03.25 01:00 [2504672] smart account 3MzcHAM4DcpYKt1ZAMibQmqU69pKQ6qz3i4 > SELF 0.00000000 Waves
{ "type": 13, "id": "CKFKmjvtTnEe31yRSn5H1SzxAjxBzit113sNyGDSD2VB", "fee": 300000, "feeAssetId": null, "timestamp": 1679695251621, "version": 2, "chainId": 84, "sender": "3MzcHAM4DcpYKt1ZAMibQmqU69pKQ6qz3i4", "senderPublicKey": "DoAid1WtwHRuonKq6xKkbxijk1QQhXG75vdyuUM7n7NN", "proofs": [ "4kUWYjnhzDb8zMXSHAFxyAYJNAMACJNzsAgQN2FDps12uxwRCYQjjqTfgx8RJvnrf81QrW9s4Js659xPCfhkTbVZ" ], "script": "base64:BgIQCAISBAoCCAgSBAoCCAgSAAwABmFkbWluMQIsRjF5akRkaG9XY3RHUDl5bUdyQmtUZE5IbUVmUHF2TXRpQ0ZYbU43aVhOZ3IABmFkbWluMgIAABZrZXlfZmFybU5mdF9uZXh0TnVtYmVyAhJmYXJtTmZ0X25leHROdW1iZXIADGZhcm1OZnRfbmFtZQILQ2F0dGxlIE5GVCAAC2Nvd05mdF9uYW1lAgdDb3cgTkZUABNmYXJtTmZ0X2Rlc2NyaXB0aW9uAjd7ImRlc2NyaXB0aW9uIjogIk5GVCBmb3IgYXNzb3RpYXRlZCBjYXR0bGUiLCAiaW1hZ2UiOiAiAARsaXZlAgZBQ1RJVkUABGRlYWQCCElOQUNUSVZFAAZmYXR0ZW4CBkZBVFRFTgENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAEMdHJ5R2V0U3RyaW5nAQNrZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUDa2V5AwkAAQIFByRtYXR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BZGRyZXNzAg0iLCAiZ2VuZXMiOiAiBQVnZW5lcwIQIiwgIm1vdGhlcklkIjogIgUIbW90aGVySWQCECIsICJmYXRoZXJJZCI6ICIFCGZhdGhlcklkAgwiLCAidHlwZSI6ICIFBHR5cGUCESIsICJpbWFnZUxpbmsiOiAiBQlpbWFnZUxpbmsCASIEBWlzc3VlCQDCCAUFC2Nvd05mdF9uYW1lCQCsAgIJAKwCAgULZGVzY3JpcHRpb24FCWltYWdlTGluawICIn0AAQAABwQCaWQJALgIAQUFaXNzdWUJAMwIAgUFaXNzdWUJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUJcmVjaXBpZW50AAEFAmlkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQCsAgIJAKwCAgIFZmFybV8FB2FkZHJlc3MCBV9jb3dfCQDYBAEFAmlkAgdfc3RhdHVzBQRsaXZlCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICAgRjb3dfCQDYBAEFAmlkAgZfb3duZXIFB2FkZHJlc3MFA25pbAkAAgECEk5vdCBhbGxvd2VkIGNhbGxlcgFpAQRpbml0AAQJY2FsbGVyUGJrCQDYBAEIBQFpD2NhbGxlclB1YmxpY0tleQMJAQVhbGxvdwEFCWNhbGxlclBiawQHbmV4dE51bQkBDXRyeUdldEludGVnZXIBBRZrZXlfZmFybU5mdF9uZXh0TnVtYmVyAwkBAiE9AgUHbmV4dE51bQAACQACAQIfQ29udHJhY3QgaXMgYWxyZWFkeSBpbml0aWFsaXplZAkAzAgCCQEMSW50ZWdlckVudHJ5AgUWa2V5X2Zhcm1OZnRfbmV4dE51bWJlcgABBQNuaWwJAAIBAhJOb3QgYWxsb3dlZCBjYWxsZXIA3eU6Fw==", "height": 2504672, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Bs7nNk5WQeViKPhhkbE7wHgs8i3oEDffzmuTzj7bm9f Next: CQkYnqzadwS3gXS8PtokDHfb6iYYGgtffTH5fKV81C2R Diff:
Old | New | Differences | |
---|---|---|---|
99 | 99 | then { | |
100 | 100 | let nextNum = tryGetInteger(key_farmNft_nextNumber) | |
101 | 101 | if ((nextNum != 0)) | |
102 | - | then throw( | |
102 | + | then throw("Contract is already initialized") | |
103 | 103 | else [IntegerEntry(key_farmNft_nextNumber, 1)] | |
104 | 104 | } | |
105 | 105 | else throw("Not allowed caller") |
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 key_farmNft_nextNumber = "farmNft_nextNumber" | |
9 | 9 | ||
10 | 10 | let farmNft_name = "Cattle NFT " | |
11 | 11 | ||
12 | 12 | let cowNft_name = "Cow NFT" | |
13 | 13 | ||
14 | 14 | let farmNft_description = "{\"description\": \"NFT for assotiated cattle\", \"image\": \"" | |
15 | 15 | ||
16 | 16 | let live = "ACTIVE" | |
17 | 17 | ||
18 | 18 | let dead = "INACTIVE" | |
19 | 19 | ||
20 | 20 | let fatten = "FATTEN" | |
21 | 21 | ||
22 | 22 | func tryGetInteger (key) = match getInteger(this, key) { | |
23 | 23 | case b: Int => | |
24 | 24 | b | |
25 | 25 | case _ => | |
26 | 26 | 0 | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func tryGetString (key) = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | "" | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func allow (callerPbk) = if (if ((callerPbk == admin1)) | |
39 | 39 | then true | |
40 | 40 | else (callerPbk == admin2)) | |
41 | 41 | then true | |
42 | 42 | else false | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | 46 | func registerFarm (address,params) = { | |
47 | 47 | let callerPbk = toBase58String(i.callerPublicKey) | |
48 | 48 | if (allow(callerPbk)) | |
49 | 49 | then { | |
50 | 50 | let recipient = addressFromStringValue(address) | |
51 | 51 | let p_arr = split_4C(params, "|") | |
52 | 52 | let $t014961568 = $Tuple3(p_arr[0], p_arr[1], p_arr[2]) | |
53 | 53 | let farmName = $t014961568._1 | |
54 | 54 | let farmLocation = $t014961568._2 | |
55 | 55 | let imageLink = $t014961568._3 | |
56 | 56 | let nextNum = tryGetInteger(key_farmNft_nextNumber) | |
57 | 57 | if ((nextNum == nextNum)) | |
58 | 58 | then { | |
59 | 59 | let issue = Issue((farmNft_name + toString(nextNum)), ((farmNft_description + imageLink) + "\"}"), 1, 0, false) | |
60 | 60 | let id = calculateAssetId(issue) | |
61 | 61 | $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)], $Tuple4(nextNum, farmName, farmLocation, imageLink)) | |
62 | 62 | } | |
63 | 63 | else throw("Strict value is not equal to itself.") | |
64 | 64 | } | |
65 | 65 | else throw("Not allowed caller") | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func registerCow (address,params) = { | |
72 | 72 | let callerPbk = toBase58String(i.callerPublicKey) | |
73 | 73 | if (allow(callerPbk)) | |
74 | 74 | then { | |
75 | 75 | let recipient = addressFromStringValue(address) | |
76 | 76 | let p_arr = split_4C(params, params) | |
77 | 77 | let $t026742823 = $Tuple7(p_arr[0], p_arr[1], p_arr[2], p_arr[3], p_arr[4], p_arr[5], p_arr[6]) | |
78 | 78 | let cowCode = $t026742823._1 | |
79 | 79 | let bornedFarmAddress = $t026742823._2 | |
80 | 80 | let genes = $t026742823._3 | |
81 | 81 | let motherId = $t026742823._4 | |
82 | 82 | let fatherId = $t026742823._5 | |
83 | 83 | let type = $t026742823._6 | |
84 | 84 | let imageLink = $t026742823._7 | |
85 | 85 | let description = (((((((((((((("{\"cowCode\": \"" + cowCode) + "\", \"bornedFarmAddress\": \"") + bornedFarmAddress) + "\", \"genes\": \"") + genes) + "\", \"motherId\": \"") + motherId) + "\", \"fatherId\": \"") + fatherId) + "\", \"type\": \"") + type) + "\", \"imageLink\": \"") + imageLink) + "\"") | |
86 | 86 | let issue = Issue(cowNft_name, ((description + imageLink) + "\"}"), 1, 0, false) | |
87 | 87 | let id = calculateAssetId(issue) | |
88 | 88 | [issue, ScriptTransfer(recipient, 1, id), StringEntry((((("farm_" + address) + "_cow_") + toBase58String(id)) + "_status"), live), StringEntry((("cow_" + toBase58String(id)) + "_owner"), address)] | |
89 | 89 | } | |
90 | 90 | else throw("Not allowed caller") | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | @Callable(i) | |
96 | 96 | func init () = { | |
97 | 97 | let callerPbk = toBase58String(i.callerPublicKey) | |
98 | 98 | if (allow(callerPbk)) | |
99 | 99 | then { | |
100 | 100 | let nextNum = tryGetInteger(key_farmNft_nextNumber) | |
101 | 101 | if ((nextNum != 0)) | |
102 | - | then throw( | |
102 | + | then throw("Contract is already initialized") | |
103 | 103 | else [IntegerEntry(key_farmNft_nextNumber, 1)] | |
104 | 104 | } | |
105 | 105 | else throw("Not allowed caller") | |
106 | 106 | } | |
107 | 107 | ||
108 | 108 |
github/deemru/w8io/026f985 29.17 ms ◑