tx · GLQGCerPZxBeq6T51izriESQFkkfBux6QFDu22QfovYb 3MwBGvHwMsCkfpjNczpKyPwjZn8kguZc1aT: -0.04000000 Waves 2022.05.19 13:20 [2058426] smart account 3MwBGvHwMsCkfpjNczpKyPwjZn8kguZc1aT > SELF 0.00000000 Waves
{ "type": 13, "id": "GLQGCerPZxBeq6T51izriESQFkkfBux6QFDu22QfovYb", "fee": 4000000, "feeAssetId": null, "timestamp": 1652955637296, "version": 2, "chainId": 84, "sender": "3MwBGvHwMsCkfpjNczpKyPwjZn8kguZc1aT", "senderPublicKey": "HR6KqHHmjzGx8fdbFkG9LMHCiNx2t8ExYHP5fWMomCJu", "proofs": [ "62LvyXc5QvtPLzb1rWDBLioECbVRX7vB8m9XzR9hxmvg3N5Ec5m9dhJwkiGKrpeGp8EpZCLEXMLeRvGxwsDuKQpU" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAFAAAAAAV0b2tlbgEAAAAg202DNWRHG5bvnwwvoM991XmdkujhmzUPwT/MewJwKQsAAAAABWxwVENJAQAAACAaMxpM7J2AkwQeyUXAgj0RTdaP0uNhJJ62DJZuUfMG8AAAAAAJaXNTdG9wcGVkBwAAAAAJa2V5U3Rha2VkAgAAAAlTVEFLRURfTFAAAAAAC2tleUNvbXBvdW5kAgAAAA1Gcm9tX0NvbXBvdW5kAAAAAgAAAAFpAQAAAAVzdGFrZQAAAAAEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAFdG9rZW4JAAACAAAAAQIAAAAdYXR0YWNoIFVTRFRVU0ROTFAgdG9rZW5zIG9ubHkDBQAAAAlpc1N0b3BwZWQJAAACAAAAAQIAAAAZc21hcnQgY29udHJhY3QgaXMgb24gbG9jawQAAAAIdGtTdGFr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QAAAAJjYQQAAAACdGMJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAtrZXlDb21wb3VuZAkAAGQAAAACBQAAAAxmcm9tQ29tcG91bmQFAAAAAmNhCQAETAAAAAIFAAAAC3VwZGF0ZVN0YXRlCQAETAAAAAIFAAAAAnRjBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAANKm07U=", "height": 2058426, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9NnHueLGEi62d3ggwunUKwNLujFro7PbZXVTLqLSZzRE Next: none Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount)) | |
26 | 26 | if ((updateState == updateState)) | |
27 | 27 | then { | |
28 | - | let totalIssued = (tkStaked - fromCompound) | |
28 | + | let totalIssued = match assetInfo(lpTCI) { | |
29 | + | case asset: Asset => | |
30 | + | asset.quantity | |
31 | + | case _ => | |
32 | + | throw("Can't find asset") | |
33 | + | } | |
29 | 34 | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
30 | 35 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
31 | 36 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) |
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'2mGo9byNgTSxPC4J8wXkGkdjhB3Tk3gjGYiiHsyCrnHd' | |
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 | 23 | let tkStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
24 | 24 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
25 | 25 | let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount)) | |
26 | 26 | if ((updateState == updateState)) | |
27 | 27 | then { | |
28 | - | let totalIssued = (tkStaked - fromCompound) | |
28 | + | let totalIssued = match assetInfo(lpTCI) { | |
29 | + | case asset: Asset => | |
30 | + | asset.quantity | |
31 | + | case _ => | |
32 | + | throw("Can't find asset") | |
33 | + | } | |
29 | 34 | let forOne = fraction(totalIssued, 100000000, tkStaked) | |
30 | 35 | let toIssue = fraction(pmtAmount, forOne, 100000000) | |
31 | 36 | let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt]) | |
32 | 37 | if ((LPstake == LPstake)) | |
33 | 38 | then { | |
34 | 39 | let LPIssue = Reissue(lpTCI, toIssue, true) | |
35 | 40 | let transfer = ScriptTransfer(i.caller, toIssue, lpTCI) | |
36 | 41 | [LPIssue, transfer, updateState] | |
37 | 42 | } | |
38 | 43 | else throw("Strict value is not equal to itself.") | |
39 | 44 | } | |
40 | 45 | else throw("Strict value is not equal to itself.") | |
41 | 46 | } | |
42 | 47 | } | |
43 | 48 | ||
44 | 49 | ||
45 | 50 | ||
46 | 51 | @Callable(i) | |
47 | 52 | func compound () = { | |
48 | 53 | let compound = value(i.payments[0]) | |
49 | 54 | let ca = compound.amount | |
50 | 55 | if ((compound.assetId != token)) | |
51 | 56 | then throw("attach USDTUSDNLP tokens only") | |
52 | 57 | else { | |
53 | 58 | let fromCompound = valueOrElse(getInteger(this, keyCompound), 0) | |
54 | 59 | let totalStaked = valueOrElse(getInteger(this, keyStaked), 0) | |
55 | 60 | let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound]) | |
56 | 61 | if ((stakeC == stakeC)) | |
57 | 62 | then { | |
58 | 63 | let updateState = IntegerEntry(keyStaked, (totalStaked + ca)) | |
59 | 64 | let tc = IntegerEntry(keyCompound, (fromCompound + ca)) | |
60 | 65 | [updateState, tc] | |
61 | 66 | } | |
62 | 67 | else throw("Strict value is not equal to itself.") | |
63 | 68 | } | |
64 | 69 | } | |
65 | 70 | ||
66 | 71 |
github/deemru/w8io/026f985 36.18 ms ◑