tx · 998GTpcEfvuZn33A2s39oMv81gypA2XgXt7ygiBjT6M5 3MxFYk97QYdeHRMTu51rVyHqvFEVB4UtmBX: -0.01700000 Waves 2022.09.14 19:01 [2228991] smart account 3MxFYk97QYdeHRMTu51rVyHqvFEVB4UtmBX > SELF 0.00000000 Waves
{ "type": 13, "id": "998GTpcEfvuZn33A2s39oMv81gypA2XgXt7ygiBjT6M5", "fee": 1700000, "feeAssetId": null, "timestamp": 1663171279302, "version": 2, "chainId": 84, "sender": "3MxFYk97QYdeHRMTu51rVyHqvFEVB4UtmBX", "senderPublicKey": "2panvMtE3s1p1oCdVqRGMuBYaZJV3AZ6zpdmZ6vHkDaL", "proofs": [ "ie2SyGb3ajJWB6c557LubGXbbQ63yCfbJfCiYecPTo6pcSPocNdLTLXVGMm93tGwaw3q5hv36A3GtqCntwe1PU4", "4MuXUvcEjKPmrrvBK3rEhakSPVQLF5fHpDGCL6HCY6v5rg79Rk7WZJp5vjKMfnBLnXD3r3Lczdju7T7Z6KaUYfsy" ], "script": "base64:BgISCAISABIDCgEBEgMKAQgSABIAIQAHa0FjdGl2ZQIGYWN0aXZlAAZrQ2F1c2UCDnNodXRkb3duX2NhdXNlABZrTGFzdFBvb2xUb2tlbkludGVyZXN0AhNfcG9vbF9sYXN0X2ludGVyZXN0ABFrVXNlckxhc3RJbnRlcmVzdAITX3VzZXJfbGFzdF9pbnRlcmVzdAATa1VzZXJDbGFpbUF2YWlsYWJsZQIYX3VzZXJfYXZhaWxhYmxlX3RvX2NsYWltABZrVXNlclNoYXJlVG9rZW5zTG9ja2VkAhRfc2hhcmVfdG9rZW5zX2xvY2tlZAASa1NoYXJlVG9rZW5zTG9ja2VkAhpfdG90YWxfc2hhcmVfdG9rZW5zX2xvY2tlZAALa09yYWNsZVBvb2wCBXBvb2xfAA1rUG9vbEFzc2V0SWRzAglhc3NldF9pZHMADWtBZG1pblB1YktleTECC2FkbWluX3B1Yl8xAA1rQWRtaW5QdWJLZXkyAgthZG1pbl9wd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JAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFDGFkbWluUHViS2V5MQABAAAEEmFkbWluUHViS2V5MlNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAEFDGFkbWluUHViS2V5MgABAAAEEmFkbWluUHViS2V5M1NpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAIFDGFkbWluUHViS2V5MwABAAAJAGcCCQBkAgkAZAIFEmFkbWluUHViS2V5MVNpZ25lZAUSYWRtaW5QdWJLZXkyU2lnbmVkBRJhZG1pblB1YktleTNTaWduZWQAAjj3UBc=", "height": 2228991, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2b1HweFDzDAUkGzFThayThXbg4J2fyqsxppSrxBjKVsJ Next: 4FmFGJwxneP5Jvrhq4XHJ4uHDpZaHcda9d74Yi4GXjUV Diff:
Old | New | Differences | |
---|---|---|---|
59 | 59 | else throw("Only pool can call this function") | |
60 | 60 | ||
61 | 61 | ||
62 | + | func isFarmingCall (caller) = if ((caller == farmingAddr)) | |
63 | + | then unit | |
64 | + | else throw("Only farming can call this function") | |
65 | + | ||
66 | + | ||
62 | 67 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
63 | 68 | ||
64 | 69 | ||
101 | 106 | let poolAddr = Address(fromBase58String(pool)) | |
102 | 107 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
103 | 108 | func calcClaimAmounts (acc,assetId) = { | |
104 | - | let $ | |
105 | - | let claimAmount = $ | |
106 | - | let lastInterest = $ | |
109 | + | let $t033323402 = calcClaimAmount(pool, assetId, user) | |
110 | + | let claimAmount = $t033323402._1 | |
111 | + | let lastInterest = $t033323402._2 | |
107 | 112 | (acc :+ [claimAmount]) | |
108 | 113 | } | |
109 | 114 | ||
127 | 132 | ||
128 | 133 | @Callable(i) | |
129 | 134 | func airDrop () = valueOrElse(isActive(), valueOrElse(isPoolCall(i.caller), { | |
130 | - | let $ | |
131 | - | let pmtAmount = $ | |
132 | - | let pmtAssetId = $ | |
135 | + | let $t036153690 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
136 | + | let pmtAmount = $t036153690._1 | |
137 | + | let pmtAssetId = $t036153690._2 | |
133 | 138 | let pool = toString(i.caller) | |
134 | 139 | let totalShareTokensLocked = getTotalShareTokensLocked(pool) | |
135 | 140 | let lastInterest = getPoolTokenLastInterest(pool, getStrAssetId(pmtAssetId)) | |
144 | 149 | ||
145 | 150 | ||
146 | 151 | @Callable(i) | |
147 | - | func updateUserInterest (newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse( | |
152 | + | func updateUserInterest (newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse(isFarmingCall(i.caller), { | |
148 | 153 | let poolAddr = i.caller | |
149 | 154 | let user = toString(i.originCaller) | |
150 | 155 | let pool = toString(poolAddr) | |
151 | 156 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
152 | 157 | func calcNewUserInterestAndClaimAmountEtries (acc,assetId) = { | |
153 | - | let $ | |
154 | - | let claimAmount = $ | |
155 | - | let lastInterest = $ | |
158 | + | let $t045754645 = calcClaimAmount(pool, assetId, user) | |
159 | + | let claimAmount = $t045754645._1 | |
160 | + | let lastInterest = $t045754645._2 | |
156 | 161 | (acc :+ [IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), claimAmount), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]) | |
157 | 162 | } | |
158 | 163 | ||
178 | 183 | let user = toString(i.caller) | |
179 | 184 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
180 | 185 | func calcClaimAmountEtries (acc,assetId) = { | |
181 | - | let $ | |
182 | - | let entries = $ | |
183 | - | let sum = $ | |
184 | - | let $ | |
185 | - | let claimAmount = $ | |
186 | - | let lastInterest = $ | |
186 | + | let $t052985322 = acc | |
187 | + | let entries = $t052985322._1 | |
188 | + | let sum = $t052985322._2 | |
189 | + | let $t053295399 = calcClaimAmount(pool, assetId, user) | |
190 | + | let claimAmount = $t053295399._1 | |
191 | + | let lastInterest = $t053295399._2 | |
187 | 192 | $Tuple2((entries :+ [ScriptTransfer(i.caller, claimAmount, fromBase58String(assetId)), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), 0), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]), claimAmount) | |
188 | 193 | } | |
189 | 194 | ||
190 | - | let $ | |
195 | + | let $t056995781 = { | |
191 | 196 | let $l = assetIds | |
192 | 197 | let $s = size($l) | |
193 | 198 | let $acc0 = $Tuple2(nil, 0) | |
201 | 206 | ||
202 | 207 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15) | |
203 | 208 | } | |
204 | - | let claimEntries = $ | |
205 | - | let sumTokens = $ | |
209 | + | let claimEntries = $t056995781._1 | |
210 | + | let sumTokens = $t056995781._2 | |
206 | 211 | if ((sumTokens == 0)) | |
207 | 212 | then throw("You have no tokens for claim") | |
208 | 213 | else claimEntries |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kActive = "active" | |
5 | 5 | ||
6 | 6 | let kCause = "shutdown_cause" | |
7 | 7 | ||
8 | 8 | let kLastPoolTokenInterest = "_pool_last_interest" | |
9 | 9 | ||
10 | 10 | let kUserLastInterest = "_user_last_interest" | |
11 | 11 | ||
12 | 12 | let kUserClaimAvailable = "_user_available_to_claim" | |
13 | 13 | ||
14 | 14 | let kUserShareTokensLocked = "_share_tokens_locked" | |
15 | 15 | ||
16 | 16 | let kShareTokensLocked = "_total_share_tokens_locked" | |
17 | 17 | ||
18 | 18 | let kOraclePool = "pool_" | |
19 | 19 | ||
20 | 20 | let kPoolAssetIds = "asset_ids" | |
21 | 21 | ||
22 | 22 | let kAdminPubKey1 = "admin_pub_1" | |
23 | 23 | ||
24 | 24 | let kAdminPubKey2 = "admin_pub_2" | |
25 | 25 | ||
26 | 26 | let kAdminPubKey3 = "admin_pub_3" | |
27 | 27 | ||
28 | 28 | let kFarmingAddr = "farming_address" | |
29 | 29 | ||
30 | 30 | let scaleValue = 100000000 | |
31 | 31 | ||
32 | 32 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
33 | 33 | ||
34 | 34 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
35 | 35 | case string: String => | |
36 | 36 | fromBase58String(string) | |
37 | 37 | case nothing => | |
38 | 38 | throw((key + "is empty")) | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
43 | 43 | ||
44 | 44 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
45 | 45 | ||
46 | 46 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
47 | 47 | ||
48 | 48 | let farmingAddr = Address(getBase58FromOracle(kFarmingAddr)) | |
49 | 49 | ||
50 | 50 | let active = valueOrElse(getBoolean(this, kActive), true) | |
51 | 51 | ||
52 | 52 | func isActive () = if (active) | |
53 | 53 | then unit | |
54 | 54 | else throw("DApp is inactive at this moment") | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func isPoolCall (caller) = if (isDefined(getString(oracle, (kOraclePool + toString(caller))))) | |
58 | 58 | then unit | |
59 | 59 | else throw("Only pool can call this function") | |
60 | 60 | ||
61 | 61 | ||
62 | + | func isFarmingCall (caller) = if ((caller == farmingAddr)) | |
63 | + | then unit | |
64 | + | else throw("Only farming can call this function") | |
65 | + | ||
66 | + | ||
62 | 67 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
63 | 68 | ||
64 | 69 | ||
65 | 70 | func getUserShareTokensLocked (pool,userAddress) = valueOrElse(getInteger(farmingAddr, (((pool + "_") + userAddress) + kUserShareTokensLocked)), 0) | |
66 | 71 | ||
67 | 72 | ||
68 | 73 | func getTotalShareTokensLocked (pool) = valueOrElse(getInteger(farmingAddr, (pool + kShareTokensLocked)), 0) | |
69 | 74 | ||
70 | 75 | ||
71 | 76 | func getUserLastInterest (user,pool,assetId) = valueOrElse(getInteger(this, (((((user + "_") + pool) + "_") + assetId) + kUserLastInterest)), 0) | |
72 | 77 | ||
73 | 78 | ||
74 | 79 | func getPoolTokenLastInterest (pool,assetId) = valueOrElse(getInteger(this, (((pool + "_") + assetId) + kLastPoolTokenInterest)), 0) | |
75 | 80 | ||
76 | 81 | ||
77 | 82 | func getUserClaimAvailable (user,pool,assetId) = valueOrElse(getInteger(this, (((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable)), 0) | |
78 | 83 | ||
79 | 84 | ||
80 | 85 | func getStrAssetId (assetId) = match assetId { | |
81 | 86 | case id: ByteVector => | |
82 | 87 | toBase58String(id) | |
83 | 88 | case waves: Unit => | |
84 | 89 | "WAVES" | |
85 | 90 | case _ => | |
86 | 91 | throw("Match error") | |
87 | 92 | } | |
88 | 93 | ||
89 | 94 | ||
90 | 95 | func calcClaimAmount (pool,assetId,user) = { | |
91 | 96 | let lastInterest = getPoolTokenLastInterest(pool, assetId) | |
92 | 97 | let userLastInterest = getUserLastInterest(user, pool, assetId) | |
93 | 98 | let userShareTokensLocked = getUserShareTokensLocked(pool, user) | |
94 | 99 | let userClaimAvailable = getUserClaimAvailable(user, pool, assetId) | |
95 | 100 | let newUserClaimAvailable = fraction(userShareTokensLocked, (lastInterest - userLastInterest), scaleValue) | |
96 | 101 | $Tuple2((userClaimAvailable + newUserClaimAvailable), lastInterest) | |
97 | 102 | } | |
98 | 103 | ||
99 | 104 | ||
100 | 105 | func calcClaimAmountEvaluate (pool,user) = { | |
101 | 106 | let poolAddr = Address(fromBase58String(pool)) | |
102 | 107 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
103 | 108 | func calcClaimAmounts (acc,assetId) = { | |
104 | - | let $ | |
105 | - | let claimAmount = $ | |
106 | - | let lastInterest = $ | |
109 | + | let $t033323402 = calcClaimAmount(pool, assetId, user) | |
110 | + | let claimAmount = $t033323402._1 | |
111 | + | let lastInterest = $t033323402._2 | |
107 | 112 | (acc :+ [claimAmount]) | |
108 | 113 | } | |
109 | 114 | ||
110 | 115 | let claimAmounts = { | |
111 | 116 | let $l = assetIds | |
112 | 117 | let $s = size($l) | |
113 | 118 | let $acc0 = nil | |
114 | 119 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
115 | 120 | then $a | |
116 | 121 | else calcClaimAmounts($a, $l[$i]) | |
117 | 122 | ||
118 | 123 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
119 | 124 | then $a | |
120 | 125 | else throw("List size exceeds 15") | |
121 | 126 | ||
122 | 127 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15) | |
123 | 128 | } | |
124 | 129 | $Tuple2(assetIds, claimAmounts) | |
125 | 130 | } | |
126 | 131 | ||
127 | 132 | ||
128 | 133 | @Callable(i) | |
129 | 134 | func airDrop () = valueOrElse(isActive(), valueOrElse(isPoolCall(i.caller), { | |
130 | - | let $ | |
131 | - | let pmtAmount = $ | |
132 | - | let pmtAssetId = $ | |
135 | + | let $t036153690 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
136 | + | let pmtAmount = $t036153690._1 | |
137 | + | let pmtAssetId = $t036153690._2 | |
133 | 138 | let pool = toString(i.caller) | |
134 | 139 | let totalShareTokensLocked = getTotalShareTokensLocked(pool) | |
135 | 140 | let lastInterest = getPoolTokenLastInterest(pool, getStrAssetId(pmtAssetId)) | |
136 | 141 | let interestNew = (lastInterest + (if (if ((totalShareTokensLocked > 0)) | |
137 | 142 | then (pmtAmount > 0) | |
138 | 143 | else false) | |
139 | 144 | then fraction(pmtAmount, scaleValue, totalShareTokensLocked) | |
140 | 145 | else 0)) | |
141 | 146 | [IntegerEntry((((pool + "_") + getStrAssetId(pmtAssetId)) + kLastPoolTokenInterest), interestNew)] | |
142 | 147 | })) | |
143 | 148 | ||
144 | 149 | ||
145 | 150 | ||
146 | 151 | @Callable(i) | |
147 | - | func updateUserInterest (newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse( | |
152 | + | func updateUserInterest (newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse(isFarmingCall(i.caller), { | |
148 | 153 | let poolAddr = i.caller | |
149 | 154 | let user = toString(i.originCaller) | |
150 | 155 | let pool = toString(poolAddr) | |
151 | 156 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
152 | 157 | func calcNewUserInterestAndClaimAmountEtries (acc,assetId) = { | |
153 | - | let $ | |
154 | - | let claimAmount = $ | |
155 | - | let lastInterest = $ | |
158 | + | let $t045754645 = calcClaimAmount(pool, assetId, user) | |
159 | + | let claimAmount = $t045754645._1 | |
160 | + | let lastInterest = $t045754645._2 | |
156 | 161 | (acc :+ [IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), claimAmount), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]) | |
157 | 162 | } | |
158 | 163 | ||
159 | 164 | let $l = assetIds | |
160 | 165 | let $s = size($l) | |
161 | 166 | let $acc0 = nil | |
162 | 167 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
163 | 168 | then $a | |
164 | 169 | else calcNewUserInterestAndClaimAmountEtries($a, $l[$i]) | |
165 | 170 | ||
166 | 171 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
167 | 172 | then $a | |
168 | 173 | else throw("List size exceeds 15") | |
169 | 174 | ||
170 | 175 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15) | |
171 | 176 | })) | |
172 | 177 | ||
173 | 178 | ||
174 | 179 | ||
175 | 180 | @Callable(i) | |
176 | 181 | func claim (pool) = valueOrElse(isActive(), { | |
177 | 182 | let poolAddr = Address(fromBase58String(pool)) | |
178 | 183 | let user = toString(i.caller) | |
179 | 184 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
180 | 185 | func calcClaimAmountEtries (acc,assetId) = { | |
181 | - | let $ | |
182 | - | let entries = $ | |
183 | - | let sum = $ | |
184 | - | let $ | |
185 | - | let claimAmount = $ | |
186 | - | let lastInterest = $ | |
186 | + | let $t052985322 = acc | |
187 | + | let entries = $t052985322._1 | |
188 | + | let sum = $t052985322._2 | |
189 | + | let $t053295399 = calcClaimAmount(pool, assetId, user) | |
190 | + | let claimAmount = $t053295399._1 | |
191 | + | let lastInterest = $t053295399._2 | |
187 | 192 | $Tuple2((entries :+ [ScriptTransfer(i.caller, claimAmount, fromBase58String(assetId)), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), 0), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]), claimAmount) | |
188 | 193 | } | |
189 | 194 | ||
190 | - | let $ | |
195 | + | let $t056995781 = { | |
191 | 196 | let $l = assetIds | |
192 | 197 | let $s = size($l) | |
193 | 198 | let $acc0 = $Tuple2(nil, 0) | |
194 | 199 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
195 | 200 | then $a | |
196 | 201 | else calcClaimAmountEtries($a, $l[$i]) | |
197 | 202 | ||
198 | 203 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
199 | 204 | then $a | |
200 | 205 | else throw("List size exceeds 15") | |
201 | 206 | ||
202 | 207 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15) | |
203 | 208 | } | |
204 | - | let claimEntries = $ | |
205 | - | let sumTokens = $ | |
209 | + | let claimEntries = $t056995781._1 | |
210 | + | let sumTokens = $t056995781._2 | |
206 | 211 | if ((sumTokens == 0)) | |
207 | 212 | then throw("You have no tokens for claim") | |
208 | 213 | else claimEntries | |
209 | 214 | }) | |
210 | 215 | ||
211 | 216 | ||
212 | 217 | ||
213 | 218 | @Callable(i) | |
214 | 219 | func shutdown () = if (!(active)) | |
215 | 220 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
216 | 221 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
217 | 222 | then throw("Only admin can call this function") | |
218 | 223 | else suspend("Paused by admin") | |
219 | 224 | ||
220 | 225 | ||
221 | 226 | ||
222 | 227 | @Callable(i) | |
223 | 228 | func activate () = if (active) | |
224 | 229 | then throw("DApp is already active") | |
225 | 230 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
226 | 231 | then throw("Only admin can call this function") | |
227 | 232 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
228 | 233 | ||
229 | 234 | ||
230 | 235 | @Verifier(tx) | |
231 | 236 | func verify () = { | |
232 | 237 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
233 | 238 | then 1 | |
234 | 239 | else 0 | |
235 | 240 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
236 | 241 | then 1 | |
237 | 242 | else 0 | |
238 | 243 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
239 | 244 | then 1 | |
240 | 245 | else 0 | |
241 | 246 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
242 | 247 | } | |
243 | 248 |
github/deemru/w8io/03bedc9 42.28 ms ◑![]()