tx · 3ZbtYo7mGH38nQpuJ2Q6tcXRV8AAQh3PBiCdRaVs2ren 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH: -0.04000000 Waves 2022.04.18 10:45 [2013716] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves
{ "type": 13, "id": "3ZbtYo7mGH38nQpuJ2Q6tcXRV8AAQh3PBiCdRaVs2ren", "fee": 4000000, "feeAssetId": null, "timestamp": 1650267949960, "version": 2, "chainId": 84, "sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH", "senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm", "proofs": [ "2XKrNQdsZqFmkdEiwJNdSVqQabm4vbYS8VkWcWcPJmx3KRY73LWd7oAF6HW5QJzuEYxeGXB7FJjeHFRVnY6vo8AW" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAwAAAAACSUQBAAAAIP8QR3aaHO4gAEH6GV3RAr44yVLBwb023LSVkrkR45liAAAAAAJMUAEAAAAgVICYp/GT+FfvfSZYAZKhhCXeJCqcu2y/TJ9L8R1cyz8AAAAACWlzU3RvcHBlZAcAAAABAAAAAWkBAAAABXN0YWtlAAAAAAQAAAADcG10CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAlwbXRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAJJRAkAAAIAAAABAgAAABthdHRhY2ggdGVzdE5TQlQgdG9rZW5zIG9ubHkDBQAAAAlpc1N0b3BwZWQJAAACAAAAAQIAAAAZc21hcnQgY29udHJhY3QgaXMgb24gbG9jawQAAAAKaW5UcmVhc3VyeQkAA/AAAAACBQAAAAR0aGlzBQAAAAJJRAQAAAALdG90YWxJc3N1ZWQEAAAAByRtYXRjaDAJAAPsAAAAAQUAAAACTFADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABUFzc2V0BAAAAAVhc3NldAUAAAAHJG1hdGNoMAgFAAAABWFzc2V0AAAACHF1YW50aXR5CQAAAgAAAAECAAAAEENhbid0IGZpbmQgYXNzZXQEAAAACHRyZWFzdXJ5CQAAZQAAAAIFAAAACmluVHJlYXN1cnkFAAAACXBtdEFtb3VudAQAAAAPc2luZ2xlTFBpblZhbHVlCQAAawAAAAMFAAAAC3RvdGFsSXNzdWVkAAAAAAAF9eEABQAAAAh0cmVhc3VyeQQAAAANYW1vdW50VG9Jc3N1ZQkAAGsAAAADBQAAAAlwbXRBbW91bnQFAAAAD3NpbmdsZUxQaW5WYWx1ZQAAAAAABfXhAAQAAAAHTFBJc3N1ZQkBAAAAB1JlaXNzdWUAAAADBQAAAAJMUAUAAAANYW1vdW50VG9Jc3N1ZQYEAAAACHRyYW5zZmVyCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWFtb3VudFRvSXNzdWUFAAAAAkxQCQAETAAAAAIFAAAAB0xQSXNzdWUJAARMAAAAAgUAAAAIdHJhbnNmZXIFAAAAA25pbAAAAAC3NBo5", "height": 2013716, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 57Q27YXxqoJ7a2NsEPnEoiYx9yiigVAtAcFPy6fuZjWw Next: Evxwpbnjv6HUZ31WwLUKLRE8eAwSfQhPP7K3yzudye7X Diff:
Old | New | Differences | |
---|---|---|---|
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | - | ||
37 | - | @Callable(i) | |
38 | - | func withdraw (amount) = { | |
39 | - | let attached = i.payments[0] | |
40 | - | let paymentID = i.payments[0].assetId | |
41 | - | if ((paymentID != LP)) | |
42 | - | then throw("Attach the correct LP token") | |
43 | - | else { | |
44 | - | let newAmount = (attached.amount - amount) | |
45 | - | if ((0 > amount)) | |
46 | - | then throw("Can't withdraw negative amount") | |
47 | - | else if ((0 > newAmount)) | |
48 | - | then throw("Not enough balance") | |
49 | - | else { | |
50 | - | let burning = Burn(LP, amount) | |
51 | - | let transfer = ScriptTransfer(i.caller, newAmount, ID) | |
52 | - | [burning, transfer] | |
53 | - | } | |
54 | - | } | |
55 | - | } | |
56 | - | ||
57 | - | ||
58 | - | @Verifier(tx) | |
59 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
60 | - |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh' | |
5 | 5 | ||
6 | 6 | let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU' | |
7 | 7 | ||
8 | 8 | let isStopped = false | |
9 | 9 | ||
10 | 10 | @Callable(i) | |
11 | 11 | func stake () = { | |
12 | 12 | let pmt = value(i.payments[0]) | |
13 | 13 | let pmtAmount = pmt.amount | |
14 | 14 | if ((pmt.assetId != ID)) | |
15 | 15 | then throw("attach testNSBT tokens only") | |
16 | 16 | else if (isStopped) | |
17 | 17 | then throw("smart contract is on lock") | |
18 | 18 | else { | |
19 | 19 | let inTreasury = assetBalance(this, ID) | |
20 | 20 | let totalIssued = match assetInfo(LP) { | |
21 | 21 | case asset: Asset => | |
22 | 22 | asset.quantity | |
23 | 23 | case _ => | |
24 | 24 | throw("Can't find asset") | |
25 | 25 | } | |
26 | 26 | let treasury = (inTreasury - pmtAmount) | |
27 | 27 | let singleLPinValue = fraction(totalIssued, 100000000, treasury) | |
28 | 28 | let amountToIssue = fraction(pmtAmount, singleLPinValue, 100000000) | |
29 | 29 | let LPIssue = Reissue(LP, amountToIssue, true) | |
30 | 30 | let transfer = ScriptTransfer(i.caller, amountToIssue, LP) | |
31 | 31 | [LPIssue, transfer] | |
32 | 32 | } | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | - | ||
37 | - | @Callable(i) | |
38 | - | func withdraw (amount) = { | |
39 | - | let attached = i.payments[0] | |
40 | - | let paymentID = i.payments[0].assetId | |
41 | - | if ((paymentID != LP)) | |
42 | - | then throw("Attach the correct LP token") | |
43 | - | else { | |
44 | - | let newAmount = (attached.amount - amount) | |
45 | - | if ((0 > amount)) | |
46 | - | then throw("Can't withdraw negative amount") | |
47 | - | else if ((0 > newAmount)) | |
48 | - | then throw("Not enough balance") | |
49 | - | else { | |
50 | - | let burning = Burn(LP, amount) | |
51 | - | let transfer = ScriptTransfer(i.caller, newAmount, ID) | |
52 | - | [burning, transfer] | |
53 | - | } | |
54 | - | } | |
55 | - | } | |
56 | - | ||
57 | - | ||
58 | - | @Verifier(tx) | |
59 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
60 | - |
github/deemru/w8io/169f3d6 66.01 ms ◑