tx · 7nT47dFUt85V6BUwnrfgjbojVw2BEJQA3CCiZTadF2LH

3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH:  -0.01400000 Waves

2022.04.08 15:50 [1999617] smart account 3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH > SELF 0.00000000 Waves

{ "type": 13, "id": "7nT47dFUt85V6BUwnrfgjbojVw2BEJQA3CCiZTadF2LH", "fee": 1400000, "feeAssetId": null, "timestamp": 1649422277585, "version": 2, "chainId": 84, "sender": "3Mv7nXq2V2Dnn9oSkB5feRt6RxtqnPiAXNH", "senderPublicKey": "HJ4JLtArYaaiBiWho6gzLRbKUVM6ZVTaKmci6sgFQtEm", "proofs": [ "3ir3QZCcvH92CeyJ7uiQsNasw6zv4DDrTdbFcTUbcVDgDxgkNAMtF7payPZ4endGULtaoAdvruSQPBmWskaWY765" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAwAAAAACSUQBAAAAAAAAAAACTFABAAAAAAAAAAAJaXNTdG9wcGVkBwAAAAEAAAABaQEAAAAFc3Rha2UAAAAABAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACXBtdEFtb3VudAgFAAAAA3BtdAAAAAZhbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAAAklECQAAAgAAAAECAAAAG2F0dGFjaCB0ZXN0TlNCVCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAAAAppblRyZWFzdXJ5CQAD8AAAAAIFAAAABHRoaXMFAAAAAklEBAAAAAt0b3RhbElzc3VlZAQAAAAHJG1hdGNoMAkAA+wAAAABBQAAAAJMUAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAFQXNzZXQEAAAABWFzc2V0BQAAAAckbWF0Y2gwCAUAAAAFYXNzZXQAAAAIcXVhbnRpdHkJAAACAAAAAQIAAAAQQ2FuJ3QgZmluZCBhc3NldAQAAAAHdG9Jc3N1ZQkAAGkAAAACBQAAAAppblRyZWFzdXJ5BQAAAAt0b3RhbElzc3VlZAkABEwAAAACCQEAAAAHUmVpc3N1ZQAAAAMFAAAAAkxQBQAAAAd0b0lzc3VlBgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAB3RvSXNzdWUFAAAAAkxQBQAAAANuaWwAAAAAgl0f+w==", "height": 1999617, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 57e4EAmJV1U94T2inp1oycCAviJHcpQZJnwzkd7JgUam Next: AHsRxHZqML38ooraMUyBNd5Xf2x4W8BF8o9MCj7dLqZy Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh'
4+let ID = base58''
55
6-let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU'
6+let LP = base58''
77
88 let isStopped = false
99
1717 then throw("smart contract is on lock")
1818 else {
1919 let inTreasury = assetBalance(this, ID)
20- let totalIssued = IntegerEntry("6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU", 100)
21- let test = totalIssued.value
22- let singleLPinValue = (test / inTreasury)
23- let LPIssue = Reissue(LP, singleLPinValue, true)
24- let transfer = ScriptTransfer(i.caller, singleLPinValue, LP)
25-[LPIssue, transfer]
20+ let totalIssued = match assetInfo(LP) {
21+ case asset: Asset =>
22+ asset.quantity
23+ case _ =>
24+ throw("Can't find asset")
25+ }
26+ let toIssue = (inTreasury / totalIssued)
27+[Reissue(LP, toIssue, true), ScriptTransfer(i.caller, toIssue, LP)]
2628 }
2729 }
2830
29-
30-
31-@Callable(i)
32-func withdraw (amount) = {
33- let attached = i.payments[0]
34- let paymentID = i.payments[0].assetId
35- if ((paymentID != LP))
36- then throw("Attach the correct LP token")
37- else {
38- let newAmount = (attached.amount - amount)
39- if ((0 > amount))
40- then throw("Can't withdraw negative amount")
41- else if ((0 > newAmount))
42- then throw("Not enough balance")
43- else {
44- let burning = Burn(LP, amount)
45- let transfer = ScriptTransfer(i.caller, newAmount, ID)
46-[burning, transfer]
47- }
48- }
49- }
50-
51-
52-@Verifier(tx)
53-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5431
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let ID = base58'JAfMu2seKNzTVfqi5w5Pjh4kwwPTZPCEFpc2q2vDyFeh'
4+let ID = base58''
55
6-let LP = base58'6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU'
6+let LP = base58''
77
88 let isStopped = false
99
1010 @Callable(i)
1111 func stake () = {
1212 let pmt = i.payments[0]
1313 let pmtAmount = pmt.amount
1414 if ((pmt.assetId != ID))
1515 then throw("attach testNSBT tokens only")
1616 else if (isStopped)
1717 then throw("smart contract is on lock")
1818 else {
1919 let inTreasury = assetBalance(this, ID)
20- let totalIssued = IntegerEntry("6gryiTrJoLkNzBtZLVBuCyCvnxPY77TVUS2ouYYjjVTU", 100)
21- let test = totalIssued.value
22- let singleLPinValue = (test / inTreasury)
23- let LPIssue = Reissue(LP, singleLPinValue, true)
24- let transfer = ScriptTransfer(i.caller, singleLPinValue, LP)
25-[LPIssue, transfer]
20+ let totalIssued = match assetInfo(LP) {
21+ case asset: Asset =>
22+ asset.quantity
23+ case _ =>
24+ throw("Can't find asset")
25+ }
26+ let toIssue = (inTreasury / totalIssued)
27+[Reissue(LP, toIssue, true), ScriptTransfer(i.caller, toIssue, LP)]
2628 }
2729 }
2830
29-
30-
31-@Callable(i)
32-func withdraw (amount) = {
33- let attached = i.payments[0]
34- let paymentID = i.payments[0].assetId
35- if ((paymentID != LP))
36- then throw("Attach the correct LP token")
37- else {
38- let newAmount = (attached.amount - amount)
39- if ((0 > amount))
40- then throw("Can't withdraw negative amount")
41- else if ((0 > newAmount))
42- then throw("Not enough balance")
43- else {
44- let burning = Burn(LP, amount)
45- let transfer = ScriptTransfer(i.caller, newAmount, ID)
46-[burning, transfer]
47- }
48- }
49- }
50-
51-
52-@Verifier(tx)
53-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5431

github/deemru/w8io/026f985 
34.34 ms