Skip to content

feat(cheatcodes): add cheatcode to calculate the IPFS CID V0 of a file content #9862

@sakulstra

Description

@sakulstra

For us it would be quite useful to have a native way of hashing file contents and strings via foundry.
The reason is that in a lot of cases we want to store the ipfs hash of a file on-chain, but automating this is currently pain.
We currently do this via ffi + node, but it's a bit painful ux wise: https://github.com/bgd-labs/aave-cli/blob/main/src/ipfs/onlyHash.ts#L3-L24

Would be great if there was a native ipfsCidV0(string memory filepath):bytes32, so we can get rid of the node tooling we currently use to supplement foundry.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions