17
17
} ,
18
18
spl_token_2022:: {
19
19
extension:: {
20
- confidential_transfer, default_account_state, memo_transfer , transfer_fee ,
21
- ExtensionType , StateWithExtensionsOwned ,
20
+ confidential_transfer, default_account_state, interest_bearing_mint , memo_transfer ,
21
+ transfer_fee , ExtensionType , StateWithExtensionsOwned ,
22
22
} ,
23
23
instruction, native_mint,
24
24
solana_zk_token_sdk:: {
@@ -84,6 +84,10 @@ pub enum ExtensionInitializationParams {
84
84
transfer_fee_basis_points : u16 ,
85
85
maximum_fee : u64 ,
86
86
} ,
87
+ InterestBearingConfig {
88
+ rate_authority : Option < Pubkey > ,
89
+ rate : i16 ,
90
+ } ,
87
91
}
88
92
impl ExtensionInitializationParams {
89
93
/// Get the extension type associated with the init params
@@ -93,6 +97,7 @@ impl ExtensionInitializationParams {
93
97
Self :: DefaultAccountState { .. } => ExtensionType :: DefaultAccountState ,
94
98
Self :: MintCloseAuthority { .. } => ExtensionType :: MintCloseAuthority ,
95
99
Self :: TransferFeeConfig { .. } => ExtensionType :: TransferFeeConfig ,
100
+ Self :: InterestBearingConfig { .. } => ExtensionType :: InterestBearingConfig ,
96
101
}
97
102
}
98
103
/// Generate an appropriate initialization instruction for the given mint
@@ -136,6 +141,15 @@ impl ExtensionInitializationParams {
136
141
transfer_fee_basis_points,
137
142
maximum_fee,
138
143
) ,
144
+ Self :: InterestBearingConfig {
145
+ rate_authority,
146
+ rate,
147
+ } => interest_bearing_mint:: instruction:: initialize (
148
+ token_program_id,
149
+ mint,
150
+ rate_authority,
151
+ rate,
152
+ ) ,
139
153
}
140
154
}
141
155
}
@@ -913,6 +927,25 @@ where
913
927
. await
914
928
}
915
929
930
+ /// Update interest rate
931
+ pub async fn update_interest_rate < S2 : Signer > (
932
+ & self ,
933
+ authority : & S2 ,
934
+ new_rate : i16 ,
935
+ ) -> TokenResult < T :: Output > {
936
+ self . process_ixs (
937
+ & [ interest_bearing_mint:: instruction:: update_rate (
938
+ & self . program_id ,
939
+ self . get_address ( ) ,
940
+ & authority. pubkey ( ) ,
941
+ & [ ] ,
942
+ new_rate,
943
+ ) ?] ,
944
+ & [ authority] ,
945
+ )
946
+ . await
947
+ }
948
+
916
949
/// Update confidential transfer mint
917
950
pub async fn confidential_transfer_update_mint < S2 : Signer > (
918
951
& self ,
0 commit comments