Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Add usage examples for hashing utilities #436

Merged
merged 2 commits into from
Sep 9, 2021
Merged

Conversation

wolflo
Copy link
Contributor

@wolflo wolflo commented Sep 8, 2021

  • Adds a doctest showing usage of utils::get_create2_address() that calculates a UniswapV3 pool address.
  • Adds an example showing the generation of an EIP-2612 permit() hash. This shows how to match solidity's abi.encode() and abi.encodePacked() using ethers-rs.

Partially addresses #432.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog - N/A?

///
/// Calculate the address of a UniswapV3 pool.
///
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a no_run?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah this is great

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thank you. Maybe custom writing an EIP-712 package might not be as hard as I thought, will take a stab at it (or if you think it'd be easy to abstract this logic into a nice generic-ish package that also works. Maybe with a trait and the user defining a struct implementing the trait for encoding the struct?)

///
/// Calculate the address of a UniswapV3 pool.
///
/// ```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah this is great

@gakonst gakonst merged commit 46faf76 into gakonst:master Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants