The Solend lending protocol is based on the token-lending program authored by Solana labs.
The Solend protocol is open source with a focus on developer friendliness and integrations.
Solend is made for developers to build on top of. Check out our developer portal to understand more and get involved.
Please note that only the lending program deployed to devnet is currently operational.
Cluster | Program Address |
---|---|
Mainnet Beta | So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo |
Devnet | ALend7Ketfx5bxh6ghsCDXAoDrhvEmsXT3cynB6aPLgx |
This is optional! You can skip these steps and use the Token Lending CLI with one of the on-chain programs listed above to create a lending market and add reserves to it.
-
Install the Token and Token Lending CLIs:
cargo install spl-token-cli cargo install solend-program-cli
-
Clone the SPL repo:
git clone https://github.com/solana-labs/solana-program-library.git
-
Go to the new directory:
cd solana-program-library
-
Generate a keypair for yourself:
solana-keygen new -o owner.json # Wrote new keypair to owner.json # ================================================================================ # pubkey: JAgN4SZLNeCo9KTnr8EWt4FzEV1UDgHkcZwkVtWtfp6P # ================================================================================ # Save this seed phrase and your BIP39 passphrase to recover your new keypair: # your seed words here never share them not even with your mom # ================================================================================
This pubkey will be the owner of the lending market that can add reserves to it.
-
Generate a keypair for the program:
solana-keygen new -o lending.json # Wrote new keypair to lending.json # ============================================================================ # pubkey: 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH # ============================================================================ # Save this seed phrase and your BIP39 passphrase to recover your new keypair: # your seed words here never share them not even with your mom # ============================================================================
This pubkey will be your Program ID.
-
Open
./token-lending/program/src/lib.rs
in your editor. In the linesolana_program::declare_id!("6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH");
replace the Program ID with yours.
-
Build the program binaries:
cargo build cargo build-bpf
-
Prepare to deploy to devnet:
solana config set --url https://api.devnet.solana.com
-
Score yourself some sweet SOL:
solana airdrop -k owner.json 10 solana airdrop -k owner.json 10 solana airdrop -k owner.json 10
You'll use this for transaction fees, rent for your program accounts, and initial reserve liquidity.
-
Deploy the program:
solana program deploy \ -k owner.json \ --program-id lending.json \ target/deploy/solend_program.so # Program Id: 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH
If the deployment doesn't succeed, follow this guide to resume it.
-
Wrap some of your SOL as an SPL Token:
spl-token wrap \ --fee-payer owner.json \ 10.0 \ -- owner.json # Wrapping 10 SOL into AJ2sgpgj6ZeQazPPiDyTYqN9vbj58QMaZQykB9Sr6XY
You'll use this for initial reserve liquidity. Note the SPL Token account pubkey (e.g.
AJ2sgpgj6ZeQazPPiDyTYqN9vbj58QMaZQykB9Sr6XY
). -
Use the Token Lending CLI to create a lending market and add reserves to it.