Factory Trade Helper (ETH In / ETH Out)

This guide covers the BFun Factory Trade Helper contract.

The helper provides ETH-in / ETH-out integrations for both curve-stage and DEX-stage flows.

Quote Methods

function quoteEthToCollateralForToken(address token, uint256 ethIn)
    external
    returns (address collateralToken, uint256 collateralOut);

function quoteCollateralToEthForToken(address token, uint256 collateralIn)
    external
    returns (address collateralToken, uint256 ethOut);

function quoteDexExactInput(address tokenIn, address tokenOut, uint256 amountIn)
    external
    view
    returns (uint256 amountOutReceivedExpected);

Bonding Curve Stage Methods

function buyWithEth(address token, uint256 funds, uint256 minTokenOut)
    external
    payable
    returns (uint256 tokenOut, uint256 refundOut);

function sellForEth(address token, uint256 tokenAmountIn, uint256 minEthOut)
    external
    returns (uint256 ethOut);
  • funds must match msg.value in buyWithEth.

  • Caller must approve helper before sellForEth.

DEX Stage Methods

These methods are for post-migration DEX trading paths.

Events

  • BuyWithEth

  • SellForEth

Last updated