For Developers
Integrate WOOFi Swap as the liquidity source

Contracts

WOOFi Swap Smart Contracts implementation info and addresses can be found in Contracts.

Supported assets

WooRouter.sol currently supports the following tokens on BSC:
Token
BSC address
BNB
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
WBNB
0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
USDT
0x55d398326f99059fF775485246999027B3197955
BTCB
0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c
ETH
0x2170ed0880ac9a755fd29b2688956bd959f933f8
WOO
0x4691937a7508860f876c9c0a2a617e7d9e945d4b

Query function to retrieve quotes on given assets

1
/// @dev query the amount to swap fromToken -> toToken
2
/// @param fromToken the from token
3
/// @param toToken the to token
4
/// @param fromAmount the amount of fromToken to swap
5
/// @return toAmount the swapped amount to receive
6
function querySwap(
7
address fromToken,
8
address toToken,
9
uint256 fromAmount
10
) external view returns (uint256 toAmount);
Copied!
Sample code to retrieve quote on selling 1 BTC:
1
querySwap(
2
0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c, // btcb token address
3
0x55d398326f99059fF775485246999027B3197955, // usdt token address
4
1000000000000000000); // btcb amount to swap in decimal 18
Copied!

Swap function

1
/// @dev swap fromToken -> toToken
2
/// @param fromToken the from token
3
/// @param toToken the to token
4
/// @param fromAmount the amount of fromToken to swap
5
/// @param minToAmount the amount of fromToken to swap
6
/// @param to the destination address
7
/// @param rebateTo the amount of fromToken to swap (optional, can be '0')
8
/// @return realToAmount the amount of toToken to receive
9
function swap(
10
address fromToken,
11
address toToken,
12
uint256 fromAmount,
13
uint256 minToAmount,
14
address payable to,
15
address rebateTo
16
) external payable returns (uint256 realToAmount);
Copied!
Sample code to swap 1 BTC to USDT:
1
swap(
2
0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c, // btcb token address
3
0x55d398326f99059fF775485246999027B3197955, // usdt token address
4
1000000000000000000, // btcb amount to swap in decimal 18
5
990000000000000000, // min amount for 1% slippage
6
0xd51062A4aF7B76ee0b2893Ef8b52aCC155393E3D, // the address to receive the swap fund
7
0); // the rebate address
Copied!
You can also directly interact with WooRouter.sol via bscscan.
Last modified 1mo ago