tx · 9B7X6xuq4JbPov4SZkhnfAhNiDJyeABY3GaZxJpdT8kh
3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH: -0.01400000 Waves
2022.04.08 11:44 [1999365] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves
{
"type": 13,
"id": "9B7X6xuq4JbPov4SZkhnfAhNiDJyeABY3GaZxJpdT8kh",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1649407530722,
"version": 2,
"chainId": 84,
"sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH",
"senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm",
"proofs": [
"P28gP56qFWD8fqxio6vzYkKHj96XPWjKDgaerg16PzwS1RRyveCAWidyeYDGw1Nnpqncy4VWCYCSa71VE231Mvx"
],
"script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACBUgJin8ZP4V+99JlgBkqGEJd4kKpy7bL9Mn0vxHVzLPwAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAt0b3RhbElzc3VlZAQAAAAHJG1hdGNoMAkAA+wAAAABBQAAAAJMUAMJAAABAAAAAgUAAAAHJG1hdGN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AAAAB2J1cm5pbmcJAARMAAAAAgUAAAAIdHJhbnNmZXIFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5hplshQ==",
"height": 1999365,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 9Tjy8L4EeS1CuVwxnmqz39VhdjA8LAcCXaE255FtmUAs
Next: FHaL2fzkoj2hxfjqxuKfyS7k3mhsfdTDZLDYFVx9eiGc
Diff:
Old | New | | Differences |
---|
16 | 16 | | else if (isStopped) |
---|
17 | 17 | | then throw("smart contract is on lock") |
---|
18 | 18 | | else { |
---|
19 | | - | let inTreasury = assetBalance(this, ID) |
---|
20 | | - | let LPIssue = Reissue(LP, inTreasury, true) |
---|
21 | | - | let transfer = ScriptTransfer(i.caller, inTreasury, LP) |
---|
| 19 | + | let totalIssued = match assetInfo(LP) { |
---|
| 20 | + | case asset: Asset => |
---|
| 21 | + | asset.quantity |
---|
| 22 | + | case _ => |
---|
| 23 | + | throw("Can't find asset") |
---|
| 24 | + | } |
---|
| 25 | + | let LPIssue = Reissue(LP, totalIssued, true) |
---|
| 26 | + | let transfer = ScriptTransfer(i.caller, totalIssued, LP) |
---|
22 | 27 | | [LPIssue, transfer] |
---|
23 | 28 | | } |
---|
24 | 29 | | } |
---|
Full:
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 | | - | let inTreasury = assetBalance(this, ID) |
---|
20 | | - | let LPIssue = Reissue(LP, inTreasury, true) |
---|
21 | | - | let transfer = ScriptTransfer(i.caller, inTreasury, LP) |
---|
| 19 | + | let totalIssued = match assetInfo(LP) { |
---|
| 20 | + | case asset: Asset => |
---|
| 21 | + | asset.quantity |
---|
| 22 | + | case _ => |
---|
| 23 | + | throw("Can't find asset") |
---|
| 24 | + | } |
---|
| 25 | + | let LPIssue = Reissue(LP, totalIssued, true) |
---|
| 26 | + | let transfer = ScriptTransfer(i.caller, totalIssued, LP) |
---|
22 | 27 | | [LPIssue, transfer] |
---|
23 | 28 | | } |
---|
24 | 29 | | } |
---|
25 | 30 | | |
---|
26 | 31 | | |
---|
27 | 32 | | |
---|
28 | 33 | | @Callable(i) |
---|
29 | 34 | | func withdraw (amount) = { |
---|
30 | 35 | | let attached = i.payments[0] |
---|
31 | 36 | | let paymentID = i.payments[0].assetId |
---|
32 | 37 | | if ((paymentID != LP)) |
---|
33 | 38 | | then throw("Attach the correct LP token") |
---|
34 | 39 | | else { |
---|
35 | 40 | | let newAmount = (attached.amount - amount) |
---|
36 | 41 | | if ((0 > amount)) |
---|
37 | 42 | | then throw("Can't withdraw negative amount") |
---|
38 | 43 | | else if ((0 > newAmount)) |
---|
39 | 44 | | then throw("Not enough balance") |
---|
40 | 45 | | else { |
---|
41 | 46 | | let burning = Burn(LP, amount) |
---|
42 | 47 | | let transfer = ScriptTransfer(i.caller, newAmount, ID) |
---|
43 | 48 | | [burning, transfer] |
---|
44 | 49 | | } |
---|
45 | 50 | | } |
---|
46 | 51 | | } |
---|
47 | 52 | | |
---|
48 | 53 | | |
---|
49 | 54 | | @Verifier(tx) |
---|
50 | 55 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
51 | 56 | | |
---|