tx · HHmywmAdYwcHsWQgfSERHMQKPayCVCPEuNAYpmMXqUqj

3N1ieY2sKqxquEPj49qPCZjZxs4jdCnr5Ts:  -0.01000000 Waves

2023.09.14 12:06 [2754855] smart account 3N1ieY2sKqxquEPj49qPCZjZxs4jdCnr5Ts > SELF 0.00000000 Waves

{ "type": 13, "id": "HHmywmAdYwcHsWQgfSERHMQKPayCVCPEuNAYpmMXqUqj", "fee": 1000000, "feeAssetId": null, "timestamp": 1694682404474, "version": 2, "chainId": 84, "sender": "3N1ieY2sKqxquEPj49qPCZjZxs4jdCnr5Ts", "senderPublicKey": "43uoprU8ciZpQxjuyk8cMBcENJCDLR3CT3suBZhcEy54", "proofs": [ "5XJ94os53H9GXP1UpReh524utKqjyPUQcALUn4sFyrTGfFEX1NfpkRk9i17AbvrhKCL548yTBFZFqi7VX432gmHB" ], "script": "base64:BgINCAISAwoBARIECgIBAQUAEGN1cnJlbnRMb2NrSWRLZXkCDWN1cnJlbnRMb2NrSWQAA1NFUAICX18BCWFzUGF5bWVudAEBdgQHJG1hdGNoMAUBdgMJAAECBQckbWF0Y2gwAg9BdHRhY2hlZFBheW1lbnQEAXAFByRtYXRjaDAFAXAJAAIBAiFmYWlsIHRvIGNhc3QgaW50byBBdHRhY2hlZFBheW1lbnQBDGFzQnl0ZVZlY3RvcgEBdgQHJG1hdGNoMAUBdgMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFwBQckbWF0Y2gwBQFwCQACAQIcZmFpbCB0byBjYXN0IGludG8gQnl0ZVZlY3RvcgEGa2V5SWRzAQdhZGRyZXNzCQCsAgIJAKwCAgUHYWRkcmVzcwUDU0VQAgNpZHMCAWkBBGxvY2sBFHBlckJsb2NrVW5sb2NrQW1vdW50AwkBAiE9AgkAkAMBCAUBaQhwYXltZW50cwABCQACAQIUT25lIFBheW1lbnQgZXhwZWN0ZWQEB3BheW1lbnQJAQlhc1BheW1lbnQBCQCRAwIIBQFpCHBheW1lbnRzAAADCQBnAgAACAU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aWxhYmxlQW1vdW50CQACAQkArAICAjZSZXF1ZXN0ZWQgYW1vdW50IGlzIHR3byBiaWcsIG1heCBhdmFpbGFibGUgYW1vdW50IGlzOiAJAKQDAQUPYXZhaWxhYmxlQW1vdW50AwkAZgIFBmFtb3VudAUQcmVtYWluaW5nQmFsYW5jZQkAAgEJAKwCAgI2UmVxdWVzdGVkIGFtb3VudCBpcyB0d28gYmlnLCBtYXggYXZhaWxhYmxlIGFtb3VudCBpczogCQCkAwEFEHJlbWFpbmluZ0JhbGFuY2UEB25ld0RhdGEJAKwCAgkArAICCQCsAgIJAKwCAgkArAICCQCsAgIJAKwCAgkArAICCQCkAwEFDHN0b3JlZEhlaWdodAUDU0VQCQCkAwEFDHN0b3JlZEFtb3VudAUDU0VQCQCkAwEJAGQCBRFzdG9yZWRUYWtlZEFtb3VudAUGYW1vdW50BQNTRVAJAKQDAQUac3RvcmVkUGVyQmxvY2tVbmxvY2tBbW91bnQFA1NFUAUNc3RvcmVkQXNzZXRJZAQRYXNzZXRJZFRvVHJhbnNmZXIDCQAAAgUNc3RvcmVkQXNzZXRJZAIFV0FWRVMFBHVuaXQJANkEAQUNc3RvcmVkQXNzZXRJZAkAzAgCCQELU3RyaW5nRW50cnkCBQNrZXkFB25ld0RhdGEJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwgFAWkGY2FsbGVyBQZhbW91bnQFEWFzc2V0SWRUb1RyYW5zZmVyBQNuaWwBAnR4AQZ2ZXJpZnkAB3WVpZA=", "height": 2754855, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let currentLockIdKey = "currentLockId"
5+
6+let SEP = "__"
7+
8+func asPayment (v) = match v {
9+ case p: AttachedPayment =>
10+ p
11+ case _ =>
12+ throw("fail to cast into AttachedPayment")
13+}
14+
15+
16+func asByteVector (v) = match v {
17+ case p: ByteVector =>
18+ p
19+ case _ =>
20+ throw("fail to cast into ByteVector")
21+}
22+
23+
24+func keyIds (address) = ((address + SEP) + "ids")
25+
26+
27+@Callable(i)
28+func lock (perBlockUnlockAmount) = if ((size(i.payments) != 1))
29+ then throw("One Payment expected")
30+ else {
31+ let payment = asPayment(i.payments[0])
32+ if ((0 >= payment.amount))
33+ then throw("Amount must be positive")
34+ else {
35+ let currentLockId = valueOrElse(getInteger(currentLockIdKey), 0)
36+ let callerAddressString = toBase58String(i.caller.bytes)
37+ let paymentAssetIdString = if (!(isDefined(payment.assetId)))
38+ then "WAVES"
39+ else toBase58String(asByteVector(payment.assetId))
40+ let key = ((callerAddressString + SEP) + toString(currentLockId))
41+ let data = ((((((((toString(height) + SEP) + toString(payment.amount)) + SEP) + "0") + SEP) + toString(perBlockUnlockAmount)) + SEP) + paymentAssetIdString)
42+ let previosUserIds = valueOrElse(getString(keyIds(callerAddressString)), "")
43+ let newUserIds = if ((size(previosUserIds) == 0))
44+ then toString(currentLockId)
45+ else ((previosUserIds + SEP) + toString(currentLockId))
46+[StringEntry(key, data), StringEntry(keyIds(callerAddressString), newUserIds), IntegerEntry(currentLockIdKey, (currentLockId + 1))]
47+ }
48+ }
49+
50+
51+
52+@Callable(i)
53+func withdraw (amount,lockId) = if (if ((0 >= amount))
54+ then true
55+ else (0 > lockId))
56+ then throw("Amount must be positive or wrong lock id")
57+ else {
58+ let callerAddressString = toBase58String(i.caller.bytes)
59+ let key = ((callerAddressString + SEP) + toString(lockId))
60+ let dataArray = split(getStringValue(key), SEP)
61+ if ((size(dataArray) != 5))
62+ then throw("Internal error")
63+ else {
64+ let storedHeight = parseIntValue(dataArray[0])
65+ let storedAmount = parseIntValue(dataArray[1])
66+ let storedTakedAmount = parseIntValue(dataArray[2])
67+ let storedPerBlockUnlockAmount = parseIntValue(dataArray[3])
68+ let storedAssetId = dataArray[4]
69+ let heightsDiffs = (height - storedHeight)
70+ let remainingBalance = (storedAmount - storedTakedAmount)
71+ if ((0 >= remainingBalance))
72+ then throw("All vesting sum taked")
73+ else {
74+ let availableAmount = ((storedPerBlockUnlockAmount * heightsDiffs) - storedTakedAmount)
75+ if ((amount > availableAmount))
76+ then throw(("Requested amount is two big, max available amount is: " + toString(availableAmount)))
77+ else if ((amount > remainingBalance))
78+ then throw(("Requested amount is two big, max available amount is: " + toString(remainingBalance)))
79+ else {
80+ let newData = ((((((((toString(storedHeight) + SEP) + toString(storedAmount)) + SEP) + toString((storedTakedAmount + amount))) + SEP) + toString(storedPerBlockUnlockAmount)) + SEP) + storedAssetId)
81+ let assetIdToTransfer = if ((storedAssetId == "WAVES"))
82+ then unit
83+ else fromBase58String(storedAssetId)
84+[StringEntry(key, newData), ScriptTransfer(i.caller, amount, assetIdToTransfer)]
85+ }
86+ }
87+ }
88+ }
89+
90+
91+@Verifier(tx)
92+func verify () = false
93+

github/deemru/w8io/169f3d6 
17.67 ms