Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Token Extensions - CPI Guard (Anchor)

Note

This is the Anchor v1 copy of this example, kept for programs staying on the Anchor v1 LTS line. Every anchor command on this page needs the v1 CLI: avm install 1.1.2 && avm use 1.1.2. The Anchor v2 version of this example is in ../anchor.

Enable CPI Guard so certain token actions cannot run inside a CPI context.

See also: the repository catalog.

Major concepts

  • CPI Guard extension
  • Transfer restrictions in CPI

Setup

From this directory (tokens/token-extensions/cpi-guard/anchor/):

anchor build

Prerequisites: Agave CLI (version in Anchor.toml [toolchain]), Anchor.

Testing

Tests run in-process with LiteSVM. No local validator.

anchor test

This runs cargo test as configured in Anchor.toml. Tests call instruction handlers and check onchain state.

Usage

Read the program programs/ source and Anchor.toml for deployed program IDs. For deployment, use anchor build && anchor deploy against your target cluster.