tx · EgWXwdPZ3wgVer7b8GqNk4aCwTFNidQUGMKzvMNHvZH

3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB:  -0.01000000 Waves

2023.01.21 12:25 [2414552] smart account 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB > SELF 0.00000000 Waves

{ "type": 13, "id": "EgWXwdPZ3wgVer7b8GqNk4aCwTFNidQUGMKzvMNHvZH", "fee": 1000000, "feeAssetId": null, "timestamp": 1674293191201, "version": 2, "chainId": 84, "sender": "3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB", "senderPublicKey": "Gd5NihbWQoWuTnSvq25TuV2BYZG4U1e9KDqZn9zBPix7", "proofs": [ "4DhCm5dBrUfuhWYHLXRUmEjNmzdrvd4RmxBwzMb1HYvUNd9rvZdDGnnd5YnoPdmWyZeQC8Qgm4WCXzLgU1QmDD9A" ], "script": "base64:BgITCAISBwoFCAgICAgSBAoCCAgSABIAD3N0b3JhZ2VWZXJpZmllcgkBBXZhbHVlAQkApggBAiMzTjJzNVJ0YUhQQmVuQ3N4MkVDY29GUmJZSHgzbm9aaFhXMQAEYmFuawIjM04xRTZ0WGRkUm9WYVJmUTlkUTN2ZzVMYVcyZnNkOEhLdWIADWFjY2VwdGVkVG9rZW4BIOilarzKd0LycGEyNUpPRYO5uR7lmWcXw3Hq2QuhBK3rAAZ1c2RuSUQCLDNLRlhCR0dMQ2pBNVoyRHVXNERxOWZERHJIakpKUDFaRWthb2FqU3p1S3NDAAdWRVJTSU9OAgUxLjEuOQAUc3RvcmFnZUZlZU11bHRpcGxpZXIAAQEKY2hlY2tFbnRyeQIGcHJlZml4BHV1aWQEByRtYXRjaDAJAJ0IAgUEdGhpcwkArAICBQZwcmVmaXgFBHV1aWQDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFhBQckbWF0Y2gwBQFhAgROT05FAQ9jaGVja0VudHJ5RW1haWwCBHV1aWQGZG9tYWluBAckbWF0Y2gwCQCdCAIFBHRoaXMJAKwCAg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m9rZUNlcnRpZmljYXRpb24JAAACCAUDaW52BGRBcHAFBHRoaXMHCQAAAggFA2ludgNmZWUAoMIeBwkAAAIIBQNpbnYKZmVlQXNzZXRJZAUEdW5pdAcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJANkEAQkBCGFzU3RyaW5nAQkAkQMCCAUDaW52BGFyZ3MAAQkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleSRbFSI=", "height": 2414552, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D8LCo4WrxBiYapL9LebP1bjp6x8U265R3NjBiHPeu9zw Next: 2o2dtQg6hmzgc1oU1odW2V3t2QnEQ66GRmfwXFc3bozr Diff:
OldNewDifferences
88 let acceptedToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a'
99
1010 let usdnID = "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC"
11+
12+let VERSION = "1.1.9"
1113
1214 let storageFeeMultiplier = 1
1315
211213
212214
213215 @Callable(invoke)
214-func emailCertification (domain,title,uuid,signerPubKey) = {
215- let id = value(invoke.transactionId)
216- let entryExist = checkEntryEmail(domain, uuid)
217- let uuidExist = checkUUID(uuid)
218- let callerIsDapp = (this == invoke.caller)
219- let callerAddress = if (callerIsDapp)
220- then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
221- else toBase58String(invoke.caller.bytes)
222- let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
223- if ((entryExist != "NONE"))
224- then throw("This entry already exist")
225- else if ((uuidExist != "NONE"))
226- then throw("This uuid already exist")
227- else if ((size(uuid) > 36))
228- then throw("Uuid is too long, 36 characters max.")
229- else if ((size(domain) > 150))
230- then throw("Domain is too long, 150 characters max.")
231- else if ((size(title) > 100))
232- then throw("Title is too long, 100 characters max.")
233- else if (if (if (contains(uuid, "\""))
234- then true
235- else contains(title, "\""))
236- then true
237- else contains(domain, "\""))
238- then throw("No \" allowed")
239- else {
240- let data = (((((((("{\"messageid\":\"" + uuid) + "@") + domain) + "\",\"timestamp\":") + toString(lastBlock.timestamp)) + ",\"reference\":\"") + title) + "\"}")
241- if ((callerIsWhiteListedNum > 0))
242- then [StringEntry(uuid, toBase58String(id)), StringEntry(((uuid + "@") + domain), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - 1)), StringEntry(((("data_ec_" + toBase58String(id)) + "_") + callerAddress), data), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken)]
243- else if (!(callerIsDapp))
244- then {
245- let payment = value(invoke.payments[0])
246- let amount = value(payment.amount)
247- let paymentAssetId = if (isDefined(payment.assetId))
248- then value(payment.assetId)
249- else throw("Waves is not accepted as payment")
250- let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId))))
251- if ((acceptedToken != paymentAssetId))
252- then throw("This token is not accepted at the moment")
253- else if (if ((amount != currentPrice))
254- then (0 >= callerIsWhiteListedNum)
255- else false)
256- then throw("The price is wrong")
257- else [StringEntry(uuid, toBase58String(id)), StringEntry(((uuid + "@") + domain), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), StringEntry(((("data_ec_" + toBase58String(id)) + "_") + callerAddress), data), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)]
258- }
259- else throw("You are not allowed to do that")
260- }
261- }
262-
263-
264-
265-@Callable(invoke)
266-func createAgreement (hash,title,stringifiedJSON,counterParts,signerPubKey,uuid) = {
267- let id = value(invoke.transactionId)
268- let entryExist = checkEntry(hash, uuid)
269- let uuidExist = checkUUID(uuid)
270- let callerIsDapp = (this == invoke.caller)
271- let callerAddress = if (callerIsDapp)
272- then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
273- else toBase58String(invoke.caller.bytes)
274- let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
275- let JSON = ((((getJsonBeforeValue(stringifiedJSON, "creator") + "\"") + callerAddress) + "\"") + getJsonAfterValue(stringifiedJSON, "creator"))
276- let addressesArray = split(counterParts, ",")
277- let totalAddresses = size(addressesArray)
278- let globalDataTitle = StringEntry((title + uuid), toBase58String(id))
279- let globalDataHash = StringEntry((hash + uuid), toBase58String(id))
280- let globalDataJson = StringEntry(((("data_MA_" + toBase58String(id)) + "_") + callerAddress), JSON)
281- let globalDataOwner = StringEntry(((callerAddress + "_MA_") + toBase58String(id)), ("SIGNED_" + toBase58String(id)))
282- let dataWhiteListed = IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - (totalAddresses + 1)))
283- if ((entryExist != "NONE"))
284- then throw("This entry already exist")
285- else if ((uuidExist != "NONE"))
286- then throw("This uuid already exist")
287- else if ((size(uuid) > 36))
288- then throw("Uuid is too long, 36 characters max.")
289- else if ((size(hash) > 64))
290- then throw("Message-id is too long, 64 characters max.")
291- else if ((size(title) > 100))
292- then throw("Title is too long, 100 characters max.")
293- else if ((callerIsWhiteListedNum > 0))
294- then if (((totalAddresses + 1) > callerIsWhiteListedNum))
295- then throw("You don't have enough certification credit")
296- else if ((totalAddresses == 6))
297- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[5] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[5]), 0, acceptedToken)]
298- else if ((totalAddresses == 5))
299- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken)]
300- else if ((totalAddresses == 4))
301- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken)]
302- else if ((totalAddresses == 3))
303- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken)]
304- else if ((totalAddresses == 2))
305- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken)]
306- else if ((totalAddresses == 1))
307- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken)]
308- else throw("Wrong number of participants")
309- else if (!(callerIsDapp))
310- then {
311- let payment = value(invoke.payments[0])
312- let amount = if (isDefined(payment.amount))
313- then value(payment.amount)
314- else 0
315- let paymentAssetId = if (isDefined(payment.assetId))
316- then value(payment.assetId)
317- else acceptedToken
318- let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId))))
319- if (((currentPrice * (totalAddresses + 1)) > amount))
320- then throw(("The price is wrong, it should be " + toString((currentPrice * (totalAddresses + 1)))))
321- else if ((totalAddresses == 6))
322- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[5] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[5]), 0, acceptedToken)]
323- else if ((totalAddresses == 5))
324- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken)]
325- else if ((totalAddresses == 4))
326- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken)]
327- else if ((totalAddresses == 3))
328- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken)]
329- else if ((totalAddresses == 2))
330- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken)]
331- else if ((totalAddresses == 1))
332- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken)]
333- else throw(("Needs 1 to 6 recipient addresses, currently sent: " + toString(totalAddresses)))
334- }
335- else throw("You are not allowed to do that")
336- }
337-
338-
339-
340-@Callable(invoke)
341-func signAgreement (hash,agreementId,signerPubKey) = {
342- let payment = value(invoke.payments[0])
343- let amount = value(payment.amount)
344- let id = value(invoke.transactionId)
345- let callerIsDapp = (this == invoke.caller)
346- let signer = if (callerIsDapp)
347- then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
348- else toBase58String(invoke.caller.bytes)
349- let signingRequestExist = checkIfPendingToSign(((signer + "_MA_") + agreementId))
350- if (!(signingRequestExist))
351- then throw("Sorry there is no pending signature")
352- else [StringEntry(((signer + "_MA_") + agreementId), ("SIGNED_" + toBase58String(id))), ScriptTransfer(addressFromStringValue(signer), 0, acceptedToken)]
353- }
354-
355-
356-
357-@Callable(invoke)
358216 func usdnSignCredits () = {
359217 let payment = value(invoke.payments[0])
360218 let callerAddress = toBase58String(invoke.caller.bytes)
375233 @Verifier(tx)
376234 func verifier () = match tx {
377235 case inv: InvokeScriptTransaction =>
378- if (if ((inv.function == "fileCertification"))
379- then true
380- else (inv.function == "createAgreement"))
236+ if (if (if (if ((inv.function == "fileCertification"))
237+ then (inv.dApp == this)
238+ else false)
239+ then (inv.fee == 500000)
240+ else false)
241+ then (inv.feeAssetId == unit)
242+ else false)
381243 then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[4])))
382- else if ((inv.function == "emailCertification"))
383- then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[3])))
384- else if ((inv.function == "signAgreement"))
385- then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[2])))
386- else if ((inv.function == "revokeCertification"))
387- then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[1])))
388- else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
244+ else if (if (if (if ((inv.function == "revokeCertification"))
245+ then (inv.dApp == this)
246+ else false)
247+ then (inv.fee == 500000)
248+ else false)
249+ then (inv.feeAssetId == unit)
250+ else false)
251+ then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[1])))
252+ else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
389253 case _ =>
390254 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
391255 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let storageVerifier = value(addressFromString("3N2s5RtaHPBenCsx2ECcoFRbYHx3noZhXW1"))
55
66 let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub"
77
88 let acceptedToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a'
99
1010 let usdnID = "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC"
11+
12+let VERSION = "1.1.9"
1113
1214 let storageFeeMultiplier = 1
1315
1416 func checkEntry (prefix,uuid) = match getString(this, (prefix + uuid)) {
1517 case a: String =>
1618 a
1719 case _ =>
1820 "NONE"
1921 }
2022
2123
2224 func checkEntryEmail (uuid,domain) = match getString(this, ((uuid + "@") + domain)) {
2325 case a: String =>
2426 a
2527 case _ =>
2628 "NONE"
2729 }
2830
2931
3032 func checkUUID (uuid) = match getString(this, uuid) {
3133 case a: String =>
3234 a
3335 case _ =>
3436 "NONE"
3537 }
3638
3739
3840 func checkIfWhiteListed (callerAddress) = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
3941 case a: Int =>
4042 a
4143 case _ =>
4244 0
4345 }
4446
4547
4648 func isAdress (addr) = if (if (if ((size(addr) == 35))
4749 then (take(addr, 2) == "3P")
4850 else false)
4951 then true
5052 else (take(addr, 2) == "3N"))
5153 then true
5254 else (take(addr, 2) == "3M")
5355
5456
5557 func countParties (accumulator,addr) = if ((size(addr) > 0))
5658 then (accumulator + 1)
5759 else (accumulator + 0)
5860
5961
6062 func checkIfPendingToSign (key) = match getString(this, key) {
6163 case a: String =>
6264 if ((a == "PENDING"))
6365 then true
6466 else false
6567 case _ =>
6668 false
6769 }
6870
6971
7072 func getValueString (json) = take(drop(json, 1), value(indexOf(drop(json, 1), "\"")))
7173
7274
7375 func getValue (json,key) = {
7476 let keyIndex = value(indexOf(json, (("\"" + key) + "\":")))
7577 let data = drop(json, ((keyIndex + size(key)) + 3))
7678 let jsonValue = getValueString(data)
7779 jsonValue
7880 }
7981
8082
8183 func getJsonBeforeValue (json,key) = {
8284 let keyIndex = value(indexOf(json, (("\"" + key) + "\":")))
8385 let data = take(json, ((keyIndex + size(key)) + 3))
8486 data
8587 }
8688
8789
8890 func getJsonAfterValue (json,key) = {
8991 let keyIndex = value(indexOf(json, (("\"" + key) + "\":")))
9092 let data = takeRight(json, (size(json) - ((((keyIndex + size(key)) + 3) + 0) + 2)))
9193 data
9294 }
9395
9496
9597 func asString (bv) = match bv {
9698 case bv0: String =>
9799 bv0
98100 case _ =>
99101 throw("Sponsored Public Key String expected")
100102 }
101103
102104
103105 @Callable(invoke)
104106 func fileCertification (hash,title,uuid,ipfs,signerPubKey) = {
105107 let id = value(invoke.transactionId)
106108 let entryExist = checkEntry(hash, uuid)
107109 let uuidExist = checkUUID(uuid)
108110 let callerIsDapp = (this == invoke.caller)
109111 let callerAddress = if (callerIsDapp)
110112 then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
111113 else toBase58String(invoke.caller.bytes)
112114 let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
113115 if ((entryExist != "NONE"))
114116 then throw("This entry already exist")
115117 else if ((uuidExist != "NONE"))
116118 then throw("This uuid already exist")
117119 else if ((size(uuid) != 36))
118120 then throw("Uuid should be 36 characters.")
119121 else if ((size(hash) != 64))
120122 then throw("Hash should be 64 characters.")
121123 else if ((size(title) > 100))
122124 then throw("Title is too long, 100 characters max.")
123125 else if (if (if (contains(hash, "\""))
124126 then true
125127 else contains(title, "\""))
126128 then true
127129 else contains(ipfs, "\""))
128130 then throw("No \" allowed")
129131 else {
130132 let data = (((((((("{\"hash\":\"" + hash) + "\",\"timestamp\":") + toString(lastBlock.timestamp)) + ",\"title\":\"") + title) + "\",\"ipfs\":\"") + ipfs) + "\"}")
131133 if ((callerIsWhiteListedNum > 0))
132134 then {
133135 let creditCost = if ((size(ipfs) != 0))
134136 then (1 + storageFeeMultiplier)
135137 else 1
136138 if ((0 > (callerIsWhiteListedNum - creditCost)))
137139 then throw("Not enough credit")
138140 else [StringEntry(uuid, toBase58String(id)), StringEntry((hash + uuid), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - creditCost)), StringEntry(((("data_fc_" + toBase58String(id)) + "_") + callerAddress), data), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken)]
139141 }
140142 else if (!(callerIsDapp))
141143 then {
142144 let payment = value(invoke.payments[0])
143145 let amount = value(payment.amount)
144146 let paymentAssetId = if (isDefined(payment.assetId))
145147 then value(payment.assetId)
146148 else throw("Waves is not accepted as payment")
147149 let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId))))
148150 let feeCost = if ((size(ipfs) != 0))
149151 then (currentPrice + (storageFeeMultiplier * currentPrice))
150152 else currentPrice
151153 if ((acceptedToken != paymentAssetId))
152154 then throw("This token is not accepted at the moment")
153155 else if (if ((amount != feeCost))
154156 then (0 >= callerIsWhiteListedNum)
155157 else false)
156158 then throw("The price is wrong")
157159 else [StringEntry(uuid, toBase58String(id)), StringEntry((hash + uuid), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), StringEntry(((("data_fc_" + toBase58String(id)) + "_") + callerAddress), data), ScriptTransfer(addressFromStringValue(bank), feeCost, payment.assetId)]
158160 }
159161 else throw("You are not allowed to do that")
160162 }
161163 }
162164
163165
164166
165167 @Callable(invoke)
166168 func revokeCertification (certificationId,signerPubKey) = {
167169 let id = value(invoke.transactionId)
168170 let callerIsDapp = (this == invoke.caller)
169171 let callerAddress = if (callerIsDapp)
170172 then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
171173 else toBase58String(invoke.caller.bytes)
172174 let entryExist = match getString(this, ((("data_fc_" + certificationId) + "_") + callerAddress)) {
173175 case a: String =>
174176 a
175177 case _ =>
176178 "NONE"
177179 }
178180 let isRevoked = match getString(this, ("STATUS_FC_" + certificationId)) {
179181 case a: String =>
180182 a
181183 case _ =>
182184 "NONE"
183185 }
184186 let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
185187 let newJson = (((dropRight(entryExist, 1) + ",\"status\":\"REVOKED_") + toBase58String(id)) + "\"}")
186188 if ((isRevoked != "NONE"))
187189 then throw("This certification have already been revoked.")
188190 else if ((entryExist == "NONE"))
189191 then throw("You cannot change the status of this certification.")
190192 else if ((callerIsWhiteListedNum > 0))
191193 then [IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - 1)), StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken)]
192194 else if (!(callerIsDapp))
193195 then {
194196 let payment = value(invoke.payments[0])
195197 let amount = value(payment.amount)
196198 let paymentAssetId = if (isDefined(payment.assetId))
197199 then value(payment.assetId)
198200 else throw("Waves is not accepted as payment")
199201 let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId))))
200202 if ((acceptedToken != paymentAssetId))
201203 then throw("This token is not accepted at the moment")
202204 else if (if ((amount != currentPrice))
203205 then (0 >= callerIsWhiteListedNum)
204206 else false)
205207 then throw("The price is wrong")
206208 else [StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)]
207209 }
208210 else throw("You are not allowed to do that")
209211 }
210212
211213
212214
213215 @Callable(invoke)
214-func emailCertification (domain,title,uuid,signerPubKey) = {
215- let id = value(invoke.transactionId)
216- let entryExist = checkEntryEmail(domain, uuid)
217- let uuidExist = checkUUID(uuid)
218- let callerIsDapp = (this == invoke.caller)
219- let callerAddress = if (callerIsDapp)
220- then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
221- else toBase58String(invoke.caller.bytes)
222- let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
223- if ((entryExist != "NONE"))
224- then throw("This entry already exist")
225- else if ((uuidExist != "NONE"))
226- then throw("This uuid already exist")
227- else if ((size(uuid) > 36))
228- then throw("Uuid is too long, 36 characters max.")
229- else if ((size(domain) > 150))
230- then throw("Domain is too long, 150 characters max.")
231- else if ((size(title) > 100))
232- then throw("Title is too long, 100 characters max.")
233- else if (if (if (contains(uuid, "\""))
234- then true
235- else contains(title, "\""))
236- then true
237- else contains(domain, "\""))
238- then throw("No \" allowed")
239- else {
240- let data = (((((((("{\"messageid\":\"" + uuid) + "@") + domain) + "\",\"timestamp\":") + toString(lastBlock.timestamp)) + ",\"reference\":\"") + title) + "\"}")
241- if ((callerIsWhiteListedNum > 0))
242- then [StringEntry(uuid, toBase58String(id)), StringEntry(((uuid + "@") + domain), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - 1)), StringEntry(((("data_ec_" + toBase58String(id)) + "_") + callerAddress), data), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken)]
243- else if (!(callerIsDapp))
244- then {
245- let payment = value(invoke.payments[0])
246- let amount = value(payment.amount)
247- let paymentAssetId = if (isDefined(payment.assetId))
248- then value(payment.assetId)
249- else throw("Waves is not accepted as payment")
250- let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId))))
251- if ((acceptedToken != paymentAssetId))
252- then throw("This token is not accepted at the moment")
253- else if (if ((amount != currentPrice))
254- then (0 >= callerIsWhiteListedNum)
255- else false)
256- then throw("The price is wrong")
257- else [StringEntry(uuid, toBase58String(id)), StringEntry(((uuid + "@") + domain), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), StringEntry(((("data_ec_" + toBase58String(id)) + "_") + callerAddress), data), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)]
258- }
259- else throw("You are not allowed to do that")
260- }
261- }
262-
263-
264-
265-@Callable(invoke)
266-func createAgreement (hash,title,stringifiedJSON,counterParts,signerPubKey,uuid) = {
267- let id = value(invoke.transactionId)
268- let entryExist = checkEntry(hash, uuid)
269- let uuidExist = checkUUID(uuid)
270- let callerIsDapp = (this == invoke.caller)
271- let callerAddress = if (callerIsDapp)
272- then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
273- else toBase58String(invoke.caller.bytes)
274- let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
275- let JSON = ((((getJsonBeforeValue(stringifiedJSON, "creator") + "\"") + callerAddress) + "\"") + getJsonAfterValue(stringifiedJSON, "creator"))
276- let addressesArray = split(counterParts, ",")
277- let totalAddresses = size(addressesArray)
278- let globalDataTitle = StringEntry((title + uuid), toBase58String(id))
279- let globalDataHash = StringEntry((hash + uuid), toBase58String(id))
280- let globalDataJson = StringEntry(((("data_MA_" + toBase58String(id)) + "_") + callerAddress), JSON)
281- let globalDataOwner = StringEntry(((callerAddress + "_MA_") + toBase58String(id)), ("SIGNED_" + toBase58String(id)))
282- let dataWhiteListed = IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - (totalAddresses + 1)))
283- if ((entryExist != "NONE"))
284- then throw("This entry already exist")
285- else if ((uuidExist != "NONE"))
286- then throw("This uuid already exist")
287- else if ((size(uuid) > 36))
288- then throw("Uuid is too long, 36 characters max.")
289- else if ((size(hash) > 64))
290- then throw("Message-id is too long, 64 characters max.")
291- else if ((size(title) > 100))
292- then throw("Title is too long, 100 characters max.")
293- else if ((callerIsWhiteListedNum > 0))
294- then if (((totalAddresses + 1) > callerIsWhiteListedNum))
295- then throw("You don't have enough certification credit")
296- else if ((totalAddresses == 6))
297- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[5] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[5]), 0, acceptedToken)]
298- else if ((totalAddresses == 5))
299- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken)]
300- else if ((totalAddresses == 4))
301- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken)]
302- else if ((totalAddresses == 3))
303- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken)]
304- else if ((totalAddresses == 2))
305- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken)]
306- else if ((totalAddresses == 1))
307- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, dataWhiteListed, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(callerAddress), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken)]
308- else throw("Wrong number of participants")
309- else if (!(callerIsDapp))
310- then {
311- let payment = value(invoke.payments[0])
312- let amount = if (isDefined(payment.amount))
313- then value(payment.amount)
314- else 0
315- let paymentAssetId = if (isDefined(payment.assetId))
316- then value(payment.assetId)
317- else acceptedToken
318- let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId))))
319- if (((currentPrice * (totalAddresses + 1)) > amount))
320- then throw(("The price is wrong, it should be " + toString((currentPrice * (totalAddresses + 1)))))
321- else if ((totalAddresses == 6))
322- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[5] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[5]), 0, acceptedToken)]
323- else if ((totalAddresses == 5))
324- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[4] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[4]), 0, acceptedToken)]
325- else if ((totalAddresses == 4))
326- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[3] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[3]), 0, acceptedToken)]
327- else if ((totalAddresses == 3))
328- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[2] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[2]), 0, acceptedToken)]
329- else if ((totalAddresses == 2))
330- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), StringEntry(((addressesArray[1] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[1]), 0, acceptedToken)]
331- else if ((totalAddresses == 1))
332- then [globalDataTitle, globalDataHash, globalDataJson, globalDataOwner, StringEntry(((addressesArray[0] + "_MA_") + toBase58String(id)), "PENDING"), ScriptTransfer(addressFromStringValue(bank), amount, acceptedToken), ScriptTransfer(addressFromStringValue(addressesArray[0]), 0, acceptedToken)]
333- else throw(("Needs 1 to 6 recipient addresses, currently sent: " + toString(totalAddresses)))
334- }
335- else throw("You are not allowed to do that")
336- }
337-
338-
339-
340-@Callable(invoke)
341-func signAgreement (hash,agreementId,signerPubKey) = {
342- let payment = value(invoke.payments[0])
343- let amount = value(payment.amount)
344- let id = value(invoke.transactionId)
345- let callerIsDapp = (this == invoke.caller)
346- let signer = if (callerIsDapp)
347- then toString(addressFromPublicKey(fromBase58String(signerPubKey)))
348- else toBase58String(invoke.caller.bytes)
349- let signingRequestExist = checkIfPendingToSign(((signer + "_MA_") + agreementId))
350- if (!(signingRequestExist))
351- then throw("Sorry there is no pending signature")
352- else [StringEntry(((signer + "_MA_") + agreementId), ("SIGNED_" + toBase58String(id))), ScriptTransfer(addressFromStringValue(signer), 0, acceptedToken)]
353- }
354-
355-
356-
357-@Callable(invoke)
358216 func usdnSignCredits () = {
359217 let payment = value(invoke.payments[0])
360218 let callerAddress = toBase58String(invoke.caller.bytes)
361219 let tokenId = value(payment.assetId)
362220 let amount = value(payment.amount)
363221 let numberOfCredits = ((amount * 2) / 1000000)
364222 let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
365223 if ((toBase58String(tokenId) != usdnID))
366224 then throw("Only USDN can be exchanged")
367225 else if (if (((amount % 1000000) != 0))
368226 then ((amount % 1000000) != 500000)
369227 else false)
370228 then throw(((("You can only exchange multiple of 0.5, you sent:" + dropRight(toString(amount), 6)) + ".") + takeRight(toString(amount), 6)))
371229 else [IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum + numberOfCredits)), ScriptTransfer(addressFromStringValue(bank), amount, tokenId)]
372230 }
373231
374232
375233 @Verifier(tx)
376234 func verifier () = match tx {
377235 case inv: InvokeScriptTransaction =>
378- if (if ((inv.function == "fileCertification"))
379- then true
380- else (inv.function == "createAgreement"))
236+ if (if (if (if ((inv.function == "fileCertification"))
237+ then (inv.dApp == this)
238+ else false)
239+ then (inv.fee == 500000)
240+ else false)
241+ then (inv.feeAssetId == unit)
242+ else false)
381243 then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[4])))
382- else if ((inv.function == "emailCertification"))
383- then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[3])))
384- else if ((inv.function == "signAgreement"))
385- then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[2])))
386- else if ((inv.function == "revokeCertification"))
387- then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[1])))
388- else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
244+ else if (if (if (if ((inv.function == "revokeCertification"))
245+ then (inv.dApp == this)
246+ else false)
247+ then (inv.fee == 500000)
248+ else false)
249+ then (inv.feeAssetId == unit)
250+ else false)
251+ then sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(asString(inv.args[1])))
252+ else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
389253 case _ =>
390254 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
391255 }
392256

github/deemru/w8io/026f985 
51.31 ms