PancakeSwapSynthChef
PancakeSwapSynthChef
Inherits: IProtocolSynthChef, Initializable, UUPSUpgradeable, AccessControlUpgradeable, OwnableUpgradeable, ReentrancyGuardUpgradeable
A contract for managing interactions with Pancake Finance for yield farming purposes.
This contract provides functionalities to interact with Pancake pools, deposit and withdraw LP tokens, harvest rewards, and more.
State Variables
chef
Interface of PancakeSwap MasterChef
router
Interface of PancakeSwap Router
entMasterChef
Entangle MasterChef address
ADMIN
Role identifier for the admin.
MASTER
Role identifier for the master.
pools
Mapping from entangle internal pool Id to Pancake pool Id
isPoolInitialized
Mapping to track if a pool is initialized.
Functions
onlyCompounder
Modifier to restrict function access to the Compounder.
constructor
initialize
Initializes the CurveConvexSynthChef contract with initial parameters.
This function is called during deployment to set up initial configuration.
Parameters
_authorizeUpgrade
addPool
Add a new pool. Can only be called by the ADMIN.
Parameters
reinvest
Reinvests LP tokens into the farm.
This function can only be called by the Compounder and requires a valid pool ID.
Parameters
Returns
withdraw
Withdraws LP tokens from the farm and removes liquidity.
This function transfers the withdrawn tokens to the recipient address.
Parameters
depositLP
Deposits LP tokens into the farm.
This function can only be called by the MASTER and requires a valid pool ID.
Parameters
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
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
Returns
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
Returns
getPoolTokens
Retrieves the addresses of tokens in a pool.
This function returns an array of pool token addresses for a given pool ID.
Parameters
Returns
_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
Returns
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
Returns
_ensureAllowance
Ensures that the contract has sufficient allowance to spend tokens.
This function ensures that the contract has the required allowance to spend tokens.
Parameters
getAvailableRewards
Retrieves the available rewards for a given pool ID.
This function returns the amount of rewards available for claiming for a specified pool ID.
Parameters
Returns
Errors
PancakeSwapSynthChef__E1
PoolId already exists : PancakeSwapSynthChef
PancakeSwapSynthChef__E2
amount eq 0 : PancakeSwapSynthChef
PancakeSwapSynthChef__E3
Caller is not Entangle's Compounder
Last updated