Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CaviesLabs/hamsterswap-program
https://github.com/CaviesLabs/hamsterswap-program
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/CaviesLabs/hamsterswap-program
- Owner: CaviesLabs
- Created: 2022-11-25T03:55:45.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-21T11:36:17.000Z (almost 2 years ago)
- Last Synced: 2024-07-31T08:17:49.699Z (3 months ago)
- Language: Rust
- Size: 334 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - CaviesLabs/hamsterswap-program - (Rust)
README
## Description
**HamsterSwap** Rust program repository.
## Prerequisites
1/ Follow this instructions to install Solana Cli and Anchor Cli (https://book.anchor-lang.com/getting_started/installation.html)
2/ Install the latest nodejs env
## Getting Started
```bash
$ yarn install
```## Get new address of program
```bash
anchor build
solana address -k target/deploy/swap-keypair.json
# above program will output the address of program
# replace all `EdeRcNsVGU1s1NXZZo8FhLD8iePxvoUCdbvwVGnj778f` with your new address
```
## Deploy swap program onto devnet/mainnet1/ Deploy devnet
Deploy
```bash
$ anchor deploy --program-name swap --provider.cluster devnet --provider.wallet ~/.config/solana/id.json
```Upgrade
```bash
$ anchor upgrade target/deploy/swap.so --program-id EdeRcNsVGU1s1NXZZo8FhLD8iePxvoUCdbvwVGnj778f --provider.cluster devnet --provider.wallet ~/.config/solana/id.json
```2/ Deploy mainnet
Deploy
```bash
$ anchor deploy --program-name swap --provider.cluster mainnet-beta --provider.wallet ~/.config/solana/id.json
```Upgrade
```bash
$ anchor upgrade target/deploy/swap.so --program-id EdeRcNsVGU1s1NXZZo8FhLD8iePxvoUCdbvwVGnj778f --provider.cluster mainnet-beta --provider.wallet ~/.config/solana/id.json
```3/ Upgrade
## Test
```bash
$ anchor test
``````txt
✔ [initialize_swap_program] should: deployer initializes swap registry successfully
✔ [initialize_swap_program] should: deployer fails to re-initialize the swap registry
✔ [update_swap_program] should: deployer updates registry successfully (443ms)
✔ [update_swap_program] should: non-owner fails to modify the swap program
✔ [update_swap_program] should: deployer fails to update invalid values
✔ [create_token_vault] should: non-deployer fails to create a token vault
✔ [create_token_vault] should: deployer creates a token vault successfully (446ms)
✔ [create_token_vault] should: deployer fails to create a token vault for an added mint account
✔ [create_proposal] should: fail to create proposal with un-allowed mint tokens
✔ [create_proposal] should: everyone can create publicly a proposal (964ms)
✔ [cancel_proposal] should: participants can cancel proposal anytime when proposal isn't fulfilled (930ms)
✔ [withdraw_assets] should: participant can withdraw assets when proposal is canceled (452ms)
✔ [deposit_assets] should: proposal owner deposits offered items successfully (491ms)
✔ [fulfil_assets] should: participant fulfill proposal successfully (447ms)
✔ [redeem_assets] should: proposal owner can redeem items once the proposal is fulfilled (459ms)
✔ [redeem_assets] should: participant can redeem items once the proposal is fulfilled (461ms)16 passing (12s)
```