Skip to content

Hamsterpocket allows users to create and manage their own dollar-cost averaging pockets that will automatically execute the chosen strategies over time

Notifications You must be signed in to change notification settings

CaviesLabs/hamsterpocket-program

Repository files navigation


CaviesLabs

Built for flexible, customizable Self-managed DCA strategies #defi #infrastructure

Launch DApp | About Cavies

GitHub Repository Stars Count Follow Us on Twitter Follow Us on LinkedIn

Build Status License PRs Welcome Coverage Status

Hero image

Hamsterpocket (Pocket) is an Open Source self-managed dollar-cost-averaging protocol that lets users create and run their own saving pools (“pockets”) that will automatically execute the chosen strategies over time.

What we deliver out-of-the-box 📦

Architecture

  • Convenient - Users only need to set up the desired pools and strategies once, then top up (reload) said pools with the required funds for execution anytime.

  • Trustless - Users are able to manage their own pools. Every pocket can only be paused, resumed, terminated and withdrawn at will by the pockets’ owners.

  • Flexible use cases:

    • Run a TWAP strategy on-chain

    • Create a simple saving pool for one or multiple assets

    • Set-and-forget vaults for medium or long-term spot purchases

Prototype Design & Test cases 🚴

Our Tech Stack 🛠

Related Workspaces 🔗

Getting started 🚀

Step 0. Deployed Contracts addresses 📢

Mainnet Devnet
BW5RwMCPY85ch6efYE3Ev43ZQpJytvvjSNbJ2beC9MzV BW5RwMCPY85ch6efYE3Ev43ZQpJytvvjSNbJ2beC9MzV

Raydium markets API: https://api.raydium.io/v2/sdk/liquidity/mainnet.json

Step 1: Clone this repo 🧰

Create a new Hamsterpocket project with Open Source integration in just a few steps.

git clone https://github.com/CaviesLabs/hamsterpocket-program.git <project_name>

Step 2: Install dependencies

Go to the newly created directory and install the required dependencies:

cd <project_name>

yarn

Hamsterpocket supports only Yarn package manager. If you don't have it installed, please follow the official Yarn installation guide.

Step 3: Configure the project ⚙️

Please refer to the .env.example to adjust your desired configuration. Please contact khang@cavies.xyz or dev@cavies.xyz for any inquiries.

Step 4: Test the program 🧪

Run the solana test validator

solana-test-validator --no-bpf-jit --reset

Run the test

$ anchor test --skip-local-validator

#  pocket_registry
#    ✔ [initialize_swap_program] should: deployer initializes pocket registry successfully
#    ✔ [initialize_swap_program] should: deployer fails to re-initialize the pocket registry
#    ✔ [update_operator] should: deployer can update operators list (453ms)
#
#  pocket
#    ✔ [create_pocket] should: anyone can create their pocket (477ms)
#    ✔ [create_token_vault] should: pocket owner can create token vault successfully (473ms)
#    ✔ [pause_pocket] should: owner should pause pocket successfully (469ms)
#    ✔ [pause_pocket] should: owner should not pause pocket that was already paused
#    ✔ [restart_pocket] should: owner can restart the paused pocket successfully (436ms)
#    ✔ [close_pocket] should: owner can close pocket successfully (470ms)

#  assets
#    ✔ [deposit] should: owner can deposit assets to pocket successfully (485ms)
#    ✔ [withdraw] should: owner can withdraw assets from pocket successfully (935ms)

Step 4: Deploy the programs 🔥

(1) Get new program address

anchor build
solana address -k target/deploy/pocket-keypair.json

# above program will output the address of program
# replace all `BW5RwMCPY85ch6efYE3Ev43ZQpJytvvjSNbJ2beC9MzV` with your new address

(2) Deploy the program on mainnet

anchor deploy --program-name pocket --provider.cluster mainnet-beta \
--provider.wallet ~/.config/solana/id.json

Contribution 🤝

Hamsterpocket is an Open Source project and we encourage everyone to help us making it better. If you are interested in contributing to the project, please feel free to do so.

If you have any questions about contributing, please refer to our twitter Follow Us on Twitter - we are happy to help you!

Discovered a 🐜 or have feature suggestion? Feel free to create an issue on Github.

Support us ❤️

Hamsterpocket is and always will be Open Source, released under MIT Licence.

How you can help us:

  • Contribute - this is how the Core Team is supporting the project.
  • Spread the word - tell your friends, colleagues, and followers about Hamsterpocket.
  • Create content - write a blog post, record a video, or create a tutorial. We will be happy to share it on our social media channels.

Follow us on Social Media

Twitter Follow LinkedIn Follow

Careers 👩‍💻👨‍💻

We are growing and we are looking for talented people to join our team. If you are interested in working with us, please check our Careers page.

Contacts 📱📱

Feel free to submit your inquiries to dev@cavies.xyz or hello@cavies.xyz

About

Hamsterpocket allows users to create and manage their own dollar-cost averaging pockets that will automatically execute the chosen strategies over time

Resources

Stars

Watchers

Forks

Packages

No packages published