0

I was watching this video https://youtu.be/nKRZ1R2BC4Q. Chainlink functions look incredible. I have a Next.js app that I plan on integrating a Chainlink function. This Chainlink function will take the place of the Next.js app's pages/api route. pages/api runs on the server, so adding a pages/api route makes it not static (dynamic). Dynamic apps aren't immutable because servers fail, go down, change IP addresses, etc... Swapping the pages/api with a Chainlink function would make my app sudo-immutable.

The only problem that I see is that the consumer contract controlling the function needs to be funded with LINK. The biggest problem here would be that app users could drain the consumer contract's funds with no consequence.

So is there a way to make the end user pay the LINK gas fee directly?

2 Answers 2

1

Chainlink Functions rely on subscriptions that are controlled by an EOA (the admin). This subscriptions holds the LINK. But any wallet can add funds to a subscription even if they dont own it as this funding is done via the transferAndCall method on the LINK token contract

So you would need to design your front end to have users add to your subscription and then implement tracking logic, or a flat fee logic or whatever funding tracking logic makes sense for your use case.

2
  • Oh this is great! Just to confirm... this transferAndCall method actually allows funding and executing the link contract in the same transaction? Commented May 11, 2023 at 2:20
  • 1
    Christian, yes as per ERC677 standard. You can read about how LINK tokens use it here: docs.chain.link/resources/link-token-contracts
    – ZeusLawyer
    Commented May 11, 2023 at 8:18
-1

Please take a look at this much simpler method for enabling end-users to pay for gas fees automatically without holding cryptocurrency: https://hackernoon.com/how-to-automatically-pay-your-end-users-gas-fees-without-hodling-crypto

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.