Yieldly 1.0.0.2

dotnet add package Yieldly --version 1.0.0.2                
NuGet\Install-Package Yieldly -Version 1.0.0.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="Yieldly" Version="1.0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Yieldly --version 1.0.0.2                
#r "nuget: Yieldly, 1.0.0.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 Yieldly as a Cake Addin
#addin nuget:?package=Yieldly&version=1.0.0.2

// Install Yieldly as a Cake Tool
#tool nuget:?package=Yieldly&version=1.0.0.2                

dotnet-yieldly-sdk

Dev CI Status NuGet version Donate Algo

Overview

This library provides access to the Yieldly No Loss Lottery and Staking contracts on the Algorand blockchain.

Stake pools

Arbitrary stake pools are now supported. Use the FetchStakingPoolAsync(...) method on YieldlyClient to retrieve pool, this object can be used by following the same pattern as the client itself. That is, either pass the account instance to a method, which will submit signed transactions to complete an operation, or use the Prepare... methods to create a transaction group and handle signing the applicable transactions (see the example directory for sample implementations).

Roadmap

  • Add support for TEAL5 Staking pools
  • Add example projects for staking pool operations
  • Create PowerShell module and cmdlets for common operations
  • Investigate Liquidity Staking pool support
  • Investigate NFT prize game support

Installation

Releases are available at nuget.org.

Package Manager

PM> Install-Package -Id Yieldly

.NET CLI

dotnet add package Yieldly

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

The default client connects to an Algod node 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

This section contains examples for interacting with the lottery and staking contracts. It's possible to use this SDK without passing the Account object to SDK methods, see the Verbose example projects in the example directory.

TEAL5 staking pools are now supported. The Type property on AsaStakingPool indicate the pool type.

Lottery Deposit

Deposit ALGO in the no loss lottery.

// Initialize the client
var client = new YieldlyClient();

// Deposit 10 ALGO in the no loss lottery
var amountToDeposit = Utils.AlgosToMicroalgos(10.0);

var result = await client.LotteryDepositAsync(account, amountToDeposit);

Lottery Withdrawal

Withdraw ALGO participating in the no loss lottery.

// Initialize the client
var client = new YieldlyClient();

// Fetch all Yieldly amounts
var amounts = await client.FetchAmountsAsync(account.Address);

// Withdraw all ALGO currently deposited in the no loss lottery
var result = await client.LotteryWithdrawAsync(account, amounts.AlgoInLottery);

Lottery Reward Claim

Claim reward from lottery participation. Note, this does not include winning the lottery, just the rewards in YLDY.

// Initialize the client
var client = new YieldlyClient();

// Fetch all Yieldly amounts
var amounts = await client.FetchAmountsAsync(account.Address);

// Claim current Yieldy rewards from lottery
var result = await client.LotteryClaimRewardAsync(account, amounts.LotteryReward.Yieldly);

Staking Deposit

Deposit YLDY in the staking pool.

// Initialize the client
var client = new YieldlyClient();

// Deposit 1000 YLDY in the Yieldly staking pool
var amountToDeposit = YieldlyUtils.YieldlyToMicroyieldly(1000.0);

var result = await client.YieldlyStakingDepositAsync(account, amountToDeposit);

Staking Withdrawal

Withdraw YLDY in the staking pool.

// Initialize the client
var client = new YieldlyClient();

// Fetch all Yieldly amounts
var amounts = await client.FetchAmountsAsync(account.Address);

// Withdraw all YLDY currently deposited in the Yieldly staking pool
var result = await client.YieldlyStakingWithdrawAsync(account, amounts.YieldlyStaked);

Staking Reward Claim

Claim rewards from staking pool participation.

// Initialize the client
var client = new YieldlyClient();

// Fetch all Yieldly amounts
var amounts = await client.FetchAmountsAsync(account.Address);

// Withdraw all ALGO and YLDY currently available as rewards from Yieldly staking pool participation
var result = await client.YieldyStakingClaimRewardAsync(account, amounts.StakingReward);

Examples

Full examples, simple and verbose, can be found in example.

How?

This SDK was built by analyzing the transactions created by the Yieldly website in AlgoExporer. A special thanks @JoshLmao, his code provided a starting point for reward calculations.

Notes

The order of transactions in each transaction group is significant. Each transaction group, except lottery winning, has been tested.

Special Thanks

Special thanks to @JoshLmao for yly-calc.

Build

dotnet-yieldly-sdk build pipelines use the Assembly Info Task extension.

License

dotnet-yieldly-sdk is licensed under a MIT license except for the exceptions listed below. See the LICENSE file for details.

Exceptions

None.

Disclaimer

Nothing in the repo constitutes professional and/or financial advice. Use this SDK at your own risk.

Product 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. 
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.0.0.2 356 1/8/2023
1.0.0.1 304 1/8/2023
0.4.0.1 467 3/31/2022
0.3.0.5 426 3/18/2022
0.3.0.4 460 2/27/2022
0.3.0.3 442 2/13/2022
0.3.0.2 458 1/11/2022
0.3.0.1 441 1/10/2022
0.2.0.1 272 1/5/2022
0.1.0.1 371 10/4/2021
0.0.1.3 326 10/1/2021
0.0.1.2 325 9/26/2021
0.0.1.1 446 9/25/2021