I'm looking at the code here:

        this.token = await DamnValuableTokenFactory.deploy();
        this.pool = await UnstoppableLenderFactory.deploy(this.token.address);

and trying to understand what it's doing. The first line deploys the contract that returns a promise that resolves to a contract "token". The second line then does the same but takes the address of the token contract as argument. Are the contracts DamnValuableToken and UnstoppableLender being deployed to the same address? Here's the github.

1 Answer 1


We can see that UnstoppableLender has a constructor argument of a ERC20 token for it constructor.

When we pass the address of the newly deployed token to the to the deploy function, this is the value we provide to the constructor of UnstoppableLender. These are two different contractors deployed to two different addresses. You can only have one contract deployed to an address.

If you want to see this more clearly shown, we can add logs to the test and print the resulting address from the deployments.

enter image description here FYI These are only deployed to a local network setup by the testing framework, you wont see them on etherscan if you look up these addresses.

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.