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: claims the reward tokens accrued in the gauges of staked positions, optionally selling them for USDC.

exchange.IO(k, positionIds)
exchange.IO(k, positionIds, sell)

Examples

Claim the rewards and sell them for USDC once they are worth more than 10 USDC.

javascript
function main() { var staked = exchange.IO("lp.positions").filter(function (p) { return p.staked }) var value = 0 staked.forEach(function (p) { value += p.rewardsValue || 0 }) if (value < 10) { return } var r = exchange.IO("lp.claim", staked.map(function (p) { return p.id }), true) if (!r) { Log("Claim failed:", GetLastError()) return } Log("Received", r.rewards, r.rewardToken, "sold:", r.sell) }

Returns

TypeDescription

object / null value

{txHash, gauges, rewardToken, rewards, sell}: gauges are the gauges claimed from, rewardToken is AERO or VELO and rewards the amount received; when selling there is also sell ({symbol, qty, txHash}, or {symbol, qty, error} when the sale failed). Null with an error on failure.

Arguments

NameTypeRequiredDescription

k

string

Yes

Set to lp.claim to claim rewards.

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.

sell

bool

No

true sells the claimed reward token for USDC at market; false by default.

See Also

Remarks

One Voter.claimRewards transaction claims the wallet's rewards in the gauges of these positions, including the wallet's other staked positions in the same gauges. The claimable amount is rewards and rewardsValue in lp.positions.

Rewards are paid in the reward token, whose price is volatile, so sell converts them to USDC; use this to claim without taking positions out, since lp.unstake also claims the rewards of Slipstream positions.