Skip to content

Commit e27e38f

Browse files
brick program (#162)
* brick program * fmt + clippy * clippy...again * should error --------- Co-authored-by: Nope X <nope@solend.fi>
1 parent 38ee67e commit e27e38f

File tree

10 files changed

+96
-4
lines changed

10 files changed

+96
-4
lines changed

Anchor.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ anchor_version = "0.13.2"
33
[workspace]
44
members = [
55
"token-lending/program",
6+
"token-lending/brick",
67
]
78

89
[provider]

Cargo.lock

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = [
33
"token-lending/cli",
44
"token-lending/program",
55
"token-lending/sdk",
6+
"token-lending/brick"
67
]
78

89
[profile.dev]

token-lending/brick/Cargo.toml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[package]
2+
name = "brick"
3+
version = "1.0.1"
4+
description = "Solend Brick"
5+
authors = ["Solend Maintainers <maintainers@solend.fi>"]
6+
repository = "https://github.com/solendprotocol/solana-program-library"
7+
license = "Apache-2.0"
8+
edition = "2018"
9+
10+
[features]
11+
no-entrypoint = []
12+
test-bpf = []
13+
14+
[dependencies]
15+
solana-program = "=1.14.10"
16+
17+
[dev-dependencies]
18+
assert_matches = "1.5.0"
19+
bytemuck = "1.5.1"
20+
base64 = "0.13"
21+
log = "0.4.14"
22+
proptest = "1.0"
23+
solana-program-test = "=1.14.10"
24+
solana-sdk = "=1.14.10"
25+
serde = "=1.0.140"
26+
serde_yaml = "0.8"
27+
thiserror = "1.0"
28+
bincode = "1.3.3"
29+
borsh = "0.9.3"
30+
31+
[lib]
32+
crate-type = ["cdylib", "lib"]
33+
34+
[profile.release]
35+
lto = "fat"
36+
codegen-units = 1
37+
38+
[profile.release.build-override]
39+
opt-level = 3
40+
incremental = false
41+
codegen-units = 1

token-lending/brick/Xargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.bpfel-unknown-unknown.dependencies.std]
2+
features = []

token-lending/brick/src/entrypoint.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//! Program entrypoint definitions
2+
3+
#![cfg(all(target_arch = "bpf", not(feature = "no-entrypoint")))]
4+
5+
use solana_program::{
6+
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg,
7+
program_error::PrintProgramError, program_error::ProgramError, pubkey::Pubkey,
8+
};
9+
10+
entrypoint!(process_instruction);
11+
fn process_instruction(
12+
program_id: &Pubkey,
13+
accounts: &[AccountInfo],
14+
instruction_data: &[u8],
15+
) -> ProgramResult {
16+
msg!("got me feeling bricked up");
17+
18+
Err(ProgramError::InvalidArgument)
19+
}

token-lending/brick/src/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![deny(missing_docs)]
2+
3+
//! A brick.
4+
5+
pub use solana_program;
6+
7+
solana_program::declare_id!("So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo");
8+
9+
pub mod entrypoint;

token-lending/cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ spl-associated-token-account = "1.0"
2323
solana-account-decoder = "1.14.10"
2424

2525
[[bin]]
26-
name = "solend-program"
26+
name = "solend-cli"
2727
path = "src/main.rs"

token-lending/program/tests/helpers/solend_program_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl SolendProgramTest {
267267
let instructions = [system_instruction::create_account(
268268
&self.context.payer.pubkey(),
269269
&keypair.pubkey(),
270-
rent as u64,
270+
rent,
271271
size as u64,
272272
owner,
273273
)];

token-lending/sdk/src/state/reserve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ mod test {
15671567
// Generate a u64 element in the range [0, u64::MAX].
15681568
.prop_flat_map(|vec| {
15691569
let max_u8 = *vec.iter().max().unwrap() as u64;
1570-
(Just(vec), max_u8..=u64::MAX as u64)
1570+
(Just(vec), max_u8..=u64::MAX)
15711571
})
15721572
.prop_map(|(mut vec, d)| {
15731573
// Sort the vector to ensure the first three elements are in non-decreasing order.
@@ -1631,7 +1631,7 @@ mod test {
16311631
min_borrow_rate,
16321632
optimal_borrow_rate,
16331633
max_borrow_rate,
1634-
super_max_borrow_rate: super_max_borrow_rate as u64,
1634+
super_max_borrow_rate,
16351635
..ReserveConfig::default()
16361636
},
16371637
..Reserve::default()

0 commit comments

Comments
 (0)