tx · 3Np9XXsZAAF6myzAQ6XNZwDBDyzkgeJkFxcQXxu5GNrr

3NAnrRUttuM8z2xyQdcZDZ9siKDcExnMD7h:  -0.01400000 Waves

2022.12.06 12:44 [2348319] smart account 3NAnrRUttuM8z2xyQdcZDZ9siKDcExnMD7h > SELF 0.00000000 Waves

{ "type": 13, "id": "3Np9XXsZAAF6myzAQ6XNZwDBDyzkgeJkFxcQXxu5GNrr", "fee": 1400000, "feeAssetId": null, "timestamp": 1670319607205, "version": 2, "chainId": 84, "sender": "3NAnrRUttuM8z2xyQdcZDZ9siKDcExnMD7h", "senderPublicKey": "9N3y4L5Mhfn5nsh2J2sfe2wNG7t8TFXQVHJb1mXXSahb", "proofs": [ "4Mcdk2muKo9JX3PXkuSrHn8CpGnpRmWgHheqeUqXWFm8uQMTbcdCuPC5MbH62ubM979XrSdna7twCHuFrbmJzeV7" ], "script": "base64:BgIjCAISBAoCGAESAwoBCBIDCgEIEgMKAQESBAoCCAgSBAoCCAgIAAlTRVBBUkFUT1ICAl9fAAxLRVlfTVVMVElTSUcCCE1VTFRJU0lHAA9LRVlfUFVCTElDX0tFWVMCC1BVQkxJQ19LRVlTAApLRVlfUVVPUlVNAgZRVU9SVU0AC0tFWV9DT05GSVJNAgdDT05GSVJNAApLRVlfU1RBVFVTAgZTVEFUVVMBEF92YWxpZGF0ZUFkZHJlc3MBCGFkZHJlc3NfBAckbWF0Y2gwCQCmCAEFCGFkZHJlc3NfAwkAAQIFByRtYXRjaDACB0FkZHJlc3MEAWEFByRtYXRjaDAGBwEOX3ZhbGlkYXRlT3duZXICBGFjY18FZWxlbV8DCQAAAgUFZWxlbV8CAAkAAgECDWludmFsaWQgb3duZXIDCQECIT0CCQDIAQEJANkEAQUFZWxlbV8AIAkAAgECGGludmFsaWQgb3duZXIgcHVibGljIGtleQUEYWNjXwYBaQEEaW5pdAIHb3duZXJzXwdxdW9ydW1fBANlcnIDCQEJaXNEZWZpbmVkAQkAoggBBQxLRVlfTVVMVElTSUc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EJvb2xlYW5FbnRyeQIFCXN0YXR1c0tleQkAZwIFEmNvbmZpcm1hdGlvbnNDb3VudAUGcXVvcnVtBQNuaWwFBHVuaXQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABAckbWF0Y2gwCQCiCAEFDEtFWV9NVUxUSVNJRwMJAAECBQckbWF0Y2gwAgZTdHJpbmcECG11bHRpc2lnBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCG11bHRpc2lnCQC5CQIJAMwIAgUKS0VZX1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tledsxC/w=", "height": 2348319, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BufGtpBmQXbwF79168vLrt8gUWLdKH8HH6NdQkT3Vtah Next: none Diff:
OldNewDifferences
7777 let publicKeysList = split(publicKeys, SEPARATOR)
7878 if ((i.caller != this))
7979 then throw("addOwner: not allowed")
80- else if ((_validateOwner(0, publicKey_) == 0))
80+ else if ((_validateOwner(0, publicKey_) != 0))
8181 then throw("addOwner: invalid public key")
82- else if ((size(publicKeysList) == 10))
83- then throw("addOwner: too many owners")
84- else {
85- let publicKeysListUpdated = (publicKeysList :+ publicKey_)
86- let publicKeysUpdated = [StringEntry(KEY_PUBLIC_KEYS, makeString(publicKeysListUpdated, SEPARATOR))]
87- $Tuple2(publicKeysUpdated, unit)
88- }
82+ else if (containsElement(publicKeysList, publicKey_))
83+ then throw("addOwner: public key already added")
84+ else if ((size(publicKeysList) == 10))
85+ then throw("addOwner: too many owners")
86+ else {
87+ let publicKeysListUpdated = (publicKeysList :+ publicKey_)
88+ let publicKeysUpdated = [StringEntry(KEY_PUBLIC_KEYS, makeString(publicKeysListUpdated, SEPARATOR))]
89+ $Tuple2(publicKeysUpdated, unit)
90+ }
8991 }
9092
9193
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEPARATOR = "__"
55
66 let KEY_MULTISIG = "MULTISIG"
77
88 let KEY_PUBLIC_KEYS = "PUBLIC_KEYS"
99
1010 let KEY_QUORUM = "QUORUM"
1111
1212 let KEY_CONFIRM = "CONFIRM"
1313
1414 let KEY_STATUS = "STATUS"
1515
1616 func _validateAddress (address_) = match addressFromString(address_) {
1717 case a: Address =>
1818 true
1919 case _ =>
2020 false
2121 }
2222
2323
2424 func _validateOwner (acc_,elem_) = if ((elem_ == ""))
2525 then throw("invalid owner")
2626 else if ((size(fromBase58String(elem_)) != 32))
2727 then throw("invalid owner public key")
2828 else acc_
2929
3030
3131 @Callable(i)
3232 func init (owners_,quorum_) = {
3333 let err = if (isDefined(getString(KEY_MULTISIG)))
3434 then throw("init: already initialized")
3535 else unit
3636 if ((err == err))
3737 then {
3838 let err1 = if (if ((0 >= size(owners_)))
3939 then true
4040 else (size(owners_) > 10))
4141 then throw("init: invalid owners")
4242 else if (if ((0 >= quorum_))
4343 then true
4444 else (quorum_ > size(owners_)))
4545 then throw("init: invalid quorum")
4646 else unit
4747 if ((err1 == err1))
4848 then {
4949 let err2 = {
5050 let $l = owners_
5151 let $s = size($l)
5252 let $acc0 = 0
5353 func $f0_1 ($a,$i) = if (($i >= $s))
5454 then $a
5555 else _validateOwner($a, $l[$i])
5656
5757 func $f0_2 ($a,$i) = if (($i >= $s))
5858 then $a
5959 else throw("List size exceeds 10")
6060
6161 $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)
6262 }
6363 if ((err2 == err2))
6464 then $Tuple2([StringEntry(KEY_MULTISIG, toString(this)), StringEntry(KEY_PUBLIC_KEYS, makeString(owners_, SEPARATOR)), IntegerEntry(KEY_QUORUM, quorum_)], unit)
6565 else throw("Strict value is not equal to itself.")
6666 }
6767 else throw("Strict value is not equal to itself.")
6868 }
6969 else throw("Strict value is not equal to itself.")
7070 }
7171
7272
7373
7474 @Callable(i)
7575 func addOwner (publicKey_) = {
7676 let publicKeys = getStringValue(KEY_PUBLIC_KEYS)
7777 let publicKeysList = split(publicKeys, SEPARATOR)
7878 if ((i.caller != this))
7979 then throw("addOwner: not allowed")
80- else if ((_validateOwner(0, publicKey_) == 0))
80+ else if ((_validateOwner(0, publicKey_) != 0))
8181 then throw("addOwner: invalid public key")
82- else if ((size(publicKeysList) == 10))
83- then throw("addOwner: too many owners")
84- else {
85- let publicKeysListUpdated = (publicKeysList :+ publicKey_)
86- let publicKeysUpdated = [StringEntry(KEY_PUBLIC_KEYS, makeString(publicKeysListUpdated, SEPARATOR))]
87- $Tuple2(publicKeysUpdated, unit)
88- }
82+ else if (containsElement(publicKeysList, publicKey_))
83+ then throw("addOwner: public key already added")
84+ else if ((size(publicKeysList) == 10))
85+ then throw("addOwner: too many owners")
86+ else {
87+ let publicKeysListUpdated = (publicKeysList :+ publicKey_)
88+ let publicKeysUpdated = [StringEntry(KEY_PUBLIC_KEYS, makeString(publicKeysListUpdated, SEPARATOR))]
89+ $Tuple2(publicKeysUpdated, unit)
90+ }
8991 }
9092
9193
9294
9395 @Callable(i)
9496 func removeOwner (publicKey_) = {
9597 let quorum = getIntegerValue(KEY_QUORUM)
9698 let publicKeys = getStringValue(KEY_PUBLIC_KEYS)
9799 let publicKeysList = split(publicKeys, SEPARATOR)
98100 if ((i.caller != this))
99101 then throw("removeOwner: not allowed")
100102 else if ((publicKey_ == ""))
101103 then throw("removeOwner: invalid public key")
102104 else if ((size(publicKeysList) == 1))
103105 then throw("removeOwner: too few owners")
104106 else {
105107 let index = match indexOf(publicKeysList, publicKey_) {
106108 case a: Int =>
107109 a
108110 case _ =>
109111 throw("removeOwner: no such owner")
110112 }
111113 let publicKeysListUpdated = removeByIndex(publicKeysList, index)
112114 let publicKeysUpdated = [StringEntry(KEY_PUBLIC_KEYS, makeString(publicKeysListUpdated, SEPARATOR))]
113115 let quorumUpdated = if ((quorum > size(publicKeysListUpdated)))
114116 then [IntegerEntry(KEY_QUORUM, size(publicKeysListUpdated))]
115117 else nil
116118 $Tuple2((publicKeysUpdated ++ quorumUpdated), unit)
117119 }
118120 }
119121
120122
121123
122124 @Callable(i)
123125 func setQuorum (quorum_) = {
124126 let publicKeys = getStringValue(KEY_PUBLIC_KEYS)
125127 let publicKeysList = split(publicKeys, SEPARATOR)
126128 if ((i.caller != this))
127129 then throw("setQuorum: not allowed")
128130 else if (if ((0 >= quorum_))
129131 then true
130132 else (quorum_ > size(publicKeysList)))
131133 then throw("setQuorum: invalid quorum")
132134 else $Tuple2([IntegerEntry(KEY_QUORUM, quorum_)], unit)
133135 }
134136
135137
136138
137139 @Callable(i)
138140 func confirmTransaction (dapp_,txId_) = {
139141 let callerPublicKey = toBase58String(i.callerPublicKey)
140142 let quorum = getIntegerValue(KEY_QUORUM)
141143 let publicKeys = getStringValue(KEY_PUBLIC_KEYS)
142144 let publicKeysList = split(publicKeys, SEPARATOR)
143145 let confirmationsKey = makeString([KEY_CONFIRM, dapp_, txId_], SEPARATOR)
144146 let confirmations = valueOrElse(getString(confirmationsKey), "")
145147 let statusKey = makeString([KEY_STATUS, dapp_, txId_], SEPARATOR)
146148 let err = if (!(containsElement(publicKeysList, callerPublicKey)))
147149 then throw("confirmTransaction: only admin")
148150 else if ((size(fromBase58String(txId_)) != 32))
149151 then throw("confirmTransaction: invalid txId")
150152 else if (!(_validateAddress(dapp_)))
151153 then throw("confirmTransaction: invalid dapp address")
152154 else if (contains(confirmations, callerPublicKey))
153155 then throw("confirmTransaction: already confirmed")
154156 else unit
155157 if ((err == err))
156158 then {
157159 let confirmationsCount = (1 + (if ((confirmations == ""))
158160 then 0
159161 else size(split(confirmations, SEPARATOR))))
160162 let confirmationsUpdated = if ((confirmations == ""))
161163 then callerPublicKey
162164 else ((confirmations + SEPARATOR) + callerPublicKey)
163165 $Tuple2([StringEntry(confirmationsKey, confirmationsUpdated), BooleanEntry(statusKey, (confirmationsCount >= quorum))], unit)
164166 }
165167 else throw("Strict value is not equal to itself.")
166168 }
167169
168170
169171
170172 @Callable(i)
171173 func revokeConfirmation (dapp_,txId_) = {
172174 let callerPublicKey = toBase58String(i.callerPublicKey)
173175 let quorum = getIntegerValue(KEY_QUORUM)
174176 let publicKeys = getStringValue(KEY_PUBLIC_KEYS)
175177 let publicKeysList = split(publicKeys, SEPARATOR)
176178 let confirmationsKey = makeString([KEY_CONFIRM, dapp_, txId_], SEPARATOR)
177179 let confirmations = valueOrElse(getString(confirmationsKey), "")
178180 let confirmationsList = split(confirmations, SEPARATOR)
179181 let statusKey = makeString([KEY_STATUS, dapp_, txId_], SEPARATOR)
180182 let status = valueOrElse(getBoolean(statusKey), false)
181183 let err = if (!(containsElement(publicKeysList, callerPublicKey)))
182184 then throw("revokeConfirmation: only admin")
183185 else if ((size(fromBase58String(txId_)) != 32))
184186 then throw("revokeConfirmation: invalid txId")
185187 else if (!(_validateAddress(dapp_)))
186188 then throw("revokeConfirmation: invalid dapp address")
187189 else if (!(containsElement(confirmationsList, callerPublicKey)))
188190 then throw("revokeConfirmation: not confirmed")
189191 else if (status)
190192 then throw("revokeConfirmation: quorum already reached")
191193 else unit
192194 if ((err == err))
193195 then {
194196 let confirmationsListUpdated = removeByIndex(confirmationsList, value(indexOf(confirmationsList, callerPublicKey)))
195197 let confirmationsCount = size(confirmationsListUpdated)
196198 $Tuple2([StringEntry(confirmationsKey, makeString(confirmationsListUpdated, SEPARATOR)), BooleanEntry(statusKey, (confirmationsCount >= quorum))], unit)
197199 }
198200 else throw("Strict value is not equal to itself.")
199201 }
200202
201203
202204 @Verifier(tx)
203205 func verify () = match getString(KEY_MULTISIG) {
204206 case multisig: String =>
205207 valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false)
206208 case _ =>
207209 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
208210 }
209211

github/deemru/w8io/026f985 
30.26 ms