exchange.IO("lp.stake", ...)
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
| 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 |
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 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.