GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aarjn/vault-manager: An asset manager’s vault, where customers can deposit SPL tokens of their choice. The vault manager should not be able to withdraw the vault’s funds.

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
migrations
migrations
 
 
programs/vault-manager
programs/vault-manager
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.prettierignore
.prettierignore
 
 
Anchor.toml
Anchor.toml
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
README.md
README.md
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

Vault Manager

This is an Anchor project implementing a simple vault manager on the Solana blockchain. The contract allows users to deposit and withdraw tokens from a vault.

Contract Structure

Program ID

2eH4VtkkB5X5592hmuQqFQvQ9QKaTEmRZyvQgf9EWyxp

Solana Explorer

Modules

vault_manager

This is the main module of the contract, containing the program's logic.

Functions

  1. initialize: Initializes the Vault Manager.
  2. deposit: Allows users to deposit tokens into the vault.
  3. withdraw: Allows users to withdraw tokens from the vault.

Structs

  1. Initialize: Accounts required for initializing the vault manager.
  2. Deposit: Accounts required for depositing tokens into the vault.
  3. Withdraw: Accounts required for withdrawing tokens from the vault.

Errors

  • VaultError: Custom error enum for handling insufficient funds errors.

Contract Details

Initialize

  • Creates a PDA (Program Derived Address) for the token account owner.
  • Initializes necessary accounts and programs.

Deposit

  • Checks if the sender has sufficient funds.
  • Transfers tokens from the sender's account to the vault.
  • Uses Cross-Program Invocation (CPI) to interact with the SPL Token program.

Withdraw

  • Checks if the vault has sufficient funds.
  • Transfers tokens from the vault to the receiver's account.
  • Uses CPI with signer seeds to authorize the transfer.

Building and Testing the Project

To build and test this Anchor project, follow these steps:

  1. Install Anchor and its dependencies:

    npm install -g @project-serum/anchor-cli
    
  2. Build the project:

    anchor build
    
  3. Update the program ID in lib.rs and Anchor.toml with the new program ID generated during the build process.

  4. Test the project:

    anchor test
    
  5. To deploy the program to a Solana cluster (e.g., devnet):

    anchor deploy --provider.cluster devnet
    

Note: Make sure you have a Solana wallet set up and funded with SOL for deployment costs.

Additional Notes

  • This contract uses the anchor_lang and anchor_spl crates for Solana program development.
  • Proper error handling is implemented for insufficient funds scenarios.
  • The contract uses PDAs for secure token management.
  • Always ensure you have the latest version of Anchor and its dependencies installed.

For more information on Anchor development, visit the official Anchor documentation.

About

An asset manager’s vault, where customers can deposit SPL tokens of their choice. The vault manager should not be able to withdraw the vault’s funds.

Topics

solanasolana-programssf-2024

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.