Skip to content
Lattice

ICurveStableSwapAdapter

Git Source

Title: ICurveStableSwapAdapter

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Curve (https://github.com/curvefi/curve-contract)

Curve-StableSwap-specific config ABI. The adapter also implements IStrategy + IProtocolAdapter. Single-asset, single-sided LP adapter over a 2-coin Curve StableSwap pool: deposits the configured asset at coinIndex, holds (or stakes in a gauge) the LP, and values the position via get_virtual_price. CRV/extra rewards are forwarded RAW (swap-free) and are NOT counted in NAV.

Functions

pool

Returns the Curve StableSwap pool this adapter supplies to.

function pool() external view returns (address);

Returns

NameTypeDescription
<none>address

lpToken

Returns the pool's LP token.

function lpToken() external view returns (address);

Returns

NameTypeDescription
<none>address

gauge

Returns the staking gauge (address(0) when the adapter holds LP unstaked).

function gauge() external view returns (address);

Returns

NameTypeDescription
<none>address

crvToken

Returns the CRV (primary gauge reward) token forwarded raw on harvest (address(0) == none).

function crvToken() external view returns (address);

Returns

NameTypeDescription
<none>address

vault

Returns the Lattice vault funds are returned to.

function vault() external view returns (address);

Returns

NameTypeDescription
<none>address

coinIndex

Returns the pool coin index the adapter's asset occupies.

function coinIndex() external view returns (int128);

Returns

NameTypeDescription
<none>int128

slippageBps

Returns the configured slippage tolerance in basis points.

function slippageBps() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

setGauge

Sets the staking gauge (admin only). address(0) clears it (run unstaked). Setting a new gauge does not migrate existing LP; stake/unstake happens on the next deploy/withdraw.

function setGauge(address gauge) external;

Parameters

NameTypeDescription
gaugeaddress

setCrvToken

Sets the CRV reward token forwarded raw on harvest (admin only). address(0) skips forwarding (claim only). Decoupled from the gauge so integrators can wire the deployment's canonical CRV address (or clear it) without re-deploying the facet.

function setCrvToken(address token) external;

Parameters

NameTypeDescription
tokenaddress

setSlippageBps

Sets the slippage tolerance in basis points (admin only).

function setSlippageBps(uint256 slippageBps) external;

Parameters

NameTypeDescription
slippageBpsuint256

setRewardRecipient

Sets the reward recipient (admin only).

function setRewardRecipient(address recipient) external;

Parameters

NameTypeDescription
recipientaddress

Events

CurveStableSwapAdapterConfigured

Emitted once at init with the wiring.

event CurveStableSwapAdapterConfigured(
        address indexed pool, address indexed lpToken, address indexed asset, int128 coinIndex
    );

Parameters

NameTypeDescription
pooladdressThe Curve StableSwap pool.
lpTokenaddressThe pool's LP token.
assetaddressThe underlying asset this adapter supplies/withdraws.
coinIndexint128The pool coin index asset occupies.

CurveGaugeSet

Emitted when the gauge is set or changed (address(0) == unstaked).

event CurveGaugeSet(address indexed gauge);

Parameters

NameTypeDescription
gaugeaddress

CurveCrvTokenSet

Emitted when the CRV reward token is set or cleared (address(0) == skip forwarding).

event CurveCrvTokenSet(address indexed token);

Parameters

NameTypeDescription
tokenaddress

CurveSlippageSet

Emitted when the slippage tolerance (bps) is changed.

event CurveSlippageSet(uint256 slippageBps);

Parameters

NameTypeDescription
slippageBpsuint256

Errors

CurveStableSwapAdapterAssetMismatch

The reward recipient is announced via IProtocolAdapter.RewardRecipientSet (shared with the generic adapter ABI) — not redeclared here to avoid an event-name collision when the facet inherits both interfaces.

The pool's coin at the configured index does not match the configured asset.

error CurveStableSwapAdapterAssetMismatch(address poolCoin, address configured);

Parameters

NameTypeDescription
poolCoinaddress
configuredaddress

CurveStableSwapAdapterBadCoinIndex

The supplied coin index is out of range for a 2-coin pool (must be 0 or 1).

error CurveStableSwapAdapterBadCoinIndex(int128 coinIndex);

Parameters

NameTypeDescription
coinIndexint128

CurveStableSwapAdapterSlippageTooHigh

The supplied slippage tolerance exceeds the allowed maximum (bps).

error CurveStableSwapAdapterSlippageTooHigh(uint256 slippageBps, uint256 maxBps);

Parameters

NameTypeDescription
slippageBpsuint256
maxBpsuint256