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:BgITCAISBwoFCAgICAgSBAoCCAgSABIAD3N0b3JhZ2VWZXJpZmllcgkBBXZhbHVlAQkApggBAiMzTjJzNVJ0YUhQQmVuQ3N4MkVDY29GUmJZSHgzbm9aaFhXMQAEYmFuawIjM04xRTZ0WGRkUm9WYVJmUTlkUTN2ZzVMYVcyZnNkOEhLdWIADWFjY2VwdGVkVG9rZW4BIOilarzKd0LycGEyNUpPRYO5uR7lmWcXw3Hq2QuhBK3rAAZ1c2RuSUQCLDNLRlhCR0dMQ2pBNVoyRHVXNERxOWZERHJIakpKUDFaRWthb2FqU3p1S3NDAAdWRVJTSU9OAgUxLjEuOQAUc3RvcmFnZUZlZU11bHRpcGxpZXIAAQEKY2hlY2tFbnRyeQIGcHJlZml4BHV1aWQEByRtYXRjaDAJAJ0IAgUEdGhpcwkArAICBQZwcmVmaXgFBHV1aWQDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFhBQckbWF0Y2gwBQFhAgROT05FAQ9jaGVja0VudHJ5RW1haWwCBHV1aWQGZG9tYWluBAckbWF0Y2gwCQCdCAIFBHRoaXMJAKwCAgk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9rZUNlcnRpZmljYXRpb24JAAACCAUDaW52BGRBcHAFBHRoaXMHCQAAAggFA2ludgNmZWUAoMIeBwkAAAIIBQNpbnYKZmVlQXNzZXRJZAUEdW5pdAcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJANkEAQkBCGFzU3RyaW5nAQkAkQMCCAUDaW52BGFyZ3MAAQkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleSRbFSI=", "height": 2414552, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D8LCo4WrxBiYapL9LebP1bjp6x8U265R3NjBiHPeu9zw Next: 2o2dtQg6hmzgc1oU1odW2V3t2QnEQ66GRmfwXFc3bozr Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let acceptedToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' | |
9 | 9 | ||
10 | 10 | let usdnID = "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC" | |
11 | + | ||
12 | + | let VERSION = "1.1.9" | |
11 | 13 | ||
12 | 14 | let storageFeeMultiplier = 1 | |
13 | 15 | ||
211 | 213 | ||
212 | 214 | ||
213 | 215 | @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) | |
358 | 216 | func usdnSignCredits () = { | |
359 | 217 | let payment = value(invoke.payments[0]) | |
360 | 218 | let callerAddress = toBase58String(invoke.caller.bytes) | |
375 | 233 | @Verifier(tx) | |
376 | 234 | func verifier () = match tx { | |
377 | 235 | 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) | |
381 | 243 | 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) | |
389 | 253 | case _ => | |
390 | 254 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
391 | 255 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let storageVerifier = value(addressFromString("3N2s5RtaHPBenCsx2ECcoFRbYHx3noZhXW1")) | |
5 | 5 | ||
6 | 6 | let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
7 | 7 | ||
8 | 8 | let acceptedToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' | |
9 | 9 | ||
10 | 10 | let usdnID = "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC" | |
11 | + | ||
12 | + | let VERSION = "1.1.9" | |
11 | 13 | ||
12 | 14 | let storageFeeMultiplier = 1 | |
13 | 15 | ||
14 | 16 | func checkEntry (prefix,uuid) = match getString(this, (prefix + uuid)) { | |
15 | 17 | case a: String => | |
16 | 18 | a | |
17 | 19 | case _ => | |
18 | 20 | "NONE" | |
19 | 21 | } | |
20 | 22 | ||
21 | 23 | ||
22 | 24 | func checkEntryEmail (uuid,domain) = match getString(this, ((uuid + "@") + domain)) { | |
23 | 25 | case a: String => | |
24 | 26 | a | |
25 | 27 | case _ => | |
26 | 28 | "NONE" | |
27 | 29 | } | |
28 | 30 | ||
29 | 31 | ||
30 | 32 | func checkUUID (uuid) = match getString(this, uuid) { | |
31 | 33 | case a: String => | |
32 | 34 | a | |
33 | 35 | case _ => | |
34 | 36 | "NONE" | |
35 | 37 | } | |
36 | 38 | ||
37 | 39 | ||
38 | 40 | func checkIfWhiteListed (callerAddress) = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) { | |
39 | 41 | case a: Int => | |
40 | 42 | a | |
41 | 43 | case _ => | |
42 | 44 | 0 | |
43 | 45 | } | |
44 | 46 | ||
45 | 47 | ||
46 | 48 | func isAdress (addr) = if (if (if ((size(addr) == 35)) | |
47 | 49 | then (take(addr, 2) == "3P") | |
48 | 50 | else false) | |
49 | 51 | then true | |
50 | 52 | else (take(addr, 2) == "3N")) | |
51 | 53 | then true | |
52 | 54 | else (take(addr, 2) == "3M") | |
53 | 55 | ||
54 | 56 | ||
55 | 57 | func countParties (accumulator,addr) = if ((size(addr) > 0)) | |
56 | 58 | then (accumulator + 1) | |
57 | 59 | else (accumulator + 0) | |
58 | 60 | ||
59 | 61 | ||
60 | 62 | func checkIfPendingToSign (key) = match getString(this, key) { | |
61 | 63 | case a: String => | |
62 | 64 | if ((a == "PENDING")) | |
63 | 65 | then true | |
64 | 66 | else false | |
65 | 67 | case _ => | |
66 | 68 | false | |
67 | 69 | } | |
68 | 70 | ||
69 | 71 | ||
70 | 72 | func getValueString (json) = take(drop(json, 1), value(indexOf(drop(json, 1), "\""))) | |
71 | 73 | ||
72 | 74 | ||
73 | 75 | func getValue (json,key) = { | |
74 | 76 | let keyIndex = value(indexOf(json, (("\"" + key) + "\":"))) | |
75 | 77 | let data = drop(json, ((keyIndex + size(key)) + 3)) | |
76 | 78 | let jsonValue = getValueString(data) | |
77 | 79 | jsonValue | |
78 | 80 | } | |
79 | 81 | ||
80 | 82 | ||
81 | 83 | func getJsonBeforeValue (json,key) = { | |
82 | 84 | let keyIndex = value(indexOf(json, (("\"" + key) + "\":"))) | |
83 | 85 | let data = take(json, ((keyIndex + size(key)) + 3)) | |
84 | 86 | data | |
85 | 87 | } | |
86 | 88 | ||
87 | 89 | ||
88 | 90 | func getJsonAfterValue (json,key) = { | |
89 | 91 | let keyIndex = value(indexOf(json, (("\"" + key) + "\":"))) | |
90 | 92 | let data = takeRight(json, (size(json) - ((((keyIndex + size(key)) + 3) + 0) + 2))) | |
91 | 93 | data | |
92 | 94 | } | |
93 | 95 | ||
94 | 96 | ||
95 | 97 | func asString (bv) = match bv { | |
96 | 98 | case bv0: String => | |
97 | 99 | bv0 | |
98 | 100 | case _ => | |
99 | 101 | throw("Sponsored Public Key String expected") | |
100 | 102 | } | |
101 | 103 | ||
102 | 104 | ||
103 | 105 | @Callable(invoke) | |
104 | 106 | func fileCertification (hash,title,uuid,ipfs,signerPubKey) = { | |
105 | 107 | let id = value(invoke.transactionId) | |
106 | 108 | let entryExist = checkEntry(hash, uuid) | |
107 | 109 | let uuidExist = checkUUID(uuid) | |
108 | 110 | let callerIsDapp = (this == invoke.caller) | |
109 | 111 | let callerAddress = if (callerIsDapp) | |
110 | 112 | then toString(addressFromPublicKey(fromBase58String(signerPubKey))) | |
111 | 113 | else toBase58String(invoke.caller.bytes) | |
112 | 114 | let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress) | |
113 | 115 | if ((entryExist != "NONE")) | |
114 | 116 | then throw("This entry already exist") | |
115 | 117 | else if ((uuidExist != "NONE")) | |
116 | 118 | then throw("This uuid already exist") | |
117 | 119 | else if ((size(uuid) != 36)) | |
118 | 120 | then throw("Uuid should be 36 characters.") | |
119 | 121 | else if ((size(hash) != 64)) | |
120 | 122 | then throw("Hash should be 64 characters.") | |
121 | 123 | else if ((size(title) > 100)) | |
122 | 124 | then throw("Title is too long, 100 characters max.") | |
123 | 125 | else if (if (if (contains(hash, "\"")) | |
124 | 126 | then true | |
125 | 127 | else contains(title, "\"")) | |
126 | 128 | then true | |
127 | 129 | else contains(ipfs, "\"")) | |
128 | 130 | then throw("No \" allowed") | |
129 | 131 | else { | |
130 | 132 | let data = (((((((("{\"hash\":\"" + hash) + "\",\"timestamp\":") + toString(lastBlock.timestamp)) + ",\"title\":\"") + title) + "\",\"ipfs\":\"") + ipfs) + "\"}") | |
131 | 133 | if ((callerIsWhiteListedNum > 0)) | |
132 | 134 | then { | |
133 | 135 | let creditCost = if ((size(ipfs) != 0)) | |
134 | 136 | then (1 + storageFeeMultiplier) | |
135 | 137 | else 1 | |
136 | 138 | if ((0 > (callerIsWhiteListedNum - creditCost))) | |
137 | 139 | then throw("Not enough credit") | |
138 | 140 | 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)] | |
139 | 141 | } | |
140 | 142 | else if (!(callerIsDapp)) | |
141 | 143 | then { | |
142 | 144 | let payment = value(invoke.payments[0]) | |
143 | 145 | let amount = value(payment.amount) | |
144 | 146 | let paymentAssetId = if (isDefined(payment.assetId)) | |
145 | 147 | then value(payment.assetId) | |
146 | 148 | else throw("Waves is not accepted as payment") | |
147 | 149 | let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId)))) | |
148 | 150 | let feeCost = if ((size(ipfs) != 0)) | |
149 | 151 | then (currentPrice + (storageFeeMultiplier * currentPrice)) | |
150 | 152 | else currentPrice | |
151 | 153 | if ((acceptedToken != paymentAssetId)) | |
152 | 154 | then throw("This token is not accepted at the moment") | |
153 | 155 | else if (if ((amount != feeCost)) | |
154 | 156 | then (0 >= callerIsWhiteListedNum) | |
155 | 157 | else false) | |
156 | 158 | then throw("The price is wrong") | |
157 | 159 | 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)] | |
158 | 160 | } | |
159 | 161 | else throw("You are not allowed to do that") | |
160 | 162 | } | |
161 | 163 | } | |
162 | 164 | ||
163 | 165 | ||
164 | 166 | ||
165 | 167 | @Callable(invoke) | |
166 | 168 | func revokeCertification (certificationId,signerPubKey) = { | |
167 | 169 | let id = value(invoke.transactionId) | |
168 | 170 | let callerIsDapp = (this == invoke.caller) | |
169 | 171 | let callerAddress = if (callerIsDapp) | |
170 | 172 | then toString(addressFromPublicKey(fromBase58String(signerPubKey))) | |
171 | 173 | else toBase58String(invoke.caller.bytes) | |
172 | 174 | let entryExist = match getString(this, ((("data_fc_" + certificationId) + "_") + callerAddress)) { | |
173 | 175 | case a: String => | |
174 | 176 | a | |
175 | 177 | case _ => | |
176 | 178 | "NONE" | |
177 | 179 | } | |
178 | 180 | let isRevoked = match getString(this, ("STATUS_FC_" + certificationId)) { | |
179 | 181 | case a: String => | |
180 | 182 | a | |
181 | 183 | case _ => | |
182 | 184 | "NONE" | |
183 | 185 | } | |
184 | 186 | let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress) | |
185 | 187 | let newJson = (((dropRight(entryExist, 1) + ",\"status\":\"REVOKED_") + toBase58String(id)) + "\"}") | |
186 | 188 | if ((isRevoked != "NONE")) | |
187 | 189 | then throw("This certification have already been revoked.") | |
188 | 190 | else if ((entryExist == "NONE")) | |
189 | 191 | then throw("You cannot change the status of this certification.") | |
190 | 192 | else if ((callerIsWhiteListedNum > 0)) | |
191 | 193 | 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)] | |
192 | 194 | else if (!(callerIsDapp)) | |
193 | 195 | then { | |
194 | 196 | let payment = value(invoke.payments[0]) | |
195 | 197 | let amount = value(payment.amount) | |
196 | 198 | let paymentAssetId = if (isDefined(payment.assetId)) | |
197 | 199 | then value(payment.assetId) | |
198 | 200 | else throw("Waves is not accepted as payment") | |
199 | 201 | let currentPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId)))) | |
200 | 202 | if ((acceptedToken != paymentAssetId)) | |
201 | 203 | then throw("This token is not accepted at the moment") | |
202 | 204 | else if (if ((amount != currentPrice)) | |
203 | 205 | then (0 >= callerIsWhiteListedNum) | |
204 | 206 | else false) | |
205 | 207 | then throw("The price is wrong") | |
206 | 208 | else [StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)] | |
207 | 209 | } | |
208 | 210 | else throw("You are not allowed to do that") | |
209 | 211 | } | |
210 | 212 | ||
211 | 213 | ||
212 | 214 | ||
213 | 215 | @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) | |
358 | 216 | func usdnSignCredits () = { | |
359 | 217 | let payment = value(invoke.payments[0]) | |
360 | 218 | let callerAddress = toBase58String(invoke.caller.bytes) | |
361 | 219 | let tokenId = value(payment.assetId) | |
362 | 220 | let amount = value(payment.amount) | |
363 | 221 | let numberOfCredits = ((amount * 2) / 1000000) | |
364 | 222 | let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress) | |
365 | 223 | if ((toBase58String(tokenId) != usdnID)) | |
366 | 224 | then throw("Only USDN can be exchanged") | |
367 | 225 | else if (if (((amount % 1000000) != 0)) | |
368 | 226 | then ((amount % 1000000) != 500000) | |
369 | 227 | else false) | |
370 | 228 | then throw(((("You can only exchange multiple of 0.5, you sent:" + dropRight(toString(amount), 6)) + ".") + takeRight(toString(amount), 6))) | |
371 | 229 | else [IntegerEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum + numberOfCredits)), ScriptTransfer(addressFromStringValue(bank), amount, tokenId)] | |
372 | 230 | } | |
373 | 231 | ||
374 | 232 | ||
375 | 233 | @Verifier(tx) | |
376 | 234 | func verifier () = match tx { | |
377 | 235 | 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) | |
381 | 243 | 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) | |
389 | 253 | case _ => | |
390 | 254 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
391 | 255 | } | |
392 | 256 |
github/deemru/w8io/026f985 51.31 ms ◑