0

I'm trying to register upkeeps from my smart contract. I started by using the template for Chainlink Automation Compatible given in the docs. Then I deployed the UpkeepIDConsumerExample contract given in the docs.

I have only added these two lines to the UpkeepIDConsumerExample contract,

    receive() external payable {}

    // Fallback function is called when msg.data is not empty
    fallback() external payable {}

The UpkeepIDConsumerExample is deployed to mumbai and is funded with $LINK and $MATIC.

These are my constructor args,

KeeperRegistrar2_0:0x57A4a13b35d25EE78e084168aBaC5ad360252467
KeeperRegistry2_0:0xE16Df59B887e3Caa439E0b29B42bA2e7976FD8b2
Link Token:0x326C977E6efc84E512bB9C30f76E30c160eD06FB

Now when I try to call registerAndPredictID function, I end up getting this error,

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error. { "code": -32000, "message": "execution reverted" }

I tried to check with other docs and stackoverflow but no positive results

Siddesh
  • 129
  • 1
  • 1
  • 7

2 Answers2

1

It looks like you found an issue with the docs. It'll be fixed soon. Until then, here is a sample contract you can check out with the revised code and values

This transaction shows it working.

One thing to note You must fund the contract you deploy UpkeepIDConsumerExample with LINK. If the contract doesn't have any, when you call registerAndPredictID, you will see the Gas estimation error.

Richard G
  • 163
  • 5
0

I tested the code from the docs, but it seems to predict incorrect keeperID.

Here is the contract on Avalanche testnet.

Here is the transaction of registration new keeper.

The keeperID that was generated in the contract is 57952118558222458575856572226220980248969724156526342114946102634652182490725 but in fact, the keeper was registered with the id 111802081932340802689174832544601047850748175357678603218220808766025723091259according to the events logs.