Tinyman 2.0.0.1
See the version list below for details.
dotnet add package Tinyman --version 2.0.0.1
NuGet\Install-Package Tinyman -Version 2.0.0.1
<PackageReference Include="Tinyman" Version="2.0.0.1" />
paket add Tinyman --version 2.0.0.1
#r "nuget: Tinyman, 2.0.0.1"
// Install Tinyman as a Cake Addin #addin nuget:?package=Tinyman&version=2.0.0.1 // Install Tinyman as a Cake Tool #tool nuget:?package=Tinyman&version=2.0.0.1
dotnet-tinyman-sdk
Overview
This library provides access to the Tinyman AMM on the Algorand blockchain.
Known Issues
High Severity
- The V1 pools should NOT be used as they are vulnerable to a liquidity draining attack.
- See the announcement here for more information.
Installation
Releases are available at nuget.org.
Package Manager
PM> Install-Package -Id Tinyman
.NET CLI
dotnet add package Tinyman
Getting Started
Other than initializing a client instance, no specific setup is required. However, if your application generates a high volume of requests it is suggested that you setup your own Algod node. See the links below for more information:
Notes
Default clients connect to Algod nodes maintained by AlgoNode.io (Thanks AlgoNode!). It's important that your application handle rate limiting (HTTP 429) responses by decreasing the frequency of requests. See this guide for a discussion on the topic.
Usage
Swapping
Swap one asset for another in an existing pool.
// Initialize the client
var client = new TinymanV2TestnetClient(); // or TinymanV1TestnetClient();
// Get the assets
var tinyUsdc = await client.FetchAssetAsync(21582668);
var algo = await client.FetchAssetAsync(0);
// Get the pool
var pool = await client.FetchPoolAsync(algo, tinyUsdc);
// Get a quote to swap 1 Algo for tinyUsdc
var amountIn = Algorand.Utils.Utils.AlgosToMicroalgos(1.0);
var quote = pool.CalculateFixedInputSwapQuote(new AssetAmount(algo, amountIn), 0.005);
// Perform the swap
var result = await client.SwapAsync(account, quote);
Minting
Add assets to an existing pool in exchange for the liquidity pool asset.
// Initialize the client
var client = new TinymanV2TestnetClient(); // or TinymanV1TestnetClient();
// Get the assets
var tinyUsdc = await client.FetchAssetAsync(21582668);
var algo = await client.FetchAssetAsync(0);
// Get the pool
var pool = await client.FetchPoolAsync(algo, tinyUsdc);
// Get a quote to add 1 Algo and the corresponding tinyUsdc amount to the pool
var amountIn = Algorand.Utils.Utils.AlgosToMicroalgos(1.0);
var quote = pool.CalculateMintQuote(new AssetAmount(algo, amountIn), 0.005);
// Perform the minting
var result = await client.MintAsync(account, quote);
Burning
Exchange the liquidity pool asset for the pool assets.
// Initialize the client
var client = new TinymanV2TestnetClient(); // or TinymanV1TestnetClient();
// Get the assets
var tinyUsdc = await client.FetchAssetAsync(21582668);
var algo = await client.FetchAssetAsync(0);
// Get the pool
var pool = await client.FetchPoolAsync(algo, tinyUsdc);
// Get a quote to swap the entire liquidity pool asset balance for pooled assets
var amount = client.GetBalance(account.Address, pool.LiquidityAsset);
var quote = pool.CalculateBurnQuote(amount, 0.005);
// Perform the burning
var result = await client.BurnAsync(account, quote);
Redeeming (V1 only)
Redeem excess amounts from previous transactions.
// Initialize the client
var client = new TinymanV1TestnetClient();
// Fetch the amounts
var excessAmounts = await client.FetchExcessAmountsAsync(account.Address);
// Redeem each amount
foreach (var quote in excessAmounts) {
var result = await client.RedeemAsync(account, quote);
}
Examples
Full examples, simple and verbose, can be found in /example.
Build
dotnet-tinyman-sdk build pipelines use the Assembly Info Task extension.
License
dotnet-tinyman-sdk is licensed under a MIT license except for the exceptions listed below. See the LICENSE file for details.
Exceptions
src\Tinyman\V1\asc.json
is currently unlicensed. It may be used by this SDK but may not be used in any other way or be distributed separately without the express permission of Tinyman. It is used here with permission.
Disclaimer
Nothing in the repo constitutes professional and/or financial advice. Use this SDK at your own risk.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Algorand.Common (>= 1.1.0.2)
- Algorand2 (>= 1.0.0.15)
- BouncyCastle.NetCore (>= 1.8.8)
- Newtonsoft.Json (>= 13.0.1)
- System.Memory (>= 4.5.4)
-
net6.0
- Algorand.Common (>= 1.1.0.2)
- Algorand2 (>= 1.0.0.15)
- BouncyCastle.NetCore (>= 1.8.8)
- Newtonsoft.Json (>= 13.0.1)
- System.Memory (>= 4.5.4)
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 |
---|---|---|
2.2.0.1 | 212 | 5/13/2023 |
2.1.0.1 | 242 | 3/12/2023 |
2.0.0.1 | 293 | 2/6/2023 |
1.0.0.2 | 323 | 1/8/2023 |
1.0.0.1 | 312 | 1/8/2023 |
0.3.0.2 | 474 | 5/7/2022 |
0.3.0.1 | 478 | 3/31/2022 |
0.2.0.10 | 455 | 2/27/2022 |
0.2.0.9 | 463 | 2/12/2022 |
0.2.0.8 | 470 | 2/10/2022 |
0.2.0.7 | 460 | 2/10/2022 |
0.2.0.6 | 442 | 2/9/2022 |
0.2.0.5 | 462 | 1/21/2022 |
0.2.0.4 | 467 | 1/19/2022 |
0.2.0.3 | 457 | 1/19/2022 |
0.2.0.2 | 469 | 1/17/2022 |
0.2.0.1 | 481 | 1/11/2022 |
0.1.0.1 | 320 | 1/5/2022 |
0.0.2.2 | 283 | 12/26/2021 |
0.0.2.1 | 385 | 10/11/2021 |
0.0.1.5 | 363 | 9/8/2021 |