tx · 8v4rP1U7bWWFZpr3pPtTvZgzFhaAd6mUym715Gd6HGUS

3N8n6BtTBKRZBoPuMzaPBH9FyJhfv9xDFJH:  -0.01700000 Waves

2022.07.26 13:41 [2156664] smart account 3N8n6BtTBKRZBoPuMzaPBH9FyJhfv9xDFJH > SELF 0.00000000 Waves

{ "type": 13, "id": "8v4rP1U7bWWFZpr3pPtTvZgzFhaAd6mUym715Gd6HGUS", "fee": 1700000, "feeAssetId": null, "timestamp": 1658832149378, "version": 2, "chainId": 84, "sender": "3N8n6BtTBKRZBoPuMzaPBH9FyJhfv9xDFJH", "senderPublicKey": "4hcnYaYoB2XaCzyJ7wfePpG7EfTd6st6aCAhkskJ9cQ5", "proofs": [ "x9xjuWR2a8UAEzSQESRc8ZpQCazwQKrHBCJLviVEWfofjEKmRZk72ko3aCJuRxXh3WiLHCeNpfRAkk6G2uvwBah" ], "script": "base64:BgIaCAISABIAEgASABIAEgASABIAEgASABIAEgAcAAp1c2R0VXNkbkxQASDbTYM1ZEcblu+fDC+gz33VeZ2S6OGbNQ/BP8x7AnApCwANdXNkdFVzZG5MUFRDSQEgCoHNqe1AYR2YSrg62HoEaFMIJsDJmPFhwSl++h3eKvIACHd4VXNkbkxQASAbuaGPe85Mpc36zkfJCxaOTfZb3sLrk8HWxajRsaoLHAALd3hVc2RuTFBUQ0kBILfs3eYbAnvathOH/VXQ1jy2x6I3PUuIvcF7b0hEAJgvAAp1c2RjVXNkbkxQASADaQH8GwqYCojNj/4RWYWFJpEys1qS/CbpSF3Tn95cdgANdXNkY1VzZG5MUFRDSQEg9gI33dOf74ZFL1wjRw+VX9E6baErwqe0m1RBB1L1bsYACnVzZGNVc2R0TFABIMb4pHQbVkhWEJ+QfsIz9DFriwRKLCv9mUuH9YWbfOSMAA11c2RjVXNkdExQVENJASACxoV8BEszx+Lvh2eHUvtVgv2z34QjtqBaxTXdz1dK/gAMcHV6emxlVXNkbkxQASDDM8Z0ziOqpCLfSSTlxJlreASwd1aCdP+40R1K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JFbnRyeQIFDWtleVBVWlpMRVVTRE4JAGQCBQt0b3RhbFN0YWtlZAUCY2EEAnRjCQEMSW50ZWdlckVudHJ5AgUVa2V5UHV6emxlVXNkbkNvbXBvdW5kCQBkAgUMZnJvbUNvbXBvdW5kBQJjYQkAzAgCBQt1cGRhdGVTdGF0ZQkAzAgCBQJ0YwUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAWkBDHNwb25zb3JCb29zdAAEAnBtCQEFdmFsdWUBCQCRAwIIBQFpCHBheW1lbnRzAAAECmxvY2tQZXJpb2QAZAMJAQIhPQIIBQJwbQdhc3NldElkBQR3eElkCQACAQIFRXJyb3IECXNwb25zb3JlZAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQ5rZXlTcG9uc29yc2hpcAAABARsb2NrCQD8BwQJAQdBZGRyZXNzAQEaAVez5uZVGBFpsOQzD4hRQ6ScrtbVSwNLEVgCDGluY3JlYXNlTG9jawkAzAgCBQpsb2NrUGVyaW9kBQNuaWwJAMwIAgUCcG0FA25pbAMJAAACBQRsb2NrBQRsb2NrBAFzCQEMSW50ZWdlckVudHJ5AgUOa2V5U3BvbnNvcnNoaXAJAGQCCAUCcG0GYW1vdW50BQlzcG9uc29yZWQJAMwIAgUBcwUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleTFNLKg=", "height": 2156664, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B9ai4yFoDP2ZeBMZqVTernmmfmbyv2hxWHFyHYTi3paW Next: 5MRDXB6MyN2YMzpNRdgjqiJDUWLSikAgD4wjetuWuWm2 Diff:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let usdnUsdt = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS'
4+let usdtUsdnLP = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS'
55
6-let usdnUsdtLPTCI = base58'i1snzKxSEZVokh9TWj8hTJQEDBsocnL2hRWsSbsMPK7'
6+let usdtUsdnLPTCI = base58'i1snzKxSEZVokh9TWj8hTJQEDBsocnL2hRWsSbsMPK7'
77
88 let wxUsdnLP = base58'2sEBVcyDFK2LupCf7MeA4vzHhGK4DC1WjbKGQCLYDqib'
99
1010 let wxUsdnLPTCI = base58'DNy6WBfhPE4y82RonGdHhZEunNotEDzmNfrBomWnsyGi'
1111
12-let wavesUsdnLp = base58'FLdC14nUVRyiSYjVrMo3X4g8rXQjLbNRaGAyQAm8V68V'
12+let usdcUsdnLP = base58'EK6N7S38xbtBT3SxAqoGdDLCiX6rojX6G169CnSyuE5'
1313
14-let wavesUsdnLPTCI = base58'EGQiqw8jLjg6SVLUeeqMLjk3EjhEVHtjkJ6w46HyFfep'
14+let usdcUsdnLPTCI = base58'HZKFpNfyPG5gt4D6Nfy1zQSg2Ptmqv932GjNTCyBEeKP'
1515
16-let ethUsdnLP = base58'9ZkS8GoUWn69QhgF1RsRtS9CFtc7ZbDNX5N238Jmqjdr'
16+let usdcUsdtLP = base58'EPhdEfmQaNcHyvDmRGhnLhgcJtKZ2a4k3ZBmKWtAEWyH'
1717
18-let ethUsdnLPTCI = base58'GCvR4BmCSjncVEEwr9psvhN5mctdNTGPs8Xp4b2oQNFZ'
18+let usdcUsdtLPTCI = base58'BqPYkaiz7Le6fFu1rjZ54anrpT57EpvyugZCUqrsjXj'
1919
20-let btcUsdnLP = base58'2RmyyZ39ZoPoTWksM6urmjgx9mB8ksP8Ru6ba8u89mZm'
20+let puzzleUsdnLP = base58'E8zHu33GfcNyGLypX77gZiUXfvuZQeaYmiEfsy7VYNwP'
2121
22-let btcUsdnLPTCI = base58'4jarprgmcev38EU5p2duJAznZSLUxZ831jCT2vf95Hey'
22+let puzzleUsdnLPTCI = base58'Dh9QXSSABE5V6aRfu3mCbDAUokbpE7ER7pbZV6cvyg1A'
2323
24-let oracle = base58'3NAVBWBnqieKa3CdN39MAhToyTHShYxX1gB'
24+let wxId = base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on'
25+
26+let keySponsorship = "Sponsorship_in_lock"
2527
2628 let isStopped = false
2729
28-let keyUsdtUsdn = "STAKED_LP"
30+let keyStaked = "STAKED_LP"
2931
30-let keyUsdtUsdnCompound = "From_Compound"
32+let keyCompound = "From_Compound"
3133
3234 let keywxUsdnCompound = "WX_USDN_compound"
3335
3436 let keyWXUSDN = "WX_USDN"
3537
36-let keyWAVESUSDN = "WAVES_USDN"
38+let keyUsdcUsdnCompound = "USDC_USDN_compound"
3739
38-let keyWavesCompound = "WAVES_USDN_COMPOUND"
40+let keyUSDCUSDN = "USDC_USDN"
3941
40-let keyBtcUsdn = "BTC_USDN"
42+let keyUsdcUsdtCompound = "USDC_USDT_compound"
4143
42-let keyBtcUsdnCompound = "BTC_USDN_COMPOUND"
44+let keyUSDCUSDT = "USDC_USDT"
4345
44-let keyEthUsdn = "ETH_USDN"
46+let keyPuzzleUsdnCompound = "PUZZLE_USDN_compound"
4547
46-let keyEthUsdnCompound = "ETH_USDN_COMPOUND"
48+let keyPUZZLEUSDN = "PUZZLE_USDN"
4749
48-@Callable(i)
49-func depositBtcUsdnLP () = {
50- let pmt = value(i.payments[0])
51- let pmtAmount = pmt.amount
52- if ((pmt.assetId != btcUsdnLP))
53- then throw("attach BTCUSDNLP tokens only")
54- else if (isStopped)
55- then throw("smart contract is on lock")
56- else {
57- let tkStaked = valueOrElse(getInteger(this, keyBtcUsdn), 0)
58- let totalIssued = match assetInfo(btcUsdnLPTCI) {
59- case asset: Asset =>
60- asset.quantity
61- case _ =>
62- throw("Can't find asset")
63- }
64- let one = fraction((totalIssued - assetBalance(this, btcUsdnLPTCI)), 100000000, tkStaked)
65- let toIssue = fraction(pmtAmount, one, 100000000)
66- let updateState = IntegerEntry(keyBtcUsdn, (tkStaked + pmtAmount))
67- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
68- if ((LPstake == LPstake))
69- then {
70- let LPIssue = Reissue(btcUsdnLPTCI, toIssue, true)
71- let transfer = ScriptTransfer(i.caller, toIssue, btcUsdnLPTCI)
72-[LPIssue, transfer, updateState]
73- }
74- else throw("Strict value is not equal to itself.")
75- }
76- }
50+let def = 100000000
7751
52+let feePerc = 10000000000
53+
54+let tw = base58'3P93R2GBkTGVehRPhytHr7sdxYww93jkbhm'
55+
56+let oracle = base58'3P6phwFZFQtZFuc9dvdXsgvtg8JEFVgECPA'
57+
58+func checkAddress (caller) = if ((caller != oracle))
59+ then false
60+ else true
7861
7962
8063 @Callable(i)
81-func depositWavesUsdnLP () = {
82- let pmt = value(i.payments[0])
83- let pmtAmount = pmt.amount
84- if ((pmt.assetId != wavesUsdnLp))
85- then throw("attach WAVESUSDNLP tokens only")
86- else if (isStopped)
87- then throw("smart contract is on lock")
88- else {
89- let tkStaked = valueOrElse(getInteger(this, keyWAVESUSDN), 0)
90- let totalIssued = match assetInfo(wavesUsdnLPTCI) {
91- case asset: Asset =>
92- asset.quantity
64+func withdraw () = {
65+ let payment = value(i.payments[0])
66+ let am = payment.amount
67+ let id = payment.assetId
68+ if ((id == usdtUsdnLP))
69+ then {
70+ let TCIAmount = match assetInfo(usdtUsdnLPTCI) {
71+ case q: Asset =>
72+ q.quantity
73+ case _ =>
74+ 0
75+ }
76+ let usdnUsdtStaked = valueOrElse(getInteger(this, keyStaked), 0)
77+ let forSingleTCI = fraction(TCIAmount, def, usdnUsdtStaked)
78+ let usdnLpToWithdraw = fraction(forSingleTCI, am, def)
79+ let fee = fraction(usdnLpToWithdraw, def, feePerc)
80+ let usdnLpfeeTransfer = ScriptTransfer(Address(tw), fee, usdtUsdnLP)
81+ let transfer = ScriptTransfer(i.caller, (usdnLpToWithdraw - fee), usdtUsdnLP)
82+ let updateUsdnLpStaked = IntegerEntry(keyStaked, (usdnUsdtStaked - usdnLpToWithdraw))
83+ let brn = Burn(usdtUsdnLPTCI, am)
84+ if ((brn == brn))
85+ then [usdnLpfeeTransfer, transfer, updateUsdnLpStaked]
86+ else throw("Strict value is not equal to itself.")
87+ }
88+ else if ((id == wxUsdnLPTCI))
89+ then {
90+ let wxTciAm = match assetInfo(wxUsdnLPTCI) {
91+ case q: Asset =>
92+ q.quantity
9393 case _ =>
94- throw("Can't find asset")
94+ 0
9595 }
96- let one = fraction(totalIssued, 100000000, tkStaked)
97- let toIssue = fraction(pmtAmount, one, 100000000)
98- let updateState = IntegerEntry(keyWAVESUSDN, (tkStaked + pmtAmount))
99- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
100- if ((LPstake == LPstake))
101- then {
102- let LPIssue = Reissue(wavesUsdnLPTCI, toIssue, true)
103- let transfer = ScriptTransfer(i.caller, toIssue, wavesUsdnLPTCI)
104-[LPIssue, transfer, updateState]
105- }
96+ let wxUsdnStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
97+ let singleWXLP = fraction(wxTciAm, def, wxUsdnStaked)
98+ let wxLpToWithdraw = fraction(singleWXLP, am, def)
99+ let fee = fraction(wxLpToWithdraw, def, feePerc)
100+ let wxLpFeeTransfer = ScriptTransfer(Address(tw), fee, wxUsdnLP)
101+ let wxLpTransfer = ScriptTransfer(i.caller, (am - fee), wxUsdnLP)
102+ let updateWxLpStaked = IntegerEntry(keyWXUSDN, (wxUsdnStaked - wxLpToWithdraw))
103+ let burnWxLpTci = Burn(wxUsdnLP, am)
104+ if ((burnWxLpTci == burnWxLpTci))
105+ then [wxLpFeeTransfer, wxLpTransfer, updateWxLpStaked]
106106 else throw("Strict value is not equal to itself.")
107107 }
108+ else if ((id == usdcUsdnLPTCI))
109+ then {
110+ let usdcUsdnTCI = match assetInfo(usdcUsdnLPTCI) {
111+ case q: Asset =>
112+ q.quantity
113+ case _ =>
114+ 0
115+ }
116+ let usdcUsdnStaked = valueOrElse(getInteger(this, keyUSDCUSDN), 0)
117+ let singleUsdcLP = fraction(usdcUsdnTCI, def, usdcUsdnStaked)
118+ let usdcLpToWithdraw = fraction(singleUsdcLP, am, def)
119+ let fee = fraction(usdcLpToWithdraw, def, feePerc)
120+ let usdcUsdnLPFee = ScriptTransfer(Address(tw), fee, usdcUsdnLP)
121+ let usdcUsdnTransfer = ScriptTransfer(i.caller, (am - fee), usdcUsdnLP)
122+ let updateUsdcUsdnLpStaked = IntegerEntry(keyUSDCUSDN, (usdcUsdnStaked - usdcLpToWithdraw))
123+ let burnUsdcUsdnLpTci = Burn(usdcUsdnLPTCI, am)
124+ if ((burnUsdcUsdnLpTci == burnUsdcUsdnLpTci))
125+ then [usdcUsdnLPFee, usdcUsdnTransfer, updateUsdcUsdnLpStaked]
126+ else throw("Strict value is not equal to itself.")
127+ }
128+ else if ((id == usdcUsdtLPTCI))
129+ then {
130+ let usdcUsdtTci = match assetInfo(usdcUsdnLPTCI) {
131+ case q: Asset =>
132+ q.quantity
133+ case _ =>
134+ 0
135+ }
136+ let usdcUsdtStaked = valueOrElse(getInteger(this, keyUSDCUSDT), 0)
137+ let singleUsdcUsdt = fraction(usdcUsdtTci, def, usdcUsdtStaked)
138+ let usdcUsdtLpToWithdraw = fraction(singleUsdcUsdt, am, def)
139+ let fee = fraction(usdcUsdtLpToWithdraw, def, feePerc)
140+ let usdcUsdtLPFee = ScriptTransfer(Address(tw), fee, usdcUsdtLP)
141+ let usdcUsdtTransfer = ScriptTransfer(i.caller, (am - fee), usdcUsdtLP)
142+ let updateUsdcUsdtLpStaked = IntegerEntry(keyUSDCUSDT, (usdcUsdtStaked - usdcUsdtLpToWithdraw))
143+ let burnWxLpTci = Burn(usdcUsdnLPTCI, am)
144+ if ((burnWxLpTci == burnWxLpTci))
145+ then [usdcUsdtLPFee, usdcUsdtTransfer, updateUsdcUsdtLpStaked]
146+ else throw("Strict value is not equal to itself.")
147+ }
148+ else if ((id == puzzleUsdnLPTCI))
149+ then {
150+ let puzzleUsdnTci = match assetInfo(puzzleUsdnLPTCI) {
151+ case q: Asset =>
152+ q.quantity
153+ case _ =>
154+ 0
155+ }
156+ let puzzleLPStaked = valueOrElse(getInteger(this, keyPUZZLEUSDN), 0)
157+ let singlePuzzleUsdn = fraction(puzzleUsdnTci, def, puzzleLPStaked)
158+ let puzzleUsdnWithdraw = fraction(singlePuzzleUsdn, am, def)
159+ let fee = fraction(puzzleUsdnWithdraw, def, feePerc)
160+ let puzzleUsdnLPFee = ScriptTransfer(Address(tw), fee, puzzleUsdnLP)
161+ let puzzleUsdnTransfer = ScriptTransfer(i.caller, (am - fee), puzzleUsdnLP)
162+ let updatePuzzleUsdnLpStaked = IntegerEntry(keyPUZZLEUSDN, (puzzleLPStaked - puzzleUsdnWithdraw))
163+ let burnPuzzleTCI = Burn(puzzleUsdnLPTCI, am)
164+ if ((burnPuzzleTCI == burnPuzzleTCI))
165+ then [puzzleUsdnLPFee, puzzleUsdnTransfer, updatePuzzleUsdnLpStaked]
166+ else throw("Strict value is not equal to itself.")
167+ }
168+ else throw("Invalid asset")
108169 }
109170
110171
128189 let one = fraction(totalIssued, 100000000, tkStaked)
129190 let toIssue = fraction(pmtAmount, one, 100000000)
130191 let updateState = IntegerEntry(keyWXUSDN, (tkStaked + pmtAmount))
131- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
192+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
132193 if ((LPstake == LPstake))
133194 then {
134195 let LPIssue = Reissue(wxUsdnLPTCI, toIssue, true)
145206 func depositUsdtUsdnLP () = {
146207 let pmt = value(i.payments[0])
147208 let pmtAmount = pmt.amount
148- if ((pmt.assetId != usdnUsdt))
209+ if ((pmt.assetId != usdtUsdnLP))
149210 then throw("attach USDTUSDNLP tokens only")
150211 else if (isStopped)
151212 then throw("smart contract is on lock")
152213 else {
153- let tkStaked = valueOrElse(getInteger(this, keyUsdtUsdn), 0)
154- let totalIssued = match assetInfo(usdnUsdtLPTCI) {
214+ let tkStaked = valueOrElse(getInteger(this, keyStaked), 0)
215+ let totalIssued = match assetInfo(usdtUsdnLPTCI) {
155216 case asset: Asset =>
156217 asset.quantity
157218 case _ =>
158219 throw("Can't find asset")
159220 }
160- let one = fraction(totalIssued, 100000000, tkStaked)
161- let toIssue = fraction(pmtAmount, one, 100000000)
162- let updateState = IntegerEntry(keyUsdtUsdn, (tkStaked + pmtAmount))
163- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
221+ let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
222+ let forOne = fraction(totalIssued, 100000000, tkStaked)
223+ let toIssue = fraction(pmtAmount, forOne, 100000000)
224+ let updateState = IntegerEntry(keyStaked, (tkStaked + pmtAmount))
225+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
164226 if ((LPstake == LPstake))
165227 then {
166- let LPIssue = Reissue(usdnUsdtLPTCI, toIssue, true)
167- let transfer = ScriptTransfer(i.caller, toIssue, usdnUsdtLPTCI)
228+ let LPIssue = Reissue(usdtUsdnLPTCI, toIssue, true)
229+ let transfer = ScriptTransfer(i.caller, toIssue, usdtUsdnLPTCI)
168230 [LPIssue, transfer, updateState]
169231 }
170232 else throw("Strict value is not equal to itself.")
174236
175237
176238 @Callable(i)
177-func depositEthUsdnLP () = {
239+func depositUsdcUsdnLP () = {
178240 let pmt = value(i.payments[0])
179241 let pmtAmount = pmt.amount
180- if ((pmt.assetId != ethUsdnLP))
181- then throw("attach ETHUSDNLP tokens only")
242+ if ((pmt.assetId != usdcUsdnLP))
243+ then throw("attach USDCUSDNLP tokens only")
182244 else if (isStopped)
183245 then throw("smart contract is on lock")
184246 else {
185- let tkStaked = valueOrElse(getInteger(this, keyEthUsdn), 0)
186- let totalIssued = match assetInfo(ethUsdnLPTCI) {
247+ let tkStaked = valueOrElse(getInteger(this, keyUSDCUSDN), 0)
248+ let totalIssued = match assetInfo(usdcUsdnLPTCI) {
187249 case asset: Asset =>
188250 asset.quantity
189251 case _ =>
190252 throw("Can't find asset")
191253 }
192- let one = fraction((totalIssued - assetBalance(this, btcUsdnLPTCI)), 100000000, tkStaked)
193- let toIssue = fraction(pmtAmount, one, 100000000)
194- let updateState = IntegerEntry(keyEthUsdn, (tkStaked + pmtAmount))
195- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
254+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdnCompound), 0)
255+ let forOne = fraction(totalIssued, 100000000, tkStaked)
256+ let toIssue = fraction(pmtAmount, forOne, 100000000)
257+ let updateState = IntegerEntry(keyUSDCUSDN, (tkStaked + pmtAmount))
258+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
196259 if ((LPstake == LPstake))
197260 then {
198- let LPIssue = Reissue(ethUsdnLPTCI, toIssue, true)
199- let transfer = ScriptTransfer(i.caller, toIssue, ethUsdnLPTCI)
261+ let LPIssue = Reissue(usdcUsdnLPTCI, toIssue, true)
262+ let transfer = ScriptTransfer(i.caller, toIssue, usdcUsdnLPTCI)
200263 [LPIssue, transfer, updateState]
201264 }
202265 else throw("Strict value is not equal to itself.")
206269
207270
208271 @Callable(i)
209-func compoundBTCUSDNLP () = {
210- let compound = value(i.payments[0])
211- let ca = compound.amount
212- if ((compound.assetId != btcUsdnLP))
213- then throw("attach BTCUSDNLP tokens only")
214- else {
215- let fromCompound = valueOrElse(getInteger(this, keyBtcUsdnCompound), 0)
216- let totalStaked = valueOrElse(getInteger(this, keyBtcUsdn), 0)
217- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
218- if ((stakeC == stakeC))
219- then {
220- let updateState = IntegerEntry(keyBtcUsdn, (totalStaked + ca))
221- let tc = IntegerEntry(keyBtcUsdnCompound, (fromCompound + ca))
222-[updateState, tc]
223- }
224- else throw("Strict value is not equal to itself.")
225- }
272+func depositUsdcUsdtLP () = {
273+ let pmt = value(i.payments[0])
274+ let pmtAmount = pmt.amount
275+ if ((pmt.assetId != usdcUsdtLP))
276+ then throw("attach USDCUSDTLP tokens only")
277+ else if (isStopped)
278+ then throw("smart contract is on lock")
279+ else {
280+ let tkStaked = valueOrElse(getInteger(this, keyUSDCUSDT), 0)
281+ let totalIssued = match assetInfo(usdcUsdtLPTCI) {
282+ case asset: Asset =>
283+ asset.quantity
284+ case _ =>
285+ throw("Can't find asset")
286+ }
287+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdtCompound), 0)
288+ let forOne = fraction(totalIssued, 100000000, tkStaked)
289+ let toIssue = fraction(pmtAmount, forOne, 100000000)
290+ let updateState = IntegerEntry(keyUSDCUSDT, (tkStaked + pmtAmount))
291+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
292+ if ((LPstake == LPstake))
293+ then {
294+ let LPIssue = Reissue(usdcUsdtLPTCI, toIssue, true)
295+ let transfer = ScriptTransfer(i.caller, toIssue, usdcUsdtLPTCI)
296+[LPIssue, transfer, updateState]
297+ }
298+ else throw("Strict value is not equal to itself.")
299+ }
226300 }
227301
228302
229303
230304 @Callable(i)
231-func compoundETHUSDNLP () = {
232- let compound = value(i.payments[0])
233- let ca = compound.amount
234- if ((compound.assetId != ethUsdnLP))
235- then throw("attach ETHUSDNLP tokens only")
236- else {
237- let fromCompound = valueOrElse(getInteger(this, keyEthUsdnCompound), 0)
238- let totalStaked = valueOrElse(getInteger(this, keyEthUsdn), 0)
239- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
240- if ((stakeC == stakeC))
241- then {
242- let updateState = IntegerEntry(keyEthUsdn, (totalStaked + ca))
243- let tc = IntegerEntry(keyEthUsdnCompound, (fromCompound + ca))
244-[updateState, tc]
245- }
246- else throw("Strict value is not equal to itself.")
247- }
305+func depositPuzzleUsdnLP () = {
306+ let pmt = value(i.payments[0])
307+ let pmtAmount = pmt.amount
308+ if ((pmt.assetId != puzzleUsdnLP))
309+ then throw("attach PUZZLEUDSNLP tokens only")
310+ else if (isStopped)
311+ then throw("smart contract is on lock")
312+ else {
313+ let tkStaked = valueOrElse(getInteger(this, keyPUZZLEUSDN), 0)
314+ let totalIssued = match assetInfo(puzzleUsdnLPTCI) {
315+ case asset: Asset =>
316+ asset.quantity
317+ case _ =>
318+ throw("Can't find asset")
319+ }
320+ let fromCompound = valueOrElse(getInteger(this, keyPuzzleUsdnCompound), 0)
321+ let forOne = fraction(totalIssued, 100000000, tkStaked)
322+ let toIssue = fraction(pmtAmount, forOne, 100000000)
323+ let updateState = IntegerEntry(keyPUZZLEUSDN, (tkStaked + pmtAmount))
324+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
325+ if ((LPstake == LPstake))
326+ then {
327+ let LPIssue = Reissue(puzzleUsdnLPTCI, toIssue, true)
328+ let transfer = ScriptTransfer(i.caller, toIssue, puzzleUsdnLPTCI)
329+[LPIssue, transfer, updateState]
330+ }
331+ else throw("Strict value is not equal to itself.")
332+ }
248333 }
249334
250335
251336
252337 @Callable(i)
253-func compoundWXUSDNLP () = {
338+func compoundWxUsdnLP () = {
254339 let compound = value(i.payments[0])
255340 let ca = compound.amount
256- if ((i.caller.bytes == oracle))
257- then throw("You are the only authorized to call this func")
258- else {
259- let fromCompound = valueOrElse(getInteger(this, keywxUsdnCompound), 0)
260- let totalStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
261- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
262- if ((stakeC == stakeC))
263- then {
264- let updateState = IntegerEntry(keyWXUSDN, (totalStaked + ca))
265- let tc = IntegerEntry(keywxUsdnCompound, (fromCompound + ca))
341+ let isOracle = checkAddress(i.caller.bytes)
342+ if ((compound.assetId != wxUsdnLP))
343+ then throw("attach WXUSDNLP tokens only")
344+ else if (!(isOracle))
345+ then throw("You are not authotized to call this function")
346+ else {
347+ let fromCompound = valueOrElse(getInteger(this, keywxUsdnCompound), 0)
348+ let totalStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
349+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
350+ if ((stakeC == stakeC))
351+ then {
352+ let updateState = IntegerEntry(keyWXUSDN, (totalStaked + ca))
353+ let tc = IntegerEntry(keywxUsdnCompound, (fromCompound + ca))
266354 [updateState, tc]
267- }
268- else throw("Strict value is not equal to itself.")
269- }
355+ }
356+ else throw("Strict value is not equal to itself.")
357+ }
270358 }
271359
272360
273361
274362 @Callable(i)
275-func compoundUSDTUSDNLP () = {
363+func compoundUsdtUsdnLP () = {
276364 let compound = value(i.payments[0])
277365 let ca = compound.amount
278- if ((compound.assetId != usdnUsdt))
366+ let isOracle = checkAddress(i.caller.bytes)
367+ if ((compound.assetId != usdtUsdnLP))
279368 then throw("attach USDTUSDNLP tokens only")
280- else {
281- let fromCompound = valueOrElse(getInteger(this, keyUsdtUsdnCompound), 0)
282- let totalStaked = valueOrElse(getInteger(this, keyUsdtUsdn), 0)
283- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
284- if ((stakeC == stakeC))
285- then {
286- let updateState = IntegerEntry(keyUsdtUsdn, (totalStaked + ca))
287- let tc = IntegerEntry(keyUsdtUsdnCompound, (fromCompound + ca))
369+ else if (!(isOracle))
370+ then throw("You are not authotized to call this function")
371+ else {
372+ let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
373+ let totalStaked = valueOrElse(getInteger(this, keyStaked), 0)
374+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
375+ if ((stakeC == stakeC))
376+ then {
377+ let updateState = IntegerEntry(keyStaked, (totalStaked + ca))
378+ let tc = IntegerEntry(keyCompound, (fromCompound + ca))
288379 [updateState, tc]
289- }
290- else throw("Strict value is not equal to itself.")
291- }
380+ }
381+ else throw("Strict value is not equal to itself.")
382+ }
292383 }
293384
294385
295386
296387 @Callable(i)
297-func compoundWAVESUSDNLP () = {
388+func compoundUsdcUsdnLP () = {
298389 let compound = value(i.payments[0])
299390 let ca = compound.amount
300- if ((compound.assetId != wavesUsdnLp))
301- then throw("attach WAVESUSDNLP tokens only")
302- else {
303- let fromCompound = valueOrElse(getInteger(this, keyWavesCompound), 0)
304- let totalStaked = valueOrElse(getInteger(this, keyWAVESUSDN), 0)
305- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
306- if ((stakeC == stakeC))
307- then {
308- let updateState = IntegerEntry(keyWAVESUSDN, (totalStaked + ca))
309- let tc = IntegerEntry(keyWavesCompound, (fromCompound + ca))
391+ let isOracle = checkAddress(i.caller.bytes)
392+ if ((compound.assetId != usdcUsdnLP))
393+ then throw("attach USDCUSDNLP tokens only")
394+ else if (!(isOracle))
395+ then throw("You are not authotized to call this function")
396+ else {
397+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdnCompound), 0)
398+ let totalStaked = valueOrElse(getInteger(this, keyUSDCUSDN), 0)
399+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
400+ if ((stakeC == stakeC))
401+ then {
402+ let updateState = IntegerEntry(keyUSDCUSDN, (totalStaked + ca))
403+ let tc = IntegerEntry(keyUsdcUsdnCompound, (fromCompound + ca))
310404 [updateState, tc]
311- }
312- else throw("Strict value is not equal to itself.")
313- }
405+ }
406+ else throw("Strict value is not equal to itself.")
407+ }
314408 }
315409
316410
317411
318412 @Callable(i)
319-func initWX () = {
320- let pm = value(i.payments[0])
321- let am = pm.amount
322- if ((pm.assetId != wxUsdnLP))
323- then throw("Unexpected token")
324- else {
325- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
326- if ((s == s))
327- then {
328- let upd = IntegerEntry(keyWXUSDN, am)
329- let updK = IntegerEntry(keywxUsdnCompound, 0)
330-[upd, updK]
331- }
332- else throw("Strict value is not equal to itself.")
333- }
413+func compoundUsdcUsdtLP () = {
414+ let compound = value(i.payments[0])
415+ let ca = compound.amount
416+ let isOracle = checkAddress(i.caller.bytes)
417+ if ((compound.assetId != usdcUsdtLP))
418+ then throw("attach USDCUSDTLP tokens only")
419+ else if (!(isOracle))
420+ then throw("You are not authotized to call this function")
421+ else {
422+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdtCompound), 0)
423+ let totalStaked = valueOrElse(getInteger(this, keyUSDCUSDT), 0)
424+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
425+ if ((stakeC == stakeC))
426+ then {
427+ let updateState = IntegerEntry(keyUSDCUSDT, (totalStaked + ca))
428+ let tc = IntegerEntry(keyUsdcUsdtCompound, (fromCompound + ca))
429+[updateState, tc]
430+ }
431+ else throw("Strict value is not equal to itself.")
432+ }
334433 }
335434
336435
337436
338437 @Callable(i)
339-func initWAVES () = {
340- let pm = value(i.payments[0])
341- let am = pm.amount
342- if ((pm.assetId != wavesUsdnLp))
343- then throw("Unexpected token")
344- else {
345- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
346- if ((s == s))
347- then {
348- let upd = IntegerEntry(keyWAVESUSDN, am)
349- let updK = IntegerEntry(keyWavesCompound, 0)
350-[upd, updK]
351- }
352- else throw("Strict value is not equal to itself.")
353- }
438+func compoundPuzzleUsdnLP () = {
439+ let compound = value(i.payments[0])
440+ let ca = compound.amount
441+ let isOracle = checkAddress(i.caller.bytes)
442+ if ((compound.assetId != puzzleUsdnLP))
443+ then throw("attach PUZZLEUSDNLP tokens only")
444+ else if (!(isOracle))
445+ then throw("You are not authotized to call this function")
446+ else {
447+ let fromCompound = valueOrElse(getInteger(this, keyPuzzleUsdnCompound), 0)
448+ let totalStaked = valueOrElse(getInteger(this, keyPUZZLEUSDN), 0)
449+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
450+ if ((stakeC == stakeC))
451+ then {
452+ let updateState = IntegerEntry(keyPUZZLEUSDN, (totalStaked + ca))
453+ let tc = IntegerEntry(keyPuzzleUsdnCompound, (fromCompound + ca))
454+[updateState, tc]
455+ }
456+ else throw("Strict value is not equal to itself.")
457+ }
354458 }
355459
356460
357461
358462 @Callable(i)
359-func initETH () = {
463+func sponsorBoost () = {
360464 let pm = value(i.payments[0])
361- let am = pm.amount
362- if ((pm.assetId != ethUsdnLP))
363- then throw("Unexpected token")
465+ let lockPeriod = 100
466+ if ((pm.assetId != wxId))
467+ then throw("Error")
364468 else {
365- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
366- if ((s == s))
469+ let sponsored = valueOrElse(getInteger(this, keySponsorship), 0)
470+ let lock = invoke(Address(base58'3PJL8Hn8LACaSBWLQ3UVhctA5cTQLBFwBAP'), "increaseLock", [lockPeriod], [pm])
471+ if ((lock == lock))
367472 then {
368- let upd = IntegerEntry(keyEthUsdn, am)
369- let updK = IntegerEntry(keyEthUsdnCompound, 0)
370- let issue = Reissue(ethUsdnLPTCI, am, true)
371- let send = ScriptTransfer(i.caller, am, ethUsdnLPTCI)
372-[upd, updK, issue, send]
373- }
374- else throw("Strict value is not equal to itself.")
375- }
376- }
377-
378-
379-
380-@Callable(i)
381-func initBTC () = {
382- let pm = value(i.payments[0])
383- let am = pm.amount
384- if ((pm.assetId != btcUsdnLP))
385- then throw("Unexpected token")
386- else {
387- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
388- if ((s == s))
389- then {
390- let upd = IntegerEntry(keyBtcUsdn, am)
391- let updK = IntegerEntry(keyBtcUsdnCompound, 0)
392- let LPIssue = Reissue(btcUsdnLPTCI, am, true)
393- let tr = ScriptTransfer(i.caller, am, btcUsdnLPTCI)
394-[upd, updK, LPIssue, tr]
473+ let s = IntegerEntry(keySponsorship, (pm.amount + sponsored))
474+[s]
395475 }
396476 else throw("Strict value is not equal to itself.")
397477 }
Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let usdnUsdt = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS'
4+let usdtUsdnLP = base58'Fm4qczu6Pepz8KUhh3Heb6LeTVfpSMX5vvNgw3x764CS'
55
6-let usdnUsdtLPTCI = base58'i1snzKxSEZVokh9TWj8hTJQEDBsocnL2hRWsSbsMPK7'
6+let usdtUsdnLPTCI = base58'i1snzKxSEZVokh9TWj8hTJQEDBsocnL2hRWsSbsMPK7'
77
88 let wxUsdnLP = base58'2sEBVcyDFK2LupCf7MeA4vzHhGK4DC1WjbKGQCLYDqib'
99
1010 let wxUsdnLPTCI = base58'DNy6WBfhPE4y82RonGdHhZEunNotEDzmNfrBomWnsyGi'
1111
12-let wavesUsdnLp = base58'FLdC14nUVRyiSYjVrMo3X4g8rXQjLbNRaGAyQAm8V68V'
12+let usdcUsdnLP = base58'EK6N7S38xbtBT3SxAqoGdDLCiX6rojX6G169CnSyuE5'
1313
14-let wavesUsdnLPTCI = base58'EGQiqw8jLjg6SVLUeeqMLjk3EjhEVHtjkJ6w46HyFfep'
14+let usdcUsdnLPTCI = base58'HZKFpNfyPG5gt4D6Nfy1zQSg2Ptmqv932GjNTCyBEeKP'
1515
16-let ethUsdnLP = base58'9ZkS8GoUWn69QhgF1RsRtS9CFtc7ZbDNX5N238Jmqjdr'
16+let usdcUsdtLP = base58'EPhdEfmQaNcHyvDmRGhnLhgcJtKZ2a4k3ZBmKWtAEWyH'
1717
18-let ethUsdnLPTCI = base58'GCvR4BmCSjncVEEwr9psvhN5mctdNTGPs8Xp4b2oQNFZ'
18+let usdcUsdtLPTCI = base58'BqPYkaiz7Le6fFu1rjZ54anrpT57EpvyugZCUqrsjXj'
1919
20-let btcUsdnLP = base58'2RmyyZ39ZoPoTWksM6urmjgx9mB8ksP8Ru6ba8u89mZm'
20+let puzzleUsdnLP = base58'E8zHu33GfcNyGLypX77gZiUXfvuZQeaYmiEfsy7VYNwP'
2121
22-let btcUsdnLPTCI = base58'4jarprgmcev38EU5p2duJAznZSLUxZ831jCT2vf95Hey'
22+let puzzleUsdnLPTCI = base58'Dh9QXSSABE5V6aRfu3mCbDAUokbpE7ER7pbZV6cvyg1A'
2323
24-let oracle = base58'3NAVBWBnqieKa3CdN39MAhToyTHShYxX1gB'
24+let wxId = base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on'
25+
26+let keySponsorship = "Sponsorship_in_lock"
2527
2628 let isStopped = false
2729
28-let keyUsdtUsdn = "STAKED_LP"
30+let keyStaked = "STAKED_LP"
2931
30-let keyUsdtUsdnCompound = "From_Compound"
32+let keyCompound = "From_Compound"
3133
3234 let keywxUsdnCompound = "WX_USDN_compound"
3335
3436 let keyWXUSDN = "WX_USDN"
3537
36-let keyWAVESUSDN = "WAVES_USDN"
38+let keyUsdcUsdnCompound = "USDC_USDN_compound"
3739
38-let keyWavesCompound = "WAVES_USDN_COMPOUND"
40+let keyUSDCUSDN = "USDC_USDN"
3941
40-let keyBtcUsdn = "BTC_USDN"
42+let keyUsdcUsdtCompound = "USDC_USDT_compound"
4143
42-let keyBtcUsdnCompound = "BTC_USDN_COMPOUND"
44+let keyUSDCUSDT = "USDC_USDT"
4345
44-let keyEthUsdn = "ETH_USDN"
46+let keyPuzzleUsdnCompound = "PUZZLE_USDN_compound"
4547
46-let keyEthUsdnCompound = "ETH_USDN_COMPOUND"
48+let keyPUZZLEUSDN = "PUZZLE_USDN"
4749
48-@Callable(i)
49-func depositBtcUsdnLP () = {
50- let pmt = value(i.payments[0])
51- let pmtAmount = pmt.amount
52- if ((pmt.assetId != btcUsdnLP))
53- then throw("attach BTCUSDNLP tokens only")
54- else if (isStopped)
55- then throw("smart contract is on lock")
56- else {
57- let tkStaked = valueOrElse(getInteger(this, keyBtcUsdn), 0)
58- let totalIssued = match assetInfo(btcUsdnLPTCI) {
59- case asset: Asset =>
60- asset.quantity
61- case _ =>
62- throw("Can't find asset")
63- }
64- let one = fraction((totalIssued - assetBalance(this, btcUsdnLPTCI)), 100000000, tkStaked)
65- let toIssue = fraction(pmtAmount, one, 100000000)
66- let updateState = IntegerEntry(keyBtcUsdn, (tkStaked + pmtAmount))
67- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
68- if ((LPstake == LPstake))
69- then {
70- let LPIssue = Reissue(btcUsdnLPTCI, toIssue, true)
71- let transfer = ScriptTransfer(i.caller, toIssue, btcUsdnLPTCI)
72-[LPIssue, transfer, updateState]
73- }
74- else throw("Strict value is not equal to itself.")
75- }
76- }
50+let def = 100000000
7751
52+let feePerc = 10000000000
53+
54+let tw = base58'3P93R2GBkTGVehRPhytHr7sdxYww93jkbhm'
55+
56+let oracle = base58'3P6phwFZFQtZFuc9dvdXsgvtg8JEFVgECPA'
57+
58+func checkAddress (caller) = if ((caller != oracle))
59+ then false
60+ else true
7861
7962
8063 @Callable(i)
81-func depositWavesUsdnLP () = {
82- let pmt = value(i.payments[0])
83- let pmtAmount = pmt.amount
84- if ((pmt.assetId != wavesUsdnLp))
85- then throw("attach WAVESUSDNLP tokens only")
86- else if (isStopped)
87- then throw("smart contract is on lock")
88- else {
89- let tkStaked = valueOrElse(getInteger(this, keyWAVESUSDN), 0)
90- let totalIssued = match assetInfo(wavesUsdnLPTCI) {
91- case asset: Asset =>
92- asset.quantity
64+func withdraw () = {
65+ let payment = value(i.payments[0])
66+ let am = payment.amount
67+ let id = payment.assetId
68+ if ((id == usdtUsdnLP))
69+ then {
70+ let TCIAmount = match assetInfo(usdtUsdnLPTCI) {
71+ case q: Asset =>
72+ q.quantity
73+ case _ =>
74+ 0
75+ }
76+ let usdnUsdtStaked = valueOrElse(getInteger(this, keyStaked), 0)
77+ let forSingleTCI = fraction(TCIAmount, def, usdnUsdtStaked)
78+ let usdnLpToWithdraw = fraction(forSingleTCI, am, def)
79+ let fee = fraction(usdnLpToWithdraw, def, feePerc)
80+ let usdnLpfeeTransfer = ScriptTransfer(Address(tw), fee, usdtUsdnLP)
81+ let transfer = ScriptTransfer(i.caller, (usdnLpToWithdraw - fee), usdtUsdnLP)
82+ let updateUsdnLpStaked = IntegerEntry(keyStaked, (usdnUsdtStaked - usdnLpToWithdraw))
83+ let brn = Burn(usdtUsdnLPTCI, am)
84+ if ((brn == brn))
85+ then [usdnLpfeeTransfer, transfer, updateUsdnLpStaked]
86+ else throw("Strict value is not equal to itself.")
87+ }
88+ else if ((id == wxUsdnLPTCI))
89+ then {
90+ let wxTciAm = match assetInfo(wxUsdnLPTCI) {
91+ case q: Asset =>
92+ q.quantity
9393 case _ =>
94- throw("Can't find asset")
94+ 0
9595 }
96- let one = fraction(totalIssued, 100000000, tkStaked)
97- let toIssue = fraction(pmtAmount, one, 100000000)
98- let updateState = IntegerEntry(keyWAVESUSDN, (tkStaked + pmtAmount))
99- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
100- if ((LPstake == LPstake))
101- then {
102- let LPIssue = Reissue(wavesUsdnLPTCI, toIssue, true)
103- let transfer = ScriptTransfer(i.caller, toIssue, wavesUsdnLPTCI)
104-[LPIssue, transfer, updateState]
105- }
96+ let wxUsdnStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
97+ let singleWXLP = fraction(wxTciAm, def, wxUsdnStaked)
98+ let wxLpToWithdraw = fraction(singleWXLP, am, def)
99+ let fee = fraction(wxLpToWithdraw, def, feePerc)
100+ let wxLpFeeTransfer = ScriptTransfer(Address(tw), fee, wxUsdnLP)
101+ let wxLpTransfer = ScriptTransfer(i.caller, (am - fee), wxUsdnLP)
102+ let updateWxLpStaked = IntegerEntry(keyWXUSDN, (wxUsdnStaked - wxLpToWithdraw))
103+ let burnWxLpTci = Burn(wxUsdnLP, am)
104+ if ((burnWxLpTci == burnWxLpTci))
105+ then [wxLpFeeTransfer, wxLpTransfer, updateWxLpStaked]
106106 else throw("Strict value is not equal to itself.")
107107 }
108+ else if ((id == usdcUsdnLPTCI))
109+ then {
110+ let usdcUsdnTCI = match assetInfo(usdcUsdnLPTCI) {
111+ case q: Asset =>
112+ q.quantity
113+ case _ =>
114+ 0
115+ }
116+ let usdcUsdnStaked = valueOrElse(getInteger(this, keyUSDCUSDN), 0)
117+ let singleUsdcLP = fraction(usdcUsdnTCI, def, usdcUsdnStaked)
118+ let usdcLpToWithdraw = fraction(singleUsdcLP, am, def)
119+ let fee = fraction(usdcLpToWithdraw, def, feePerc)
120+ let usdcUsdnLPFee = ScriptTransfer(Address(tw), fee, usdcUsdnLP)
121+ let usdcUsdnTransfer = ScriptTransfer(i.caller, (am - fee), usdcUsdnLP)
122+ let updateUsdcUsdnLpStaked = IntegerEntry(keyUSDCUSDN, (usdcUsdnStaked - usdcLpToWithdraw))
123+ let burnUsdcUsdnLpTci = Burn(usdcUsdnLPTCI, am)
124+ if ((burnUsdcUsdnLpTci == burnUsdcUsdnLpTci))
125+ then [usdcUsdnLPFee, usdcUsdnTransfer, updateUsdcUsdnLpStaked]
126+ else throw("Strict value is not equal to itself.")
127+ }
128+ else if ((id == usdcUsdtLPTCI))
129+ then {
130+ let usdcUsdtTci = match assetInfo(usdcUsdnLPTCI) {
131+ case q: Asset =>
132+ q.quantity
133+ case _ =>
134+ 0
135+ }
136+ let usdcUsdtStaked = valueOrElse(getInteger(this, keyUSDCUSDT), 0)
137+ let singleUsdcUsdt = fraction(usdcUsdtTci, def, usdcUsdtStaked)
138+ let usdcUsdtLpToWithdraw = fraction(singleUsdcUsdt, am, def)
139+ let fee = fraction(usdcUsdtLpToWithdraw, def, feePerc)
140+ let usdcUsdtLPFee = ScriptTransfer(Address(tw), fee, usdcUsdtLP)
141+ let usdcUsdtTransfer = ScriptTransfer(i.caller, (am - fee), usdcUsdtLP)
142+ let updateUsdcUsdtLpStaked = IntegerEntry(keyUSDCUSDT, (usdcUsdtStaked - usdcUsdtLpToWithdraw))
143+ let burnWxLpTci = Burn(usdcUsdnLPTCI, am)
144+ if ((burnWxLpTci == burnWxLpTci))
145+ then [usdcUsdtLPFee, usdcUsdtTransfer, updateUsdcUsdtLpStaked]
146+ else throw("Strict value is not equal to itself.")
147+ }
148+ else if ((id == puzzleUsdnLPTCI))
149+ then {
150+ let puzzleUsdnTci = match assetInfo(puzzleUsdnLPTCI) {
151+ case q: Asset =>
152+ q.quantity
153+ case _ =>
154+ 0
155+ }
156+ let puzzleLPStaked = valueOrElse(getInteger(this, keyPUZZLEUSDN), 0)
157+ let singlePuzzleUsdn = fraction(puzzleUsdnTci, def, puzzleLPStaked)
158+ let puzzleUsdnWithdraw = fraction(singlePuzzleUsdn, am, def)
159+ let fee = fraction(puzzleUsdnWithdraw, def, feePerc)
160+ let puzzleUsdnLPFee = ScriptTransfer(Address(tw), fee, puzzleUsdnLP)
161+ let puzzleUsdnTransfer = ScriptTransfer(i.caller, (am - fee), puzzleUsdnLP)
162+ let updatePuzzleUsdnLpStaked = IntegerEntry(keyPUZZLEUSDN, (puzzleLPStaked - puzzleUsdnWithdraw))
163+ let burnPuzzleTCI = Burn(puzzleUsdnLPTCI, am)
164+ if ((burnPuzzleTCI == burnPuzzleTCI))
165+ then [puzzleUsdnLPFee, puzzleUsdnTransfer, updatePuzzleUsdnLpStaked]
166+ else throw("Strict value is not equal to itself.")
167+ }
168+ else throw("Invalid asset")
108169 }
109170
110171
111172
112173 @Callable(i)
113174 func depositWxUsdnLP () = {
114175 let pmt = value(i.payments[0])
115176 let pmtAmount = pmt.amount
116177 if ((pmt.assetId != wxUsdnLP))
117178 then throw("attach WXUSDNLP tokens only")
118179 else if (isStopped)
119180 then throw("smart contract is on lock")
120181 else {
121182 let tkStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
122183 let totalIssued = match assetInfo(wxUsdnLPTCI) {
123184 case asset: Asset =>
124185 asset.quantity
125186 case _ =>
126187 throw("Can't find asset")
127188 }
128189 let one = fraction(totalIssued, 100000000, tkStaked)
129190 let toIssue = fraction(pmtAmount, one, 100000000)
130191 let updateState = IntegerEntry(keyWXUSDN, (tkStaked + pmtAmount))
131- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
192+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
132193 if ((LPstake == LPstake))
133194 then {
134195 let LPIssue = Reissue(wxUsdnLPTCI, toIssue, true)
135196 let transfer = ScriptTransfer(i.caller, toIssue, wxUsdnLPTCI)
136197 [LPIssue, transfer, updateState]
137198 }
138199 else throw("Strict value is not equal to itself.")
139200 }
140201 }
141202
142203
143204
144205 @Callable(i)
145206 func depositUsdtUsdnLP () = {
146207 let pmt = value(i.payments[0])
147208 let pmtAmount = pmt.amount
148- if ((pmt.assetId != usdnUsdt))
209+ if ((pmt.assetId != usdtUsdnLP))
149210 then throw("attach USDTUSDNLP tokens only")
150211 else if (isStopped)
151212 then throw("smart contract is on lock")
152213 else {
153- let tkStaked = valueOrElse(getInteger(this, keyUsdtUsdn), 0)
154- let totalIssued = match assetInfo(usdnUsdtLPTCI) {
214+ let tkStaked = valueOrElse(getInteger(this, keyStaked), 0)
215+ let totalIssued = match assetInfo(usdtUsdnLPTCI) {
155216 case asset: Asset =>
156217 asset.quantity
157218 case _ =>
158219 throw("Can't find asset")
159220 }
160- let one = fraction(totalIssued, 100000000, tkStaked)
161- let toIssue = fraction(pmtAmount, one, 100000000)
162- let updateState = IntegerEntry(keyUsdtUsdn, (tkStaked + pmtAmount))
163- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
221+ let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
222+ let forOne = fraction(totalIssued, 100000000, tkStaked)
223+ let toIssue = fraction(pmtAmount, forOne, 100000000)
224+ let updateState = IntegerEntry(keyStaked, (tkStaked + pmtAmount))
225+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
164226 if ((LPstake == LPstake))
165227 then {
166- let LPIssue = Reissue(usdnUsdtLPTCI, toIssue, true)
167- let transfer = ScriptTransfer(i.caller, toIssue, usdnUsdtLPTCI)
228+ let LPIssue = Reissue(usdtUsdnLPTCI, toIssue, true)
229+ let transfer = ScriptTransfer(i.caller, toIssue, usdtUsdnLPTCI)
168230 [LPIssue, transfer, updateState]
169231 }
170232 else throw("Strict value is not equal to itself.")
171233 }
172234 }
173235
174236
175237
176238 @Callable(i)
177-func depositEthUsdnLP () = {
239+func depositUsdcUsdnLP () = {
178240 let pmt = value(i.payments[0])
179241 let pmtAmount = pmt.amount
180- if ((pmt.assetId != ethUsdnLP))
181- then throw("attach ETHUSDNLP tokens only")
242+ if ((pmt.assetId != usdcUsdnLP))
243+ then throw("attach USDCUSDNLP tokens only")
182244 else if (isStopped)
183245 then throw("smart contract is on lock")
184246 else {
185- let tkStaked = valueOrElse(getInteger(this, keyEthUsdn), 0)
186- let totalIssued = match assetInfo(ethUsdnLPTCI) {
247+ let tkStaked = valueOrElse(getInteger(this, keyUSDCUSDN), 0)
248+ let totalIssued = match assetInfo(usdcUsdnLPTCI) {
187249 case asset: Asset =>
188250 asset.quantity
189251 case _ =>
190252 throw("Can't find asset")
191253 }
192- let one = fraction((totalIssued - assetBalance(this, btcUsdnLPTCI)), 100000000, tkStaked)
193- let toIssue = fraction(pmtAmount, one, 100000000)
194- let updateState = IntegerEntry(keyEthUsdn, (tkStaked + pmtAmount))
195- let LPstake = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pmt])
254+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdnCompound), 0)
255+ let forOne = fraction(totalIssued, 100000000, tkStaked)
256+ let toIssue = fraction(pmtAmount, forOne, 100000000)
257+ let updateState = IntegerEntry(keyUSDCUSDN, (tkStaked + pmtAmount))
258+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
196259 if ((LPstake == LPstake))
197260 then {
198- let LPIssue = Reissue(ethUsdnLPTCI, toIssue, true)
199- let transfer = ScriptTransfer(i.caller, toIssue, ethUsdnLPTCI)
261+ let LPIssue = Reissue(usdcUsdnLPTCI, toIssue, true)
262+ let transfer = ScriptTransfer(i.caller, toIssue, usdcUsdnLPTCI)
200263 [LPIssue, transfer, updateState]
201264 }
202265 else throw("Strict value is not equal to itself.")
203266 }
204267 }
205268
206269
207270
208271 @Callable(i)
209-func compoundBTCUSDNLP () = {
210- let compound = value(i.payments[0])
211- let ca = compound.amount
212- if ((compound.assetId != btcUsdnLP))
213- then throw("attach BTCUSDNLP tokens only")
214- else {
215- let fromCompound = valueOrElse(getInteger(this, keyBtcUsdnCompound), 0)
216- let totalStaked = valueOrElse(getInteger(this, keyBtcUsdn), 0)
217- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
218- if ((stakeC == stakeC))
219- then {
220- let updateState = IntegerEntry(keyBtcUsdn, (totalStaked + ca))
221- let tc = IntegerEntry(keyBtcUsdnCompound, (fromCompound + ca))
222-[updateState, tc]
223- }
224- else throw("Strict value is not equal to itself.")
225- }
272+func depositUsdcUsdtLP () = {
273+ let pmt = value(i.payments[0])
274+ let pmtAmount = pmt.amount
275+ if ((pmt.assetId != usdcUsdtLP))
276+ then throw("attach USDCUSDTLP tokens only")
277+ else if (isStopped)
278+ then throw("smart contract is on lock")
279+ else {
280+ let tkStaked = valueOrElse(getInteger(this, keyUSDCUSDT), 0)
281+ let totalIssued = match assetInfo(usdcUsdtLPTCI) {
282+ case asset: Asset =>
283+ asset.quantity
284+ case _ =>
285+ throw("Can't find asset")
286+ }
287+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdtCompound), 0)
288+ let forOne = fraction(totalIssued, 100000000, tkStaked)
289+ let toIssue = fraction(pmtAmount, forOne, 100000000)
290+ let updateState = IntegerEntry(keyUSDCUSDT, (tkStaked + pmtAmount))
291+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
292+ if ((LPstake == LPstake))
293+ then {
294+ let LPIssue = Reissue(usdcUsdtLPTCI, toIssue, true)
295+ let transfer = ScriptTransfer(i.caller, toIssue, usdcUsdtLPTCI)
296+[LPIssue, transfer, updateState]
297+ }
298+ else throw("Strict value is not equal to itself.")
299+ }
226300 }
227301
228302
229303
230304 @Callable(i)
231-func compoundETHUSDNLP () = {
232- let compound = value(i.payments[0])
233- let ca = compound.amount
234- if ((compound.assetId != ethUsdnLP))
235- then throw("attach ETHUSDNLP tokens only")
236- else {
237- let fromCompound = valueOrElse(getInteger(this, keyEthUsdnCompound), 0)
238- let totalStaked = valueOrElse(getInteger(this, keyEthUsdn), 0)
239- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
240- if ((stakeC == stakeC))
241- then {
242- let updateState = IntegerEntry(keyEthUsdn, (totalStaked + ca))
243- let tc = IntegerEntry(keyEthUsdnCompound, (fromCompound + ca))
244-[updateState, tc]
245- }
246- else throw("Strict value is not equal to itself.")
247- }
305+func depositPuzzleUsdnLP () = {
306+ let pmt = value(i.payments[0])
307+ let pmtAmount = pmt.amount
308+ if ((pmt.assetId != puzzleUsdnLP))
309+ then throw("attach PUZZLEUDSNLP tokens only")
310+ else if (isStopped)
311+ then throw("smart contract is on lock")
312+ else {
313+ let tkStaked = valueOrElse(getInteger(this, keyPUZZLEUSDN), 0)
314+ let totalIssued = match assetInfo(puzzleUsdnLPTCI) {
315+ case asset: Asset =>
316+ asset.quantity
317+ case _ =>
318+ throw("Can't find asset")
319+ }
320+ let fromCompound = valueOrElse(getInteger(this, keyPuzzleUsdnCompound), 0)
321+ let forOne = fraction(totalIssued, 100000000, tkStaked)
322+ let toIssue = fraction(pmtAmount, forOne, 100000000)
323+ let updateState = IntegerEntry(keyPUZZLEUSDN, (tkStaked + pmtAmount))
324+ let LPstake = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [pmt])
325+ if ((LPstake == LPstake))
326+ then {
327+ let LPIssue = Reissue(puzzleUsdnLPTCI, toIssue, true)
328+ let transfer = ScriptTransfer(i.caller, toIssue, puzzleUsdnLPTCI)
329+[LPIssue, transfer, updateState]
330+ }
331+ else throw("Strict value is not equal to itself.")
332+ }
248333 }
249334
250335
251336
252337 @Callable(i)
253-func compoundWXUSDNLP () = {
338+func compoundWxUsdnLP () = {
254339 let compound = value(i.payments[0])
255340 let ca = compound.amount
256- if ((i.caller.bytes == oracle))
257- then throw("You are the only authorized to call this func")
258- else {
259- let fromCompound = valueOrElse(getInteger(this, keywxUsdnCompound), 0)
260- let totalStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
261- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
262- if ((stakeC == stakeC))
263- then {
264- let updateState = IntegerEntry(keyWXUSDN, (totalStaked + ca))
265- let tc = IntegerEntry(keywxUsdnCompound, (fromCompound + ca))
341+ let isOracle = checkAddress(i.caller.bytes)
342+ if ((compound.assetId != wxUsdnLP))
343+ then throw("attach WXUSDNLP tokens only")
344+ else if (!(isOracle))
345+ then throw("You are not authotized to call this function")
346+ else {
347+ let fromCompound = valueOrElse(getInteger(this, keywxUsdnCompound), 0)
348+ let totalStaked = valueOrElse(getInteger(this, keyWXUSDN), 0)
349+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
350+ if ((stakeC == stakeC))
351+ then {
352+ let updateState = IntegerEntry(keyWXUSDN, (totalStaked + ca))
353+ let tc = IntegerEntry(keywxUsdnCompound, (fromCompound + ca))
266354 [updateState, tc]
267- }
268- else throw("Strict value is not equal to itself.")
269- }
355+ }
356+ else throw("Strict value is not equal to itself.")
357+ }
270358 }
271359
272360
273361
274362 @Callable(i)
275-func compoundUSDTUSDNLP () = {
363+func compoundUsdtUsdnLP () = {
276364 let compound = value(i.payments[0])
277365 let ca = compound.amount
278- if ((compound.assetId != usdnUsdt))
366+ let isOracle = checkAddress(i.caller.bytes)
367+ if ((compound.assetId != usdtUsdnLP))
279368 then throw("attach USDTUSDNLP tokens only")
280- else {
281- let fromCompound = valueOrElse(getInteger(this, keyUsdtUsdnCompound), 0)
282- let totalStaked = valueOrElse(getInteger(this, keyUsdtUsdn), 0)
283- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
284- if ((stakeC == stakeC))
285- then {
286- let updateState = IntegerEntry(keyUsdtUsdn, (totalStaked + ca))
287- let tc = IntegerEntry(keyUsdtUsdnCompound, (fromCompound + ca))
369+ else if (!(isOracle))
370+ then throw("You are not authotized to call this function")
371+ else {
372+ let fromCompound = valueOrElse(getInteger(this, keyCompound), 0)
373+ let totalStaked = valueOrElse(getInteger(this, keyStaked), 0)
374+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
375+ if ((stakeC == stakeC))
376+ then {
377+ let updateState = IntegerEntry(keyStaked, (totalStaked + ca))
378+ let tc = IntegerEntry(keyCompound, (fromCompound + ca))
288379 [updateState, tc]
289- }
290- else throw("Strict value is not equal to itself.")
291- }
380+ }
381+ else throw("Strict value is not equal to itself.")
382+ }
292383 }
293384
294385
295386
296387 @Callable(i)
297-func compoundWAVESUSDNLP () = {
388+func compoundUsdcUsdnLP () = {
298389 let compound = value(i.payments[0])
299390 let ca = compound.amount
300- if ((compound.assetId != wavesUsdnLp))
301- then throw("attach WAVESUSDNLP tokens only")
302- else {
303- let fromCompound = valueOrElse(getInteger(this, keyWavesCompound), 0)
304- let totalStaked = valueOrElse(getInteger(this, keyWAVESUSDN), 0)
305- let stakeC = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [compound])
306- if ((stakeC == stakeC))
307- then {
308- let updateState = IntegerEntry(keyWAVESUSDN, (totalStaked + ca))
309- let tc = IntegerEntry(keyWavesCompound, (fromCompound + ca))
391+ let isOracle = checkAddress(i.caller.bytes)
392+ if ((compound.assetId != usdcUsdnLP))
393+ then throw("attach USDCUSDNLP tokens only")
394+ else if (!(isOracle))
395+ then throw("You are not authotized to call this function")
396+ else {
397+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdnCompound), 0)
398+ let totalStaked = valueOrElse(getInteger(this, keyUSDCUSDN), 0)
399+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
400+ if ((stakeC == stakeC))
401+ then {
402+ let updateState = IntegerEntry(keyUSDCUSDN, (totalStaked + ca))
403+ let tc = IntegerEntry(keyUsdcUsdnCompound, (fromCompound + ca))
310404 [updateState, tc]
311- }
312- else throw("Strict value is not equal to itself.")
313- }
405+ }
406+ else throw("Strict value is not equal to itself.")
407+ }
314408 }
315409
316410
317411
318412 @Callable(i)
319-func initWX () = {
320- let pm = value(i.payments[0])
321- let am = pm.amount
322- if ((pm.assetId != wxUsdnLP))
323- then throw("Unexpected token")
324- else {
325- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
326- if ((s == s))
327- then {
328- let upd = IntegerEntry(keyWXUSDN, am)
329- let updK = IntegerEntry(keywxUsdnCompound, 0)
330-[upd, updK]
331- }
332- else throw("Strict value is not equal to itself.")
333- }
413+func compoundUsdcUsdtLP () = {
414+ let compound = value(i.payments[0])
415+ let ca = compound.amount
416+ let isOracle = checkAddress(i.caller.bytes)
417+ if ((compound.assetId != usdcUsdtLP))
418+ then throw("attach USDCUSDTLP tokens only")
419+ else if (!(isOracle))
420+ then throw("You are not authotized to call this function")
421+ else {
422+ let fromCompound = valueOrElse(getInteger(this, keyUsdcUsdtCompound), 0)
423+ let totalStaked = valueOrElse(getInteger(this, keyUSDCUSDT), 0)
424+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
425+ if ((stakeC == stakeC))
426+ then {
427+ let updateState = IntegerEntry(keyUSDCUSDT, (totalStaked + ca))
428+ let tc = IntegerEntry(keyUsdcUsdtCompound, (fromCompound + ca))
429+[updateState, tc]
430+ }
431+ else throw("Strict value is not equal to itself.")
432+ }
334433 }
335434
336435
337436
338437 @Callable(i)
339-func initWAVES () = {
340- let pm = value(i.payments[0])
341- let am = pm.amount
342- if ((pm.assetId != wavesUsdnLp))
343- then throw("Unexpected token")
344- else {
345- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
346- if ((s == s))
347- then {
348- let upd = IntegerEntry(keyWAVESUSDN, am)
349- let updK = IntegerEntry(keyWavesCompound, 0)
350-[upd, updK]
351- }
352- else throw("Strict value is not equal to itself.")
353- }
438+func compoundPuzzleUsdnLP () = {
439+ let compound = value(i.payments[0])
440+ let ca = compound.amount
441+ let isOracle = checkAddress(i.caller.bytes)
442+ if ((compound.assetId != puzzleUsdnLP))
443+ then throw("attach PUZZLEUSDNLP tokens only")
444+ else if (!(isOracle))
445+ then throw("You are not authotized to call this function")
446+ else {
447+ let fromCompound = valueOrElse(getInteger(this, keyPuzzleUsdnCompound), 0)
448+ let totalStaked = valueOrElse(getInteger(this, keyPUZZLEUSDN), 0)
449+ let stakeC = invoke(Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV'), "stake", nil, [compound])
450+ if ((stakeC == stakeC))
451+ then {
452+ let updateState = IntegerEntry(keyPUZZLEUSDN, (totalStaked + ca))
453+ let tc = IntegerEntry(keyPuzzleUsdnCompound, (fromCompound + ca))
454+[updateState, tc]
455+ }
456+ else throw("Strict value is not equal to itself.")
457+ }
354458 }
355459
356460
357461
358462 @Callable(i)
359-func initETH () = {
463+func sponsorBoost () = {
360464 let pm = value(i.payments[0])
361- let am = pm.amount
362- if ((pm.assetId != ethUsdnLP))
363- then throw("Unexpected token")
465+ let lockPeriod = 100
466+ if ((pm.assetId != wxId))
467+ then throw("Error")
364468 else {
365- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
366- if ((s == s))
469+ let sponsored = valueOrElse(getInteger(this, keySponsorship), 0)
470+ let lock = invoke(Address(base58'3PJL8Hn8LACaSBWLQ3UVhctA5cTQLBFwBAP'), "increaseLock", [lockPeriod], [pm])
471+ if ((lock == lock))
367472 then {
368- let upd = IntegerEntry(keyEthUsdn, am)
369- let updK = IntegerEntry(keyEthUsdnCompound, 0)
370- let issue = Reissue(ethUsdnLPTCI, am, true)
371- let send = ScriptTransfer(i.caller, am, ethUsdnLPTCI)
372-[upd, updK, issue, send]
373- }
374- else throw("Strict value is not equal to itself.")
375- }
376- }
377-
378-
379-
380-@Callable(i)
381-func initBTC () = {
382- let pm = value(i.payments[0])
383- let am = pm.amount
384- if ((pm.assetId != btcUsdnLP))
385- then throw("Unexpected token")
386- else {
387- let s = invoke(Address(base58'3Mx3zmXrMcLFCafMuPtXAzR4ZPVeZYb6qLz'), "stake", nil, [pm])
388- if ((s == s))
389- then {
390- let upd = IntegerEntry(keyBtcUsdn, am)
391- let updK = IntegerEntry(keyBtcUsdnCompound, 0)
392- let LPIssue = Reissue(btcUsdnLPTCI, am, true)
393- let tr = ScriptTransfer(i.caller, am, btcUsdnLPTCI)
394-[upd, updK, LPIssue, tr]
473+ let s = IntegerEntry(keySponsorship, (pm.amount + sponsored))
474+[s]
395475 }
396476 else throw("Strict value is not equal to itself.")
397477 }
398478 }
399479
400480
401481 @Verifier(tx)
402482 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
403483

github/deemru/w8io/026f985 
73.99 ms