Skip to content

Commit

Permalink
docs: document flattening (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Feb 19, 2024
1 parent 03aafed commit 31fab19
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,18 @@ You can enable `solc`'s `--via-IR` flag by adding the following values to your `
solidity:
via_ir: True
```

### Contract Flattening

`ape-solidity` has contract-flattening capabilities.
If you are publishing contracts using Ape, Ape automatically detects and uses the flattened-contract approach if needed.

To manually flatten a contract for your own benefit, use the following code:

```python
from ape import compilers, project
source_path = project.source_paths[0] # Replace with your path.
flattened_src = compilers.flatten_contract(source_path)
print(str(flattened_src))
```

0 comments on commit 31fab19

Please sign in to comment.