Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update import paths in README #210

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ forge install PaulRBerg/prb-math@release-v4
Then, add this to your `remappings.txt` file:

```text
@prb/math/=lib/prb-math/src/
@prb/math/=lib/prb-math/
```

### Node.js
Expand Down Expand Up @@ -71,17 +71,17 @@ and static analyzers like Slither erroring, especially as repos grow and have mo
```solidity
pragma solidity >=0.8.19;

import { SD59x18 } from "@prb/math/SD59x18.sol";
import { UD60x18 } from "@prb/math/UD60x18.sol";
import { SD59x18 } from "@prb/math/src/SD59x18.sol";
import { UD60x18 } from "@prb/math/src/UD60x18.sol";
```

Any function that is not available in the types directly has to be imported explicitly. Here's an example for the `sd` and the `ud` functions:

```solidity
pragma solidity >=0.8.19;

import { SD59x18, sd } from "@prb/math/SD59x18.sol";
import { UD60x18, ud } from "@prb/math/UD60x18.sol";
import { SD59x18, sd } from "@prb/math/src/SD59x18.sol";
import { UD60x18, ud } from "@prb/math/src/UD60x18.sol";
```

Note that PRBMath can only be used in Solidity v0.8.19 and above.
Expand All @@ -92,7 +92,7 @@ Note that PRBMath can only be used in Solidity v0.8.19 and above.
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { SD59x18, sd } from "@prb/math/SD59x18.sol";
import { SD59x18, sd } from "@prb/math/src/SD59x18.sol";

contract SignedConsumer {
/// @notice Calculates 5% of the given signed number.
Expand All @@ -116,7 +116,7 @@ contract SignedConsumer {
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { UD60x18, ud } from "@prb/math/UD60x18.sol";
import { UD60x18, ud } from "@prb/math/src/UD60x18.sol";

contract UnsignedConsumer {
/// @notice Calculates 5% of the given signed number.
Expand Down Expand Up @@ -239,7 +239,7 @@ using the vanilla types.
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { UD60x18, ud } from "@prb/math/UD60x18.sol";
import { UD60x18, ud } from "@prb/math/src/UD60x18.sol";

function addRshiftEq() pure returns (bool result) {
UD60x18 x = ud(1e18);
Expand All @@ -259,9 +259,9 @@ Foundry. This is useful if, for example, you would like to assert that two UD60x
```solidity
pragma solidity >=0.8.19;

import { UD60x18, ud } from "@prb/math/UD60x18.sol";
import { UD60x18, ud } from "@prb/math/src/UD60x18.sol";
import { Assertions as PRBMathAssertions } from "@prb/math/test/Assertions.sol";
import { PRBTest } from "@prb/math/test/PRBTest.sol";
import { PRBTest } from "@prb/math/src/test/PRBTest.sol";

contract MyTest is PRBTest, PRBMathAssertions {
function testAdd() external {
Expand Down