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

Converting BigNumber into int256 #12

Open
ediskandarov opened this issue May 2, 2023 · 2 comments
Open

Converting BigNumber into int256 #12

ediskandarov opened this issue May 2, 2023 · 2 comments

Comments

@ediskandarov
Copy link

Hi there,

Assuming, the code can inspect big number, and if ensured it fits into int256 - how to covert it?

I didn't find any example.

@jdbertron
Copy link

You can just use abi.encodePacked(bn);

I added this to my version of the library for debugging purposes, but it's not necessay.

function toBytes(BigNumber memory n) public pure returns(bytes memory r){
return n.val;
}

@riordant
Copy link
Collaborator

riordant commented May 3, 2023

Hi there,

Assuming, the code can inspect big number, and if ensured it fits into int256 - how to covert it?

I didn't find any example.

Hi, the conversion functions are indeed lacking. I will take a look at adding more, as it seems there is some demand for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants