1use anchor_lang::prelude::*;
2
3declare_id!("2BUrizpXHXA43qJxnzRBGpwemtHKVqB3JE3G63NKHbzz");
4
5pub mod combinations;
6pub mod web;
7pub mod constants;
8pub mod instructions;
9pub mod state;
10pub mod utils;
11use combinations::*;
12use instructions::*;
13use web::*;
14#[program]
17pub mod psylend_cpi {
18 use super::*;
19
20 pub fn dummy_cpi(ctx: Context<DummyMsgCpi>) -> Result<()> {
22 instructions::dummy_cpi::handler(ctx)
23 }
24
25 pub fn accrue_interest_cpi(ctx: Context<AccrueInterest>) -> Result<()> {
26 instructions::accrue_interest::handler(ctx)
27 }
28
29 pub fn init_obligation_cpi(ctx: Context<InitializeObligation>, bump: u8) -> Result<()> {
30 instructions::init_obligation::handler(ctx, bump)
31 }
32
33 pub fn refresh_reserve_cpi(ctx: Context<RefreshReserve>) -> Result<()> {
34 instructions::refresh_reserve::handler(ctx)
35 }
36
37 pub fn refresh_psyfi_reserve_cpi(ctx: Context<RefreshPsyFiReserve>) -> Result<()> {
38 instructions::refresh_psyfi_reserve::handler(ctx)
39 }
40
41 pub fn close_obligation_cpi(ctx: Context<CloseObligation>) -> Result<()> {
42 instructions::close_obligation::handler(ctx)
43 }
44
45 pub fn close_deposit_cpi(ctx: Context<CloseDepositAccount>) -> Result<()> {
46 instructions::close_deposit_account::handler(ctx)
47 }
48
49 pub fn init_deposit_cpi(ctx: Context<InitializeDepositAccount>, bump: u8) -> Result<()> {
50 instructions::init_deposit_account::handler(ctx, bump)
51 }
52
53 pub fn deposit_cpi(ctx: Context<Deposit>, bump: u8, amount: Amount) -> Result<()> {
54 instructions::deposit::handler(ctx, bump, amount)
55 }
56
57 pub fn withdraw_cpi(ctx: Context<Withdraw>, bump: u8, amount: Amount) -> Result<()> {
58 instructions::withdraw::handler(ctx, bump, amount)
59 }
60
61 pub fn init_collateral_account_cpi(
62 ctx: Context<InitializeCollateralAccount>,
63 bump: u8,
64 ) -> Result<()> {
65 instructions::init_collateral_account::handler(ctx, bump)
66 }
67
68 pub fn close_collateral_account_cpi(ctx: Context<CloseCollateralAccount>) -> Result<()> {
69 instructions::close_collateral_account::handler(ctx)
70 }
71
72 pub fn borrow_cpi(ctx: Context<Borrow>, bump: u8, amount: Amount) -> Result<()> {
73 instructions::borrow::handler(ctx, bump, amount)
74 }
75
76 pub fn init_loan_account_cpi(ctx: Context<InitializeLoanAccount>, bump: u8) -> Result<()> {
77 instructions::init_loan_account::handler(ctx, bump)
78 }
79
80 pub fn close_loan_account_cpi(ctx: Context<CloseLoanAccount>) -> Result<()> {
81 instructions::close_loan_account::handler(ctx)
82 }
83
84 pub fn deposit_collateral_cpi(
85 ctx: Context<DepositCollateral>,
86 collateral_bump: u8,
87 deposit_bump: u8,
88 amount: Amount,
89 ) -> Result<()> {
90 instructions::deposit_collateral::handler(ctx, collateral_bump, deposit_bump, amount)
91 }
92
93 pub fn withdraw_collateral_cpi(
94 ctx: Context<WithdrawCollateral>,
95 collateral_bump: u8,
96 deposit_bump: u8,
97 amount: Amount,
98 ) -> Result<()> {
99 instructions::withdraw_collateral::handler(ctx, collateral_bump, deposit_bump, amount)
100 }
101
102 pub fn repay_cpi(ctx: Context<Repay>, amount: Amount) -> Result<()> {
103 instructions::repay::handler(ctx, amount)
104 }
105
106 pub fn deposit_tokens_cpi(ctx: Context<DepositTokens>, amount: Amount) -> Result<()> {
107 instructions::deposit_tokens::handler(ctx, amount)
108 }
109
110 pub fn withdraw_tokens_cpi(ctx: Context<WithdrawTokens>, amount: Amount) -> Result<()> {
111 instructions::withdraw_tokens::handler(ctx, amount)
112 }
113
114 pub fn accrue_deposit_tokens_cpi(
115 ctx: Context<AccrueAndDepositTokens>,
116 amount: Amount,
117 ) -> Result<()> {
118 combinations::accrue_deposit_token::handler(ctx, amount)
119 }
120
121 pub fn accrue_withdraw_tokens_cpi(
122 ctx: Context<AccrueAndWithdrawTokens>,
123 amount: Amount,
124 ) -> Result<()> {
125 combinations::accrue_withdraw_token::handler(ctx, amount)
126 }
127
128 pub fn get_current_interest(ctx: Context<GetCurrentInterest>) -> Result<()> {
129 combinations::get_current_interest::handler(ctx)
130 }
131
132 pub fn get_reserve_balance(ctx: Context<GetReserveBalance>) -> Result<()> {
133 web::get_reserve_balance::handler(ctx)
134 }
135
136 pub fn get_user_balance(ctx: Context<GetUserBalance>) -> Result<()> {
137 web::get_user_balance::handler(ctx)
138 }
139
140
141 }
150
151pub const TOKENS: u8 = 0;
152pub const DEPOSIT_NOTES: u8 = 1;
153pub const LOAN_NOTES: u8 = 2;
154
155#[derive(AnchorDeserialize, AnchorSerialize, Eq, PartialEq, Debug, Clone, Copy)]
158pub struct Amount {
159 pub units: u8,
160 pub value: u64,
161}