Skip to Content
PluginsCurve

Curve

Curve Finance is a decentralized exchange protocol optimized for stablecoin and like-asset swaps using the StableSwap invariant. This plugin provides actions for querying pool state, executing token exchanges, and managing CRV tokens across Ethereum, Base, Arbitrum, and Optimism.

Supported chains: Ethereum (pool + CRV), Base (pool only), Arbitrum (pool + CRV), Optimism (pool + CRV). Read-only actions work without credentials. Write actions require a connected wallet.

Actions

ActionTypeCredentialsDescription
Get Expected OutputReadNoGet the expected output amount for a token exchange in a pool
Get Virtual PriceReadNoGet the virtual price of the pool’s LP token
Get Coin AddressReadNoGet the token address at a specific index in the pool
Get Pool BalanceReadNoGet the pool’s balance of a specific coin by index
Exchange TokensWriteWalletSwap tokens in a Curve pool
Get CRV BalanceReadNoCheck CRV token balance of an address
Approve CRVWriteWalletApprove an address to spend CRV tokens
Transfer CRVWriteWalletTransfer CRV tokens to an address

Get Expected Output

Get the expected output amount for swapping one token for another in a Curve pool. Uses the StableSwap invariant to calculate the dy (output amount) for a given dx (input amount) and coin indices.

Inputs:

InputTypeDescription
iint128Input Coin Index
jint128Output Coin Index
dxuint256Input Amount (wei)

Outputs:

OutputTypeDescription
dyuint256Expected Output (wei)

When to use: Calculate the expected output before executing an exchange, implement slippage checks, compare rates across pools, or build quote workflows to surface best prices.


Get Virtual Price

Get the virtual price of the pool’s LP token. The virtual price increases over time as the pool accrues trading fees, representing the cumulative value accrued per LP token.

Inputs: None

Outputs:

OutputTypeDescription
virtualPriceuint256Virtual Price (18 decimals)

When to use: Monitor LP token appreciation, track fee accrual over time, verify pool health, or alert when virtual price deviates from expected growth.


Get Coin Address

Get the ERC-20 token address at a specific index position within the pool’s coin array.

Inputs:

InputTypeDescription
arg0uint256Coin Index

Outputs:

OutputTypeDescription
coinaddressToken Address

When to use: Discover which tokens are in a pool before interacting with it, validate coin indices, or enumerate all tokens in a user-specified pool.


Get Pool Balance

Get the pool’s internal balance of a specific coin by its index. Reflects the total amount of that token held by the pool contract.

Inputs:

InputTypeDescription
arg0uint256Coin Index

Outputs:

OutputTypeDescription
balanceuint256Coin Balance (wei)

When to use: Monitor pool liquidity depth, detect pool imbalances, alert when balances fall below thresholds, or track liquidity changes over time.


Exchange Tokens

Swap an exact input amount of one token for at least a minimum output amount of another token in a Curve pool. The caller must have approved the pool to spend the input token.

Inputs:

InputTypeDescription
iint128Input Coin Index
jint128Output Coin Index
dxuint256Input Amount (wei)
min_dyuint256Minimum Output (wei)

Outputs: success, transactionHash, transactionLink, error

When to use: Execute automated stablecoin swaps, rebalance portfolio positions between stablecoins, or perform keeper-triggered swaps when price conditions are met.


Get CRV Balance

Check the CRV governance token balance of any address on Ethereum, Arbitrum, or Optimism.

Inputs:

InputTypeDescription
accountaddressWallet Address

Outputs:

OutputTypeDescription
balanceuint256CRV Balance (18 decimals)

When to use: Monitor CRV holdings, check balances before approvals or transfers, or trigger workflows based on CRV accumulation thresholds.


Approve CRV

Approve a spender address to spend a specified amount of CRV tokens on behalf of the connected wallet. Required before depositing CRV into gauge contracts or other DeFi protocols.

Inputs:

InputTypeDescription
spenderaddressSpender Address
amountuint256Amount (wei)

Outputs: success, transactionHash, transactionLink, error

When to use: Grant allowance to a gauge, locker, or other contract before a CRV deposit step, or set up automated approval workflows for CRV operations.


Transfer CRV

Transfer CRV tokens from the connected wallet to a recipient address.

Inputs:

InputTypeDescription
toaddressRecipient Address
amountuint256Amount (wei)

Outputs: success, transactionHash, transactionLink, error

When to use: Distribute CRV rewards to recipients, consolidate CRV balances to a treasury address, or automate CRV transfers when balance thresholds are reached.


Example Workflows

Pool Imbalance Monitor

Schedule (hourly) -> Curve: Get Pool Balance (coin 0) -> Curve: Get Pool Balance (coin 1) -> Condition (ratio out of range) -> Discord: Send Message

Check the balances of two coins in a stableswap pool every hour. If the ratio deviates beyond an acceptable range (indicating pool imbalance), send a Discord alert.

Pre-Swap Quote and Execute

Manual -> Curve: Get Expected Output -> Condition (dy >= min acceptable) -> Curve: Exchange Tokens

First fetch the expected output for a swap, then only proceed with the exchange if the quote meets a minimum acceptable output. Prevents executing swaps during adverse pool conditions.

CRV Accumulation Alert

Schedule (daily) -> Curve: Get CRV Balance -> Condition (balance > threshold) -> Telegram: Send Message

Monitor a wallet’s CRV balance daily. When it accumulates above a set threshold, send a Telegram notification signaling it may be time to lock or deploy the CRV.

Virtual Price Deviation Alert

Schedule (hourly) -> Curve: Get Virtual Price -> Condition (price < expected floor) -> Discord: Send Message

Track the virtual price of a Curve LP token. If it drops below the expected floor (which should only increase over time), alert via Discord as this may indicate a pool exploit or manipulation.


Supported Chains

ChainContracts Available
Ethereum (1)Curve Pool, CRV Token
Base (8453)Curve Pool
Arbitrum (42161)Curve Pool, CRV Token
Optimism (10)Curve Pool, CRV Token

The CRV token is not deployed on Base. Pool actions using a user-specified pool address are available on all four chains.