tx · A5G4PTzE2uJaFqfd2zS8NkoMZQ39jqMgeiiUKKZMbCMC

3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so:  -0.04000000 Waves

2022.05.20 12:43 [2059830] smart account 3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so > SELF 0.00000000 Waves

{ "type": 13, "id": "A5G4PTzE2uJaFqfd2zS8NkoMZQ39jqMgeiiUKKZMbCMC", "fee": 4000000, "feeAssetId": null, "timestamp": 1653039804816, "version": 2, "chainId": 84, "sender": "3NAVJcqMw8AsPecAtd74CeNtAG2qRV2V1so", "senderPublicKey": "EpvN8tsbEWeeqZSLaEVCda8PZfKa1JAF3ZFp7hRq1gWj", "proofs": [ "21zAQjD7V6KSU9bZr89BUAqKVQmiUYC7KrdfFNQt2bJi35hujhhGvLLe2yjRUnF18aHfMqA7srSMSwAMWQLiTTAU" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAGAAAAAAV0b2tlbgEAAAAg202DNWRHG5bvnwwvoM991XmdkujhmzUPwT/MewJwKQsAAAAABWxwVENJAQAAACBYukfmA8VHrjQiYf9ySqYH4A864xu2rNSaNwUvI60S5AAAAAAJaXNTdG9wcGVkBwAAAAAJa2V5U3Rha2VkAgAAAAlTVEFLRURfTFAAAAAAC2tleUNvbXBvdW5kAgAAAA1Gcm9tX0NvbXBvdW5kAAAAAARkZWZWAAAAAAAF9eEAAAAAAgAAAAFpAQAAAAVzdGFrZQAAAAAEAAAAA3BtdAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAJcG10QW1vdW50CAUAAAADcG10AAAABmFtb3VudAMJAQAAAAIhPQAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAFdG9rZW4JAAACAAAAAQIAAAAdYXR0YWNoIFVTRFRVU0ROTFAgdG9rZW5zIG9ubHkDBQAAAAlpc1N0b3BwZWQJAAACAAAAAQIAAAAZc21hcnQgY29udHJh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AAABnN0YWtlQwUAAAAGc3Rha2VDBAAAAAt1cGRhdGVTdGF0ZQkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACWtleVN0YWtlZAkAAGQAAAACBQAAAAt0b3RhbFN0YWtlZAUAAAACY2EEAAAAAnRjCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAALa2V5Q29tcG91bmQJAABkAAAAAgUAAAAMZnJvbUNvbXBvdW5kBQAAAAJjYQkABEwAAAACBQAAAAt1cGRhdGVTdGF0ZQkABEwAAAACBQAAAAJ0YwUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5e4HdMg==", "height": 2059830, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CmhLjTuBTwxcDRvyLgtfsoscSVJ7cm5L9bqhA6WSeHBA Next: C1DwMPrJFmsBBEUBAykuueWXABRbe9rUzoqTEPVAHKsG Diff:
OldNewDifferences
2222 else if (isStopped)
2323 then throw("smart contract is on lock")
2424 else {
25- let tkStaked = valueOrElse(getInteger(this, keyStaked), defV)
25+ let tkStaked = match getInteger(this, keyStaked) {
26+ case n: Int =>
27+ n
28+ case _ =>
29+ assetBalance(this, token)
30+ }
2631 let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
2732 let updateState = IntegerEntry(keyStaked, ((tkStaked + i.payments[0].amount) - defV))
2833 if ((updateState == updateState))
29- then if ((updateState == updateState))
30- then {
31- let totalIssued = match assetInfo(lpTCI) {
32- case asset: Asset =>
33- asset.quantity
34- case _ =>
35- throw("Can't find asset")
36- }
37- let forOne = fraction(totalIssued, 100000000, tkStaked)
38- let toIssue = fraction(pmtAmount, forOne, 100000000)
39- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
40- if ((LPstake == LPstake))
41- then {
42- let LPIssue = Reissue(lpTCI, toIssue, true)
43- let transfer = ScriptTransfer(i.caller, toIssue, lpTCI)
34+ then {
35+ let totalIssued = match assetInfo(lpTCI) {
36+ case asset: Asset =>
37+ asset.quantity
38+ case _ =>
39+ throw("Can't find asset")
40+ }
41+ let forOne = fraction(totalIssued, 100000000, tkStaked)
42+ let toIssue = fraction(pmtAmount, forOne, 100000000)
43+ let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
44+ if ((LPstake == LPstake))
45+ then {
46+ let LPIssue = Reissue(lpTCI, toIssue, true)
47+ let transfer = ScriptTransfer(i.caller, toIssue, lpTCI)
4448 [LPIssue, transfer, updateState]
45- }
46- else throw("Strict value is not equal to itself.")
47- }
48- else throw("Strict value is not equal to itself.")
49+ }
50+ else throw("Strict value is not equal to itself.")
51+ }
4952 else throw("Strict value is not equal to itself.")
5053 }
5154 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let token = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS'
55
66 let lpTCI = base58'6yMdFxB7ULdLQ8mMjkLtoQvTy9WFrBKoTRK5JXnwMPAb'
77
88 let isStopped = false
99
1010 let keyStaked = "STAKED_LP"
1111
1212 let keyCompound = "From_Compound"
1313
1414 let defV = 100000000
1515
1616 @Callable(i)
1717 func stake () = {
1818 let pmt = value(i.payments[0])
1919 let pmtAmount = pmt.amount
2020 if ((pmt.assetId != token))
2121 then throw("attach USDTUSDNLP tokens only")
2222 else if (isStopped)
2323 then throw("smart contract is on lock")
2424 else {
25- let tkStaked = valueOrElse(getInteger(this, keyStaked), defV)
25+ let tkStaked = match getInteger(this, keyStaked) {
26+ case n: Int =>
27+ n
28+ case _ =>
29+ assetBalance(this, token)
30+ }
2631 let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
2732 let updateState = IntegerEntry(keyStaked, ((tkStaked + i.payments[0].amount) - defV))
2833 if ((updateState == updateState))
29- then if ((updateState == updateState))
30- then {
31- let totalIssued = match assetInfo(lpTCI) {
32- case asset: Asset =>
33- asset.quantity
34- case _ =>
35- throw("Can't find asset")
36- }
37- let forOne = fraction(totalIssued, 100000000, tkStaked)
38- let toIssue = fraction(pmtAmount, forOne, 100000000)
39- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
40- if ((LPstake == LPstake))
41- then {
42- let LPIssue = Reissue(lpTCI, toIssue, true)
43- let transfer = ScriptTransfer(i.caller, toIssue, lpTCI)
34+ then {
35+ let totalIssued = match assetInfo(lpTCI) {
36+ case asset: Asset =>
37+ asset.quantity
38+ case _ =>
39+ throw("Can't find asset")
40+ }
41+ let forOne = fraction(totalIssued, 100000000, tkStaked)
42+ let toIssue = fraction(pmtAmount, forOne, 100000000)
43+ let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
44+ if ((LPstake == LPstake))
45+ then {
46+ let LPIssue = Reissue(lpTCI, toIssue, true)
47+ let transfer = ScriptTransfer(i.caller, toIssue, lpTCI)
4448 [LPIssue, transfer, updateState]
45- }
46- else throw("Strict value is not equal to itself.")
47- }
48- else throw("Strict value is not equal to itself.")
49+ }
50+ else throw("Strict value is not equal to itself.")
51+ }
4952 else throw("Strict value is not equal to itself.")
5053 }
5154 }
5255
5356
5457
5558 @Callable(i)
5659 func compound () = {
5760 let compound = value(i.payments[0])
5861 let ca = compound.amount
5962 if ((compound.assetId != token))
6063 then throw("attach USDTUSDNLP tokens only")
6164 else {
6265 let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
6366 let totalStaked = valueOrElse(getInteger(this, keyStaked), 0)
6467 let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
6568 if ((stakeC == stakeC))
6669 then {
6770 let updateState = IntegerEntry(keyStaked, (totalStaked + ca))
6871 let tc = IntegerEntry(keyCompound, (fromCompound + ca))
6972 [updateState, tc]
7073 }
7174 else throw("Strict value is not equal to itself.")
7275 }
7376 }
7477
7578
7679 @Verifier(tx)
7780 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
7881

github/deemru/w8io/026f985 
37.67 ms