From 3f02cd2b0cfb207ed16d0d89d3590621f804fb8c Mon Sep 17 00:00:00 2001 From: dasichuan <0xdasichuan@gmail.com> Date: Tue, 3 Aug 2021 18:45:09 -0700 Subject: [PATCH] Print authority address after creating lending market --- deploy_token_lending.sh | 5 ++--- token-lending/cli/src/main.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/deploy_token_lending.sh b/deploy_token_lending.sh index aa3485bca46..6a1bd818b40 100755 --- a/deploy_token_lending.sh +++ b/deploy_token_lending.sh @@ -31,9 +31,9 @@ CREATE_MARKET_OUTPUT=`target/debug/spl-token-lending create-market \ echo "$CREATE_MARKET_OUTPUT"; MARKET_ADDR=`echo $CREATE_MARKET_OUTPUT | head -n1 | awk '{print $4}'`; +AUTHORITY_ADDR=`echo $CREATE_MARKET_OUTPUT | grep "Authority Address" | awk '{print $NF}'`; echo "Creating SOL reserve"; -echo " -----$SOURCE -----" SOL_RESERVE_OUTPUT=`target/debug/spl-token-lending add-reserve \ --fee-payer $OWNER \ --market-owner $OWNER \ @@ -154,8 +154,7 @@ export BTC_MINT_ADDRESS="$BTC_TOKEN_MINT"; # Main Market export MAIN_MARKET_ADDRESS="$MARKET_ADDR"; -export MAIN_MARKET_AUTHORITY_ADDRESS="TODO"; -export MAIN_MARKET_TRANSFER_AUTHORITY_ADDRESS="TODO"; +export MAIN_MARKET_AUTHORITY_ADDRESS="$AUTHORITY_ADDR"; # Reserves export SOL_RESERVE_ADDRESS=`echo "$SOL_RESERVE_OUTPUT" | grep "Adding reserve" | awk '{print $NF}'`; diff --git a/token-lending/cli/src/main.rs b/token-lending/cli/src/main.rs index 188e37db414..5d5a7f27a9a 100644 --- a/token-lending/cli/src/main.rs +++ b/token-lending/cli/src/main.rs @@ -756,6 +756,18 @@ fn command_create_lending_market( recent_blockhash, ); send_transaction(config, transaction)?; + + let lending_market_pubkey = lending_market_keypair.pubkey(); + let lending_market_account = config.rpc_client.get_account(&lending_market_pubkey)?; + let lending_market = LendingMarket::unpack_from_slice(lending_market_account.data.borrow())?; + let authority_signer_seeds = &[ + lending_market_pubkey.as_ref(), + &[lending_market.bump_seed], + ]; + println!( + "Authority Address {}", + Pubkey::create_program_address(authority_signer_seeds, &config.lending_program_id)?, + ); Ok(()) }