I have two contracts. One is a contract that implements chainlink to obtain off-chain data. Part of its code is

  function requestConfig() public returns (bytes32 id) {
     Chainlink.Request memory req = buildChainlinkRequest(
     req.add("path", "data");
     return sendChainlinkRequest(req, fee);
  function getPositionData() external view returns(uint256[] memory) {
     return positionData;

  function fulfill(
     bytes32 _requestId,
     string memory _dataType
  ) public recordChainlinkFulfillment(_requestId) {
     require(positionAddress != address(0),"position address error");

The fulfill function will call the mintNewPosition function of another contract after receiving the data. Its function is to cast uniswap v3 position. Part of the code is

function mintNewPosition(uint256 amount0In,uint256 amount1In) external returns (
        uint256 tokenId,
        uint128 liquidity,
        uint256 amount0,
        uint256 amount1
    ) {
    uint256 amount0ToMint = amount0In * 1e18;
    uint256 amount1ToMint = amount1In * 1e18;
    int24 tickLowerMint = -887220;
    int24 tickUpperMint = 887220;

    TransferHelper.safeApprove(UNI, address(nonfungiblePositionManager), amount0ToMint);
    TransferHelper.safeApprove(WETH, address(nonfungiblePositionManager), amount1ToMint);
    INonfungiblePositionManager.MintParams memory params =
            token0: UNI,
            token1: WETH,
            fee: poolFee,
            tickLower: tickLowerMint,
            tickUpper: tickUpperMint,
            amount0Desired: amount0ToMint,
            amount1Desired: amount1ToMint,
            amount0Min: 0,
            amount1Min: 0,
            recipient: address(this),
            deadline: block.timestamp
    (tokenId, liquidity, amount0, amount1) = nonfungiblePositionManager.mint(params);


An error occurred when executing IAutoPosition(positionAddress).mintNewPosition(1,1);. I used tenderly to check the error and he told me out of gas. I made sure that there were enough links in my first contract and in the second contract. With enough UNI and WETH, I tried many times and this is one of the transactions and it happened on goerli network 0x172a1f5199846b95c978d28cfe6f10665f88dd44b43a8be40fa7df4e10fa0767 Please help me, any thanks

  • Hi Leo Out of gas means out of the native token on the chain you're running the contract on, not LINK, UNI or WETH. Also you should consider Chainlink Functions(docs.chain.link/chainlink-functions) instead of Chainlink AnyAPI. Much, much faster, flexible and more powerful.
    – ZeusLawyer
    Commented Jan 1 at 22:59

1 Answer 1


Solved, make sure token0 and token1 are in the same order as the token0 and token1 of the pool address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.