EntangleDexV2
Inherits: Initializable, UUPSUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable
This contract facilitates the exchange of LP tokens for synthetic assets and vice versa. It integrates with the MasterSynthChef and SynthFactory contracts to manage LP token staking and synthetic asset creation.
State Variables
ADMIN_ROLE
Constant that defines Admin role
sidInfo
Mapping to store SID information
masterSynthChef
Entangle MasterChef address
synthFactory
Entangle SynthFactory address
Functions
isPausedSID
Modifier to check if a SID is paused.
onlyLpStakingSid
Modifier to check if a SID is an LP staking synth.
onlyHomeChain
Modifier to check if a SID belongs to the home chain.
constructor
initialize
Initializes the contract.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the admin. |
|
| Address of the SynthFactory contract. |
|
| Address of the MasterSynthChef contract. |
_authorizeUpgrade
setPausedSid
Sets the pause state of a SID.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to set the pause state for. |
|
| Pause state to set. |
setSynthFactory
Sets the SynthFactory contract address.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the SynthFactory contract. |
setMasterSynthChef
Sets the MasterSynthChef contract address.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the MasterSynthChef contract. |
getDexSynthTokenBalance
Gets the balance of Dex Synth token for a given SID.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to get the balance for. |
Returns
Name | Type | Description |
---|---|---|
|
| Balance of Dex Synth token. |
buyForLP
Buys LP tokens for a given SID.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to buy LP tokens for. |
|
| Amount of LP tokens to buy. |
sellForLP
Sells LP tokens for a given SID.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to sell LP tokens for. |
|
| Amount of synthetic tokens to sell. |
|
| Address to receive LP tokens. |
sellForLPAndWithdraw
Sells LP tokens for a given SID and withdraws them.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to sell LP tokens for. |
|
| Amount of synthetic tokens to sell. |
|
| Address to receive LP tokens. |
Returns
Name | Type | Description |
---|---|---|
|
| Array of LP token amounts and token addresses. |
|
| Array of LP token addresses. |
convertLpToSynth
Converts LP tokens to synthetic tokens for a given SID.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to convert LP tokens for. |
|
| Amount of LP tokens to convert. |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of synthetic tokens obtained. |
convertSynthToLp
Converts synthetic tokens to LP tokens for a given SID.
Parameters
Name | Type | Description |
---|---|---|
|
| SID to convert synthetic tokens for. |
|
| Amount of synthetic tokens to convert. |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of LP tokens obtained. |
Events
LPStackingSynthSell
SynthFactorySetted
SynthStateChanged
MasterChefSetted
DepositLP
Errors
EntangleDex__E1
paused sid : EntangleDexV2
EntangleDex__E2
Non liquidable sid : EntangleDexV2
EntangleDex__E3
Not an lp staking synth : EntangleDexV2
EntangleDex__E4
Not the home network for synth : EntangleDexV2
EntangleDex__E5
zero amount : EntangleDexV2
EntangleDex__E6
crossChain operations are not allowed for this sid
Structs
SidInfo
Struct to store SID information
Last updated