A basic command line interface for initializing lending markets and reserves for SPL Token Lending.
See https://spl.solana.com/token-lending for more details
shell
cargo install spl-token-lending-cli
This is optional! You can simply add your own market and reserves to the existing on-chain programs.
If you want to deploy your own program, follow this guide and note the program ID.
A lending market is a collection of reserves that can be configured to borrow and lend with each other.
The lending market owner must sign to add reserves.
shell
spl-token-lending \
--program PUBKEY \
--fee-payer SIGNER \
create-market \
--market-owner PUBKEY
- --program
is the lending program ID.
- --fee-payer
will sign to pay transaction fees.
- --market-owner
is the lending market owner pubkey.
Run spl-token-lending create-market --help
for more details and options.
```shell spl-token-lending \ --program 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH \ --fee-payer owner.json \ create-market \ --market-owner JAgN4SZLNeCo9KTnr8EWt4FzEV1UDgHkcZwkVtWtfp6P
``
Note the lending market pubkey (e.g.
7uX9ywsk1X2j6wLoywMDVQLNWAqhDpVqZzL4qm4CuMMT`). You'll use this to add reserves.
A reserve is a liquidity pool that can be deposited into, borrowed from, and optionally used as collateral for borrows.
shell
spl-token-lending \
--program PUBKEY \
--fee-payer SIGNER \
add-reserve \
--market-owner SIGNER \
--source-owner SIGNER \
--market PUBKEY \
--source PUBKEY \
--amount DECIMAL_AMOUNT \
--pyth-product PUBKEY \
--pyth-price PUBKEY
- --program
is the lending program ID.
- --fee-payer
will sign to pay transaction fees.
- --market-owner
will sign as the lending market owner.
- --source-owner
will sign as the source liquidity owner.
- --market
is the lending market pubkey.
- --source
is the SPL Token account pubkey (owned by --source-owner
).
- --amount
is the amount of tokens to deposit.
- --pyth-product
and --pyth-price
are oracle
accounts provided by Pyth.
Run spl-token-lending add-reserve --help
for more details and options.
```shell spl-token-lending \ --program 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH \ --fee-payer owner.json \ add-reserve \ --market-owner owner.json \ --source-owner owner.json \ --market 7uX9ywsk1X2j6wLoywMDVQLNWAqhDpVqZzL4qm4CuMMT \ --source AJ2sgpgj6ZeQazPPiDyTYqN9vbj58QMaZQykB9Sr6XY \ --amount 5.0 \ --pyth-product 8yrQMUyJRnCJ72NWwMiPV9dNGw465Z8bKUvnUC8P5L6F \ --pyth-price BdgHsXrH1mXqhdosXavYxZgX6bGqTdj5mh2sxDhF8bJy
```
Note the reserve pubkey (e.g. 69BwFhpQBzZfcp9MCj9V8TLvdv9zGfQQPQbb8dUHsaEa
). You'll use this to deposit liquidity, redeem collateral, borrow, repay, and liquidate.