0

I'm trying to programmably wrap and unwrap matic/wmatic calling the processRoute function on sushiswap route processor contract. I can unwrap no issue but I can't wrap.

Source code of the contract: https://github.com/sushiswap/sushiswap/blob/master/protocols/route-processor/contracts/RouteProcessor3.sol

Polygonscan address of the contract: https://polygonscan.com/address/0x0a6e511fe663827b9ca7e2d2542b20b37fc217a6

It is possible to wrap through sushiswap interface and I compared to make sure my input data is exactly the same as if generated by sushiswap interface.

What am I missing?

const routerContract_poly = new ethers.Contract(
    router_poly,
    [
        'function processRoute(address tokenIn, uint amountIn, address tokenOut, uint amountOut, address to, bytes route) external returns (uint[] memory amounts)'
        
    ],
    signer_poly
  );
const run = async() =>{
    let maticAmount_poly = ethers.utils.parseUnits('0.0001', 18);
    let wmaticAmount_poly = ethers.utils.parseUnits('0.0000995', 18);
    txid_poly = await routerContract_poly.processRoute(    //wrap
        wrapAddress_poly,
        maticAmount_poly,
        WMATIC_poly,
        wmaticAmount_poly,
        wallet.address,
        route_wrap_poly,
        {gasLimit: gasLimit_poly, maxFeePerGas: maxFeePerGas_poly, maxPriorityFeePerGas: maxPriorityFee_poly}
        
    )    
}
cappu
  • 1
  • 1

0 Answers0