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