agentsclimarketplace

Cdpm agent sdk

Skill RandyPen/cdpm/skills/cdpm-agent-sdk

Install
npx -y skills add RandyPen/cdpm --skill cdpm-agent-sdk

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

TypeScript SDK guide for AI agents managing CDPM positions. Defines permission boundaries, operation workflows, automation strategies, and the Scallop and Kai SAV supply/redeem APIs agents share with owners and protocol bots. Use when building automated liquidity management agents.

SKILL.md

4.6 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

CDPM Agent SDK Guide

Overview

This guide is for AI agents authorized to manage CDPM positions on behalf of users. Agents have limited permissions and operate within specific boundaries.

Package Address: 0x573584cc4698e82fd85f2b54e64ad4cd901c42b768f7628ec167bf2d24aa2aa7 (only-dep-upgrades digest: F5kVa3YDSHoBvJvYJFH9y5dANCJScEdyZoxZLLy6qd15cdpm.move bytecode is locked; only dependency-version upgrades are allowed). Other shared object IDs live in reference/constants.md.

import { Transaction } from '@mysten/sui/transactions';
import { SuiGrpcClient } from '@mysten/sui/grpc';

Agent Permission Model

What Agents CAN Do

OperationDescription
Add LiquidityAdd liquidity using PositionManager balance
Remove LiquidityRemove liquidity and return to balance
Collect FeesCollect fees from position (goes to fee bag)
Collect RewardsCollect rewards (goes to fee bag)
Transfer Fee to BalanceMove fees from fee bag to balance
Scallop scallop_supplyPark idle balance into Scallop
Scallop scallop_redeemPull underlying back; yield fee deducted from interest portion
Kai SAV kai_supplyPark idle balance into a Kai Vault<T, YT>
Kai SAV kai_redeemPull underlying back via the strategy walk; same yield fee on interest

What Agents CANNOT Do

OperationReason
Withdraw FundsCannot move funds out of PositionManager
Close PositionOnly owner can close
Authorize/Revoke AgentsOnly owner can manage agents
Modify PositionManagerCannot change configuration

Permission Check

function canAgentOperate(
  pm: PositionManager,
  agentAddress: string
): boolean {
  return pm.agents.includes(agentAddress);
}

// Example check
const { response: pm } = await client.getObject({ id: pmId, include: { content: true } });
const agents = pm?.content?.fields?.agents || [];
const isAuthorized = agents.includes(agentAddress);

Topics

Core Operations

  • Agent Operations - Add/remove liquidity, collect fees, transfer fees
  • Scallop Lending - Agent-driven scallop_supply / scallop_redeem (one tx.moveCall each); yield fee shares fee_house.fee_rate with Kai
  • Kai SAV Lending - Agent-driven kai_supply / kai_redeem (one tx.moveCall each); yield fee shares fee_house.fee_rate with Scallop
  • Automation Strategies - Auto-compounding, rebalancing, fee collection scheduler

Monitoring & Best Practices

Reference

Calculations

For liquidity calculations, bin price math, position management, and fee calculations, use the cdpm-calculation skill with the Cetus DLMM SDK:

import { BinUtils, FeeUtils } from '@cetusprotocol/dlmm-sdk/utils'

// Agent-specific calculations
const qPrice = BinUtils.getQPriceFromId(binId, binStep)
const liquidity = BinUtils.getLiquidity(amountA, amountB, qPrice)
const binId = BinUtils.getBinIdFromPrice(price, binStep, true, decimalA, decimalB)
const positionCount = BinUtils.getPositionCount(lowerBinId, upperBinId)
const { amount_a, amount_b } = BinUtils.calculateOutByShare(bin, removeLiquidity)

// Agent strategy helper
function distributeLiquidity(totalA: string, totalB: string, bins: number[], binStep: number) {
  return bins.map(binId => {
    const qPrice = BinUtils.getQPriceFromId(binId, binStep)
    const amountA = (BigInt(totalA) / BigInt(bins.length)).toString()
    const amountB = (BigInt(totalB) / BigInt(bins.length)).toString()
    return { binId, amountA, amountB, liquidity: BinUtils.getLiquidity(amountA, amountB, qPrice) }
  })
}

See cdpm-calculation-skill for the full reference (formulas, redemption sizing, distribution math).

What ships with it: 8 files

49.9 KB alongside SKILL.md

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.