tx · 89kWQo6McU2xsm6pV9fEbC9mygjJs2ieu9a3SqChrech

3MpWdTGf7g4WqgCF16vRCm47r3jqWR4x3rH:  -0.01400000 Waves

2023.09.06 15:20 [2743503] smart account 3MpWdTGf7g4WqgCF16vRCm47r3jqWR4x3rH > SELF 0.00000000 Waves

{ "type": 13, "id": "89kWQo6McU2xsm6pV9fEbC9mygjJs2ieu9a3SqChrech", "fee": 1400000, "feeAssetId": null, "timestamp": 1694002831173, "version": 2, "chainId": 84, "sender": "3MpWdTGf7g4WqgCF16vRCm47r3jqWR4x3rH", "senderPublicKey": "E1AisEe56YET9Mh4nmc7caxvzk8vBN6W6Er2y7XoyLHt", "proofs": [ "2gJytW9N5bcfqiJMRc64yrnSct9Q1SWWdCgGZNsbfbztkhvdTPmPELCGoVb2B2sB6ZZopb9JndfHTAT1P8Lassuy" ], "script": "base64:AAIFAAAAAAAAACAIAhIHCgUIAQgYARIDCgEBEgQKAgEBEgMKAQQSAwoBAQAAAA8AAAAAEGN1cnJlbnRMb2NrSWRLZXkCAAAADWN1cnJlbnRMb2NrSWQAAAAAEGFkbWluQ29udHJhY3RLZXkCAAAADWFkbWluQ29udHJhY3QAAAAAE3RyZWFzdXJ5Q29udHJhY3RLZXkCAAAAEHRyZWFzdXJ5Q29udHJhY3QAAAAADGlzRnJlZXplZEtleQIAAAAJaXNGcmVlemVkAAAAABBpc0NvbnN0cnVjdGVkS2V5AgAAAA1pc0NvbnN0cnVjdGVkAAAAAAx2ZXJpZmllcnNLZXkCAAAACXZlcmlmaWVycwAAAAAQdmVyaWZpZXJzRGF0YUtleQIAAAANdmVyaWZpZXJzRGF0YQAAAAARdW5sb2NrRmVlQmFzaXNLZXkCAAAADnVubG9ja0ZlZUJhc2lzAAAAAANTRVACAAAAAl9fAAAAAAZNVUxUMTAAAAAAAlQL5AABAAAACWFzUGF5bWVudAAAAAEAAAABdgQAAAAHJG1hdGNoMAUAAAABdgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQX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W5kZXgJAAJZAAAAAQUAAAAEbmV4dAAAAAAAAAAAAQAAAAAAAAAAAAkABRQAAAACCQAAZAAAAAIFAAAAFHZhbGlkYXRlZFByb29mc0NvdW50BQAAAAppc1ZlcmlmaWVkCQAAZAAAAAIFAAAAEmN1cnJlbnRQcm9vZnNJbmRleAAAAAAAAAAAAQQAAAAOdmFsaWRhdGlvbkRhdGEKAAAAAAIkbAUAAAAJdmVyaWZpZXJzCgAAAAACJHMJAAGQAAAAAQUAAAACJGwKAAAAAAUkYWNjMAkABRQAAAACAAAAAAAAAAAAAAAAAAAAAAAACgEAAAAFJGYwXzEAAAACAAAAAiRhAAAAAiRpAwkAAGcAAAACBQAAAAIkaQUAAAACJHMFAAAAAiRhCQEAAAADc3VtAAAAAgUAAAACJGEJAAGRAAAAAgUAAAACJGwFAAAAAiRpCgEAAAAFJGYwXzIAAAACAAAAAiRhAAAAAiRpAwkAAGcAAAACBQAAAAIkaQUAAAACJHMFAAAAAiRhCQAAAgAAAAECAAAAE0xpc3Qgc2l6ZSBleGNlZWRzIDgJAQAAAAUkZjBfMgAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIJAQAAAAUkZjBfMQAAAAIFAAAABSRhY2MwAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAACAAAAAAAAAAADAAAAAAAAAAAEAAAAAAAAAAAFAAAAAAAAAAAGAAAAAAAAAAAHAAAAAAAAAAAICQAAZwAAAAIIBQAAAA52YWxpZGF0aW9uRGF0YQAAAAJfMQUAAAARdmVyaWZpZXJzUmVxdWlyZWTYcYR+", "height": 2743503, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AQHZK71TiM3hwqXmCwXgqDBnmSXk9rieCee1EVpQFsN1 Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let boosterPubKey = base58'DNDe2ziQMdDJSijzg5hDggeA1yxxwiAdqiu2hKo6dPSb'
4+let currentLockIdKey = "currentLockId"
5+
6+let adminContractKey = "adminContract"
7+
8+let treasuryContractKey = "treasuryContract"
9+
10+let isFreezedKey = "isFreezed"
11+
12+let isConstructedKey = "isConstructed"
13+
14+let verifiersKey = "verifiers"
15+
16+let verifiersDataKey = "verifiersData"
17+
18+let unlockFeeBasisKey = "unlockFeeBasis"
19+
20+let SEP = "__"
21+
22+let MULT10 = 10000000000
23+
24+func asPayment (v) = match v {
25+ case p: AttachedPayment =>
26+ p
27+ case _ =>
28+ throw("fail to cast into AttachedPayment")
29+}
30+
31+
32+func asByteVector (v) = match v {
33+ case p: ByteVector =>
34+ p
35+ case _ =>
36+ throw("fail to cast into ByteVector")
37+}
38+
39+
40+func asInt (val) = match val {
41+ case valInt: Int =>
42+ valInt
43+ case _ =>
44+ throw("fail to cast into Int")
45+}
46+
47+
48+func maxTakeableAmount (lockHeight,vestingPeriod,amount,takedAmount) = {
49+ let blocksPassed = (height - lockHeight)
50+ if ((blocksPassed >= vestingPeriod))
51+ then (amount - takedAmount)
52+ else {
53+ let perBlockUnlock = fraction(amount, MULT10, vestingPeriod, HALFUP)
54+ let availableUnlock = fraction(perBlockUnlock, blocksPassed, MULT10)
55+ (availableUnlock - takedAmount)
56+ }
57+ }
58+
59+
60+func treasuryAmount (amount) = {
61+ let feeBasis = getIntegerValue(unlockFeeBasisKey)
62+ if ((feeBasis == 0))
63+ then 0
64+ else 0
65+ }
66+
567
668 @Callable(i)
7-func call () = [BooleanEntry("Executed_6", true), ScriptTransfer(i.caller, 200000, unit)]
69+func constructor (adminAdress,unlockFeeBasis,treasuryContract,verifiers,requiredVerifiers) = match getBoolean(isConstructedKey) {
70+ case _: Boolean =>
71+ throw("Constructor can be called just once")
72+ case _ =>
73+ let verifiersCount = size(verifiers)
74+ if ((verifiersCount > 8))
75+ then throw("Max verifiers number is 8")
76+ else {
77+ let verifiersPubKeys = makeString(verifiers, SEP)
78+[StringEntry(adminContractKey, adminAdress), IntegerEntry(currentLockIdKey, 0), BooleanEntry(isFreezedKey, false), BooleanEntry(isConstructedKey, true), IntegerEntry(unlockFeeBasisKey, unlockFeeBasis), StringEntry(treasuryContractKey, treasuryContract), StringEntry(verifiersKey, verifiersPubKeys), StringEntry(verifiersDataKey, ((toString(verifiersCount) + SEP) + toString(requiredVerifiers)))]
79+ }
80+}
81+
82+
83+
84+@Callable(i)
85+func lock (period) = if (getBooleanValue(isFreezedKey))
86+ then throw("Contract operations is suspended")
87+ else {
88+ let payment = asPayment(i.payments[0])
89+ if ((0 >= payment.amount))
90+ then throw("Amount must be positive")
91+ else if ((1440 > period))
92+ then throw("24 hours is minimum vesting period")
93+ else {
94+ let currentLockId = getIntegerValue(currentLockIdKey)
95+ let callerAddressString = toBase58String(i.caller.bytes)
96+ let paymentAssetIdString = toBase58String(asByteVector(payment.assetId))
97+ let key = ((callerAddressString + SEP) + toString(currentLockId))
98+ let data = ((((((((toString(height) + SEP) + toString(payment.amount)) + SEP) + "0") + SEP) + toString(period)) + SEP) + paymentAssetIdString)
99+[StringEntry(key, data), IntegerEntry(currentLockIdKey, (currentLockId + 1))]
100+ }
101+ }
102+
103+
104+
105+@Callable(i)
106+func withdraw (amount,lockId) = if (getBooleanValue(isFreezedKey))
107+ then throw("Contract operations is suspended")
108+ else if (if ((0 >= amount))
109+ then true
110+ else (0 > lockId))
111+ then throw("Amount must be positive or wrong lock id")
112+ else {
113+ let callerAddressString = toBase58String(i.caller.bytes)
114+ let key = ((callerAddressString + SEP) + toString(lockId))
115+ let dataArray = split(getStringValue(key), SEP)
116+ if ((size(dataArray) != 5))
117+ then throw("Internal error")
118+ else {
119+ let storedHeight = dataArray[0]
120+ let storedAmount = dataArray[1]
121+ let storedTakedAmount = dataArray[2]
122+ let storedVestingPeriod = dataArray[3]
123+ let storedAssetId = dataArray[4]
124+ let availableAmount = maxTakeableAmount(asInt(storedHeight), asInt(storedVestingPeriod), asInt(storedAmount), asInt(storedTakedAmount))
125+ if ((amount > availableAmount))
126+ then throw(("Requested amount is two big, max available amount is: " + toString(availableAmount)))
127+ else {
128+ let newData = ((((((((storedHeight + SEP) + storedAmount) + SEP) + toString((asInt(storedTakedAmount) + amount))) + SEP) + storedVestingPeriod) + SEP) + storedAssetId)
129+[StringEntry(key, newData), ScriptTransfer(i.caller, amount, fromBase58String(storedAssetId))]
130+ }
131+ }
132+ }
133+
134+
135+
136+@Callable(i)
137+func freezeContract (isUnfreeze) = {
138+ let adminAddress = getStringValue(adminContractKey)
139+ if ((adminAddress != toBase58String(i.caller.bytes)))
140+ then throw("Only admin contract can call this function")
141+ else [BooleanEntry(isFreezedKey, !(isUnfreeze))]
142+ }
143+
144+
145+
146+@Callable(i)
147+func changeFeeBasis (newFeeBasis) = {
148+ let adminAddress = getStringValue(adminContractKey)
149+ if ((adminAddress != toBase58String(i.caller.bytes)))
150+ then throw("Only admin contract can call this function")
151+ else if ((0 > newFeeBasis))
152+ then throw("Fee basis can't be negative")
153+ else if ((newFeeBasis > 1000))
154+ then throw("Fee basis can't be bigger than 10 percent")
155+ else [IntegerEntry(unlockFeeBasisKey, newFeeBasis)]
156+ }
8157
9158
10159 @Verifier(tx)
11-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], boosterPubKey)
160+func verify () = {
161+ let verifiers = split(getStringValue(verifiersKey), SEP)
162+ let verifiersData = split(getStringValue(verifiersDataKey), SEP)
163+ let verifiersCount = asInt(verifiersData[0])
164+ let verifiersRequired = asInt(verifiersData[1])
165+ func sum (accum,next) = {
166+ let validatedProofsCount = accum._1
167+ let currentProofsIndex = accum._2
168+ let isVerified = if (sigVerify(tx.bodyBytes, tx.proofs[currentProofsIndex], fromBase58String(next)))
169+ then 1
170+ else 0
171+ $Tuple2((validatedProofsCount + isVerified), (currentProofsIndex + 1))
172+ }
173+
174+ let validationData = {
175+ let $l = verifiers
176+ let $s = size($l)
177+ let $acc0 = $Tuple2(0, 0)
178+ func $f0_1 ($a,$i) = if (($i >= $s))
179+ then $a
180+ else sum($a, $l[$i])
181+
182+ func $f0_2 ($a,$i) = if (($i >= $s))
183+ then $a
184+ else throw("List size exceeds 8")
185+
186+ $f0_2($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)
187+ }
188+ (validationData._1 >= verifiersRequired)
189+ }
12190

github/deemru/w8io/026f985 
29.65 ms