#alloy #ethereum #erc20

alloy-erc20

Interact with ERC-20 contracts using Alloy

6 releases (3 breaking)

0.5.0 Oct 25, 2024
0.4.0 Oct 5, 2024
0.2.1 Sep 3, 2024
0.2.0 Jul 28, 2024
0.1.1 Jun 19, 2024

#686 in Magic Beans

Download history 93/week @ 2024-07-22 53/week @ 2024-07-29 170/week @ 2024-09-02 3/week @ 2024-09-09 14/week @ 2024-09-16 8/week @ 2024-09-23 160/week @ 2024-09-30 31/week @ 2024-10-07 16/week @ 2024-10-14 101/week @ 2024-10-21 16/week @ 2024-10-28

189 downloads per month

MIT license

29KB
681 lines

alloy-erc20

ERC20 is a Rust libary relying on Alloy allowing to interact with ERC-20 contracts.

Installation

Add alloy-erc20 to your Cargo.toml.

alloy-erc20 = "0.5"

Features

  • A basic Token struct and associated extensions methods on Alloy's Provider, allowing to retrieve token decimals, and compute balances as BigDecimal from U256.
  • A TokenStore trait, and a BasicTokenStore impl, allowing to cache Tokens in memory.
  • A LazyToken struct, acting as a wrapper around Alloy contract instance, lazily retrieving name, symbol, decimals and totalSupply from the blockchain.

Dependencies

~31–41MB
~733K SLoC