VelocoreSynthChef
Inherits: IProtocolSynthChef, Initializable, UUPSUpgradeable, AccessControlUpgradeable, OwnableUpgradeable
A contract for managing interactions with Velocore Finance for yield farming purposes.
This contract provides functionalities to interact with Velocore pools, deposit and withdraw LP tokens, harvest rewards, and more.
State Variables
vault
Interface of Velocore Vault (Router)
entMasterChef
Entangle MasterChef address
ADMIN
Role identifier for the admin.
MASTER
Role identifier for the master.
SWAP
Velocore 'execute' codes
GAUGE
EXACTLY
AT_MOST
ALL
vc
lens
NATIVE
WETH
pools
Mapping from entangle internal pool Id to Velocore pool Id
isPoolInitialized
Mapping to track if a pool is initialized.
Functions
onlyCompounder
Modifier to restrict function access to the Compounder.
initialize
Initializes the CurveConvexSynthChef contract with initial parameters.
This function is called during deployment to set up initial configuration.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the Vault Velocore contract. |
|
| |
|
| The address of the Entangle MasterChef contract. |
|
| The address of the admin role for managing contract administration. |
|
| The address of the Lens Velocore contract. |
|
| Array of Entangle internal pool IDs. |
|
| Array of Pool struct data containing Curve pool information. |
_authorizeUpgrade
addPool
Adds a new Curve pool to the contract.
This function can only be called by the admin.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
|
| Information required to communicate with Velocore. |
reinvest
Reinvests LP tokens into the farm.
This function can only be called by the Compounder and requires a valid pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
Returns
Name | Type | Description |
---|---|---|
|
| amountLPs The amount of LP tokens reinvested. |
_optimalDeposit
Calculates the optimal amount of LP tokens to deposit into the farm.
This function computes the deposit amounts for each token in the pool based on the current balances.
Parameters
Name | Type | Description |
---|---|---|
|
| Pool entity for dedicated Velocore pool. |
Returns
Name | Type | Description |
---|---|---|
|
| amountLPs The optimal amount of LP tokens to deposit. |
_getOptimalDeposit
_ensureAllowance
withdraw
Withdraws LP tokens from the farm and removes liquidity.
This function transfers the withdrawn tokens to the recipient address.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
|
| Amount of LP tokens to withdraw. |
|
| Address to receive the withdrawn tokens. |
depositLP
Deposits LP tokens into the farm.
This function can only be called by the MASTER and requires a valid pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
|
| Amount of LP tokens to deposit. |
withdrawLP
Withdraws LP tokens from the farm and transfers them to the Entangle MasterChef.
This function can only be called by the MASTER and requires a valid pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
|
| Amount of LP tokens to withdraw. |
harvest
Accrues rewards and transfers them to the Compounder.
This function can only be called by the Compounder and requires a valid pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
Returns
Name | Type | Description |
---|---|---|
|
| Array of reward tokens transferred. |
|
| Array of reward amounts transferred. |
getTotalLpBalance
Retrieves the total balance of LP tokens on the farm.
This function returns the LP token balance of this contract for a given pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
Returns
Name | Type | Description |
---|---|---|
|
| Balance of LP tokens of this contract. |
getPoolTokens
Retrieves the addresses of tokens in a pool.
This function returns an array of pool token addresses for a given pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
Returns
Name | Type | Description |
---|---|---|
|
| Array of pool token addresses. |
lpTokenAddress
Retrieves the LP token address for a given pool ID.
This function returns the address of the LP token for a specified pool ID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
Returns
Name | Type | Description |
---|---|---|
|
| Address of the LP token. |
getLPDecimals
run3
run2
run1
addressToToken
getPoolInfo
Retrieves the details of a pool for a given pool ID.
This function returns the details of the pool including LP token, convex ID, Curve pool, and Convex reward contract.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle internal poolId. |
Returns
Name | Type | Description |
---|---|---|
|
| Pool struct containing the details of the pool. |
addressToBytes32
receive
Errors
VelocoreSynthChef__E1
PoolId already exists : VelocoreSynthChef
VelocoreSynthChef__E2
Amount eq 0 : VelocoreSynthChef
VelocoreSynthChef__NotACompounder
Caller is not Entangle's Compounder
VelocoreSynthChef__WrongUnderlyingCount
Amount of tokens unexpected
Structs
Pool
Enums
Action
Last updated