Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
Decentralized Exchanges (DEX)
Hyperliquid
Lighter
edgeX
Aster
Aevo
Pendle
WOOFi Pro
Uniswap / PancakeSwap
Aerodrome / Velodrome
exchange.IO("lp.stake", ...)
exchange.IO("lp.unstake", ...)
exchange.IO("lp.claim", ...)
KyberSwap
1inch
EVM DEX Common Commands
Jupiter
OKX DEX
DEX Strategy Examples
Prediction Markets
Securities and Futures
On-chain & Custom

Aerodrome and Velodrome: stakes positions in their pool's gauge to earn the reward token (AERO or VELO) instead.

exchange.IO(k, positionIds)

Examples

Stake every unstaked position of the wallet that is still in range.

javascript
function main() { var ids = exchange.IO("lp.positions").filter(function (p) { return !p.staked && !p.closed && p.inRange }).map(function (p) { return p.id }) if (ids.length == 0) { return } var r = exchange.IO("lp.stake", ids) if (!r) { Log("Staking failed:", GetLastError()) return } r.positions.forEach(function (p) { Log(p.id, "staked in", p.gauge, "transaction", p.txHash) }) }

Returns

TypeDescription

object / null value

{positions: [{id, gauge, approveTxHash, txHash, feesBase, feesQuote}]}: approveTxHash is the transaction approving the NFT to the gauge (null when already approved), feesBase and feesQuote the uncollected fees the gauge passed to the owner on deposit; for a basic pool {id, gauge, txHash, lpTokens}. Null with an error on failure.

Arguments

NameTypeRequiredDescription

k

string

Yes

Set to lp.stake to stake positions.

positionIds

string / array

Yes

Position IDs: one ID or an array; Slipstream positions such as aero:123 or aero2:456 (velo: and velo2: on Velodrome), basic pools by the pool address.

See Also

Remarks

One set of transactions per position: a Slipstream position NFT is first approved to the gauge (skipped when already approved) and then deposited whole, the gauge passing the position's uncollected fees to the owner on deposit; for a basic pool all unstaked LP tokens in the wallet are deposited. A gauge killed by the Voter (gaugeAlive false in lp.pools) accepts no deposits and fails.

While staked, the position's trading fees go to voters and it earns only the reward token; an out-of-range Slipstream position earns no rewards either. Staked positions cannot be increased, decreased or have fees collected until taken out with lp.unstake (lp.remove takes them out automatically). An unstaked Slipstream position gives part of its fees (the pool's unstakedFee, mostly 5% today) to the gauge.

Positions can also be staked when added: put stake: true in the lp.plan parameters, and lp.add stakes right after adding, with stake in its result.