What it offers
- deposit: Deposit Curve LP tokens into Convex pool (with auto-staking)
- withdraw: Withdraw Curve LP tokens from Convex pool
- getReward: Claim accumulated CRV + CVX + extra rewards
Notes
- Pool IDs (pid) are sequential integers
- Third param in deposit = auto-stake in reward pool (always pass true for yield)
- Each pool has its own BaseRewardPool contract (get from poolInfo.crvRewards)
- Approve Curve LP token to Booster before depositing
- getReward with claimExtras=true claims CRV + CVX + any extra reward tokens
Its names in a program
On Ethereum,Convex is a namespace: its contracts need no import.
Deployments
ABI
Where a line says what an address it returns is, a program that calls the function through its namespace calls that contract’s methods on the result directly:<Namespace>.<Contract>.<function>(...).<method>(...). A token’s methods are the ERC-20
functions, and its writes are SafeERC20.
BaseRewardPoolABI
import BaseRewardPoolABI from "./protocols/convex/BaseRewardPoolABI.json";
getReward(address _account, bool _claimExtras) returns (bool)earned(address account) view returns (uint256)balanceOf(address account) view returns (uint256)withdrawAndUnwrap(uint256 amount, bool claim) returns (bool)
BoosterABI
import BoosterABI from "./protocols/convex/BoosterABI.json"; Speaks for: booster.
deposit(uint256 _pid, uint256 _amount, bool _stake) returns (bool)withdraw(uint256 _pid, uint256 _amount) returns (bool)poolLength() view returns (uint256)poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown):lptokenis a token,tokenis a token,crvRewardsis aConvex.BaseRewardPool
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
