Skip to content

Commit

Permalink
Add example using OZ contracts in VSCode (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbakers authored Sep 13, 2024
1 parent 65ff398 commit 3c17bff
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/config/vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,39 @@ To get Foundry in line with the chosen version, add the following to your `defau
```toml
solc = "0.8.17"
```

### Example of using OpenZeppelin contracts and non-standard project layout.

```
.
└── project
└── contracts
├── lib
│ ├── forge-std
│ └── openzeppelin-contracts
├── script
├── src
└── test
```

Add line to `remappings.txt` file ([`forge remapping`](../projects/dependencies.md#remapping-dependencies)):

```
@openzeppelin/=lib/openzeppelin-contracts/
```

Add line to `.vscode/settings.json` file (solidity extension settings):

```json
{
"solidity.remappings": [
"@openzeppelin/=project/contracts/lib/openzeppelin-contracts/"
]
}
```

Now all contracts from the OpenZeppelin documentation can be used.

```javascript
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
```

0 comments on commit 3c17bff

Please sign in to comment.