Skip to content

Commit

Permalink
Print authority address after creating lending market
Browse files Browse the repository at this point in the history
  • Loading branch information
DaSichuan committed Aug 4, 2021
1 parent f2af190 commit 3f02cd2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions deploy_token_lending.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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}'`;
Expand Down
12 changes: 12 additions & 0 deletions token-lending/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down

0 comments on commit 3f02cd2

Please sign in to comment.