I have a contract that uses Chainlink Log Trigger Automation and I want to be able to get the exact fee for the Automation before it happens.

The user pays in LINK to use the contract and the transaction involves the use of Log Trigger Automation. The user should pay the exact fee in LINK, rather than a slightly more, general amount.

This is the line in the function where funds are added to the automation consumer contract. The linkAutomationPayment is provided by the user when they call the function.

i_automationConsumer.addFunds(i_subId, uint96(linkAutomationPayment));

The uint96(linkAutomationPayment) should be the exact amount required for the checkLog and performUpkeep functions to successfully work - with the user's provided input. (The user provides an address as a parameter, an event is emitted based on that address, then data from that event is used in checkLog and performUpkeep).

CCIP has a getFee function that allows users to get the fee for a transaction based on its parameters before it happens, and something like that would be ideal for Automation. Is there?


1 Answer 1


Chainlink Automation does not have that exact functionality yet. What you can do is utilize the https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol#L458-L460 function which is the minimum balance required for an Upkeep to execute, but it is not the exact amount the Job will cost.

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.