1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
use crate::config::deposit_tracking::issue_shares::DepositAddresses;
use crate::config::deposit_tracking::issue_shares::DepositAddressesPermissioned;
use crate::config::deposit_tracking::register::RegisterDepositTrackingAddresses;
use crate::config::deposit_tracking::traits::{
IssueShares, RegisterDepositTracking, WithdrawDepositTracking,
};
use crate::config::deposit_tracking::withdraw::WithdrawDepositTrackingAddresses;
use crate::config::strategy::traits::WithdrawMultiOptimizerVault;
use crate::config::strategy::withdraw::{PlatformConfigAddresses, WithdrawAddresses};
use crate::config::strategy::Platform;
use anchor_lang::prelude::*;
use anchor_lang::solana_program;
use static_pubkey::static_pubkey;
use tulipv2_sdk_farms::{lending::Lending, Farm};
pub mod multi_deposit {
use crate::config::strategy::traits::{MultiVaultProgramConfig, StandaloneVaultProgramConfig};
use super::*;
#[derive(Clone, Copy)]
pub struct ProgramConfig;
pub const TAG_STRING: &str = "usdtv1";
pub const FARM_KEY: Farm = Farm::Lending {
name: Lending::MULTI_DEPOSIT,
};
pub const ACCOUNT: Pubkey = static_pubkey!("BBRkN5paHbHLku4KrZMN8Mc5U3Ygasd4v2FtxdwG7F8F");
pub const PDA: Pubkey = static_pubkey!("DkP2YsqzjiAhnURstef1AmB2EDzRpigbJQuLyNtFcH3Y");
pub const SHARES_MINT: Pubkey = static_pubkey!("AHV6CBjuT7M2HMMKDa5gRSEoBcJGWVjURCBhpgMbyESX");
pub const UNDERLYING_COMPOUND_QUEUE: Pubkey =
static_pubkey!("E8E1Bdhp67tanf4UonTUnAervkhSmYkYkQo2DkxpdVc9");
pub const UNDERLYING_DEPOSIT_QUEUE: Pubkey =
static_pubkey!("2WxVfyi9ps7Ym1jhK43HKVetuxpJwDpaok6AU9T5KKuP");
pub const UNDERLYING_WITHDRAW_QUEUE: Pubkey =
static_pubkey!("4RQC5TorXks2zU7cznQe3FAmdntHkbjoeWW9y5A9WoW4");
pub const UNDERLYING_MINT: Pubkey =
static_pubkey!("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
pub const REBALANCE_STATE_TRANSITION: Pubkey =
static_pubkey!("7NFyTU8NnwQ3TWxeLXmHNSbqwP4cF7Tpb5BRgfa5B5MC");
pub const REBALANCE_STATE_TRANSITION_UNDERLYING: Pubkey =
static_pubkey!("B126PNhYa7AgnktVcsvpikXHqdAA3yUDUc5eRgnzLGd");
pub const SOLEND_OPTIMIZER_SHARES_ACCOUNT: Pubkey =
static_pubkey!("5LhLY4tKxeVeqV5P3BdNZvHRePCZxqCM9DgqAEhofjzG");
pub const TULIP_OPTIMIZER_SHARES_ACCOUNT: Pubkey =
static_pubkey!("9vtcrGjfzYkf3R2PNLaayjdTazxAQ7tx6fgSQjXWUkD");
pub const MANGO_OPTIMIZER_SHARES_ACCOUNT: Pubkey =
static_pubkey!("5ai771C6H16dAEXywGz7AyVSXkbaJ5qYA2wfvpLPabn");
impl ProgramConfig {
#[inline(always)]
pub fn issue_shares_ix(user: Pubkey) -> impl IssueShares {
DepositAddresses::new(user, ACCOUNT, PDA, SHARES_MINT, UNDERLYING_MINT)
}
#[inline(always)]
pub fn permissioned_issue_shares_ix(user: Pubkey) -> impl IssueShares {
DepositAddressesPermissioned::new(user, ACCOUNT, PDA, SHARES_MINT, UNDERLYING_MINT)
}
#[inline(always)]
pub fn register_deposit_tracking_ix(user: Pubkey) -> impl RegisterDepositTracking {
RegisterDepositTrackingAddresses::new(user, ACCOUNT, SHARES_MINT, UNDERLYING_MINT)
}
#[inline(always)]
pub fn withdraw_deposit_tracking_ix(user: Pubkey) -> impl WithdrawDepositTracking {
WithdrawDepositTrackingAddresses::new(user, ACCOUNT, SHARES_MINT)
}
pub fn withdraw_multi_deposit_optimizer_vault(
user: Pubkey,
platform: Platform,
) -> std::result::Result<Box<impl WithdrawMultiOptimizerVault>, std::io::Error> {
let (standalone_config, platform_config) = if platform.eq(&Platform::MangoV3) {
(
(
ProgramConfig::get_mango_remaining_accounts().to_vec(),
platform,
),
super::mango::platform_config(),
)
} else if platform.eq(&Platform::Solend) {
(
(
ProgramConfig::get_solend_remaining_accounts().to_vec(),
platform,
),
super::solend::platform_config(),
)
} else {
(
(
ProgramConfig::get_tulip_remaining_accounts().to_vec(),
platform,
),
super::tulip::platform_config(),
)
};
Ok(Box::new(WithdrawAddresses::new(
user,
ACCOUNT,
PDA,
SHARES_MINT,
UNDERLYING_MINT,
UNDERLYING_WITHDRAW_QUEUE,
platform_config,
(&standalone_config.0, standalone_config.1),
)?))
}
#[inline(always)]
pub fn get_tulip_remaining_accounts() -> [Pubkey; 7] {
[
super::tulip::COLLATERAL_TOKEN_ACCOUNT,
super::tulip::RESERVE_ACCOUNT,
super::tulip::RESERVE_LIQUIDITY_ACCOUNT,
super::tulip::COLLATERAL_MINT,
super::tulip::LENDING_MARKET_ACCOUNT,
super::tulip::LENDING_MARKET_AUTHORITY,
super::tulip::PYTH_PRICE_ACCOUNT,
]
}
#[inline(always)]
pub fn get_solend_remaining_accounts() -> [Pubkey; 8] {
[
super::solend::COLLATERAL_TOKEN_ACCOUNT,
super::solend::RESERVE_ACCOUNT,
super::solend::RESERVE_LIQUIDITY_ACCOUNT,
super::solend::COLLATERAL_MINT,
super::solend::LENDING_MARKET_ACCOUNT,
super::solend::LENDING_MARKET_AUTHORITY,
super::solend::PYTH_PRICE_ACCOUNT,
super::solend::SWITCHBOARD_PRICE_ACCOUNT,
]
}
#[inline(always)]
pub fn get_mango_remaining_accounts() -> [Pubkey; 7] {
[
super::mango::GROUP,
super::mango::OPTIMIZER_MANGO_ACCOUNT,
super::mango::CACHE,
super::mango::ROOT_BANK,
super::mango::NODE_BANK,
super::mango::GROUP_TOKEN_ACCOUNT,
super::mango::GROUP_SIGNER,
]
}
}
impl MultiVaultProgramConfig for ProgramConfig {
fn account(&self) -> Pubkey {
ACCOUNT
}
fn pda(&self) -> Pubkey {
PDA
}
fn shares_mint(&self) -> Pubkey {
SHARES_MINT
}
fn underlying_compound_queue(&self) -> Pubkey {
UNDERLYING_COMPOUND_QUEUE
}
fn underlying_deposit_queue(&self) -> Pubkey {
UNDERLYING_DEPOSIT_QUEUE
}
fn underlying_withdraw_queue(&self) -> Pubkey {
UNDERLYING_WITHDRAW_QUEUE
}
fn underlying_mint(&self) -> Pubkey {
UNDERLYING_MINT
}
fn rebalance_state_transition(&self) -> Pubkey {
REBALANCE_STATE_TRANSITION
}
fn rebalance_state_transition_underlying(&self) -> Pubkey {
REBALANCE_STATE_TRANSITION_UNDERLYING
}
fn optimizer_shares_account(&self, platform: Platform) -> Pubkey {
match platform {
Platform::MangoV3 => MANGO_OPTIMIZER_SHARES_ACCOUNT,
Platform::Solend => SOLEND_OPTIMIZER_SHARES_ACCOUNT,
Platform::Tulip => TULIP_OPTIMIZER_SHARES_ACCOUNT,
}
}
fn issue_shares(&self, user: Pubkey) -> Box<dyn IssueShares> {
Box::new(ProgramConfig::issue_shares_ix(user))
}
fn permissioned_issue_shares(&self, user: Pubkey) -> Box<dyn IssueShares> {
Box::new(ProgramConfig::permissioned_issue_shares_ix(user))
}
fn register_deposit_tracking(&self, user: Pubkey) -> Box<dyn RegisterDepositTracking> {
Box::new(ProgramConfig::register_deposit_tracking_ix(user))
}
fn withdraw_deposit_tracking(&self, user: Pubkey) -> Box<dyn WithdrawDepositTracking> {
Box::new(ProgramConfig::withdraw_deposit_tracking_ix(user))
}
fn withdraw_multi_deposit_optimizer_vault(
&self,
user: Pubkey,
platform: Platform,
) -> std::result::Result<Box<dyn WithdrawMultiOptimizerVault>, std::io::Error> {
Ok(ProgramConfig::withdraw_multi_deposit_optimizer_vault(
user, platform,
)?)
}
fn remaining_accounts(&self, platform: Platform) -> Vec<Pubkey> {
match platform {
Platform::MangoV3 => ProgramConfig::get_mango_remaining_accounts().to_vec(),
Platform::Solend => ProgramConfig::get_solend_remaining_accounts().to_vec(),
Platform::Tulip => ProgramConfig::get_tulip_remaining_accounts().to_vec(),
}
}
fn standalone_config(&self, platform: Platform) -> Box<dyn StandaloneVaultProgramConfig> {
match platform {
Platform::MangoV3 => Box::new(mango::ProgramConfig),
Platform::Solend => Box::new(solend::ProgramConfig),
Platform::Tulip => Box::new(tulip::ProgramConfig),
}
}
fn farm(&self) -> Farm {
FARM_KEY
}
fn tag(&self) -> &str {
TAG_STRING
}
}
}
pub mod solend {
use super::*;
use crate::config::strategy::traits::{SolendProgramConfig, StandaloneVaultProgramConfig};
pub const TAG_STRING: &str = "solend";
pub const FARM_KEY: Farm = Farm::Lending {
name: Lending::USDT,
};
#[derive(Clone, Copy)]
pub struct ProgramConfig;
pub const ACCOUNT: Pubkey = static_pubkey!("4YmXxV6C6MQs3TrZjpH5bw4qTtgZZhVRNfkWEteVXcWX");
pub const PDA: Pubkey = static_pubkey!("GZqAKKd7pApvbe2abgTZs9X7heJxqkYEig5c9CgJCHYD");
pub const SHARES_MINT: Pubkey = static_pubkey!("HYXLSi4xA4GtcUkm5zjRSBf6vVwebYfMfEMjgQiLbYeW");
pub const UNDERLYING_COMPOUND_QUEUE: Pubkey =
static_pubkey!("Fxhy5ShwJq5hXkB8Ch9TFowwuMpW7QA9yMDMvTv7iZJZ");
pub const UNDERLYING_DEPOSIT_QUEUE: Pubkey =
static_pubkey!("AFdRMvwdLfsyLTxGbGYRLYh4Mhqx2bEyYQm9K3wYkFpX");
pub const UNDERLYING_WITHDRAW_QUEUE: Pubkey =
static_pubkey!("87beLgLgD1fdJwBxrL5h9Fb9bjq9bGBJwEMxLss9mwaa");
pub const UNDERLYING_MINT: Pubkey =
static_pubkey!("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
pub const CONFIG_DATA_ACCOUNT: Pubkey =
static_pubkey!("A7mxsEKDVYgSgp9n13qbKNAKNxcLF8Df9Rpea3gCzh9p");
pub const INFORMATION_ACCOUNT: Pubkey =
static_pubkey!("4bwpyxZh67UqjgqcK9rxDL7vZwcpe1S6EEZJc59P6bXd");
pub const PROGRAM_ID: Pubkey = static_pubkey!("So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo");
pub const COLLATERAL_MINT: Pubkey =
static_pubkey!("BTsbZDV7aCMRJ3VNy9ygV4Q2UeEo9GpR8D6VvmMZzNr8");
pub const LENDING_MARKET_ACCOUNT: Pubkey =
static_pubkey!("4UpD2fh7xH3VP9QQaXtsS1YY3bxzWhtfpks7FatyKvdY");
pub const LENDING_MARKET_AUTHORITY: Pubkey =
static_pubkey!("DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby");
pub const PYTH_PRICE_ACCOUNT: Pubkey =
static_pubkey!("3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL");
pub const SWITCHBOARD_PRICE_ACCOUNT: Pubkey =
static_pubkey!("ETAaeeuQBwsh9mC2gCov9WdhJENZuffRMXY2HgjCcSL9");
pub const PYTH_PROGRAM_ID: Pubkey =
static_pubkey!("FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH");
pub const SWITCHBOARD_PROGRAM_ID: Pubkey =
static_pubkey!("DtmE9D2CSB4L5D6A15mraeEjrGMm6auWVzgaD8hK2tZM");
pub const RESERVE_ACCOUNT: Pubkey =
static_pubkey!("8K9WC8xoh2rtQNY7iEGXtPvfbDCi563SdWhCAhuMP2xE");
pub const RESERVE_LIQUIDITY_ACCOUNT: Pubkey =
static_pubkey!("3CdpSW5dxM7RTxBgxeyt8nnnjqoDbZe48tsBs9QUrmuN");
pub const COLLATERAL_TOKEN_ACCOUNT: Pubkey =
static_pubkey!("8DPzi8QSpREME7hsFs3Pcf7Uzgi5Ranxe1HvUt8L8jBg");
#[inline(always)]
pub fn platform_config() -> PlatformConfigAddresses {
PlatformConfigAddresses {
vault: ACCOUNT,
vault_pda: PDA,
information_account: INFORMATION_ACCOUNT,
config_data_account: CONFIG_DATA_ACCOUNT,
shares_mint: SHARES_MINT,
underlying_deposit_queue: UNDERLYING_DEPOSIT_QUEUE,
lending_program: PROGRAM_ID,
}
}
impl StandaloneVaultProgramConfig for ProgramConfig {
fn account(&self) -> Pubkey {
ACCOUNT
}
fn pda(&self) -> Pubkey {
PDA
}
fn shares_mint(&self) -> Pubkey {
SHARES_MINT
}
fn underlying_compound_queue(&self) -> Pubkey {
UNDERLYING_COMPOUND_QUEUE
}
fn underlying_deposit_queue(&self) -> Pubkey {
UNDERLYING_DEPOSIT_QUEUE
}
fn underlying_withdraw_queue(&self) -> Pubkey {
UNDERLYING_WITHDRAW_QUEUE
}
fn underlying_mint(&self) -> Pubkey {
UNDERLYING_MINT
}
fn config_data_account(&self) -> Pubkey {
CONFIG_DATA_ACCOUNT
}
fn information_account(&self) -> Pubkey {
INFORMATION_ACCOUNT
}
fn program_id(&self) -> Pubkey {
PROGRAM_ID
}
fn solend_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::SolendProgramConfig>> {
Some(Box::new(*self))
}
fn tulip_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::TulipProgramConfig>> {
None
}
fn mango_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::MangoProgramConfig>> {
None
}
fn is_platform(&self, platform: Platform) -> bool {
matches!(platform, Platform::Solend)
}
fn farm(&self) -> Farm {
FARM_KEY
}
fn tag(&self) -> &str {
TAG_STRING
}
}
impl SolendProgramConfig for ProgramConfig {
fn collateral_mint(&self) -> Pubkey {
COLLATERAL_MINT
}
fn lending_market(&self) -> Pubkey {
LENDING_MARKET_ACCOUNT
}
fn lending_market_authority(&self) -> Pubkey {
LENDING_MARKET_AUTHORITY
}
fn pyth_price_account(&self) -> Pubkey {
PYTH_PRICE_ACCOUNT
}
fn switchboard_price_account(&self) -> Pubkey {
SWITCHBOARD_PRICE_ACCOUNT
}
fn pyth_program_id(&self) -> Pubkey {
PYTH_PROGRAM_ID
}
fn switchboard_program_id(&self) -> Pubkey {
SWITCHBOARD_PROGRAM_ID
}
fn reserve(&self) -> Pubkey {
RESERVE_ACCOUNT
}
fn reserve_liquidity(&self) -> Pubkey {
RESERVE_LIQUIDITY_ACCOUNT
}
fn vault_collateral_account(&self) -> Pubkey {
COLLATERAL_TOKEN_ACCOUNT
}
}
}
pub mod tulip {
use super::*;
use crate::config::strategy::traits::{StandaloneVaultProgramConfig, TulipProgramConfig};
pub const TAG_STRING: &str = "tulip";
pub const FARM_KEY: Farm = Farm::Lending {
name: Lending::USDT,
};
#[derive(Clone, Copy)]
pub struct ProgramConfig;
pub const ACCOUNT: Pubkey = static_pubkey!("HC3ah2Z1VNBHjavM3o9uCWnPniy5g9VgHSzbuuBvTMzT");
pub const PDA: Pubkey = static_pubkey!("GFFHxCNUB3EVUQt73N6E6icaqJUwRLSxHcYpvLvrDry");
pub const SHARES_MINT: Pubkey = static_pubkey!("FNQDs4ub4wFRnspu3JGcH79R2icxCggYm4BRAcc6Mnwp");
pub const UNDERLYING_COMPOUND_QUEUE: Pubkey =
static_pubkey!("Axa64R5SyuQdEkZ9xvAMzrWz5Kf88aPchKAhZQHbCpJG");
pub const UNDERLYING_DEPOSIT_QUEUE: Pubkey =
static_pubkey!("7dJHyjD5MZ2EBZRbe4PdRyKSHj4BuH7nLkV1fjgwU9za");
pub const UNDERLYING_WITHDRAW_QUEUE: Pubkey =
static_pubkey!("BehWgvqQoLdPDB1siPedWjDKgMX8mVrmvESM1bR5oGv4");
pub const UNDERLYING_MINT: Pubkey =
static_pubkey!("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
pub const CONFIG_DATA_ACCOUNT: Pubkey =
static_pubkey!("H6vGDBUBtydhDTCzqaGeenZEZVx1goR4Poq1MRAgSfgB");
pub const INFORMATION_ACCOUNT: Pubkey =
static_pubkey!("DpR4xJSoqE1BW7i2bmEkGPhtYpFF4McgM8V6oAgzgBxE");
pub const PROGRAM_ID: Pubkey = static_pubkey!("4bcFeLv4nydFrsZqV5CgwCVrPhkQKsXtzfy2KyMz7ozM");
pub const COLLATERAL_MINT: Pubkey =
static_pubkey!("gLhY2arqFpmVGkpbBbTi3TeWbsWevA8dqrwbKacK3vJ");
pub const LENDING_MARKET_ACCOUNT: Pubkey =
static_pubkey!("D1cqtVThyebK9KXKGXrCEuiqaNf5L4UfM1vHgCqiJxym");
pub const LENDING_MARKET_AUTHORITY: Pubkey =
static_pubkey!("8gEGZbUfVE1poBq71VHKX9LU7ca4x8wTUyZgcbyQe51s");
pub const PYTH_PRICE_ACCOUNT: Pubkey =
static_pubkey!("uo3MK2mD9KogjNLxTWVaB5XqA9Hg4mx4QuRm9SRtKdE");
pub const PYTH_PROGRAM_ID: Pubkey =
static_pubkey!("5JQ8Mhdp2wv3HWcfjq9Ts8kwzCAeBADFBDAgBznzRsE4");
pub const RESERVE_ACCOUNT: Pubkey =
static_pubkey!("Csn3exasdhDzxYApmnci3d8Khb629VmgK4NQqdeyZBNt");
pub const RESERVE_LIQUIDITY_ACCOUNT: Pubkey =
static_pubkey!("124J21csiR1FdDywteXa8LhAmeqBXZRvozhoE7zq9znc");
pub const COLLATERAL_TOKEN_ACCOUNT: Pubkey =
static_pubkey!("BD7AHG6GwNRj4xaTr9RZgJTpWfMJtZsARMzgnFvNYffm");
#[inline(always)]
pub fn platform_config() -> PlatformConfigAddresses {
PlatformConfigAddresses {
vault: ACCOUNT,
vault_pda: PDA,
information_account: INFORMATION_ACCOUNT,
config_data_account: CONFIG_DATA_ACCOUNT,
shares_mint: SHARES_MINT,
underlying_deposit_queue: UNDERLYING_DEPOSIT_QUEUE,
lending_program: PROGRAM_ID,
}
}
impl StandaloneVaultProgramConfig for ProgramConfig {
fn account(&self) -> Pubkey {
ACCOUNT
}
fn pda(&self) -> Pubkey {
PDA
}
fn shares_mint(&self) -> Pubkey {
SHARES_MINT
}
fn underlying_compound_queue(&self) -> Pubkey {
UNDERLYING_COMPOUND_QUEUE
}
fn underlying_deposit_queue(&self) -> Pubkey {
UNDERLYING_DEPOSIT_QUEUE
}
fn underlying_withdraw_queue(&self) -> Pubkey {
UNDERLYING_WITHDRAW_QUEUE
}
fn underlying_mint(&self) -> Pubkey {
UNDERLYING_MINT
}
fn config_data_account(&self) -> Pubkey {
CONFIG_DATA_ACCOUNT
}
fn information_account(&self) -> Pubkey {
INFORMATION_ACCOUNT
}
fn program_id(&self) -> Pubkey {
PROGRAM_ID
}
fn solend_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::SolendProgramConfig>> {
None
}
fn tulip_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::TulipProgramConfig>> {
Some(Box::new(*self))
}
fn mango_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::MangoProgramConfig>> {
None
}
fn is_platform(&self, platform: Platform) -> bool {
matches!(platform, Platform::Tulip)
}
fn farm(&self) -> Farm {
FARM_KEY
}
fn tag(&self) -> &str {
TAG_STRING
}
}
impl TulipProgramConfig for ProgramConfig {
fn collateral_mint(&self) -> Pubkey {
COLLATERAL_MINT
}
fn lending_market(&self) -> Pubkey {
LENDING_MARKET_ACCOUNT
}
fn lending_market_authority(&self) -> Pubkey {
LENDING_MARKET_AUTHORITY
}
fn pyth_price_account(&self) -> Pubkey {
PYTH_PRICE_ACCOUNT
}
fn pyth_program_id(&self) -> Pubkey {
PYTH_PROGRAM_ID
}
fn reserve(&self) -> Pubkey {
RESERVE_ACCOUNT
}
fn reserve_liquidity(&self) -> Pubkey {
RESERVE_LIQUIDITY_ACCOUNT
}
fn vault_collateral_account(&self) -> Pubkey {
COLLATERAL_TOKEN_ACCOUNT
}
}
}
pub mod mango {
use crate::config::strategy::{
traits::{MangoProgramConfig, StandaloneVaultProgramConfig},
withdraw::PlatformConfigAddresses,
Platform,
};
use anchor_lang::solana_program::{self, pubkey::Pubkey};
use static_pubkey::static_pubkey;
use tulipv2_sdk_farms::{lending::Lending, Farm};
pub const TAG_STRING: &str = "mango";
pub const FARM_KEY: Farm = Farm::Lending {
name: Lending::USDT,
};
#[derive(Clone, Copy)]
pub struct ProgramConfig;
pub const ACCOUNT: Pubkey = static_pubkey!("3Y9yqi2K4E4zsthNj2YP4sip59azSHA4qhwMkLxtokFZ");
pub const PDA: Pubkey = static_pubkey!("FQDN8oEuY5umdCjTRFwcxETwCiN9Zw2B92m9DEcvC8Hg");
pub const SHARES_MINT: Pubkey = static_pubkey!("56xxyq9Yi4kmy2WxvsHAKjLudMUorTbpcgQe1Uemt3oJ");
pub const UNDERLYING_COMPOUND_QUEUE: Pubkey =
static_pubkey!("BYamJDsGk6AWoA4z8D4myDNfZeiAqMsJ6B35GG4E6vFy");
pub const UNDERLYING_DEPOSIT_QUEUE: Pubkey =
static_pubkey!("G4EkAvPDjgWRWvweLRx5WJtCbQ5UmJD1JALADUwUNSsW");
pub const UNDERLYING_WITHDRAW_QUEUE: Pubkey =
static_pubkey!("ESMmJBo93jeeyPAcDRrSbLnNwccnyatqh5yV5VuwgpF5");
pub const UNDERLYING_MINT: Pubkey =
static_pubkey!("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
pub const CONFIG_DATA_ACCOUNT: Pubkey =
static_pubkey!("2T4fsgXC58v6j45no7SHG3Lfv41EkWyjx7VaMDEcftAK");
pub const INFORMATION_ACCOUNT: Pubkey =
static_pubkey!("3ouKmRBzRiemgHULi13sUxq9unNksHtinUa97g3tJX5c");
pub const PROGRAM_ID: Pubkey = static_pubkey!("mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68");
pub const CACHE: Pubkey = static_pubkey!("EBDRoayCDDUvDgCimta45ajQeXbexv7aKqJubruqpyvu");
pub const GROUP: Pubkey = static_pubkey!("98pjRuQjK3qA6gXts96PqZT4Ze5QmnCmt3QYjhbUSPue");
pub const GROUP_SIGNER: Pubkey = static_pubkey!("9BVcYqEQxyccuwznvxXqDkSJFavvTyheiTYk231T1A8S");
pub const GROUP_TOKEN_ACCOUNT: Pubkey =
static_pubkey!("GZGmwCc3CWrS2guzfTrvQNhiWcW4TVwSPo9Y8VVRxVXY");
pub const ROOT_BANK: Pubkey = static_pubkey!("4GYDmgvMpBx2n2iSmaS1xhZnwebR2gJ5V7UYUBA1PkJi");
pub const NODE_BANK: Pubkey = static_pubkey!("FYFJ4YHDEJnX7yVPoejUTAcKstnovTZpLq5zWAM7c6Uz");
pub const OPTIMIZER_MANGO_ACCOUNT: Pubkey =
static_pubkey!("FhLkZ4krKGzjLzJhMQHJt94gPpWdGNUkqYZKwtUGZFW");
#[inline(always)]
pub fn platform_config() -> PlatformConfigAddresses {
PlatformConfigAddresses {
vault: ACCOUNT,
vault_pda: PDA,
information_account: INFORMATION_ACCOUNT,
config_data_account: CONFIG_DATA_ACCOUNT,
shares_mint: SHARES_MINT,
underlying_deposit_queue: UNDERLYING_DEPOSIT_QUEUE,
lending_program: PROGRAM_ID,
}
}
impl StandaloneVaultProgramConfig for ProgramConfig {
fn account(&self) -> Pubkey {
ACCOUNT
}
fn pda(&self) -> Pubkey {
PDA
}
fn shares_mint(&self) -> Pubkey {
SHARES_MINT
}
fn underlying_compound_queue(&self) -> Pubkey {
UNDERLYING_COMPOUND_QUEUE
}
fn underlying_deposit_queue(&self) -> Pubkey {
UNDERLYING_DEPOSIT_QUEUE
}
fn underlying_withdraw_queue(&self) -> Pubkey {
UNDERLYING_WITHDRAW_QUEUE
}
fn underlying_mint(&self) -> Pubkey {
UNDERLYING_MINT
}
fn config_data_account(&self) -> Pubkey {
CONFIG_DATA_ACCOUNT
}
fn information_account(&self) -> Pubkey {
INFORMATION_ACCOUNT
}
fn program_id(&self) -> Pubkey {
PROGRAM_ID
}
fn solend_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::SolendProgramConfig>> {
None
}
fn tulip_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::TulipProgramConfig>> {
None
}
fn mango_config(
&self,
) -> Option<Box<dyn crate::config::strategy::traits::MangoProgramConfig>> {
Some(Box::new(*self))
}
fn is_platform(&self, platform: Platform) -> bool {
matches!(platform, Platform::MangoV3)
}
fn farm(&self) -> Farm {
FARM_KEY
}
fn tag(&self) -> &str {
TAG_STRING
}
}
impl MangoProgramConfig for ProgramConfig {
fn cache(&self) -> Pubkey {
CACHE
}
fn group(&self) -> Pubkey {
GROUP
}
fn group_signer(&self) -> Pubkey {
GROUP_SIGNER
}
fn group_token_account(&self) -> Pubkey {
GROUP_TOKEN_ACCOUNT
}
fn root_bank(&self) -> Pubkey {
ROOT_BANK
}
fn node_bank(&self) -> Pubkey {
NODE_BANK
}
fn optimizer_mango_account(&self) -> Pubkey {
OPTIMIZER_MANGO_ACCOUNT
}
}
}