FusionXSynthChefMainnet

(coming soon..)

Git Source

Inherits: IProtocolSynthChef, Initializable, UUPSUpgradeable, AccessControlUpgradeable, OwnableUpgradeable

State Variables

router

Interface of Fusionx Router

Mantle mainnet address: 0xDd0840118bF9CCCc6d67b2944ddDfbdb995955FD

IRouter public router;

masterChefEnt

Entangle MasterChef address

address public masterChefEnt;

ADMIN

bytes32 public constant ADMIN = keccak256("ADMIN");

MASTER

bytes32 public constant MASTER = keccak256("MASTER");

pools

Mapping from entangle internal pool Id to Fusionx pool address

mapping(uint32 poolId => uint256 protocolPoolId) public pools;

isPoolInitialized

mapping(uint32 poolId => bool) public isPoolInitialized;

chef

Interface of Fusionx MasterChef

IFusionXMasterChefMainnet public chef;

Functions

onlyCompounder

modifier onlyCompounder();

constructor

constructor();

initialize

function initialize(
    address _fusionXMasterChef,
    address _fusionXRouter,
    address _admin,
    address _masterSynthChef,
    uint32[] calldata entanglePoolIds,
    uint256[] calldata fusionXPoolIds
) public initializer;

_authorizeUpgrade

function _authorizeUpgrade(address) internal override onlyOwner;

setProtoMasterChef

function setProtoMasterChef(address masterChef) external onlyRole(ADMIN);

addPool

Add a new pool. Can only be called by the ADMIN.

function addPool(uint32 poolId, bytes calldata poolInfo) external onlyRole(ADMIN);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

poolInfo

bytes

Information required to communicate with Fusionx.

reinvest

Provide liquidity to pool and stake LP tokens. Can only be called by the Compounder.

function reinvest(uint32 poolId) external onlyCompounder returns (uint256);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

_optimalDeposit

function _optimalDeposit(address lpToken) internal returns (uint256);

_ensureAllowance

function _ensureAllowance(address token, address spender, uint256 amount) internal;

withdraw

Withdraw LP tokens from farm and remove liquidity. Transfer all to entangle MasterChef. Can only be called by the MASTER.

function withdraw(uint32 poolId, uint256 lpAmountToWithdraw, address recipient)
    external
    onlyRole(MASTER)
    returns (uint256[] memory amounts);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

lpAmountToWithdraw

uint256

Amount of LP tokens to witdraw

recipient

address

depositLP

Deposit LP tokens to farm. Can only be called by the MASTER.

function depositLP(uint32 poolId, uint256 lpAmount) external onlyRole(MASTER);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

lpAmount

uint256

Amount of LP tokens to deposit

withdrawLP

Withdraw LP tokens from farm and transfer it to entangle MasterChef. Can only be called by the MASTER.

function withdrawLP(uint32 poolId, uint256 lpAmount) external onlyRole(MASTER);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

lpAmount

uint256

Amount of LP tokens to withdraw

harvest

Accrue rewards and transfer it to Compounder. Can only be called by the Compounder.

function harvest(uint32 poolId)
    external
    onlyCompounder
    returns (address[] memory rewardTokens, uint256[] memory amounts);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

getTotalLpBalance

View function to get balance of LP tokens.

function getTotalLpBalance(uint32 poolId) public view returns (uint256 amount);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

Returns

NameTypeDescription

amount

uint256

Balance of LP tokens of this contract

getPoolTokens

View function to get pool tokens addresses.

function getPoolTokens(uint32 poolId) external view returns (address[] memory tokens);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

Returns

NameTypeDescription

tokens

address[]

array of pool token addresses.

lpTokenAddress

View function to get address of lp tokens of specific pool.

function lpTokenAddress(uint32 poolId) external view returns (address lpToken);

Parameters

NameTypeDescription

poolId

uint32

Entangle internal poolId

Errors

FusionxSynthChef__E1

error FusionxSynthChef__E1();

FusionxSynthChef__E2

error FusionxSynthChef__E2();

FusionxSynthChef__NotACompounder

error FusionxSynthChef__NotACompounder();

Last updated