tx · 2yvs7h94JprVLZpYmyDDR84DAABDifeyfyTQpK6ezs5Z 3Mu3rHXsZEzEFRmstTmo2ibxjvaHNd4hU6t: -0.01400000 Waves 2022.05.27 10:04 [2069753] smart account 3Mu3rHXsZEzEFRmstTmo2ibxjvaHNd4hU6t > SELF 0.00000000 Waves
{ "type": 13, "id": "2yvs7h94JprVLZpYmyDDR84DAABDifeyfyTQpK6ezs5Z", "fee": 1400000, "feeAssetId": null, "timestamp": 1653635078575, "version": 2, "chainId": 84, "sender": "3Mu3rHXsZEzEFRmstTmo2ibxjvaHNd4hU6t", "senderPublicKey": "Cn7Ky2YAx4p6dx8e7Mcb9rTQ2Z5TD9MrRbLA8AXDsumJ", "proofs": [ "keNSCmeSDebsWi8dd9MsErKPB7bysT48dhEv7mUYcDC2TmkSxZX9RUfQ8pYRyUe7UTkibjxL9pcbVM5VCng2jrG" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAAUAAAAABXRva2VuAQAAACDbTYM1ZEcblu+fDC+gz33VeZ2S6OGbNQ/BP8x7AnApCwAAAAAFbHBUQ0kBAAAAINwe9E82QQSn4fpmplpgv7lZsVFUrddvc/qDvGp4NjmlAAAAAAlpc1N0b3BwZWQHAAAAAAlrZXlTdGFrZWQCAAAACVNUQUtFRF9MUAAAAAALa2V5Q29tcG91bmQCAAAADUZyb21fQ29tcG91bmQAAAADAAAAAWkBAAAABXN0YWtlAAAAAAQAAAADcG10CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAlwbXRBbW91bnQIBQAAAANwbXQAAAAGYW1vdW50AwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAV0b2tlbgkAAAIAAAABAgAAAB1hdHRhY2ggVVNEVFVTRE5MUCB0b2tlbnMgb25seQMFAAAACWlzU3RvcHBlZAkAAAIAAAABAgAAABlzbWFydCBjb250cmFjdCBpcyBvbiBsb2NrBAAA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RyeQAAAAIFAAAAC2tleUNvbXBvdW5kCQAAZAAAAAIFAAAADGZyb21Db21wb3VuZAUAAAACY2EJAARMAAAAAgUAAAALdXBkYXRlU3RhdGUJAARMAAAAAgUAAAACdGMFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABaQEAAAAEaW5pdAAAAAAEAAAAAnBtCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAJhbQgFAAAAAnBtAAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAAJwbQAAAAdhc3NldElkBQAAAAV0b2tlbgkAAAIAAAABAgAAABBVbmV4cGVjdGVkIHRva2VuBAAAAAFzCQAD/AAAAAQJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVRZQCeTa0sp7r6xoQ7m3EC4z6SNegzrtQ8CAAAABXN0YWtlBQAAAANuaWwJAARMAAAAAgUAAAACcG0FAAAAA25pbAMJAAAAAAAAAgUAAAABcwUAAAABcwQAAAADdXBkCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAJa2V5U3Rha2VkBQAAAAJhbQQAAAAEdXBkSwkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAC2tleUNvbXBvdW5kAAAAAAAAAAAACQAETAAAAAIFAAAAA3VwZAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5LNBa0Q==", "height": 2069753, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4yEFNrXitLRCPT7qGQUjxmcFdNua4vPiXREGixMd6vJD Next: Dp2CpBN8HNfczfKoqiQ4jyh9rLJtwa5jnqTKhJpoZovF Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | else if (isStopped) | |
21 | 21 | then throw("smart contract is on lock") | |
22 | 22 | else { | |
23 | - | let tkStaked = valueOrElse(getInteger(this, keyStaked), | |
23 | + | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
24 | 24 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
25 | - | let updateState = IntegerEntry(keyStaked, ( | |
25 | + | let updateState = IntegerEntry(keyStaked, (tkStaked + pmtAmount)) | |
26 | 26 | if ((updateState == updateState)) | |
27 | 27 | then { | |
28 | 28 | let totalIssued = match assetInfo(lpTCI) { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let token = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS' | |
5 | 5 | ||
6 | 6 | let lpTCI = base58'FpG53PqcPPUmMwjHd2SQrpLPMXYHUBpdoM1ynBbMzsAk' | |
7 | 7 | ||
8 | 8 | let isStopped = false | |
9 | 9 | ||
10 | 10 | let keyStaked = "STAKED_LP" | |
11 | 11 | ||
12 | 12 | let keyCompound = "From_Compound" | |
13 | 13 | ||
14 | 14 | @Callable(i) | |
15 | 15 | func stake () = { | |
16 | 16 | let pmt = value(i.payments[0]) | |
17 | 17 | let pmtAmount = pmt.amount | |
18 | 18 | if ((pmt.assetId != token)) | |
19 | 19 | then throw("attach USDTUSDNLP tokens only") | |
20 | 20 | else if (isStopped) | |
21 | 21 | then throw("smart contract is on lock") | |
22 | 22 | else { | |
23 | - | let tkStaked = valueOrElse(getInteger(this, keyStaked), | |
23 | + | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
24 | 24 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
25 | - | let updateState = IntegerEntry(keyStaked, ( | |
25 | + | let updateState = IntegerEntry(keyStaked, (tkStaked + pmtAmount)) | |
26 | 26 | if ((updateState == updateState)) | |
27 | 27 | then { | |
28 | 28 | let totalIssued = match assetInfo(lpTCI) { | |
29 | 29 | case asset: Asset => | |
30 | 30 | asset.quantity | |
31 | 31 | case _ => | |
32 | 32 | throw("Can't find asset") | |
33 | 33 | } | |
34 | 34 | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
35 | 35 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
36 | 36 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
37 | 37 | if ((LPstake == LPstake)) | |
38 | 38 | then { | |
39 | 39 | let LPIssue = Reissue(lpTCI, toIssue, true) | |
40 | 40 | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
41 | 41 | [LPIssue, transfer, updateState] | |
42 | 42 | } | |
43 | 43 | else throw("Strict value is not equal to itself.") | |
44 | 44 | } | |
45 | 45 | else throw("Strict value is not equal to itself.") | |
46 | 46 | } | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func compound () = { | |
53 | 53 | let compound = value(i.payments[0]) | |
54 | 54 | let ca = compound.amount | |
55 | 55 | if ((compound.assetId != token)) | |
56 | 56 | then throw("attach USDTUSDNLP tokens only") | |
57 | 57 | else { | |
58 | 58 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
59 | 59 | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
60 | 60 | let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound]) | |
61 | 61 | if ((stakeC == stakeC)) | |
62 | 62 | then { | |
63 | 63 | let updateState = IntegerEntry(keyStaked, (totalStaked + ca)) | |
64 | 64 | let tc = IntegerEntry(keyCompound, (fromCompound + ca)) | |
65 | 65 | [updateState, tc] | |
66 | 66 | } | |
67 | 67 | else throw("Strict value is not equal to itself.") | |
68 | 68 | } | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func init () = { | |
75 | 75 | let pm = i.payments[0] | |
76 | 76 | let am = pm.amount | |
77 | 77 | if ((pm.assetId != token)) | |
78 | 78 | then throw("Unexpected token") | |
79 | 79 | else { | |
80 | 80 | let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm]) | |
81 | 81 | if ((s == s)) | |
82 | 82 | then { | |
83 | 83 | let upd = IntegerEntry(keyStaked, am) | |
84 | 84 | let updK = IntegerEntry(keyCompound, 0) | |
85 | 85 | [upd] | |
86 | 86 | } | |
87 | 87 | else throw("Strict value is not equal to itself.") | |
88 | 88 | } | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | @Verifier(tx) | |
93 | 93 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
94 | 94 |
github/deemru/w8io/169f3d6 45.70 ms ◑