Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish crate2 #80

Merged
merged 5 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/workflows/pull-request-token-lending.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,3 @@ jobs:
name: token-lending-programs
path: "target/deploy/*.so"
if-no-files-found: error

js-test:
runs-on: ubuntu-latest
env:
NODE_VERSION: 12.x
needs: cargo-test-bpf
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: node-${{ hashFiles('token-lending/js/package-lock.json') }}
restore-keys: |
node-
- name: Download programs
uses: actions/download-artifact@v2
with:
name: token-lending-programs
path: target/deploy
- run: ./ci/js-test-token-lending.sh
78 changes: 39 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions ci/js-test-token-lending.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/js-test-token-swap.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/js-test-token.sh

This file was deleted.

12 changes: 6 additions & 6 deletions deploy_token_lending.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ SOURCE=`target/debug/spl-token --config $SOLANA_CONFIG wrap 10 2>&1 | head -n1 |

solana program --config $SOLANA_CONFIG deploy \
--program-id $PROGRAM_ID \
target/deploy/spl_token_lending.so;
target/deploy/solend_program.so;

echo "Creating Lending Market";
CREATE_MARKET_OUTPUT=`target/debug/spl-token-lending create-market \
CREATE_MARKET_OUTPUT=`target/debug/solend-program create-market \
--fee-payer $OWNER \
--market-owner $MARKET_OWNER \
--verbose`;
Expand All @@ -34,7 +34,7 @@ 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";
SOL_RESERVE_OUTPUT=`target/debug/spl-token-lending add-reserve \
SOL_RESERVE_OUTPUT=`target/debug/solend-program add-reserve \
--fee-payer $OWNER \
--market-owner $OWNER \
--source-owner $OWNER \
Expand Down Expand Up @@ -63,7 +63,7 @@ echo "USDC MINT: $USDC_TOKEN_MINT"
USDC_TOKEN_ACCOUNT=`target/debug/spl-token --config $SOLANA_CONFIG create-account $USDC_TOKEN_MINT | awk '{print $3}'`;
target/debug/spl-token --config $SOLANA_CONFIG mint $USDC_TOKEN_MINT 30000000;

USDC_RESERVE_OUTPUT=`target/debug/spl-token-lending add-reserve \
USDC_RESERVE_OUTPUT=`target/debug/solend-program add-reserve \
--fee-payer $OWNER \
--market-owner $OWNER \
--source-owner $OWNER \
Expand Down Expand Up @@ -92,7 +92,7 @@ echo "ETH MINT: $ETH_TOKEN_MINT"
ETH_TOKEN_ACCOUNT=`target/debug/spl-token --config $SOLANA_CONFIG create-account $ETH_TOKEN_MINT | awk '{print $3}'`;
target/debug/spl-token --config $SOLANA_CONFIG mint $ETH_TOKEN_MINT 8000000;

ETH_RESERVE_OUTPUT=`target/debug/spl-token-lending add-reserve \
ETH_RESERVE_OUTPUT=`target/debug/solend-program add-reserve \
--fee-payer $OWNER \
--market-owner $OWNER \
--source-owner $OWNER \
Expand Down Expand Up @@ -121,7 +121,7 @@ echo "BTC MINT: $BTC_TOKEN_MINT"
BTC_TOKEN_ACCOUNT=`target/debug/spl-token --config $SOLANA_CONFIG create-account $BTC_TOKEN_MINT | awk '{print $3}'`;
target/debug/spl-token --config $SOLANA_CONFIG mint $BTC_TOKEN_MINT 8000000;

