SynthFactory
SynthFactory creates synthetic tokens and also stores information about them (e.g. their current price).
Inherits: Initializable, AccessControlUpgradeable, UUPSUpgradeable, OwnableUpgradeable
SynthFactory manages CDT creation, price fetching, comission handling
State Variables
ADMIN
Admin role
MINTER
Minter role
masterSynthChef
Address of Entangle MasterSynthChef
synths
Mapping that link sid with SynthInfo(address of synth token, and info if it is active)
synthDecimals
Default Synth token decimals
feeCollector
Address of Entangle fee collector. The Address where we are accumalating all fees
feeRate
Global commission rate
customFeeRates
Mapping from Entangle sid to custom fee rates
FEE_BASE
Fee divider for calculations of fees
Functions
constructor
initialize
Initializes the contract with initial parameters and sets up protocol-specific synthetic chefs.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the MasterChef contract. |
|
| Address of the admin. |
|
| Address of the EntangleDex contract. |
|
| Address of the Fee collecter, where we collect all fees. |
|
| Initial fee rate for sids across all chain |
|
| Array with initial Synths |
_authorizeUpgrade
validSynth
Modifier that checks if Synth is active
Parameters
Name | Type | Description |
---|---|---|
|
| Sid of the Synth token that should be checked |
deploySynth
Function that managing the process of Synth token creation
Parameters
Name | Type | Description |
---|---|---|
|
| Sid of Synth token that will be created |
|
| The name that will be assigned to new Synth token |
Returns
Name | Type | Description |
---|---|---|
|
| Address of created Synth token |
mint
first depositor encounters a slight decrease of liquidity
Mint function for the Synth token
Parameters
Name | Type | Description |
---|---|---|
|
| Sid of the Synth token that should be minted |
|
| Amount of Synth token to mint |
|
| Recipient of frsh tokens |
burn
Mint function for the Synth token
Due to Entangle grabs comission only when user withdraw his token, also, commission is calculated here. The commission is in Synth token and we send it to feeCollector address.
Parameters
Name | Type | Description |
---|---|---|
|
| Sid of the Synth token that should be burned |
|
| Amount of Synth token to burn |
|
| Address that will be burned |
Returns
Name | Type | Description |
---|---|---|
|
| the amount of Synth token that should be gained |
getSynth
Function that returns address of Synth token associated with a given sid.
Parameters
Name | Type | Description |
---|---|---|
|
| Sid of Synth token |
Returns
Name | Type | Description |
---|---|---|
|
| Address of the Synth token |
getPrice
Retrieves the current price of a synthetic asset.
The price is calculated as the ratio of the total locked LP token balance to the total supply of the synthetic asset.
Parameters
Name | Type | Description |
---|---|---|
|
| Compressed information required to identify the synthetic asset. |
Returns
Name | Type | Description |
---|---|---|
|
| The current price of the synthetic asset, expressed with 18 decimals. |
setFeeRate
Sets the fee rate percentage.
Parameters
Name | Type | Description |
---|---|---|
|
| New fee rate percentage. |
setCustomFeeRate
Sets custom fee rate for a specific SID.
Parameters
Name | Type | Description |
---|---|---|
|
| Entangle's sid of the pool |
|
| New fee rate percentage. |
|
| Flag to indicate whether to use the custom fee rate. |
setFeeCollector
Sets the fee collector address.
Parameters
Name | Type | Description |
---|---|---|
|
| New fee collector address. |
Events
Mint
Burn
SetPrice
NewFeeRate
NewCustomFeeRate
NewFeeCollector
Errors
SynthFactory__E1
Synth already delpoyed : SynthFactory
SynthFactory__E2
SID is not active : SynthFactory
SynthFactory__E3
New fee rate should less than or equal to FEE_BASE : SynthFactory
SynthFactory__E4
Address of the new feeCollector equals to 0x0 : SynthFactory
Structs
SidName
struct that have sid and it's name
CustomFeeRate
Struct that reflects Custom Fee Rates
SynthInfo
Struct that have information about active state of synth and also address of synth
Last updated