eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
https://eth-brownie.readthedocs.io
MIT License
2.64k stars 550 forks source link

Brownie Compile ignores compiling contracts without constructors in the local code #936

Open PatrickAlphaC opened 3 years ago

PatrickAlphaC commented 3 years ago

Overview

If I import a file that has a constructor and just that file, and try to compile and deploy, brownie ignores it.

Specification

Here's what a file that brownie would ignore looks like:

pragma solidity 0.4.24;

import "@chainlink/contracts/src/v0.4/Oracle.sol";

(I remapped chainlink contacts so I could use the @ syntax)

However, Oracle.sol has a constructor, and could be compiled and deployed. We can actually compile and deploy that code in remix (using the github syntax instead of the @ syntax. See here for an example.)

Right now, the workaround is to just copy-paste the whole code into my repo, obviously breaking DRY (don't repeat yourself) and risking having my contract be out of sync with the most up to date version of the contract I want to work with.

iamdefinitelyahuman commented 3 years ago

I think this is related to how brownie decides if a contract has been changed - it might be looking at the runtime bytecode when it should instead look at the deployment bytecode.