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(examples): add usage examples #24

Merged
merged 30 commits into from
Nov 29, 2023

Conversation

gaspermerela
Copy link
Contributor

Description

Created examples:

  • tracker of ETH and ERC20 token balances for a given address
  • abi generation and ERC20 transfer
  • data decoding: decoding tx data with SC wrapper or with function signature
  • consolidated and manual request batching
  • ETH to ERC20 swap with listening to UniswapV2Pair Sync event
  • Searching for transactions with function selector from SC wrapper or manually from the function signature

Solution

Copy link
Member

@ArtificialPB ArtificialPB left a comment

Choose a reason for hiding this comment

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

Thanks for contributing. Looking good, just needs a few changes and simplifications.

Please follow the conventional commits naming for PR titles since we plan to auto-gen changelog from them.

@ArtificialPB ArtificialPB changed the title Examples/function selectors feat: add usage examples Nov 26, 2023
@gaspermerela gaspermerela changed the title feat: add usage examples feat(examples): add usage examples Nov 27, 2023
Copy link
Member

@ArtificialPB ArtificialPB left a comment

Choose a reason for hiding this comment

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

Looks good, two small changes and it's ready for merge


// # Manually decode function input data when we only know function signature
val function = AbiFunction.parseSignature("swapExactTokensForTokens(uint256,uint256,address[],address,uint256)")
val manualDec = AbiCodec.decodeWithPrefix(4, function.inputs, calldata.value)
Copy link
Member

Choose a reason for hiding this comment

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

This should be replaced with function.decodeCall. Normally, users should not use AbiCodec directly.

@ArtificialPB ArtificialPB merged commit c029150 into Kr1ptal:master Nov 29, 2023
1 check passed
@gaspermerela gaspermerela deleted the examples/function-selectors branch December 1, 2023 08:26
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

Successfully merging this pull request may close these issues.

None yet

2 participants