BTC_RESERVE_OUTPUT=`target/debug/spl-token-lending add-reserve \
BTC_RESERVE_OUTPUT=`target/debug/solend-program add-reserve \
--fee-payer $OWNER \
--market-owner $OWNER \
--source-owner $OWNER \
Expand Down
4 changes: 2 additions & 2 deletions token-lending/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This is optional! You can skip these steps and use the [Token Lending CLI](./cli
1. Install the Token and Token Lending CLIs:
```shell
cargo install spl-token-cli
cargo install spl-token-lending-cli
cargo install solend-program-cli
```

1. Clone the SPL repo:
Expand Down Expand Up @@ -101,7 +101,7 @@ This is optional! You can skip these steps and use the [Token Lending CLI](./cli
solana program deploy \
-k owner.json \
--program-id lending.json \
target/deploy/spl_token_lending.so
target/deploy/solend_program.so

# Program Id: 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH
```
Expand Down
14 changes: 7 additions & 7 deletions token-lending/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
description = "SPL Token Lending CLI"
authors = ["Solend Maintainers <maintainers@solend.fi>"]
description = "Solend Program CLI"
edition = "2018"
homepage = "https://spl.solana.com/token-lending"
homepage = "https://solend.fi"
license = "Apache-2.0"
name = "spl-token-lending-cli"
repository = "https://github.com/solana-labs/solana-program-library"
name = "solend-program-cli"
repository = "https://github.com/solendprotocol/solana-program-library"
version = "0.1.0"

[dependencies]
Expand All @@ -16,9 +16,9 @@ solana-client = "=1.8.14"
solana-logger = "=1.8.14"
solana-sdk = "=1.8.14"
solana-program = "=1.8.14"
spl-token-lending = { path="../program", features = [ "no-entrypoint" ] }
solend-program = { path="../program", features = [ "no-entrypoint" ] }
spl-token = { version = "3.2.0", features=["no-entrypoint"] }

[[bin]]
name = "spl-token-lending"
name = "solend-program"
path = "src/main.rs"
14 changes: 7 additions & 7 deletions token-lending/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ See https://spl.solana.com/token-lending for more details

## Install the CLI
```shell
cargo install spl-token-lending-cli
cargo install solend-program-cli
```

## Deploy a lending program (optional)
Expand All @@ -23,7 +23,7 @@ The lending market owner must sign to add reserves.

### Usage
```shell
spl-token-lending \
solend-program \
--program PUBKEY \
--fee-payer SIGNER \
create-market \
Expand All @@ -33,11 +33,11 @@ spl-token-lending \
- `--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.
Run `solend-program create-market --help` for more details and options.

### Example
```shell
spl-token-lending \
solend-program \
--program 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH \
--fee-payer owner.json \
create-market \
Expand All @@ -54,7 +54,7 @@ A reserve is a liquidity pool that can be deposited into, borrowed from, and opt

### Usage
```shell
spl-token-lending \
solend-program \
--program PUBKEY \
--fee-payer SIGNER \
add-reserve \
Expand All @@ -76,11 +76,11 @@ spl-token-lending \
- `--pyth-product` and `--pyth-price` are oracle
accounts [provided by Pyth](https://pyth.network/developers/consumers/accounts).

Run `spl-token-lending add-reserve --help` for more details and options.
Run `solend-program add-reserve --help` for more details and options.

### Example
```shell
spl-token-lending \
solend-program \
--program 6TvznH3B2e3p2mbhufNBpgSrLx6UkgvxtVQvopEZ2kuH \
--fee-payer owner.json \
add-reserve \
Expand Down
35 changes: 27 additions & 8 deletions token-lending/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ use {
system_instruction,
transaction::Transaction,
},
solend_program::{
self,
instruction::{init_lending_market, init_reserve, update_reserve_config},
math::WAD,
state::{LendingMarket, Reserve, ReserveConfig, ReserveFees},
},
spl_token::{
amount_to_ui_amount,
instruction::{approve, revoke},
state::{Account as Token, Mint},
ui_amount_to_amount,
},
spl_token_lending::{
self,
instruction::{init_lending_market, init_reserve, update_reserve_config},
math::WAD,
state::{LendingMarket, Reserve, ReserveConfig, ReserveFees},
},
std::{borrow::Borrow, process::exit, str::FromStr},
system_instruction::create_account,
};
Expand Down Expand Up @@ -90,7 +90,7 @@ const SWITCHBOARD_PROGRAM_ID_DEV: &str = "7azgmy1pFXHikv36q1zZASvFq5vFa39TT9NweV
fn main() {
solana_logger::setup_with_default("solana=info");

let default_lending_program_id: &str = &spl_token_lending::id().to_string();
let default_lending_program_id: &str = &solend_program::id().to_string();

let matches = App::new(crate_name!())
.about(crate_description!())
Expand Down Expand Up @@ -368,6 +368,16 @@ fn main() {
.default_value("20")
.help("Amount of fee going to host account: [0, 100]"),
)
.arg(
Arg::with_name("protocol_liquidation_fee")
.long("protocol-liquidation-fee")
.validator(is_parsable::<u8>)
.value_name("INTEGER_PERCENT")
.takes_value(true)
.required(false)
.default_value("30")
.help("Amount of liquidation bonus going to fee reciever: [0, 100]"),
)
.arg(
Arg::with_name("deposit_limit")
.long("deposit-limit")
Expand Down Expand Up @@ -510,6 +520,15 @@ fn main() {
.required(false)
.help("Amount of fee going to host account: [0, 100]"),
)
.arg(
Arg::with_name("protocol_liquidation_fee")
.long("protocol-liquidation-fee")
.validator(is_parsable::<u8>)
.value_name("INTEGER_PERCENT")
.takes_value(true)
.required(false)
.help("Amount of liquidation bonus going to fee reciever: [0, 100]"),
)
.arg(
Arg::with_name("deposit_limit")
.long("deposit-limit")
Expand Down Expand Up @@ -1180,7 +1199,7 @@ fn command_update_reserve(
reserve.config.protocol_liquidation_fee = reserve_config.protocol_liquidation_fee.unwrap();
}

let mut new_pyth_product_pubkey = spl_token_lending::NULL_PUBKEY;
let mut new_pyth_product_pubkey = solend_program::NULL_PUBKEY;
if pyth_price_pubkey.is_some() {
println!(
"Updating pyth oracle pubkey from {} to {}",
Expand Down
Loading