0

Okay, so I was looking over the wolf contract(https://etherscan.io/address/0xeb834ae72b30866af20a6ce5440fa598bfad3a42#code), to understand how they fixed it and what happened... and one thing just doesn't make sense... I was hoping someone could clairfy it for me. On lines 37-42 of Woolf.sol the following variables are labled

  **// reference to the Barn for choosing random Wolf thieves
  IBarn public barn;
  // reference to $WOOL for burning on mint
  WOOL public wool;
  // reference to Traits
  ITraits public traits;**

my question is, is this declared in the deployer, like an .env file in hardhat and does it refrence a contract address or address AND if it does how would you do that? Can someone explain?

1 Answer 1

0

Two of those variables are initialized in the constructor.

  constructor(address _wool, address _traits, uint256 _maxTokens) ERC721("Wolf Game", 'WGAME') { 
    wool = WOOL(_wool);
    traits = ITraits(_traits);

And barn is initialized by calling setBarn function.

  function setBarn(address _barn) external onlyOwner {
    barn = IBarn(_barn);
  }

It is likely those contracts are deployed in a separate transaction. It is common to have a script that deploy several contracts passing around the addresses when they are required.

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.