tx · HpTrwcrNgEG3TbjNBu9ut76Lfh6aQeJhexhBUNQ8Povb
3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh: -0.01000000 Waves
2023.04.18 11:57 [2539780] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves
{
"type": 13,
"id": "HpTrwcrNgEG3TbjNBu9ut76Lfh6aQeJhexhBUNQ8Povb",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1681808277037,
"version": 2,
"chainId": 84,
"sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh",
"senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7",
"proofs": [
"2vi8SDZP6jQ4zNdTW1zecnXAZkF8d8vd1ZDvHYckdpERFVjFSd2igK2buQD4b1GBdmX8D8S9WVjzTpsBcnRxc9Kj"
],
"script": "base64:BgIECAISABAAA1NFUAICX18AEGNvbnRyYWN0RmlsZW5hbWUCCXRlc3QucmlkZQEQa2V5UHVibGljS2V5TGlzdAAJALkJAgkAzAgCAgIlcwkAzAgCAhVtdWx0aXNpZ1B1YmxpY0tleUxpc3QFA25pbAUDU0VQAQh0aHJvd0VycgEBcwkAAgEJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcwETcHViS2V5U3RyaW5nVG9CeXRlcwIGcmVzdWx0DHB1YktleVN0cmluZwkAzQgCBQZyZXN1bHQJANkEAQUMcHViS2V5U3RyaW5nARZnZXRNdWx0aXNpZ1B1YktleXNMaXN0AAQScmF3TXVsdGlzaWdQdWJLZXlzCQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMJARBrZXlQdWJsaWNLZXlMaXN0AAIACQC1CQIFEnJhd011bHRpc2lnUHViS2V5cwUDU0VQAR5nZXRQdXRibGljS2V5c0FzQnl0ZVZlY3Rvckxpc3QABA5yYXdQdWJLZXlzTGlzdAkBFmdldE11bHRpc2lnUHViS2V5c0xpc3QACgACJ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yhY87EE
Next: FssQmkuRz22Yy3oADxDj7YEfp5Pxh4ZnwGZGmfJQ1Ri2
Diff:
Old | New | | Differences |
---|
11 | 11 | | func throwErr (s) = throw(((contractFilename + ": ") + s)) |
---|
12 | 12 | | |
---|
13 | 13 | | |
---|
14 | | - | func getMultisigPubKeysListOrUnit () = { |
---|
| 14 | + | func pubKeyStringToBytes (result,pubKeyString) = (result :+ fromBase58String(pubKeyString)) |
---|
| 15 | + | |
---|
| 16 | + | |
---|
| 17 | + | func getMultisigPubKeysList () = { |
---|
15 | 18 | | let rawMultisigPubKeys = valueOrElse(getString(this, keyPublicKeyList()), "") |
---|
16 | 19 | | split(rawMultisigPubKeys, SEP) |
---|
17 | 20 | | } |
---|
18 | 21 | | |
---|
19 | 22 | | |
---|
20 | | - | func validateProof (publicKey,proof,bodyBytes) = if ((publicKey == proof)) |
---|
| 23 | + | func getPutblicKeysAsByteVectorList () = { |
---|
| 24 | + | let rawPubKeysList = getMultisigPubKeysList() |
---|
| 25 | + | let $l = rawPubKeysList |
---|
| 26 | + | let $s = size($l) |
---|
| 27 | + | let $acc0 = nil |
---|
| 28 | + | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
| 29 | + | then $a |
---|
| 30 | + | else pubKeyStringToBytes($a, $l[$i]) |
---|
| 31 | + | |
---|
| 32 | + | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
| 33 | + | then $a |
---|
| 34 | + | else throw("List size exceeds 3") |
---|
| 35 | + | |
---|
| 36 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
| 37 | + | } |
---|
| 38 | + | |
---|
| 39 | + | |
---|
| 40 | + | func validateProof (publicKey,proof,bodyBytes) = if (sigVerify(bodyBytes, proof, publicKey)) |
---|
21 | 41 | | then 1 |
---|
22 | 42 | | else 0 |
---|
23 | 43 | | |
---|
24 | 44 | | |
---|
25 | 45 | | func compareHelper (lst,proof) = { |
---|
26 | | - | let $t0646687 = lst |
---|
27 | | - | let results = $t0646687._1 |
---|
28 | | - | let publicKey = $t0646687._2 |
---|
29 | | - | let bodyBytes = $t0646687._3 |
---|
| 46 | + | let $t0927968 = lst |
---|
| 47 | + | let results = $t0927968._1 |
---|
| 48 | + | let publicKey = $t0927968._2 |
---|
| 49 | + | let bodyBytes = $t0927968._3 |
---|
30 | 50 | | $Tuple3((results :+ validateProof(publicKey, proof, bodyBytes)), publicKey, bodyBytes) |
---|
31 | 51 | | } |
---|
32 | 52 | | |
---|
|
41 | 61 | | |
---|
42 | 62 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
43 | 63 | | then $a |
---|
44 | | - | else throw("List size exceeds 10") |
---|
| 64 | + | else throw("List size exceeds 3") |
---|
45 | 65 | | |
---|
46 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 66 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
47 | 67 | | } |
---|
48 | 68 | | |
---|
49 | 69 | | |
---|
|
60 | 80 | | |
---|
61 | 81 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
62 | 82 | | then $a |
---|
63 | | - | else throw("List size exceeds 10") |
---|
| 83 | + | else throw("List size exceeds 3") |
---|
64 | 84 | | |
---|
65 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 85 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
66 | 86 | | } |
---|
67 | 87 | | |
---|
68 | 88 | | |
---|
69 | 89 | | func compareListHelper (proofs,publicKey) = { |
---|
70 | | - | let $t011511196 = proofs |
---|
71 | | - | let results = $t011511196._1 |
---|
72 | | - | let proofsList = $t011511196._2 |
---|
73 | | - | let bodyBytes = $t011511196._3 |
---|
| 90 | + | let $t014301475 = proofs |
---|
| 91 | + | let results = $t014301475._1 |
---|
| 92 | + | let proofsList = $t014301475._2 |
---|
| 93 | + | let bodyBytes = $t014301475._3 |
---|
74 | 94 | | let compareList = compare(proofsList, publicKey, bodyBytes)._1 |
---|
75 | 95 | | let sum = sumList(compareList) |
---|
76 | 96 | | $Tuple3((results :+ sum), proofsList, bodyBytes) |
---|
|
90 | 110 | | |
---|
91 | 111 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
92 | 112 | | then $a |
---|
93 | | - | else throw("List size exceeds 10") |
---|
| 113 | + | else throw("List size exceeds 3") |
---|
94 | 114 | | |
---|
95 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 115 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
96 | 116 | | } |
---|
97 | 117 | | |
---|
98 | 118 | | |
---|
|
107 | 127 | | |
---|
108 | 128 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
109 | 129 | | then $a |
---|
110 | | - | else throw("List size exceeds 10") |
---|
| 130 | + | else throw("List size exceeds 3") |
---|
111 | 131 | | |
---|
112 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 132 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
113 | 133 | | } |
---|
114 | 134 | | let norm = normilize(rawList._1) |
---|
115 | | - | norm |
---|
| 135 | + | sumList(norm) |
---|
116 | 136 | | } |
---|
117 | 137 | | |
---|
118 | 138 | | |
---|
119 | | - | func test () = { |
---|
120 | | - | let proofsList = [base58'AAA', base58'AAAA'] |
---|
121 | | - | let publicKeysList = [base58'AAA', base58'AAAAAA', base58'AAAAA', base58'AAAA', base58'AAAAAAA'] |
---|
122 | | - | let bodyBytes = base58'AAAA' |
---|
123 | | - | let b = validProofCount(publicKeysList, proofsList, bodyBytes) |
---|
124 | | - | $Tuple2(sumList(b), b) |
---|
125 | | - | } |
---|
| 139 | + | @Callable(i) |
---|
| 140 | + | func test () = nil |
---|
126 | 141 | | |
---|
127 | 142 | | |
---|
| 143 | + | @Verifier(tx) |
---|
| 144 | + | func verify () = match tx { |
---|
| 145 | + | case s: SetScriptTransaction => |
---|
| 146 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
| 147 | + | case _ => |
---|
| 148 | + | let proofsList = tx.proofs |
---|
| 149 | + | let publicKeysList = getPutblicKeysAsByteVectorList() |
---|
| 150 | + | (validProofCount(publicKeysList, proofsList, tx.bodyBytes) > 0) |
---|
| 151 | + | } |
---|
128 | 152 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let SEP = "__" |
---|
5 | 5 | | |
---|
6 | 6 | | let contractFilename = "test.ride" |
---|
7 | 7 | | |
---|
8 | 8 | | func keyPublicKeyList () = makeString(["%s", "multisigPublicKeyList"], SEP) |
---|
9 | 9 | | |
---|
10 | 10 | | |
---|
11 | 11 | | func throwErr (s) = throw(((contractFilename + ": ") + s)) |
---|
12 | 12 | | |
---|
13 | 13 | | |
---|
14 | | - | func getMultisigPubKeysListOrUnit () = { |
---|
| 14 | + | func pubKeyStringToBytes (result,pubKeyString) = (result :+ fromBase58String(pubKeyString)) |
---|
| 15 | + | |
---|
| 16 | + | |
---|
| 17 | + | func getMultisigPubKeysList () = { |
---|
15 | 18 | | let rawMultisigPubKeys = valueOrElse(getString(this, keyPublicKeyList()), "") |
---|
16 | 19 | | split(rawMultisigPubKeys, SEP) |
---|
17 | 20 | | } |
---|
18 | 21 | | |
---|
19 | 22 | | |
---|
20 | | - | func validateProof (publicKey,proof,bodyBytes) = if ((publicKey == proof)) |
---|
| 23 | + | func getPutblicKeysAsByteVectorList () = { |
---|
| 24 | + | let rawPubKeysList = getMultisigPubKeysList() |
---|
| 25 | + | let $l = rawPubKeysList |
---|
| 26 | + | let $s = size($l) |
---|
| 27 | + | let $acc0 = nil |
---|
| 28 | + | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
| 29 | + | then $a |
---|
| 30 | + | else pubKeyStringToBytes($a, $l[$i]) |
---|
| 31 | + | |
---|
| 32 | + | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
| 33 | + | then $a |
---|
| 34 | + | else throw("List size exceeds 3") |
---|
| 35 | + | |
---|
| 36 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
| 37 | + | } |
---|
| 38 | + | |
---|
| 39 | + | |
---|
| 40 | + | func validateProof (publicKey,proof,bodyBytes) = if (sigVerify(bodyBytes, proof, publicKey)) |
---|
21 | 41 | | then 1 |
---|
22 | 42 | | else 0 |
---|
23 | 43 | | |
---|
24 | 44 | | |
---|
25 | 45 | | func compareHelper (lst,proof) = { |
---|
26 | | - | let $t0646687 = lst |
---|
27 | | - | let results = $t0646687._1 |
---|
28 | | - | let publicKey = $t0646687._2 |
---|
29 | | - | let bodyBytes = $t0646687._3 |
---|
| 46 | + | let $t0927968 = lst |
---|
| 47 | + | let results = $t0927968._1 |
---|
| 48 | + | let publicKey = $t0927968._2 |
---|
| 49 | + | let bodyBytes = $t0927968._3 |
---|
30 | 50 | | $Tuple3((results :+ validateProof(publicKey, proof, bodyBytes)), publicKey, bodyBytes) |
---|
31 | 51 | | } |
---|
32 | 52 | | |
---|
33 | 53 | | |
---|
34 | 54 | | func compare (proofsList,publicKey,bodyBytes) = { |
---|
35 | 55 | | let $l = proofsList |
---|
36 | 56 | | let $s = size($l) |
---|
37 | 57 | | let $acc0 = $Tuple3(nil, publicKey, bodyBytes) |
---|
38 | 58 | | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
39 | 59 | | then $a |
---|
40 | 60 | | else compareHelper($a, $l[$i]) |
---|
41 | 61 | | |
---|
42 | 62 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
43 | 63 | | then $a |
---|
44 | | - | else throw("List size exceeds 10") |
---|
| 64 | + | else throw("List size exceeds 3") |
---|
45 | 65 | | |
---|
46 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 66 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
47 | 67 | | } |
---|
48 | 68 | | |
---|
49 | 69 | | |
---|
50 | 70 | | func accum (sum,val) = (sum + val) |
---|
51 | 71 | | |
---|
52 | 72 | | |
---|
53 | 73 | | func sumList (list) = { |
---|
54 | 74 | | let $l = list |
---|
55 | 75 | | let $s = size($l) |
---|
56 | 76 | | let $acc0 = 0 |
---|
57 | 77 | | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
58 | 78 | | then $a |
---|
59 | 79 | | else accum($a, $l[$i]) |
---|
60 | 80 | | |
---|
61 | 81 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
62 | 82 | | then $a |
---|
63 | | - | else throw("List size exceeds 10") |
---|
| 83 | + | else throw("List size exceeds 3") |
---|
64 | 84 | | |
---|
65 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 85 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
66 | 86 | | } |
---|
67 | 87 | | |
---|
68 | 88 | | |
---|
69 | 89 | | func compareListHelper (proofs,publicKey) = { |
---|
70 | | - | let $t011511196 = proofs |
---|
71 | | - | let results = $t011511196._1 |
---|
72 | | - | let proofsList = $t011511196._2 |
---|
73 | | - | let bodyBytes = $t011511196._3 |
---|
| 90 | + | let $t014301475 = proofs |
---|
| 91 | + | let results = $t014301475._1 |
---|
| 92 | + | let proofsList = $t014301475._2 |
---|
| 93 | + | let bodyBytes = $t014301475._3 |
---|
74 | 94 | | let compareList = compare(proofsList, publicKey, bodyBytes)._1 |
---|
75 | 95 | | let sum = sumList(compareList) |
---|
76 | 96 | | $Tuple3((results :+ sum), proofsList, bodyBytes) |
---|
77 | 97 | | } |
---|
78 | 98 | | |
---|
79 | 99 | | |
---|
80 | 100 | | func normilizeHelper (results,next) = (results :+ min([1, next])) |
---|
81 | 101 | | |
---|
82 | 102 | | |
---|
83 | 103 | | func normilize (results) = { |
---|
84 | 104 | | let $l = results |
---|
85 | 105 | | let $s = size($l) |
---|
86 | 106 | | let $acc0 = nil |
---|
87 | 107 | | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
88 | 108 | | then $a |
---|
89 | 109 | | else normilizeHelper($a, $l[$i]) |
---|
90 | 110 | | |
---|
91 | 111 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
92 | 112 | | then $a |
---|
93 | | - | else throw("List size exceeds 10") |
---|
| 113 | + | else throw("List size exceeds 3") |
---|
94 | 114 | | |
---|
95 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 115 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
96 | 116 | | } |
---|
97 | 117 | | |
---|
98 | 118 | | |
---|
99 | 119 | | func validProofCount (publicKeysList,proofsList,bodyBytes) = { |
---|
100 | 120 | | let rawList = { |
---|
101 | 121 | | let $l = publicKeysList |
---|
102 | 122 | | let $s = size($l) |
---|
103 | 123 | | let $acc0 = $Tuple3(nil, proofsList, bodyBytes) |
---|
104 | 124 | | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
105 | 125 | | then $a |
---|
106 | 126 | | else compareListHelper($a, $l[$i]) |
---|
107 | 127 | | |
---|
108 | 128 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
109 | 129 | | then $a |
---|
110 | | - | else throw("List size exceeds 10") |
---|
| 130 | + | else throw("List size exceeds 3") |
---|
111 | 131 | | |
---|
112 | | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
| 132 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) |
---|
113 | 133 | | } |
---|
114 | 134 | | let norm = normilize(rawList._1) |
---|
115 | | - | norm |
---|
| 135 | + | sumList(norm) |
---|
116 | 136 | | } |
---|
117 | 137 | | |
---|
118 | 138 | | |
---|
119 | | - | func test () = { |
---|
120 | | - | let proofsList = [base58'AAA', base58'AAAA'] |
---|
121 | | - | let publicKeysList = [base58'AAA', base58'AAAAAA', base58'AAAAA', base58'AAAA', base58'AAAAAAA'] |
---|
122 | | - | let bodyBytes = base58'AAAA' |
---|
123 | | - | let b = validProofCount(publicKeysList, proofsList, bodyBytes) |
---|
124 | | - | $Tuple2(sumList(b), b) |
---|
125 | | - | } |
---|
| 139 | + | @Callable(i) |
---|
| 140 | + | func test () = nil |
---|
126 | 141 | | |
---|
127 | 142 | | |
---|
| 143 | + | @Verifier(tx) |
---|
| 144 | + | func verify () = match tx { |
---|
| 145 | + | case s: SetScriptTransaction => |
---|
| 146 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
| 147 | + | case _ => |
---|
| 148 | + | let proofsList = tx.proofs |
---|
| 149 | + | let publicKeysList = getPutblicKeysAsByteVectorList() |
---|
| 150 | + | (validProofCount(publicKeysList, proofsList, tx.bodyBytes) > 0) |
---|
| 151 | + | } |
---|
128 | 152 | | |
---|