An open API service indexing awesome lists of open source software.

https://github.com/vvizardev/marinade-liquid-stake-fork

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
https://github.com/vvizardev/marinade-liquid-stake-fork

anchor liquid marinade native rust smart-contract solana stake

Last synced: 30 days ago
JSON representation

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

Awesome Lists containing this project

README

          

# 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

- [Anchor](https://book.anchor-lang.com/)
- [Solana CLI](https://docs.solana.com/cli/install-solana-cli-tools)
- Node.js >= 16
- Yarn or NPM

### Install

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

### Build & Deploy Locally

```bash
anchor build
anchor deploy
```

### Run Tests

```bash
anchor test
```

## ๐Ÿงช Example Test Case

```ts
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](https://github.com/coral-xyz/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](https://marinade.finance) staking protocol.