exchange.IO("lp.claim", ...)
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
| Type | Description |
object / null value |
|
Arguments
| Name | Type | Required | Description |
k | string | Yes | Set to |
positionIds | string / array | Yes | Position IDs: one ID or an array; Slipstream positions such as |
sell | bool | No |
|
See Also
Aerodrome / Velodrome exchange.IO exchange.IO("lp.stake") exchange.IO("lp.unstake") exchange.IO("lp.claim") exchange.IO("lp.positions") exchange.IO("lp.pools")
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.