tx · BfmNmqHutrCh3iVPxsru92QBckdtgSxm2TjZ4q96Y5e3 3NBh7HdHTW4Py7zvsEhRiW8PXu6H2Cd5Xov: -0.01400000 Waves 2023.09.06 15:46 [2743529] smart account 3NBh7HdHTW4Py7zvsEhRiW8PXu6H2Cd5Xov > SELF 0.00000000 Waves
{ "type": 13, "id": "BfmNmqHutrCh3iVPxsru92QBckdtgSxm2TjZ4q96Y5e3", "fee": 1400000, "feeAssetId": null, "timestamp": 1694004483434, "version": 2, "chainId": 84, "sender": "3NBh7HdHTW4Py7zvsEhRiW8PXu6H2Cd5Xov", "senderPublicKey": "DgvK9fjubJDHqAhVSuupToiDF7zUafPidM2yH1i7gyPh", "proofs": [ "5kndyLBZ9UptFv5ZpymjUZUqx2Z7esDcx4ut7YqG6hPtJggoeVd14V53WpyoX4EAJMAoNZjTX3Lzy8ZUNer133CJ" ], "script": "base64:AAIFAAAAAAAAACAIAhIHCgUIAQgYARIDCgEBEgQKAgEBEgMKAQQSAwoBAQAAAA8AAAAAEGN1cnJlbnRMb2NrSWRLZXkCAAAADWN1cnJlbnRMb2NrSWQAAAAAEGFkbWluQ29udHJhY3RLZXkCAAAADWFkbWluQ29udHJhY3QAAAAAE3RyZWFzdXJ5Q29udHJhY3RLZXkCAAAAEHRyZWFzdXJ5Q29udHJhY3QAAAAADGlzRnJlZXplZEtleQIAAAAJaXNGcmVlemVkAAAAABBpc0NvbnN0cnVjdGVkS2V5AgAAAA1pc0NvbnN0cnVjdGVkAAAAAAx2ZXJpZmllcnNLZXkCAAAACXZlcmlmaWVycwAAAAAQdmVyaWZpZXJzRGF0YUtleQIAAAANdmVyaWZpZXJzRGF0YQAAAAARdW5sb2NrRmVlQmFzaXNLZXkCAAAADnVubG9ja0ZlZUJhc2lzAAAAAANTRVACAAAAAl9fAAAAAAZNVUxUMTAAAAAAAlQL5AABAAAACWFzUGF5bWVudAAAAAEAAAABdgQAAAAHJG1hdGNoMAUAAAABdgMJAAABAAAAAgUAAAAHJG1hd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dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkd2kl5", "height": 2743529, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EJLnDXvjBKeHUrg8UYg3EXEuLnZy2KwT5sTDY5re9ijh Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# 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 | + | ||
5 | 67 | ||
6 | 68 | @Callable(i) | |
7 | - | func call () = [BooleanEntry("Executed_5", 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 | + | } | |
8 | 157 | ||
9 | 158 | ||
10 | 159 | @Verifier(tx) | |
11 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], boosterPubKey) | |
160 | + | func verify () = match tx { | |
161 | + | case _: SetScriptTransaction => | |
162 | + | let verifiers = split(getStringValue(verifiersKey), SEP) | |
163 | + | let verifiersData = split(getStringValue(verifiersDataKey), SEP) | |
164 | + | let verifiersCount = asInt(verifiersData[0]) | |
165 | + | let verifiersRequired = asInt(verifiersData[1]) | |
166 | + | func sum (accum,next) = { | |
167 | + | let validatedProofsCount = accum._1 | |
168 | + | let currentProofsIndex = accum._2 | |
169 | + | let isVerified = if (sigVerify(tx.bodyBytes, tx.proofs[currentProofsIndex], fromBase58String(next))) | |
170 | + | then 1 | |
171 | + | else 0 | |
172 | + | $Tuple2((validatedProofsCount + isVerified), (currentProofsIndex + 1)) | |
173 | + | } | |
174 | + | ||
175 | + | let validationData = { | |
176 | + | let $l = verifiers | |
177 | + | let $s = size($l) | |
178 | + | let $acc0 = $Tuple2(0, 0) | |
179 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
180 | + | then $a | |
181 | + | else sum($a, $l[$i]) | |
182 | + | ||
183 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
184 | + | then $a | |
185 | + | else throw("List size exceeds 8") | |
186 | + | ||
187 | + | $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) | |
188 | + | } | |
189 | + | (validationData._1 >= verifiersRequired) | |
190 | + | case _ => | |
191 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
192 | + | } | |
12 | 193 |
github/deemru/w8io/169f3d6 34.28 ms ◑