tx · 6MndZur8Qv4H5saQCAE6X186qe3dcgGiQNPQX9WAmuwc 3MyGHJgyds85p2nqZM5eMGfepRa91EiGiH6: -0.01400000 Waves 2020.09.09 23:20 [1170254] smart account 3MyGHJgyds85p2nqZM5eMGfepRa91EiGiH6 > SELF 0.00000000 Waves
{ "type": 13, "id": "6MndZur8Qv4H5saQCAE6X186qe3dcgGiQNPQX9WAmuwc", "fee": 1400000, "feeAssetId": null, "timestamp": 1599682814405, "version": 1, "sender": "3MyGHJgyds85p2nqZM5eMGfepRa91EiGiH6", "senderPublicKey": "8j6j7bNmpCteruuoKqKAsq5oFuacuU3rKg6UgCn7PeT", "proofs": [ "2tTKcBk9DRf91FNPE6JMzCTHZEwmoeRxE1otMb9vh3S6npNt844YjtxzxFb1HKVTWFby9sHnLRxkKD422h7xkwTj" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMICAEAAAALAAAAAApNYXhDb25zdWxzAAAAAAAAAAAFAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAF2BQAAAAckbWF0Y2gwBQAAAAF2AAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAF2BQAAAAckbWF0Y2gwBQAAAAF2AgAAAAABAAAAD2dldEJvb2xlYW5CeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABdgUAAAAHJG1hdGNoMAUAAAABdgcAAAAAEUJmdENvZWZmaWNpZW50S2V5AgAAAA9iZnRfY29lZm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AkAAZEAAAACBQAAAAdjb25zdWxzAAAAAAAAAAAACQEAAAAMdmFsaWRhdGVTaWduAAAAAwUAAAADbXNnCQABkQAAAAIFAAAABXNpZ25zAAAAAAAAAAABCQABkQAAAAIFAAAAB2NvbnN1bHMAAAAAAAAAAAEJAQAAAAx2YWxpZGF0ZVNpZ24AAAADBQAAAANtc2cJAAGRAAAAAgUAAAAFc2lnbnMAAAAAAAAAAAIJAAGRAAAAAgUAAAAHY29uc3VscwAAAAAAAAAAAgkBAAAADHZhbGlkYXRlU2lnbgAAAAMFAAAAA21zZwkAAZEAAAACBQAAAAVzaWducwAAAAAAAAAAAwkAAZEAAAACBQAAAAdjb25zdWxzAAAAAAAAAAADCQEAAAAMdmFsaWRhdGVTaWduAAAAAwUAAAADbXNnCQABkQAAAAIFAAAABXNpZ25zAAAAAAAAAAAECQABkQAAAAIFAAAAB2NvbnN1bHMAAAAAAAAAAAQDCQAAZwAAAAIFAAAACWxhc3RSb3VuZAUAAAAFcm91bmQJAAACAAAAAQIAAAAVcm91bmQgbGVzcyBsYXN0IHJvdW5kAwkAAGYAAAACBQAAAA5iZnRDb2VmZmljaWVudAUAAAAFY291bnQJAAACAAAAAQIAAAARaW52YWxpZCBiZnQgY291bnQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAApDb25zdWxzS2V5AAAAAQUAAAAFcm91bmQFAAAACm5ld0NvbnN1bHMJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADExhc3RSb3VuZEtleQUAAAAFcm91bmQFAAAAA25pbAAAAACdHM12", "chainId": 84, "height": 1170254, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: BjNJTs4jJs1ABqXaMvr4SAFe8sVof559exGJo7k4A82r Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let MaxConsuls = 5 | |
5 | + | ||
6 | + | func getNumberByKey (key) = match getInteger(this, key) { | |
7 | + | case v: Int => | |
8 | + | v | |
9 | + | case _ => | |
10 | + | 0 | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | func getStringByKey (key) = match getString(this, key) { | |
15 | + | case v: String => | |
16 | + | v | |
17 | + | case _ => | |
18 | + | "" | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func getBooleanByKey (key) = match getBoolean(this, key) { | |
23 | + | case v: Boolean => | |
24 | + | v | |
25 | + | case _ => | |
26 | + | false | |
27 | + | } | |
28 | + | ||
29 | + | ||
30 | + | let BftCoefficientKey = "bft_coefficient" | |
31 | + | ||
32 | + | let LastRoundKey = "last_round" | |
33 | + | ||
34 | + | func ConsulsKey (round) = ("consuls_" + toString(round)) | |
35 | + | ||
36 | + | ||
37 | + | let bftCoefficient = getNumberByKey(BftCoefficientKey) | |
38 | + | ||
39 | + | let lastRound = getNumberByKey(LastRoundKey) | |
40 | + | ||
41 | + | func consulsByRound (round) = split(getStringByKey(ConsulsKey(round)), ",") | |
42 | + | ||
43 | + | ||
44 | + | func validateSign (hash,sign,oracle) = if ((sign != "nil")) | |
45 | + | then if (sigVerify(hash, fromBase58String(sign), fromBase58String(oracle))) | |
46 | + | then 1 | |
47 | + | else 0 | |
48 | + | else 0 | |
49 | + | ||
50 | + | ||
51 | + | @Callable(i) | |
52 | + | func updateConsuls (newConsuls,stringSigns,round) = { | |
53 | + | let consuls = consulsByRound(lastRound) | |
54 | + | let msg = toBytes(((newConsuls + ",") + toString(round))) | |
55 | + | let signs = split(stringSigns, ",") | |
56 | + | let count = ((((validateSign(msg, signs[0], consuls[0]) + validateSign(msg, signs[1], consuls[1])) + validateSign(msg, signs[2], consuls[2])) + validateSign(msg, signs[3], consuls[3])) + validateSign(msg, signs[4], consuls[4])) | |
57 | + | if ((lastRound >= round)) | |
58 | + | then throw("round less last round") | |
59 | + | else if ((bftCoefficient > count)) | |
60 | + | then throw("invalid bft count") | |
61 | + | else WriteSet([DataEntry(ConsulsKey(round), newConsuls), DataEntry(LastRoundKey, round)]) | |
62 | + | } | |
63 | + | ||
64 | + |
github/deemru/w8io/026f985 13.13 ms ◑