tx · 6yFyFmNhQ5UkNKSuqdCefRqLHJutuipHukjHWr2sY9av 3MtbJcg9NWusk8HEjh99rTWUEQJcwkb4VLf: -0.01400000 Waves 2021.02.06 15:27 [1386341] smart account 3MtbJcg9NWusk8HEjh99rTWUEQJcwkb4VLf > SELF 0.00000000 Waves
{ "type": 13, "id": "6yFyFmNhQ5UkNKSuqdCefRqLHJutuipHukjHWr2sY9av", "fee": 1400000, "feeAssetId": null, "timestamp": 1612614515626, "version": 2, "chainId": 84, "sender": "3MtbJcg9NWusk8HEjh99rTWUEQJcwkb4VLf", "senderPublicKey": "4uDrWT1LHZDaY7qPR8P1nq5zwUrhNs7cds7yv9dUv25E", "proofs": [ "2X8ZuX8sLRzcBbisJKwjtYjETKrN4mfAU5jEKZAg21q1kDpAbp1CxL1vFkckCZEasRxWoWNkhdmRCW8KxBufqXeM" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAtkZXBvc2l0REVGSQAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAAdhc3NldGlkAQAAACDpKWmZsanC+ko3hajVyuy5b9MC0yIR9PNWrsZlaZuHqQMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAHYXNzZXRpZAkAAAIAAAABAgAAAEhLaW5kbHkgRGVwb3NpdCBPbmx5IEdoQWN1TERvRVR3Rm9vUGh1cWtkVkFyVU03WTdWcVpWYlVYa0ZwTUFjZzlOIChERUZJKS4EAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAA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AAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAjQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgREVGSSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABdOb3QgZW5vdWdoIERFRkkgYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAUVG90YWxfVG9rZW5zX0xvY2tlZDoFAAAACW5ld0Ftb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGgAAAACBQAAAAZhbW91bnQAAAAAAAX14QABAAAAIOkpaZmxqcL6SjeFqNXK7Llv0wLTIhH081auxmVpm4epCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGkAAAACCQAAaAAAAAIJAABoAAAAAgUAAAAEZGlmZgUAAAAGYW1vdW50AAAAAAAAAAAEAAAAAAAAAAWgBQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlD9/PC", "height": 1386341, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BhDJ8GZjSHHCE4MTP4G6VjtLL2tD68FRdoxar1LP8Tjd Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func call () = { | |
8 | - | let asset = Issue("Asset", "", 1, 0, true, unit, 0) | |
9 | - | let assetId = calculateAssetId(asset) | |
10 | - | [asset, ScriptTransfer(i.caller, 1, assetId)] | |
7 | + | func depositDEFI () = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | let assetid = base58'GhAcuLDoETwFooPhuqkdVArUM7Y7VqZVbUXkFpMAcg9N' | |
10 | + | if ((pmt.assetId != assetid)) | |
11 | + | then throw("Kindly Deposit Only GhAcuLDoETwFooPhuqkdVArUM7Y7VqZVbUXkFpMAcg9N (DEFI).") | |
12 | + | else { | |
13 | + | let currentKey = toBase58String(i.caller.bytes) | |
14 | + | let currentAmount = match getInteger(this, currentKey) { | |
15 | + | case a: Int => | |
16 | + | a | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
20 | + | let newAmount = (currentAmount + pmt.amount) | |
21 | + | let useramount = DataEntry(currentKey, newAmount) | |
22 | + | let userdepositheight = DataEntry(("Deposit_Height_Of_" + currentKey), height) | |
23 | + | let TLV = DataEntry("Total_Tokens_Locked:", newAmount) | |
24 | + | WriteSet([useramount, userdepositheight, TLV]) | |
25 | + | } | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | @Callable(i) | |
31 | + | func withdrawDEFI (amount) = { | |
32 | + | let currentKey = toBase58String(i.caller.bytes) | |
33 | + | let currentAmount = match getInteger(this, currentKey) { | |
34 | + | case a: Int => | |
35 | + | a | |
36 | + | case _ => | |
37 | + | 0 | |
38 | + | } | |
39 | + | let newAmount = (currentAmount - (amount * 100000000)) | |
40 | + | let swapheightkeyname = ("Deposit_Height_Of_" + currentKey) | |
41 | + | let diff = (height - extract(getInteger(this, swapheightkeyname))) | |
42 | + | if ((0 > amount)) | |
43 | + | then throw("Can't withdraw negative DEFI amount") | |
44 | + | else if ((0 > newAmount)) | |
45 | + | then throw("Not enough DEFI balance") | |
46 | + | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount), DataEntry("Total_Tokens_Locked:", newAmount)]), TransferSet([ScriptTransfer(i.caller, (amount * 100000000), base58'GhAcuLDoETwFooPhuqkdVArUM7Y7VqZVbUXkFpMAcg9N'), ScriptTransfer(i.caller, (((diff * amount) * 4) / 1440), unit)])) | |
11 | 47 | } | |
12 | 48 | ||
13 | 49 | ||
14 | 50 | @Verifier(tx) | |
15 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
51 | + | func verify () = match tx { | |
52 | + | case _ => | |
53 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
54 | + | } | |
16 | 55 |
github/deemru/w8io/026f985 22.87 ms ◑