0

I am very new to Solidity and Blockchain, have a background of Web Developer though, and as many i am following the Youtube video on these technologies by freeCodeCamp.org channel, where the VRF v1 is implemented. I am then updating it to the VRF v2 on my contract, i can say i understood its cycle and it works fine through Remix and the Subscription Manager.

Although i have a questions on when trying to implement it programmatically with Brownie(Python) on either the Rinkeby testnet or the ganache-cli forked with Infura endpoint

createSubscription():

function createNewSubscription() private onlyOwner {
  // Create a subscription with a new subscription ID.
  address[] memory consumers = new address[](1);
  consumers[0] = address(this);
  s_subscriptionId = COORDINATOR.createSubscription();
  // Add this contract as a consumer of its own subscription.
  COORDINATOR.addConsumer(s_subscriptionId, consumers[0]);
}

When creating the subscription through my Contract using the above function, it sets the Contract address as the admin of the subscription, whereas when i create it through the Subscription Manager on the Chainlink website it sets my Metamask account as the admin which is what i want.

Is there a way to obtain the same through the script?

2
  • This is hard to answer without seeing the full code for the COORDINATOR. I assume there is a function there for updating the admin of a subscription, but without seeing it we can't properly help
    – natewelch_
    Apr 5 at 16:27
  • The COORDINATOR code it is the one in the chainlink repo, anyhow the python script in the Harry's answer is what i was looking for. Thanks
    – salderosa
    Apr 6 at 22:07

1 Answer 1

0

The VRFv2 coordinator contract uses msg.sender when assigning the owner/admin of the subscription, so you need to make sure the signer of the transaction is the user wallet account. You can see how it's done in the brownie starter kit via a python script

1
  • That script is exactly what i was looking for! Thank you so much.
    – salderosa
    Apr 6 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.