STRKFarm Docs
AppTwitterTelegram
  • 🙏Welcome to STRKFarm
  • 📥How to deposit?
  • 📤How to withdraw?
  • ❓FAQ
  • 🫂Community
    • 🎉Raffle
    • 💯NFT Levels System
    • 🤝Referral Campaign
    • 🖼️OG Farmer NFT Campaign
  • 💰Strategies
    • 1️Auto-Compounding
    • 2️Sensei - Delta neutral Lending
    • Vesu Fusion - Rebalancing vaults
  • Ekubo - CL Vaults
  • 👩‍💻Developers
    • Integrations
      • Auto-compounding strategies
      • Sensei strategies
    • Risk engine
    • Contribute - Onlydust
    • Rebalancing strategies
    • Contracts
Powered by GitBook
On this page

Was this helpful?

  1. Developers
  2. Integrations

Sensei strategies

Our sensei strategies are based on NFT holdings. Each user can only get one NFT and it is used to describe their position. The NFT ID of a user is simply their address in felt/number format.

starknetjs.num.getDecimalString(hexAddress)

Functions

  1. Deposit:

deposit(amount: u256, receiver: ContractAddress);
  1. Withdraw:

withdraw(amount: u256, receiver: ContractAddress, max_slippage_bps: u32);
  1. Get stratregy config

config() -> StrategyConfig

interface StrategyConfig {
    // this is the token used by user to make the deposit (e.g. ETH)
    main_token: ContractAddress,
    main_offset: u128, // decimal offset used to handle shares
    // internal token used by strategy to do looping (e.g. USDC)
    secondary_token: ContractAddress,
    secondary_offset: u128
}
  1. Get holdings by user address:

let token_id = starknetjs.num.getDecimalString(userAddr);
let position = strategyContract.describe_position(token_id);

// Expected output:
// @returns (Position, PositionDescription)

// Position shows the shares of user relative to other user positions
// Each share corresponds to one step of the looping action (i.e. supply/borrow)
interface Position {
  acc1_supply_shares: u256,
  acc1_borrow_shares: u256,
  acc2_supply_shares: u256,
  acc2_borrow_shares: u256
}

interface PositionDescription {
  // shows the expected value of user position in main token terms
  // This is probably the most important value a user cares
  estimated_size: u256,
  // below show the split of holdings in respective token terms
  deposit1: u256, // in main token
  borrow1: u256, // in secondary token (used to loop)
  deposit2: u256, // in secondary token
  borrow2: u256, // in main token
}
PreviousAuto-compounding strategiesNextRisk engine

Last updated 4 months ago

Was this helpful?

👩‍💻