Initial commit from template

This commit is contained in:
StackClass
2026-01-08 09:19:59 +00:00
commit f5485c229f
17 changed files with 1841 additions and 0 deletions

23
.eslintrc.js Normal file
View File

@@ -0,0 +1,23 @@
module.exports = {
root: true,
env: {
es2020: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
project: "./tsconfig.json",
},
ignorePatterns: ["**/target/**", "node_modules"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/ban-ts-comment": "off",
},
};

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
target/
*.so
.DS_Store

11
.stackclass/compile.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
#
# This script is used to compile your program on StackClass
#
# This runs before .stackclass/run.sh
#
# Learn more: https://docs.stackclass.dev/challenges/program-interface
set -e # Exit on failure
anchor build

11
.stackclass/run.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
#
# This script is used to run your program on StackClass
#
# This runs after .stackclass/compile.sh
#
# Learn more: https://docs.stackclass.dev/challenges/program-interface
set -e # Exit on failure
# exec target/release/stackclass-solana-lending-program "$@"

18
Anchor.toml Normal file
View File

@@ -0,0 +1,18 @@
[toolchain]
[features]
resolution = true
skip-lint = false
[programs.localnet]
lending-program = "3CtFsp1pYwxuS7hyoNt5iynXtykC5QCozjMiJBya1JEN"
[registry]
url = "https://api.apr.dev"
[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"
[scripts]
test = "cargo test -- --nocapture"

1576
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

21
Cargo.toml Normal file
View File

@@ -0,0 +1,21 @@
[workspace]
members = [
"programs/*"
]
resolver = "2"
[package]
name = "stackclass-solana-lending-program"
version = "0.1.0"
authors = ["StackClass <hello@stackclass.dev>"]
edition = "2021"
[profile.release]
overflow-checks = true
lto = "fat"
codegen-units = 1
[profile.release.build-override]
opt-level = 3
incremental = false
codegen-units = 1

14
migrations/deploy.ts Normal file
View File

@@ -0,0 +1,14 @@
// Migrations are managed by Anchor
// This file can be used for custom deployment scripts
import * as anchor from "@coral-xyz/anchor";
async function main() {
console.log("Running deployment script...");
// Custom deployment logic can be added here
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

24
package.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "solana-lending",
"version": "0.1.0",
"description": "Solana lending program built with Anchor",
"main": "index.js",
"scripts": {
"test": "anchor test",
"lint": "eslint --ext .ts tests/",
"build": "anchor build",
"deploy": "anchor deploy"
},
"dependencies": {
"@coral-xyz/anchor": "^0.32.1",
"@solana/web3.js": "^1.87.0"
},
"devDependencies": {
"@types/mocha": "^10.0.0",
"@types/node": "^20.0.0",
"eslint": "^8.0.0",
"mocha": "^10.0.0",
"ts-mocha": "^10.0.0",
"typescript": "^5.0.0"
}
}

View File

@@ -0,0 +1,28 @@
[package]
name = "lending-program"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "lending_program"
[features]
default = []
cpi = ["no-entrypoint"]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
idl-build = ["anchor-lang/idl-build"]
anchor-debug = []
custom-heap = []
custom-panic = []
[dependencies]
anchor-lang = "0.32.1"
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] }

View File

@@ -0,0 +1,16 @@
use anchor_lang::prelude::*;
declare_id!("3CtFsp1pYwxuS7hyoNt5iynXtykC5QCozjMiJBya1JEN");
#[program]
pub mod lending_program {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
msg!("Greetings from: {:?}", ctx.program_id);
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize {}

4
rust-toolchain.toml Normal file
View File

@@ -0,0 +1,4 @@
[toolchain]
channel = "1.89.0"
components = ["rustfmt","clippy"]
profile = "minimal"

1
src/main.rs Normal file
View File

@@ -0,0 +1 @@
fn main() {}

18
stackclass.yml Normal file
View File

@@ -0,0 +1,18 @@
# Set this to true if you want debug logs.
#
# These can be VERY verbose, so we suggest turning them off
# unless you really need them.
debug: false
# Use this to change the Rust version used to run your code
# on StackClass.
#
# Available versions: rust-1.87
language_pack: rust-1.87
# The executable required to build and run the this project,
# along with its minimum required version.
required_executable: cargo (1.87)
# The main source file that users can edit for this project.
user_editable_file: programs/lending-program/src/lib.rs

34
tests/lending.ts Normal file
View File

@@ -0,0 +1,34 @@
import * as anchor from "@coral-xyz/anchor";
import { Program } from "@coral-xyz/anchor";
import { Lending } from "../target/types/lending";
describe("lending", () => {
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
const program = anchor.workspace.Lending as Program<Lending>;
it("Initialize bank", async () => {
// Test initialization
});
it("Initialize user", async () => {
// Test user initialization
});
it("Deposit tokens", async () => {
// Test deposit functionality
});
it("Withdraw tokens", async () => {
// Test withdraw functionality
});
it("Borrow tokens", async () => {
// Test borrow functionality
});
it("Repay loan", async () => {
// Test repay functionality
});
});

14
tsconfig.json Normal file
View File

@@ -0,0 +1,14 @@
{
"compilerOptions": {
"types": ["mocha"],
"lib": ["esnext"],
"module": "commonjs",
"target": "es2020",
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
}

25
your_program.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
#
# Use this script to run your program LOCALLY.
#
# Note: Changing this script WILL NOT affect how StackClass runs your program.
#
# Learn more: https://docs.stackclass.dev/challenges/program-interface
set -e # Exit early if any commands fail
# Copied from .stackclass/compile.sh
#
# - Edit this to change how your program compiles locally
# - Edit .stackclass/compile.sh to change how your program compiles remotely
(
cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory
anchor build
)
# Copied from .stackclass/run.sh
#
# - Edit this to change how your program runs locally
# - Edit .stackclass/run.sh to change how your program runs remotely
# cd "$(dirname "$0"
# exec target/release/stackclass-solana-swap-program "$@"