Skip to content

Lesson9: confused with why Interactions.s.sol:AddConsumer is working with forked spolia test #2013

Answered by caodanbobo
caodanbobo asked this question in Q&A
Discussion options

You must be logged in to vote

I asked ChatGPT this question, and here is the answer:

address vrfAdd = /* address of a deployed VRFCoordinatorV2_5 or VRFCoordinatorV2_5Mock */;
VRFCoordinatorV2_5Mock(vrfAdd).addConsumer(consumerAddress);
VRFCoordinatorV2_5(vrfAdd).addConsumer(consumerAddress);

In Solidity, both calls to addConsumer will behave the same way if the contract at vrfAdd correctly implements addConsumer.

To understand this clearly, i ask it a similar question: Assume foo is a virtual function in SubscriptionAPI, VRFCoordinatorV2_5 and VRFCoordinatorV2_5Mock provide their own implementations of foo, what would happen if VRFCoordinatorV2_5Mock(vrfAdd).foo() is called?

Answer:

  1. In Solidity, casting an address t…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@caodanbobo
Comment options

@caodanbobo
Comment options

Answer selected by caodanbobo
@EngrPips
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants