Skip to content

This project implements a Marinade-compatible Liquid Staking smart contract on Solana with a full suite of Web3-based test cases. solana-liquid-stake-smart-contract-staking solana-liquid-stake-smart-contract-staking solana-liquid-stake-smart-contract-staking solana-liquid-stake-smart-contract-staking

Notifications You must be signed in to change notification settings

vvizardev/marinade-liquid-stake-fork

Repository files navigation

Marinade Liquid Staking Smart Contract

This project implements a Marinade-compatible Liquid Staking smart contract on Solana with a full suite of Web3-based test cases.

📦 Features

  • Stake SOL and receive mSOL (Marinade Staked SOL)
  • Unstake to receive SOL back
  • mSOL/SOL accounting via Marinade protocol
  • Web3-based test suite with @solana/web3.js and @project-serum/anchor
  • Simulates staking/unstaking in a local test validator

📁 Project Structure

.
├── programs/
│   └── marinade_staking/       # Solana smart contract (Anchor)
├── tests/
│   └── marinade.test.ts        # Web3 test cases
├── migrations/
├── Anchor.toml
├── Cargo.toml
└── README.md

🚀 Getting Started

Prerequisites

Install

git clone https://github.com/your-username/marinade-liquid-staking.git
cd marinade-liquid-staking
yarn install

Build & Deploy Locally

anchor build
anchor deploy

Run Tests

anchor test

🧪 Example Test Case

it("Stake SOL and receive mSOL", async () => {
  const tx = await program.methods
    .stake(new anchor.BN(1_000_000_000)) // 1 SOL
    .accounts({
      user: user.publicKey,
      marinadeState: marinadeStatePDA,
      msolMint: msolMint,
      systemProgram: SystemProgram.programId,
    })
    .signers([user])
    .rpc();

  const msolBalance = await getTokenBalance(userMsolATA);
  assert.ok(msolBalance > 0, "User should receive mSOL");
});

🔐 Smart Contract (Program)

  • Written in Rust using Anchor
  • Interacts with Marinade's on-chain staking pool
  • Performs CPI calls to stake/unstake

📜 License

MIT License


🤝 Credits

Built on top of the Marinade Finance staking protocol.

About

This project implements a Marinade-compatible Liquid Staking smart contract on Solana with a full suite of Web3-based test cases. solana-liquid-stake-smart-contract-staking solana-liquid-stake-smart-contract-staking solana-liquid-stake-smart-contract-staking solana-liquid-stake-smart-contract-staking

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published