File tree Expand file tree Collapse file tree 2 files changed +0
-10
lines changed
examples/sol-anchor-contract
programs/example-sol-anchor-contract/src Expand file tree Collapse file tree 2 files changed +0
-10
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ declare_id!("Fwn1fCmbjd8d95hxY9NUUr5Xa7D13khveMnmCUFdd3ah");
77
88#[ account]
99pub struct AdminConfig {
10- pub is_initialized : bool ,
1110 pub loan_price_feed_id : Pubkey ,
1211 pub collateral_price_feed_id : Pubkey ,
1312}
@@ -39,18 +38,11 @@ pub mod example_sol_anchor_contract {
3938 use super :: * ;
4039
4140 pub fn init ( ctx : Context < InitRequest > , config : AdminConfig ) -> Result < ( ) > {
42- if ctx. accounts . config . is_initialized {
43- return Err ( error ! ( ErrorCode :: ReInitialize ) ) ;
44- }
4541 ctx. accounts . config . set_inner ( config) ;
4642 Ok ( ( ) )
4743 }
4844
4945 pub fn loan_to_value ( ctx : Context < QueryRequest > , loan_qty : i64 , collateral_qty : i64 ) -> Result < ( ) > {
50- if !ctx. accounts . config . is_initialized {
51- return Err ( error ! ( ErrorCode :: UnInitialize ) ) ;
52- }
53-
5446 msg ! ( "Loan quantity is {}." , loan_qty) ;
5547 msg ! ( "Collateral quantity is {}." , collateral_qty) ;
5648
Original file line number Diff line number Diff line change 3232it ( "Initialize the config." , async ( ) => {
3333 let txSig = await program . rpc . init (
3434 {
35- isInitialized : true ,
3635 loanPriceFeedId : new anchor . web3 . PublicKey ( ethToUSD ) ,
3736 collateralPriceFeedId : new anchor . web3 . PublicKey ( usdtToUSD ) ,
3837 } ,
@@ -73,7 +72,6 @@ it("Prevent initialization of config without authority.", async () => {
7372 try {
7473 txSig = await program . rpc . init (
7574 {
76- isInitialized : true ,
7775 loanPriceFeedId : new anchor . web3 . PublicKey ( ethToUSD ) ,
7876 collateralPriceFeedId : new anchor . web3 . PublicKey ( usdtToUSD ) ,
7977 } ,
You can’t perform that action at this time.
0 commit comments