Initial commit from template

This commit is contained in:
StackClass
2025-12-31 03:17:44 +00:00
commit 261dd39540
16 changed files with 3094 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
[package]
name = "swap-program"
version = "0.1.0"
description = "Solana swap program"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
anchor-lang = "0.30.1"
anchor-spl = "0.30.1"

View File

@@ -0,0 +1,42 @@
use anchor_lang::prelude::*;
declare_id!("11111111111111111111111111111111");
#[program]
pub mod swap {
use super::*;
pub fn make_offer(
ctx: Context<MakeOffer>,
id: u64,
token_a_offered_amount: u64,
token_b_wanted_amount: u64,
) -> Result<()> {
// Students will implement this function
Ok(())
}
pub fn take_offer(ctx: Context<TakeOffer>) -> Result<()> {
// Students will implement this function
Ok(())
}
}
#[derive(Accounts)]
#[instruction(id: u64)]
pub struct MakeOffer<'info> {
pub maker: Signer<'info>,
}
#[derive(Accounts)]
pub struct TakeOffer<'info> {
pub taker: Signer<'info>,
}
#[cfg(test)]
mod tests {
#[test]
fn test_sample() {
assert_eq!(2 + 2, 4);
}
}