Yield Strategies

Yield Strategies


Strategies in FYV define how yield is generated from deposited collateral. Each strategy implements a specific approach to converting collateral into yield-bearing positions, managing those positions, and handling withdrawals. This document explains the available strategies and how they work.


Strategy Interface

All strategies implement the Strategy interface, which provides a consistent API regardless of the underlying yield mechanism.

pub resource interface Strategy {
    // Initialize position with collateral deposit
    pub fun deposit(collateralVault: @FungibleToken.Vault)
    // Withdraw specified amount of value
    pub fun withdraw(amount: UFix64): @FungibleToken.Vault
    // Close position and return all accumulated value
    pub fun liquidate(): @FungibleToken.Vault
    // Get current position value
    pub fun getBalance(): UFix64
}

This interface enables YieldVaults to remain strategy-agnostic, allowing users to switch strategies or compose multiple strategies without changing vault logic.


TracerStrategy

TracerStrategy is the flagship strategy that implements automated leveraged yield farming by bridging ALP lending positions with external DeFi yield opportunities.


How It Works

TracerStrategy combines three components to create leveraged yield:

ALP Position (Collateral & Borrowing): Deposits collateral (FLOW, stFLOW, etc.) to ALP, borrows MOET against collateral up to 80% of value, and maintains health factor at target of 1.3.

Swap Connectors (Token Conversion): Converts MOET to yield-bearing tokens (LP tokens, farm tokens), converts yield tokens back to FLOW for rebalancing, and provides slippage protection on all swaps.

AutoBalancer (Yield Management): Deposits yield tokens to ERC4626 vaults, monitors value and triggers rebalancing at 95%-105% thresholds, and automatically manages position health.


Capital Flow Diagram

sequenceDiagram participant User participant Strategy as TracerStrategy participant Position as ALP Position participant Swap as SwapConnectors participant AB as AutoBalancer participant Vault as ERC4626 Vault User->>Strategy: deposit(1000 FLOW) Strategy->>Position: deposit(1000 FLOW) Position->>Position: Calculate borrowing capacity Note over Position: EC = 1000 × $1 × 0.8 = $800
Max borrow = 800 / 1.3 = $615.38 Position->>Position: borrow(615.38 MOET) Position-->>Strategy: 615.38 MOET Strategy->>Swap: swap(615.38 MOET → YieldToken) Swap-->>Strategy: ~610 YieldToken (slippage) Strategy->>AB: deposit(610 YieldToken) AB->>Vault: deposit(610 YieldToken) Vault-->>AB: 610 shares Note over AB,Vault: Yield accrues over time AB->>AB: Monitor ratio
(Current / Historical) alt Ratio > 105% AB->>Vault: withdraw(excess) Vault-->>AB: YieldToken AB->>Swap: swap(YieldToken → FLOW) Swap-->>AB: FLOW AB->>Position: deposit(FLOW) end

Example: Leveraged Farming with 1000 FLOW

Let's walk through a complete TracerStrategy lifecycle:

Initial Deposit:

User deposits: 1000 FLOW @ $1.00 = $1,000
Step 1: Deposit to ALP Position
  - Collateral: 1000 FLOW
  - Collateral Factor: 0.8 (80%)
  - Effective Collateral: $1,000 × 0.8 = $800
Step 2: Calculate borrowing at target HF = 1.3
  - Target Debt = EC / Target HF = $800 / 1.3 = $615.38
  - Position borrows: 615.38 MOET
Step 3: Swap MOET → YieldToken
  - Swap 615.38 MOET via Uniswap V3
  - Receive ~610 YieldToken (assuming 1% slippage)
  - Slippage protection: min 608.92 YieldToken (1% tolerance)
Step 4: Deposit to ERC4626 Vault
  - AutoBalancer deposits 610 YieldToken
  - Receives 610 vault shares
  - Historical deposit value: $610 (tracked for rebalancing)
