tx · 2vuwqsWGUYjvMy2gKvPMXqFpyB7o9CCRV9ppkMsqs9Yy 3MtSS7RTsDoG91pR5gx5EWzGjJKuciDPeFN: -0.01400000 Waves 2020.05.22 22:01 [1009869] smart account 3MtSS7RTsDoG91pR5gx5EWzGjJKuciDPeFN > SELF 0.00000000 Waves
{ "type": 13, "id": "2vuwqsWGUYjvMy2gKvPMXqFpyB7o9CCRV9ppkMsqs9Yy", "fee": 1400000, "feeAssetId": null, "timestamp": 1590174086495, "version": 1, "sender": "3MtSS7RTsDoG91pR5gx5EWzGjJKuciDPeFN", "senderPublicKey": "8ffZxZakt7dEoMzAQT8TtX1zEBkt7fy8Z4amcAGGP4n6", "proofs": [ "5rwpTtbE75qwVUaPiF5wWJmHkwRnLnQQQ7GUrh23EPV1mAvJRcaSf9XpaGmYggBrV2tb9jjhLvfSVZw3yiLee98T" ], "script": "base64:AAIDAAAAAAAAABEIARIHCgUICAgICBIECgIICAAAAAUAAAAABE5PTkUCAAAABG5vbmUAAAAACWFkbVB1YktleQEAAAAgSbRXZpKipUGQZgwtsByHuazYu1/9b9MYoKHOzSIEyXQBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAANZ2V0U2VjdXJlSGFzaAAAAAEAAAADa2V5CQACWAAAAAEJAAH1AAAAAQkAAfYAAAABCQABmwAAAAEFAAAAA2t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AAAAAAgAAAAhSZWNvdmVyeQcJAAACAAAAAQIAAAATUmVxdWVzdCBub3QgYWxsb3dlZAMJAAAAAAAAAgkAAZEAAAACBQAAAARhdXRoAAAAAAAAAAAAAgAAAAhSZWNvdmVyeQQAAAAFbXVsdGkJAQAAAA1wYXJzZUludFZhbHVlAAAAAQkAAZEAAAACBQAAAARhdXRoAAAAAAAAAAABCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACHNlY0VtYWlsAgAAAAdfb3BBdXRoCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAlSZWNvdmVyeSwJAAGkAAAAAQkAAGQAAAACBQAAAAVtdWx0aQAAAAAAAAAAAQIAAAABLAkAAaQAAAABCQAAZAAAAAIIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0CQAAaAAAAAIFAAAABW11bHRpAAAAAAAAAAA8BQAAAANuaWwJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACHNlY0VtYWlsBQAAAAhyZXNldEtleQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAhzZWNFbWFpbAIAAAAHX29wQXV0aAkAASwAAAACAgAAAAtSZWNvdmVyeSwxLAkAAaQAAAABCQAAZAAAAAIIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0AAAAAAAAAAA8BQAAAANuaWwAAAAApbgt8g==", "chainId": 84, "height": 1009869, "spentComplexity": 0 } View: original | compacted Prev: Ecvfz2pKtCXZEXydLPmM1Mr5uySUHeuTsz1epd2rQUjK Next: GM6EMyytHiyB2iodwzJu52mHkviUUS2iXLPgXXjAjF2J Diff:
Old | New | Differences | |
---|---|---|---|
35 | 35 | let pubKey = toBase58String(i.callerPublicKey) | |
36 | 36 | let secEmail = getSecureHash(opEmail) | |
37 | 37 | let secPass = getSecureHash(opPass) | |
38 | - | if ((pubKey != toBase58String(admPubKey))) | |
39 | - | then throw("Not auth to add operator") | |
40 | - | else if ((getStrByKey(secEmail) != NONE)) | |
41 | - | then throw("This operator already added") | |
42 | - | else if ((sigVerify(toBytes((opEmail + opPass)), fromBase58String(opSign), fromBase58String(opPubKey)) == false)) | |
43 | - | then throw("Sign not verified") | |
44 | - | else WriteSet([DataEntry(secEmail, secPass), DataEntry((secEmail + "_opKey"), opPubKey), DataEntry((secEmail + "_opSign"), opSign), DataEntry((secEmail + "_opLevel"), opLevel), DataEntry((secEmail + "_opAuth"), ("Allow,0," + toString(lastBlock.height)))]) | |
38 | + | if ((toBase58String(i.caller.bytes) != "oo")) | |
39 | + | then throw(("this is " + toString(getNumberByKey(toBase58String(i.caller.bytes))))) | |
40 | + | else if ((pubKey != toBase58String(admPubKey))) | |
41 | + | then throw("Not auth to add operator") | |
42 | + | else if ((getStrByKey(secEmail) != NONE)) | |
43 | + | then throw("This operator already added") | |
44 | + | else if (isDefined(transactionHeightById(i.transactionId))) | |
45 | + | then throw("BAD GUY") | |
46 | + | else if ((sigVerify(toBytes(((opEmail + opPass) + toBase58String(i.transactionId))), fromBase58String(opSign), fromBase58String(opPubKey)) == false)) | |
47 | + | then throw("Sign not verified") | |
48 | + | else WriteSet([DataEntry(secEmail, secPass), DataEntry((secEmail + "_opKey"), opPubKey), DataEntry((secEmail + "_opSign"), opSign), DataEntry((secEmail + "_opLevel"), opLevel), DataEntry((secEmail + "_opAuth"), ("Allow,0," + toString(lastBlock.height)))]) | |
45 | 49 | } | |
46 | 50 | ||
47 | 51 | ||
48 | 52 | ||
49 | 53 | @Callable(i) | |
50 | - | func resetOp (opEmail) = { | |
54 | + | func resetOp (opEmail,resetKey) = { | |
51 | 55 | let pubKey = toBase58String(i.callerPublicKey) | |
52 | 56 | let pay = extract(i.payment) | |
53 | 57 | let secEmail = getSecureHash(opEmail) | |
54 | 58 | if ((getStrByKey(secEmail) == NONE)) | |
55 | 59 | then throw("This operator does not exist") | |
56 | - | else | |
57 | - | | |
58 | - | | |
59 | - | | |
60 | - | then | |
61 | - | else | |
62 | - | | |
63 | - | | |
64 | - | if ((parseIntValue(auth[2]) >= height)) | |
60 | + | else { | |
61 | + | let auth = split(getStrByKey((secEmail + "_opAuth")), ",") | |
62 | + | if (((getStrByKey(secEmail) + "_opKey") != pubKey)) | |
63 | + | then if (if ((isDefined(pay.assetId) == true)) | |
64 | + | then true | |
65 | + | else ((20000000 * (parseIntValue(auth[1]) + 1)) >= pay.amount)) | |
66 | + | then throw("Need at least 2 Waves for auth change password") | |
67 | + | else TransferSet([ScriptTransfer(addressFromStringValue("3MpBUJbYZVA8iwoesCYaSytA82dVPyzVpmW"), 15000000, pay.assetId)]) | |
68 | + | else if ((parseIntValue(auth[2]) >= height)) | |
65 | 69 | then throw((("There is already a request delivered to your email, wait " + toString((parseIntValue(auth[2]) - height))) + " minutes")) | |
66 | 70 | else if (if (if ((auth[0] == "Allow")) | |
67 | 71 | then true | |
76 | 80 | let multi = parseIntValue(auth[1]) | |
77 | 81 | WriteSet([DataEntry((secEmail + "_opAuth"), ((("Recovery," + toString((multi + 1))) + ",") + toString((lastBlock.height + (multi * 60)))))]) | |
78 | 82 | } | |
79 | - | else WriteSet([DataEntry(secEmail, | |
80 | - | ||
83 | + | else WriteSet([DataEntry(secEmail, resetKey), DataEntry((secEmail + "_opAuth"), ("Recovery,1," + toString((lastBlock.height + 60))))]) | |
84 | + | } | |
81 | 85 | } | |
82 | 86 | ||
83 | 87 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let NONE = "none" | |
5 | 5 | ||
6 | 6 | let admPubKey = base58'5xiFtrMoXunfGTJwkeA26uAcy2ByUajvA7WQ7xNNSa8b' | |
7 | 7 | ||
8 | 8 | func getNumberByKey (key) = { | |
9 | 9 | let num = match getInteger(this, key) { | |
10 | 10 | case a: Int => | |
11 | 11 | a | |
12 | 12 | case _ => | |
13 | 13 | 0 | |
14 | 14 | } | |
15 | 15 | num | |
16 | 16 | } | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getStrByKey (key) = { | |
20 | 20 | let str = match getString(this, key) { | |
21 | 21 | case a: String => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | NONE | |
25 | 25 | } | |
26 | 26 | str | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func getSecureHash (key) = toBase58String(keccak256(blake2b256(toBytes(key)))) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | 34 | func addOp (opEmail,opPass,opPubKey,opSign,opLevel) = { | |
35 | 35 | let pubKey = toBase58String(i.callerPublicKey) | |
36 | 36 | let secEmail = getSecureHash(opEmail) | |
37 | 37 | let secPass = getSecureHash(opPass) | |
38 | - | if ((pubKey != toBase58String(admPubKey))) | |
39 | - | then throw("Not auth to add operator") | |
40 | - | else if ((getStrByKey(secEmail) != NONE)) | |
41 | - | then throw("This operator already added") | |
42 | - | else if ((sigVerify(toBytes((opEmail + opPass)), fromBase58String(opSign), fromBase58String(opPubKey)) == false)) | |
43 | - | then throw("Sign not verified") | |
44 | - | else WriteSet([DataEntry(secEmail, secPass), DataEntry((secEmail + "_opKey"), opPubKey), DataEntry((secEmail + "_opSign"), opSign), DataEntry((secEmail + "_opLevel"), opLevel), DataEntry((secEmail + "_opAuth"), ("Allow,0," + toString(lastBlock.height)))]) | |
38 | + | if ((toBase58String(i.caller.bytes) != "oo")) | |
39 | + | then throw(("this is " + toString(getNumberByKey(toBase58String(i.caller.bytes))))) | |
40 | + | else if ((pubKey != toBase58String(admPubKey))) | |
41 | + | then throw("Not auth to add operator") | |
42 | + | else if ((getStrByKey(secEmail) != NONE)) | |
43 | + | then throw("This operator already added") | |
44 | + | else if (isDefined(transactionHeightById(i.transactionId))) | |
45 | + | then throw("BAD GUY") | |
46 | + | else if ((sigVerify(toBytes(((opEmail + opPass) + toBase58String(i.transactionId))), fromBase58String(opSign), fromBase58String(opPubKey)) == false)) | |
47 | + | then throw("Sign not verified") | |
48 | + | else WriteSet([DataEntry(secEmail, secPass), DataEntry((secEmail + "_opKey"), opPubKey), DataEntry((secEmail + "_opSign"), opSign), DataEntry((secEmail + "_opLevel"), opLevel), DataEntry((secEmail + "_opAuth"), ("Allow,0," + toString(lastBlock.height)))]) | |
45 | 49 | } | |
46 | 50 | ||
47 | 51 | ||
48 | 52 | ||
49 | 53 | @Callable(i) | |
50 | - | func resetOp (opEmail) = { | |
54 | + | func resetOp (opEmail,resetKey) = { | |
51 | 55 | let pubKey = toBase58String(i.callerPublicKey) | |
52 | 56 | let pay = extract(i.payment) | |
53 | 57 | let secEmail = getSecureHash(opEmail) | |
54 | 58 | if ((getStrByKey(secEmail) == NONE)) | |
55 | 59 | then throw("This operator does not exist") | |
56 | - | else | |
57 | - | | |
58 | - | | |
59 | - | | |
60 | - | then | |
61 | - | else | |
62 | - | | |
63 | - | | |
64 | - | if ((parseIntValue(auth[2]) >= height)) | |
60 | + | else { | |
61 | + | let auth = split(getStrByKey((secEmail + "_opAuth")), ",") | |
62 | + | if (((getStrByKey(secEmail) + "_opKey") != pubKey)) | |
63 | + | then if (if ((isDefined(pay.assetId) == true)) | |
64 | + | then true | |
65 | + | else ((20000000 * (parseIntValue(auth[1]) + 1)) >= pay.amount)) | |
66 | + | then throw("Need at least 2 Waves for auth change password") | |
67 | + | else TransferSet([ScriptTransfer(addressFromStringValue("3MpBUJbYZVA8iwoesCYaSytA82dVPyzVpmW"), 15000000, pay.assetId)]) | |
68 | + | else if ((parseIntValue(auth[2]) >= height)) | |
65 | 69 | then throw((("There is already a request delivered to your email, wait " + toString((parseIntValue(auth[2]) - height))) + " minutes")) | |
66 | 70 | else if (if (if ((auth[0] == "Allow")) | |
67 | 71 | then true | |
68 | 72 | else (auth[0] != "Recovery")) | |
69 | 73 | then if ((auth[0] != "Allow")) | |
70 | 74 | then true | |
71 | 75 | else (auth[0] == "Recovery") | |
72 | 76 | else false) | |
73 | 77 | then throw("Request not allowed") | |
74 | 78 | else if ((auth[0] == "Recovery")) | |
75 | 79 | then { | |
76 | 80 | let multi = parseIntValue(auth[1]) | |
77 | 81 | WriteSet([DataEntry((secEmail + "_opAuth"), ((("Recovery," + toString((multi + 1))) + ",") + toString((lastBlock.height + (multi * 60)))))]) | |
78 | 82 | } | |
79 | - | else WriteSet([DataEntry(secEmail, | |
80 | - | ||
83 | + | else WriteSet([DataEntry(secEmail, resetKey), DataEntry((secEmail + "_opAuth"), ("Recovery,1," + toString((lastBlock.height + 60))))]) | |
84 | + | } | |
81 | 85 | } | |
82 | 86 | ||
83 | 87 |
github/deemru/w8io/026f985 44.21 ms ◑