Net.Cache.DynamoDb.ERC20 1.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Net.Cache.DynamoDb.ERC20 --version 1.2.2                
NuGet\Install-Package Net.Cache.DynamoDb.ERC20 -Version 1.2.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Net.Cache.DynamoDb.ERC20" Version="1.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Net.Cache.DynamoDb.ERC20 --version 1.2.2                
#r "nuget: Net.Cache.DynamoDb.ERC20, 1.2.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Net.Cache.DynamoDb.ERC20 as a Cake Addin
#addin nuget:?package=Net.Cache.DynamoDb.ERC20&version=1.2.2

// Install Net.Cache.DynamoDb.ERC20 as a Cake Tool
#tool nuget:?package=Net.Cache.DynamoDb.ERC20&version=1.2.2                

Net.Cache.DynamoDb.ERC20

Overview

Net.Cache.DynamoDb.ERC20 is a specialized extension designed to facilitate the caching of ERC20 token information using Amazon DynamoDB. It integrates seamlessly with Ethereum blockchain networks to provide efficient access and management of ERC20 token details, such as token name, symbol, decimals, and total supply.

Features

  • ERC20 Token Information Caching: Efficiently caches ERC20 token information, reducing the need for repeated blockchain queries.
  • Automatic Key Generation: Generates unique hash keys for each token based on its chain ID and address, ensuring efficient data retrieval.
  • Flexible Initialization Options: Supports initialization with custom or default DynamoDB client settings.
  • Update Total Supply: Offers functionality to update the total supply of tokens in the cache dynamically.
  • Integration with Net.Cache.DynamoDb: Builds upon the robust caching capabilities of Net.Cache.DynamoDb, providing a specific solution for ERC20 tokens.

Getting Started

Installation

To get started with Net.Cache.DynamoDb.ERC20, ensure that you have Net.Cache.DynamoDb installed. Then, include Net.Cache.DynamoDb.ERC20 in your project

Usage

Initialize ERC20CacheProvider

You can initialize the ERC20CacheProvider using the default constructor or by passing an instance of ERC20StorageProvider for more customized settings.

var erc20CacheProvider = new ERC20CacheProvider();

Or with a custom storage provider:

var customContext = new DynamoDBContext(customClient);
var erc20StorageProvider = new ERC20StorageProvider(customContext);
var erc20CacheProvider = new ERC20CacheProvider(erc20StorageProvider);

Caching ERC20 Token Information

To cache ERC20 token information, create a GetCacheRequest and use the GetOrAdd method of ERC20CacheProvider:

var chainId = BigInteger.Parse("1"); // Ethereum mainnet
var contractAddress = new EthereumAddress("0x..."); // ERC20 token contract address
var rpcUrl = "https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID";

var request = new GetCacheRequest(chainId, contractAddress, rpcUrl);
var tokenInfo = erc20CacheProvider.GetOrAdd(contractAddress, request);

Console.WriteLine($"Token Name: {tokenInfo.Name}, Symbol: {tokenInfo.Symbol}");

This method retrieves the token information from the cache if it exists or fetches it from the blockchain and adds it to the cache otherwise.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Net.Cache.DynamoDb.ERC20:

Package Downloads
DownloaderV3.Source.CovalentDocument

The module for fetching, decoding, and saving blockchain event data using Covalent API in the DownloaderV3 system.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.5 523 8/20/2024
1.3.4 107 7/10/2024
1.3.3 198 6/17/2024
1.3.0 816 3/19/2024
1.2.2 984 2/9/2024
1.2.1 1,001 2/8/2024
1.2.0 136 2/7/2024

- `UpdateTotalSupply` and `TryGetValue` methods are marked as virtual in the `ERC20StorageProvider` class.
- `GetOrAdd` method is marked as virtual in the `ERC20CacheProvider` class.

Full changes can found here: https://github.com/The-Poolz/Net.Cache/releases/tag/v1.2.2