Position Summary:
  - Collateral: 1000 FLOW ($1,000)
  - Debt: 615.38 MOET ($615.38)
  - Yield Tokens: 610 ($610 equivalent)
  - Health Factor: 800 / 615.38 = 1.30 ✓
  - Effective Exposure: $1,000 collateral + $610 yield = $1,610
  - Leverage: 1.61x

Key Takeaway
TracerStrategy amplifies returns through leverage (1.6x+ exposure) but carries liquidation risk. mUSDCStrategy provides conservative cross-chain yield without leverage. Choose based on your risk tolerance and yield goals.

Authentication Integration Guide

Authentication Integration Guide

Crossmint provides a comprehensive user management solution tightly integrated with all other Crossmint products. Authenticate users with Web3 or traditional sign-in methods, with seamless wallet creation and unified identity management.


Why this matters:

  • Unified identity system: Single user account across your backend and Web3 app.
  • Multiple auth methods: Email OTP, social logins, wallet connections, and Farcaster.
  • Automatic wallet creation: Optionally create or link wallets with user accounts.
  • Drag and drop integration: Setup in under five minutes.

Available authentication methods

1. Email OTP authentication

Passwordless sign-in with one-time codes delivered to the user's email.

  • No passwords required
  • Secure and user-friendly
  • Automatic account creation

2. Social account authentication

Sign in with popular social platforms:

  • Google
  • Apple
  • X (Twitter)
  • And more

3. Farcaster integration

Use the Sign In With Farcaster (SIWF) standard

  • Web3-native authentication
  • Decentralized identity support

4. External wallet authentication

Connect with crypto wallets for Web3 authentication:

  • MetaMask
  • WalletConnect
  • Flow wallets
  • And other Web3 wallets

Prerequisites

Make sure you have:

Crossmint account:

React/Next.js project:

  • React 16.8+ or Next.js 13+
  • TypeScript support (recommended)

Technical knowledge:

  • Basic React hooks and state management
  • Understanding of authentication flows

Quick start

Step 1: install the SDK

npm i @crossmint/client-sdk-react-ui

Step 2: add crossmint providers

"use client";
import {
    CrossmintProvider,
    CrossmintAuthProvider,
    CrossmintWalletProvider
} from "@crossmint/client-sdk-react-ui";
export function Providers({ children }: { children: React.ReactNode }) {
    return (
        
            
                {children}
            
        
    );
}

Step 3: create authentication component

"use client";
import { useAuth } from "@crossmint/client-sdk-react-ui";
export function AuthButton() {
  const { login, logout, user, jwt } = useAuth();
  return (
    
{user == null ? ( ) : ( )} {/* Display user information */}

User ID: {user?.userId}

Email: {user?.email ?? "None"}

Phone: {user?.phoneNumber ?? "None"}

Farcaster: {user?.farcaster?.username ?? "None"}

Google: {user?.google?.displayName ?? "None"}

JWT: {jwt}

); }

Environment configuration

// Use environment-specific API keys
const crossmintConfig = {
  apiKey: process.env.NODE_ENV === 'production'
    ? process.env.CROSSMINT_PROD_API_KEY
    : process.env.CROSSMINT_STAGING_API_KEY,
  environment: process.env.NODE_ENV === 'production' ? 'production' : 'staging'
};

Production deployment

1. Create production account

  1. Create a developer account on the Production Console.
  2. Complete account verification and KYB process.

Production Console Login

2. Configure production API keys

  1. Create a production client API key.
  2. Navigate to Integrate > API Keys

API Keys

Activate required scopes:

  • users.create
  • users.read
  • wallets.read
  • wallets.create

3. Update environment variables

# Production
CROSSMINT_API_KEY=your_production_client_api_key
CROSSMINT_ENVIRONMENT=production
# Staging (for testing)
CROSSMINT_API_KEY=your_staging_client_api_key
CROSSMINT_ENVIRONMENT=staging

4. Test authentication flow

// Test authentication in staging first
const testAuth = async () => {
  const { login, user } = useAuth();
  await login();
  if (user) {
    console.log('Authentication successful:', user);
    // Test wallet creation
    await createUserWallet();
  }
};

Troubleshooting

Common issues

