MasterSynthChef
MasterSynthChef
Inherits: Initializable, UUPSUpgradeable, AccessControlUpgradeable, OwnableUpgradeable
This contract manages the staking of LP tokens for synthetic assets in various protocols. Users can deposit LP tokens and earn rewards, and the contract can compound rewards automatically.
State Variables
chefs
Map with addresses of Entangle ProtoSynthChefs protocols
compounder
Entangle Compounder address
ADMIN
Admin role
DEPOSITOR
Depositor Role
COMPOUNDER_EOA
Compounder External owned account role
synthFactory
Entangle SynthFactory address
Functions
sidCheck
Modifier that checks sid that it satisfies current requirements
constructor
initialize
Initializes the contract with initial parameters and sets up protocol-specific synthetic chefs.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the admin. |
|
| Address of the EOA (externally owned account) for the compounder. |
|
| Address of the compounder contract. |
|
| Address of the EntangleDex contract. |
|
| Array of protocol synthetic chef data. |
_authorizeUpgrade
setCompounder
Sets the address of the compounder contract.
Parameters
Name | Type | Description |
---|---|---|
|
| New address of the compounder contract. |
addProtocolSynthChef
Adds a new synthetic chef for a specific protocol.
Parameters
Name | Type | Description |
---|---|---|
|
| Inner ID of the new protocol. |
|
| Address of the synthetic chef. |
getLpTokenTotalBalance
Retrieves the total LP token balance for a specific SID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle's sid of the pool |
Returns
Name | Type | Description |
---|---|---|
|
| Total LP token balance. |
getLpToken
Retrieves the address of the LP token for a specific SID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle's sid of the pool |
Returns
Name | Type | Description |
---|---|---|
|
| Address of the LP token. |
depositLP
LOGIC FUNCTIONS **
Transfer lp tokens to ProtocolSynthChef to stake them into farm
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle's sid of the pool |
|
| amount of lp tokens to deposit |
withdrawLP
unstake lp tokens and transfer them to recipient address
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle's sid of the pool |
|
| amount of lp tokens to withdraw |
|
| lp tokens recipient |
withdrawLPAndExtract
unstake lp tokens, unwraps them to underlying assets and transfer underlying assets to recipient address. Only for liquidator's usage.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle's sid of the pool |
|
| amount of lp tokens to withdraw |
|
| lp tokens recipient |
compound
this function should be called from a special backend script that preconfigures all the data including compound fee transferring and approvals needed
_emitCompound
Function that emits special event required for handle metrics on Entangle's front
Events
DepositLP
WithdrawLP
NewCompounder
NewProtoSynthChef
Compound
WithdrawLPAndExtract
Errors
MasterSynthChef__E1
not lp staking sid : MasterSynthChef
MasterSynthChef__E3
wrong protocol id : MasterSynthChef
MasterSynthChef__E4
wrong pool Id : MasterSynthChef
MasterSynthChef__E5
compounder address eq 0 : MasterSynthChef
MasterSynthChef__E8
Protocol id already exists : MasterSynthChef
MasterSynthChef__E9
chefAddress eq 0 : MasterSynthChef
MasterSynthChef__E10
Amount eq 0 : MasterSynthChef
MasterSynthChef__E11
recipient address eq 0 : MasterSynthChef
MasterSynthChef__E12
Compound slippage error : MasterSynthChef
Structs
ProtocolSynthChefData
Struct that reflects Data about ProtocolSynthChef
CompoundTempData
Struct for internal usage in compound process
Last updated