Learn about our Trading smart contract which enables developers create their own swapping and arbitrage bots and scripts. This DeFi contract is presently in public beta.
Contract Address
Polygon v2: 0xf3452c9a6b86eA4c3bCe3D8b876C4A0E70f23D6f
Polygon: 0xd26B861Dd45436A3A4Ce77829Efe4704226fD25B
Binance: 0x0e83A21EC2f7fb8AbE89736aDF5CF3EDe786eC33 (Added Oct 26 – beta)
Ethereum: Coming Soon
Arbitrage ABI’s
function getArbitrageV2Quote(address[] memory path1, address[] memory path2, uint256 amountIn) external view returns (uint256,uint256,uint256,uint256)
Input Parameters
path1: Sequence of token addresses beginning with the initial token.
path2: Sequence of token addresses, 1st must be the last token in path1 and last token in sequence must be the 1st from path1.
amountIn: Amount of tokens being arbitraged.
Output Parameters
route1: The initial DEX route found,
output1: Output amount of last token from path1
route2: The second DEX route found
output2: Output amount of initial swapping token. This amount should be greater than amountIn.
function dexArbitrageV2Swap(uint256 route1, uint256 route2, uint256 amountIn, uint256 amountOutMin, address[] memory path1, address[] memory path2) external payable returns (uint256)
Input Parameters
route1: The initial DEX route found
route2: The second DEX route found
amountIn: Amount of tokens being arbitraged.
amountOutMin: Should be either the same as amountIn or output2 with slippage.
path1: Sequence of token addresses beginning with the initial token.
path2: Sequence of token addresses, 1st must be the last token in path1 and last token in sequence must be the 1st from path1.
Output Parameters
output: Output amount of initial swapping token. This amount should be greater than amountIn.
Swapping ABI’s
function getV2QuoteWithPath(address[] memory path, uint256 amountIn) external view returns (uint256,uint256)
Input Parameters
path1: Sequence of token addresses beginning with the initial token.
amountIn: Amount of tokens being arbitraged.
Output Parameters
output: Output amount before slippage.
function dexV2SwapWithPath(uint256 route, uint256 amountIn, uint256 amountOutMin, address[] memory path) external payable returns (uint256)
Input Parameters
route: The initial DEX route found
amountIn: Amount of tokens being arbitraged.
amountOutMin: Should be the output value from getV2QuoteWithPath with slippage added.
path1: Sequence of token addresses beginning with the initial token.
Output Parameters
output: Output amount from swapping token. This amount should be equal to or less than the getV2QuoteWithPath output.
Example Code Coming Soon
web3.js and ethers.js supported.