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

Console.log for the UD60x18, SD59x18 types #234

Open
asparuhdamyanov opened this issue Jun 21, 2024 · 2 comments
Open

Console.log for the UD60x18, SD59x18 types #234

asparuhdamyanov opened this issue Jun 21, 2024 · 2 comments
Labels
effort: high Large or difficult task. priority: 2 We will do our best to deal with this. type: feature New feature or request. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise.

Comments

@asparuhdamyanov
Copy link

Describe the feature you would like

A way to console.log for the UD60x18, SD59x18 types.

Additional context

No response

@PaulRBerg
Copy link
Owner

Thanks @asparuhdamyanov for your feature request.

Extending things like Forge's console.log and console2.log is difficult in Solidity because Rust-like traits are not supported.

One idea is to create a bespoke prbConsole library. Users would have to import both that and the Forge library. Would this work for you?

@PaulRBerg PaulRBerg added effort: high Large or difficult task. type: feature New feature or request. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise. priority: 2 We will do our best to deal with this. labels Jun 21, 2024
@PaulRBerg
Copy link
Owner

Note that in the meantime, you can unwrap the PRBMath types like so:

import { ud, unwrap } from "@prb/math/src/UD60x18.sol";
import { console2 } from "forge-std/src/console2.sol";

function testFoo() external view {
    UD60x18 x = ud(3.14e18);
    console2.log(unwrap(x));
}

or using UD60x18.unwrap(x).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: high Large or difficult task. priority: 2 We will do our best to deal with this. type: feature New feature or request. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise.
Projects
None yet
Development

No branches or pull requests

2 participants