Skip to content

Esimus/vigri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

130 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VIGRI Contract (devnet)

Program ID (devnet): 2Z8VfenUPpxgHTec3EDtT1tp25KnWN5sicB5zCDxrEnv
Release tag: v0.2.0-devnet - secure transfer + blocklist

This repo contains the Anchor on-chain program used for VIGRI devnet testing.


Requirements

  • Solana CLI (devnet), key at ~/.config/solana/id.json
  • Anchor CLI 0.31.x
  • Rust/cargo with SBF toolchain
  • Node.js 18+, npm i, npx ts-node

Environment

Typically set per-command:

ANCHOR_PROVIDER_URL=https://api.devnet.solana.com \
ANCHOR_WALLET=$HOME/.config/solana/id.json \
<your command>

Build & Deploy

Use the single script: ./scripts/upgrade.sh

It runs:

  • cargo build-sbf
  • solana program deploy (fixed Program ID)
  • anchor idl build
  • anchor idl upgrade

On-chain Safety

  • SelfTransfer - forbid sending to the same PDA.
  • Unauthorized - only the PDA owner can operate (checked against owner).
  • Blocked - if is_blocked = true on src or dst, transfer/credit/debit are rejected.

User Scripts

Note: in all scripts, --to expects the OWNER public key, not the PDA address. Initialize your UserAccount PDA (run once with the recipients wallet): npx ts-node run_init_user.ts

List all users / export CSV: npx ts-node run_scan.ts npx ts-node run_scan_csv.ts > users_devnet_<date>.csv

Credit your own PDA: npx ts-node run_credit.ts --amount 1

Debit your own PDA: npx ts-node run_credit.ts --amount 1 --debit

Transfer 1 unit to another user: npx ts-node run_transfer.ts --to <RECIPIENT_OWNER_PUBKEY> --amount 1 --memo "note"


Admin

Block / unblock a specific UserAccount PDA: npx ts-node run_set_blocked.ts <UserAccount_PDA> true # block npx ts-node run_set_blocked.ts <UserAccount_PDA> false # unblock


Common Pitfalls

ANCHOR_PROVIDER_URL is not defined -> pass env vars (see Environment). anchor idl upgrade ... -u devnet: unexpected argument '-u' -> set network via ANCHOR_PROVIDER_URL.

"Recipient has no UserAccount PDA ..." -> --to must be OWNER pubkey; and the recipient must initialize their UserAccount once (run_init_user.ts from their wallet).


Versioning

  • Latest release: v0.1.1 (verifiable build + assets + SHA256 checksums)
  • Latest devnet pre-release: v0.2.0-devnet (secure transfer + blocklist + updated IDL)
  • Release script: ./scripts/upgrade.sh

About

Smart contract for $VIGRI token (Solana + Anchor)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors