A decentralized index fund protocol on Solana that allows users to create, manage, and trade token baskets with dynamic rebalancing capabilities.
For detailed documentation, visit our GitBook.
- Create custom token baskets with configurable weights
- Buy and sell underlying components using Jupiter API
- Mint and redeem basket tokens
- Dynamic rebalancing of basket components
- Fee management system
- Node.js (v23 or higher)
- Rust and Cargo
- Solana CLI tools
- Anchor Framework
- Clone the repository:
git clone https://github.com/ao-labs/pie-dot-fun-solana.git
cd pie-dot-fun-solana- Install dependencies:
yarn install- Create deployer wallet:
make deployer/create- Airdrop SOL to deployer (for testing):
# For local testing
make deployer/airdrop/local
# For devnet testing
make deployer/airdrop/devnetBuild the program:
anchor buildDeploy to different networks:
# Deploy to devnet
yarn deploy-devnet
# Deploy to mainnet
yarn deploy-mainnetRun tests on different networks:
# Run specific test suites
yarn test # local test
yarn test-devnet # devnet test
yarn test-mainnet # mainnet test├── programs/ # Solana program source code
│ └── pie/
│ ├── src/
│ │ ├── instructions/ # Program instructions
│ │ ├── states/ # Program state definitions
│ │ └── utils/ # Utility functions
├── sdk/ # TypeScript SDK
├── tests/ # Test suites
└── scripts/ # Deployment and utility scripts
The project provides a TypeScript SDK for interacting with the protocol:
import { PieProgram } from '@ao-labs/pie-dot-fun-solana';
// Initialize the program
const pieProgram = new PieProgram({
connection,
cluster: "mainnet-beta",
jitoRpcUrl: QUICKNODE_RPC_URL,
});
// Create a new basket
const createBasketArgs = {
name: "My Basket",
symbol: "MBKT",
components: [...],
rebalancer: rebalancer.publicKey,
rebalanceType: { dynamic: {} },
creatorFeeBp: new BN(50),
};
// Create basket transaction
const createBasketTx = await pieProgram.creator.createBasket({
creator: admin.publicKey,
args: createBasketArgs,
basketId,
});