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

feat: implement getTokenInfo for Hardhat #142

Merged
merged 26 commits into from
Dec 4, 2024
Merged

Conversation

acuarica
Copy link
Contributor

@acuarica acuarica commented Nov 27, 2024

Description:

This PR implements getTokenInfo for Hardhat. It extends the getHtsStorageAt to interpret Solidity structs and arrays together with support for more types. Also supports extracting keys and custom fees (except royalty fees which are only applicable to NFTs).

It builds a "SlotMap" for a given token. This is a mapping from slots to primitive values. It uses the Solidity storage layout definition to build the slot map.

Additionally, this PR includes a script to create tokens with custom fees to aid testing f5eef27, a144b29, 55f688c. The launch-token submodule was removed in favor of this new script 7292022.

Related issue(s):

Fixes #141.

Notes for reviewer:

When testing fractional fees, two issues appeared in the Foundry solution. One was it was unable to abi.decode. I had to include all_collectors_are_exempt in src/IMirrorNodeResponses.sol. The other issue was that field values were shifted. I guess there was a missing ++ in src/HtsSystemContractJson.sol. See this changes in 40893c8.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@acuarica acuarica added the feature Enhancing an existing feature driven by business requirements. Typically backwards compatible. label Nov 27, 2024
@acuarica acuarica self-assigned this Nov 27, 2024
@acuarica acuarica requested a review from a team as a code owner November 27, 2024 08:24
@acuarica acuarica linked an issue Nov 27, 2024 that may be closed by this pull request
@acuarica acuarica force-pushed the 141-hardhat-gettokeninfo branch from 77bd525 to 58e4459 Compare November 27, 2024 09:32
@hts-forking/src/slotmap.js Outdated Show resolved Hide resolved
@hts-forking/src/slotmap.js Outdated Show resolved Hide resolved
@hts-forking/src/slotmap.js Show resolved Hide resolved
@hts-forking/src/slotmap.js Show resolved Hide resolved
victor-yanev
victor-yanev previously approved these changes Dec 3, 2024
Nana-EC
Nana-EC previously approved these changes Dec 3, 2024
Copy link

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

Nice work.
SlotMap is great stuff, can' you update the PR description to summarize logic there but I'm also looking forward to in depth description of it elsewhere

@hts-forking/src/slotmap.js Show resolved Hide resolved
@acuarica acuarica dismissed stale reviews from Nana-EC and victor-yanev via df227c3 December 3, 2024 18:43
@acuarica acuarica requested review from a team as code owners December 3, 2024 23:16
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
@acuarica acuarica force-pushed the 141-hardhat-gettokeninfo branch from ff8b0e4 to e6a1503 Compare December 3, 2024 23:46
Copy link
Contributor

@victor-yanev victor-yanev left a comment

Choose a reason for hiding this comment

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

LGTM

@acuarica acuarica merged commit 47ab756 into main Dec 4, 2024
8 checks passed
@acuarica acuarica deleted the 141-hardhat-gettokeninfo branch December 4, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Enhancing an existing feature driven by business requirements. Typically backwards compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Hardhat] Implement getTokenInfo state on HTS for Hardhat
3 participants