From: Flat precompiled files?
OZ verify doesn’t work for this after all as I am using non upgrade able contracts.
I am still trying to figure out how to get truffle to work as well as I run into issues with it finding imports that work fine when building with OZ CLI tools.
If anyone has run into similar issues moving from just oz to oz and truffle I would love your feedback on how to resolve this. I have no good debugging process right now due to this and so am feeling a bit impeded in my development.
Thanks
Hi @Skyler_Fly,
I use the following process: Verifying a contract inheriting from OpenZeppelin Contracts
truffle-flattener
just needs a truffle-config.js
.
The main issue with verifying is knowing the compiler version, EVM version and what optimization was used.
Feel free to share your address and contract here, along with what license it uses and I am can see if I can verify.
Thanks @abcoathup
Here is the address on ropsten
Here is the contract code
I have the truffle-config setup and truffle is working as I am able to use it to send transactions to contracts. Compiling though wont run and flattening is also returning an error.
The compilation complains about not being able to find some of my dependencies that are working fine with the oz build tools.
Here is the error I get when flattening:
(node:2738) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2738) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
Error: There is a cycle in the dependency graph, can't compute topological ordering. Files:
contracts/TinyBoxes.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/TinyBoxesStore.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/VRFConsumerBase.sol
@openzeppelin/contracts/math/SafeMath.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/interfaces/LinkTokenInterface.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/VRFRequestIDBase.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/libraries/SVGBuffer.sol
@openzeppelin/contracts/utils/Strings.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/structs/Decimal.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/libraries/Decimal.sol
@openzeppelin/contracts/math/SignedSafeMath.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/libraries/StringUtilsLib.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/TinyBoxesPricing.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/ChainlinkClient.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/Chainlink.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/vendor/CBOR.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/vendor/Buffer.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/interfaces/ENSInterface.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/interfaces/ChainlinkRequestInterface.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/interfaces/PointerInterface.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/vendor/ENSResolver.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/chainlink/interfaces/AggregatorInterface.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/TinyBoxesBase.sol
@openzeppelin/contracts/token/ERC721/ERC721.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/GSN/Context.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/introspection/IERC165.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/introspection/ERC165.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/math/SafeMath.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/utils/Address.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/utils/EnumerableSet.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/utils/EnumerableMap.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/@openzeppelin/contracts/utils/Strings.sol
@openzeppelin/contracts/access/AccessControl.sol
@openzeppelin/contracts/utils/Counters.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/structs/TinyBox.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/libraries/Utils.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/TinyBoxesRenderer.sol
@openzeppelin/contracts/math/Math.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/structs/Shape.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/structs/Modulation.sol
/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/contracts/libraries/Random.sol
at getSortedFilePaths (/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/truffle-flattener/index.js:95:13)
at async flatten (/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/truffle-flattener/index.js:170:23)
at async main (/mnt/c/Users/skyfl/Documents/GitHub/tiny-boxes/node_modules/truffle-flattener/index.js:227:3)
Hi @Skyler_Fly,
Do you have a GitHub repository with TinyBoxes.sol
and it’s dependencies?
The Google Drive link is only to TinyBoxes.sol
.
I’m not sure why the contract is compiling with OpenZeppelin CLI but not Truffle.
Sure, it is still private right now though. Whats your username. I will add you.
On GitHub I am abcoathup
:
I am lucky to have the same username everywhere.
Hey, I just added you to the repo
here is the repo url
GitHub Repo
Hi @Skyler_Fly,
Compiling with OpenZeppelin CLI I get a warning
There is more than one contract named SafeMath. The compiled artifact for only one of them will be generated.
I resolved this by removing SafeMath
from vendor
Compiling with Truffle it complains about the structs in structs
contracts/TinyBoxesBase.sol:11:1: ParserError: Source "contracts/structs/TinyBox.sol" not found: File import callback not supported
import "./structs/TinyBox.sol";
^-----------------------------^
I wasn’t sure if you can declare structs outside of a contract. I didn’t see anything either way in the Solidity documentation.
When I try to flatten using truffle-flattener
, I get the error that there is a cycle in the dependency graph.
$ npx truffle-flattener ./contracts/TinyBoxes.sol > FlatTinyBoxes.sol
Error: There is a cycle in the dependency graph, can't compute topological ordering.
This is a known issue with truffle-flattener
: https://github.com/nomiclabs/truffle-flattener/issues/14
You could try solidity-flattener
to flatten.
Thanks!
I will check out that tool