Authentication fails:

  • Verify API key is correct.
  • Check authentication scopes are activated.
  • Make sure you're using the right environment (staging vs. production)

Wallet creation fails:

  • Verify user is authenticated.
  • Check wallet creation scopes.
  • Ensure proper wallet configuration for Flow.

Get Help


Quick Tip
Start in staging mode to test everything safely before moving to production. Always verify scopes and environment variables to avoid common authentication errors.

Minting Platform Integration Guide

Minting Platform Integration Guide

Crossmint's Minting Platform allows you to create, manage, and distribute NFTs and fungible tokens on Flow (and other chains) with minimal code. This guide covers the key steps to integrate minting functionality into your application using Crossmint's APIs and SDKs.


Why use Crossmint for minting?

  • Gasless minting for users (no wallet funding required)
  • Multi-chain support including Flow, Ethereum, Polygon, Solana, and more
  • Built-in metadata management and IPFS storage
  • Seamless integration with authentication and wallet creation
  • Developer-friendly APIs and React SDK

Prerequisites

Before you begin, ensure you have:

  • A Crossmint Console account (staging or production)
  • A Client API Key with minting scopes enabled
  • A React/Next.js project (or any frontend framework that can make HTTP requests)
  • Optional: Crossmint SDK already installed if using the React components

Step 1: Set up your Collection

Collections are the foundation for your NFTs or tokens. Create one in the Crossmint Console:

  1. Go to Collections → Create Collection
  2. Choose Flow as the blockchain
  3. Select type: NFT (ERC-721-like) or Fungible Token
  4. Fill in name, symbol, description, and image
  5. Enable gasless minting if desired (recommended for better UX)
  6. Save — you'll get a collectionId (e.g., flow-mainnet-abc123)

Step 2: Install the SDK (optional but recommended)

npm install @crossmint/client-sdk-react-ui

Step 3: Mint an NFT (Client-side example)

Use the React SDK for a simple mint button:

"use client";
import { useMintNFT } from "@crossmint/client-sdk-react-ui";

export function MintButton() {
  const { mint, status, error } = useMintNFT({
    collectionId: "flow-mainnet-your-collection-id",
    environment: "staging", // or "production"
  });

  const handleMint = async () => {
    try {
      const response = await mint({
        metadata: {
          name: "My Awesome NFT",
          description: "This is a test NFT minted via Crossmint",
          image: "https://example.com/nft-image.png",
          attributes: [
            { trait_type: "Rarity", value: "Legendary" },
            { trait_type: "Level", value: 100 }
          ]
        },
        recipient: "email:frances@example.com", // or wallet address
      });
      console.log("Minted!", response);
    } catch (err) {
      console.error("Mint failed:", err);
    }
  };

  return (
    
{error &&

{error.message}

}
); }

Step 4: Mint via API (Server-side / backend)

For more control or backend minting, use the REST API:

POST https://staging.crossmint.com/api/2022-06-09/collections/{collectionId}/nfts
Authorization: Bearer {your-server-api-key}
Content-Type: application/json

{
  "metadata": {
    "name": "Server-Minted NFT",
    "description": "Minted from backend",
    "image": "ipfs://Qm.../image.png"
  },
  "recipient": "flow:0x123...abc",
  "reuploadLinkedFiles": true
}

Advanced: Gasless Minting with Email Recipient

Crossmint can mint directly to an email (creates/links a wallet automatically):

{
  "recipient": "email:user@example.com",
  "metadata": { ... },
  "wallet": {
    "type": "flow",
    "chain": "flow-mainnet"
  }
}

Troubleshooting

  • Mint fails with 401: Check API key and scopes (nfts.create)
  • Metadata not showing: Ensure image URLs are public and use IPFS if possible
  • Wallet not created: Verify recipient format and wallet creation scopes
  • Rate limits: Staging has lower limits — upgrade to production for high volume

Pro Tip
Always test minting in staging first. Use email recipients for the best onboarding experience — users don't need a wallet upfront. Monitor the Crossmint Console dashboard for minting analytics and errors.