0

The scenario is when an EOA interacted with Function 1 from smart contract A. But in a single transaction, function 1 also makes calls to contract B, which makes calls to contract C.

Question 1: Would this EOA cover the gas invoked in the chain of functions(state-changing) upfront when signing in Metamask? In this case, contract A, B and C don't pay for gas.

Because this seems to contradict what I read on Chainlink's VRF direct funding cost calculation. (https://docs.chain.link/vrf/v2/direct-funding/) This calculates the total gas cost when a consuming smart contract gets a random number but the gas is converted and charged in LINK Token additionally from the gas cost already paid in ETH upfront by an EOA who invokes the function. See chainlink's gas cost formula: (Gas price * (Verification gas + Callback gas limit + Wrapper gas Overhead)) = total gas cost

Question 2: why is there additional gas charged to the consuming smart contract aside from the upfront gas paid by an EOA(signer)? Or this additional gas cost in LINK is only post-charged for Callback functions? If so, is there a way to avoid the chain of Callback functions to avoid extra gas costs? Thank you!

1 Answer 1

0

Question 1: The user initiating the transaction will pay for all of the gas accounted during the transaction, regardless of how many contracts interact.

Question 2: Using Vrf or any other Chainlink product requires interaction with the Chainlnk chain. This chain nodes offer the mentioned services, and paying with Link is the way to pay for these extra services.

Hope it helps

2
  • Thanks for your answer! It helps. Regarding Q2, I think Chainlink charge a premium for their service in Link in addition to the gas cost they charge also in Link. And I thought the gas cost is for transactions on Mainnet or testnet(same chain as the consuming contract), not on Chainlink chain. And the random number service is provided off-chain. So maybe there are two transactions invoked here instead of one? The post-charged gas is for the second transaction that returns random numbers. Jan 13, 2023 at 14:22
  • yes, you are right, the fee of ending the vfr on chain
    – donoso.eth
    Jan 13, 2023 at 19:38

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.