tx · GzGaACPWBRoSQKG12xpRQoACv3FwnVurupSwnH7bhMxR
3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH: -0.04000000 Waves
2022.04.11 12:29 [2003750] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves
{
"type": 13,
"id": "GzGaACPWBRoSQKG12xpRQoACv3FwnVurupSwnH7bhMxR",
"fee": 4000000,
"feeAssetId": null,
"timestamp": 1649669432869,
"version": 2,
"chainId": 84,
"sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH",
"senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm",
"proofs": [
"5VQTBHrqmcBJ8RnLh37oK4NRot7n6AH5upWzUuhsfqeQG3cFFe4bLQTQRUaGWqBw52Xbd6K1EmCe3QgWWij51hzy"
],
"script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAADAAAAAAJJRAEAAAAg/xBHdpoc7iAAQfoZXdECvjjJUsHBvTbctJWSuRHjmWIAAAAAAkxQAQAAACBUgJin8ZP4V+99JlgBkqGEJd4kKpy7bL9Mn0vxHVzLPwAAAAAJaXNTdG9wcGVkBwAAAAIAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAQAAAAV2YWx1ZQAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAQAAAAHJG1h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ACW5ld0Ftb3VudAUAAAACSUQJAARMAAAAAgUAAAAHYnVybmluZwkABEwAAAACBQAAAAh0cmFuc2ZlcgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmCRYmV",
"height": 2003750,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 5vBEr9z1cVoKURowEEEcPqpxB4CScrZVaJvuCZYmyMb1
Next: ECgz6fY4eSvFxiAfJws3aGFpwh5pHJBMuWNNWJHAQemd
Diff:
Old | New | | Differences |
---|
10 | 10 | | @Callable(i) |
---|
11 | 11 | | func stake () = { |
---|
12 | 12 | | let pmt = value(i.payments[0]) |
---|
13 | | - | let pmtAmount = ((18 * pmt.amount) / 10) |
---|
| 13 | + | let pmtAmount = pmt.amount |
---|
14 | 14 | | if ((pmt.assetId != ID)) |
---|
15 | 15 | | then throw("attach testNSBT tokens only") |
---|
16 | 16 | | else if (isStopped) |
---|
|
23 | 23 | | case _ => |
---|
24 | 24 | | throw("Can't find asset") |
---|
25 | 25 | | } |
---|
26 | | - | let singleLPinValue = (inTreasury / totalIssued) |
---|
27 | | - | let LPIssue = Reissue(LP, singleLPinValue, true) |
---|
28 | | - | let transfer = ScriptTransfer(i.caller, singleLPinValue, LP) |
---|
| 26 | + | let LPIssue = Reissue(LP, pmtAmount, true) |
---|
| 27 | + | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) |
---|
29 | 28 | | [LPIssue, transfer] |
---|
30 | 29 | | } |
---|
31 | 30 | | } |
---|
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 | | - | let pmtAmount = ((18 * pmt.amount) / 10) |
---|
| 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 | | - | let singleLPinValue = (inTreasury / totalIssued) |
---|
27 | | - | let LPIssue = Reissue(LP, singleLPinValue, true) |
---|
28 | | - | let transfer = ScriptTransfer(i.caller, singleLPinValue, LP) |
---|
| 26 | + | let LPIssue = Reissue(LP, pmtAmount, true) |
---|
| 27 | + | let transfer = ScriptTransfer(i.caller, pmtAmount, LP) |
---|
29 | 28 | | [LPIssue, transfer] |
---|
30 | 29 | | } |
---|
31 | 30 | | } |
---|
32 | 31 | | |
---|
33 | 32 | | |
---|
34 | 33 | | |
---|
35 | 34 | | @Callable(i) |
---|
36 | 35 | | func withdraw (amount) = { |
---|
37 | 36 | | let attached = i.payments[0] |
---|
38 | 37 | | let paymentID = i.payments[0].assetId |
---|
39 | 38 | | if ((paymentID != LP)) |
---|
40 | 39 | | then throw("Attach the correct LP token") |
---|
41 | 40 | | else { |
---|
42 | 41 | | let newAmount = (attached.amount - amount) |
---|
43 | 42 | | if ((0 > amount)) |
---|
44 | 43 | | then throw("Can't withdraw negative amount") |
---|
45 | 44 | | else if ((0 > newAmount)) |
---|
46 | 45 | | then throw("Not enough balance") |
---|
47 | 46 | | else { |
---|
48 | 47 | | let burning = Burn(LP, amount) |
---|
49 | 48 | | let transfer = ScriptTransfer(i.caller, newAmount, ID) |
---|
50 | 49 | | [burning, transfer] |
---|
51 | 50 | | } |
---|
52 | 51 | | } |
---|
53 | 52 | | } |
---|
54 | 53 | | |
---|
55 | 54 | | |
---|
56 | 55 | | @Verifier(tx) |
---|
57 | 56 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
58 | 57 | | |
---|