Net.Cache.DynamoDb.ERC20 1.3.4

dotnet add package Net.Cache.DynamoDb.ERC20 --version 1.3.4                
NuGet\Install-Package Net.Cache.DynamoDb.ERC20 -Version 1.3.4                
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.3.4" />                
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.3.4                
#r "nuget: Net.Cache.DynamoDb.ERC20, 1.3.4"                
#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.3.4

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

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 net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.4 52 7/10/2024
1.3.3 172 6/17/2024
1.3.0 572 3/19/2024
1.2.2 743 2/9/2024
1.2.1 747 2/8/2024
1.2.0 110 2/7/2024