tx · Gr9thtj8mX2nBzCYqkEhmJ4CHTmJLouGWmvfFAhDKFou

3MsNyiuucHjySwoeQ8FxeofPKJyYF4cqG28:  -0.00200000 Waves

2024.12.07 14:05 [3404128] smart account 3MsNyiuucHjySwoeQ8FxeofPKJyYF4cqG28 > SELF 0.00000000 Waves

{ "type": 13, "id": "Gr9thtj8mX2nBzCYqkEhmJ4CHTmJLouGWmvfFAhDKFou", "fee": 200000, "feeAssetId": null, "timestamp": 1733569507641, "version": 2, "chainId": 84, "sender": "3MsNyiuucHjySwoeQ8FxeofPKJyYF4cqG28", "senderPublicKey": "HJeoRksknZ8YoWG1bjM8cjCoh51MGhj2K7rcdzhEZn9h", "proofs": [ "41RFckMwoUpgJqQPXCo56G2yJUNNm5YcCtw3vy3CNqaF7pv5gfUm3j4S2S2KQQnMqWh48Exo1dSgMHrbquNGv8mz" ], "script": "base64:CAIYCAISBgoECAgICBIFCgMICAgSBQoDCAgBAAMBaQEJYWRkRmFybWVyBA13YWxsZXRBZGRyZXNzB2FkZHJlc3MJZmlyc3ROYW1lCGxhc3ROYW1lBAZmYXJtZXIJAJ8IAQkArAICBQdhZGRyZXNzAgZfY291bnQDCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAipPbmx5IHRoZSB2ZXQgb2ZmaWNlIGNhbiBjcmVhdGUgbmV3IEZhcm1lcnMDCQAAAgUGZmFybWVyBQR1bml0CQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgUNd2FsbGV0QWRkcmVzcwIJX3VzZXJkYXRhCQCsAgIJAKwCAgkArAICCQCsAgIFB2FkZHJlc3MCASwFCWZpcnN0TmFtZQIBLAUIbGFzdE5hbWUJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQ13YWxsZXRBZGRyZXNzAghfcGVuZGluZwIACQDMCAIJAQxJbnRlZ2VyRW50cnkCCQCsAgIFDXdhbGxldEFkZHJlc3MCBl9jb3VudAAABQNuaWwJAAIBAhVGYXJtZXIgYWxyZWFke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CQCkAwEFBWVudHJ5Ag8gZG9lcyBub3QgZXhpc3QEC3BlbmRpbmdMaXN0CQC1CQIJARFAZXh0ck5hdGl2ZSgxMDU4KQEJAKwCAgUGZmFybWVyAghfcGVuZGluZwIBLAQFaW5kZXgJAM8IAgULcGVuZGluZ0xpc3QJAKQDAQUFZW50cnkDCQAAAgUFaW5kZXgFBHVuaXQJAAIBCQCsAgIJAKwCAgIGRW50cnkgCQCkAwEFBWVudHJ5Ag8gZG9lcyBub3QgZXhpc3QEEG5ld1BlbmRpbmdTdHJpbmcJALkJAgkA0QgCBQtwZW5kaW5nTGlzdAkBBXZhbHVlAQUFaW5kZXgCASwJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKwCAgUGZmFybWVyAgFfCQCkAwEFBWVudHJ5AglfVmVyaWZpZWQFBGRhdGEJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICBQZmYXJtZXICCF9wZW5kaW5nBRBuZXdQZW5kaW5nU3RyaW5nBQNuaWwA1mQyJw==", "height": 3404128, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HftXQzSBfnJEFKEHmeVnwNH7PPPerWxoAE8z6iF8dESZ Next: 4wUZpyyhB2xn46oCKEqz1rFhX4r2J7QQW7xPV7Bx4g8J Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func addFarmer () = {
8- let address = toString(i.caller)
7+func addFarmer (walletAddress,address,firstName,lastName) = {
98 let farmer = getInteger((address + "_count"))
10- if ((farmer == unit))
11- then [StringEntry((address + "_pending"), ""), IntegerEntry((address + "_count"), 0)]
12- else throw("Farmer already exists")
9+ if ((i.caller != this))
10+ then throw("Only the vet office can create new Farmers")
11+ else if ((farmer == unit))
12+ then [StringEntry((walletAddress + "_userdata"), ((((address + ",") + firstName) + ",") + lastName)), StringEntry((walletAddress + "_pending"), ""), IntegerEntry((walletAddress + "_count"), 0)]
13+ else throw("Farmer already exists")
1314 }
1415
1516
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 8 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func addFarmer () = {
8- let address = toString(i.caller)
7+func addFarmer (walletAddress,address,firstName,lastName) = {
98 let farmer = getInteger((address + "_count"))
10- if ((farmer == unit))
11- then [StringEntry((address + "_pending"), ""), IntegerEntry((address + "_count"), 0)]
12- else throw("Farmer already exists")
9+ if ((i.caller != this))
10+ then throw("Only the vet office can create new Farmers")
11+ else if ((farmer == unit))
12+ then [StringEntry((walletAddress + "_userdata"), ((((address + ",") + firstName) + ",") + lastName)), StringEntry((walletAddress + "_pending"), ""), IntegerEntry((walletAddress + "_count"), 0)]
13+ else throw("Farmer already exists")
1314 }
1415
1516
1617
1718 @Callable(i)
1819 func addAuA (dataFarmer,dataVet,farmer) = {
1920 let count = match getInteger((farmer + "_count")) {
2021 case a: Int =>
2122 a
2223 case _ =>
2324 throw("Farmer does not exist")
2425 }
2526 let pending = getStringValue((farmer + "_pending"))
2627 let pendingList = [toString(count), split(pending, ",")]
2728 [StringEntry((farmer + "_pending"), makeString(pendingList, ",")), StringEntry(((farmer + "_") + toString(count)), dataFarmer), StringEntry(((((toString(i.caller) + "_") + farmer) + "_") + toString(count)), dataVet), IntegerEntry((farmer + "_count"), (count + 1))]
2829 }
2930
3031
3132
3233 @Callable(i)
3334 func verify (data,farmer,entry) = if (!(isDefined(getString((farmer + "_pending")))))
3435 then throw("Farmer does not exist")
3536 else if (isDefined(getString((((farmer + "_") + toString(entry)) + "_Verified"))))
3637 then throw("AuA Entry already verified")
3738 else if (!(isDefined(getString(((farmer + "_") + toString(entry))))))
3839 then throw((("Entry " + toString(entry)) + " does not exist"))
3940 else {
4041 let pendingList = split(getStringValue((farmer + "_pending")), ",")
4142 let index = indexOf(pendingList, toString(entry))
4243 if ((index == unit))
4344 then throw((("Entry " + toString(entry)) + " does not exist"))
4445 else {
4546 let newPendingString = makeString(removeByIndex(pendingList, value(index)), ",")
4647 [StringEntry((((farmer + "_") + toString(entry)) + "_Verified"), data), StringEntry((farmer + "_pending"), newPendingString)]
4748 }
4849 }
4950
5051

github/deemru/w8io/169f3d6 
19.37 ms