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/MewJwKQsAAAAABWxwVENJAQAAACAaMxpM7J2AkwQeyUXAgj0RTdaP0uNhJJ62DJZuUfMG8AAAAAAJaXNTdG9wcGVkBwAAAAAJa2V5U3Rha2VkAgAAAAlTVEFLRURfTFAAAAAAC2tleUNvbXBvdW5kAgAAAA1Gcm9tX0NvbXBvdW5kAAAAAgAAAAFpAQAAAAVzdGFrZQAAAAAEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAFdG9rZW4JAAACAAAAAQIAAAAdYXR0YWNoIFVTRFRVU0ROTFAgdG9rZW5zIG9ubHkDBQAAAAlpc1N0b3BwZWQJAAACAAAAAQIAAAAZc21hcnQgY29udHJhY3QgaXMgb24gbG9jawQAAAAIdGtTdGF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BQAAAAJjYQQAAAACdGMJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAtrZXlDb21wb3VuZAkAAGQAAAACBQAAAAxmcm9tQ29tcG91bmQFAAAAAmNhCQAETAAAAAIFAAAAC3VwZGF0ZVN0YXRlCQAETAAAAAIFAAAAAnRjBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAANKm07U=", "height": 2058426, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9NnHueLGEi62d3ggwunUKwNLujFro7PbZXVTLqLSZzRE Next: none Diff:
OldNewDifferences
2525 let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount))
2626 if ((updateState == updateState))
2727 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+ }
2934 let forOne = fraction(totalIssued, 100000000, tkStaked)
3035 let toIssue = fraction(pmtAmount, forOne, 100000000)
3136 let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let token = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS'
55
66 let lpTCI = base58'2mGo9byNgTSxPC4J8wXkGkdjhB3Tk3gjGYiiHsyCrnHd'
77
88 let isStopped = false
99
1010 let keyStaked = "STAKED_LP"
1111
1212 let keyCompound = "From_Compound"
1313
1414 @Callable(i)
1515 func stake () = {
1616 let pmt = value(i.payments[0])
1717 let pmtAmount = pmt.amount
1818 if ((pmt.assetId != token))
1919 then throw("attach USDTUSDNLP tokens only")
2020 else if (isStopped)
2121 then throw("smart contract is on lock")
2222 else {
2323 let tkStaked = valueOrElse(getInteger(this, keyStaked), 0)
2424 let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
2525 let updateState = IntegerEntry(keyStaked, (tkStaked + i.payments[0].amount))
2626 if ((updateState == updateState))
2727 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+ }
2934 let forOne = fraction(totalIssued, 100000000, tkStaked)
3035 let toIssue = fraction(pmtAmount, forOne, 100000000)
3136 let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
3237 if ((LPstake == LPstake))
3338 then {
3439 let LPIssue = Reissue(lpTCI, toIssue, true)
3540 let transfer = ScriptTransfer(i.caller, toIssue, lpTCI)
3641 [LPIssue, transfer, updateState]
3742 }
3843 else throw("Strict value is not equal to itself.")
3944 }
4045 else throw("Strict value is not equal to itself.")
4146 }
4247 }
4348
4449
4550
4651 @Callable(i)
4752 func compound () = {
4853 let compound = value(i.payments[0])
4954 let ca = compound.amount
5055 if ((compound.assetId != token))
5156 then throw("attach USDTUSDNLP tokens only")
5257 else {
5358 let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
5459 let totalStaked = valueOrElse(getInteger(this, keyStaked), 0)
5560 let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
5661 if ((stakeC == stakeC))
5762 then {
5863 let updateState = IntegerEntry(keyStaked, (totalStaked + ca))
5964 let tc = IntegerEntry(keyCompound, (fromCompound + ca))
6065 [updateState, tc]
6166 }
6267 else throw("Strict value is not equal to itself.")
6368 }
6469 }
6570
6671

github/deemru/w8io/026f985 
36.18 ms