Skip to content

Library to accesses Aave price feed oracle using Nethereum

License

Notifications You must be signed in to change notification settings

lucasespinosa28/NAave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NChainlink NuGet

NAave a library made for Nethereum to help work with Aave price oracle

How to use NChainlink

Basic example

using System;
using NAave;
using Nethereum.Web3;
using System.Threading.Tasks;

//Ethereum endpoint URL.
var web3 = new Web3("https://mainnet.infura.io/v3/<KEY>");

//Pass web3 to Aave to access Ethereum
var aave = new Aave(web3);

//Aave Protocol data 
var protocolDataProvider = aave.ProtocolDataProvider();

//Aave oracle  
var PriceOracle = aave.PriceOracle();

//get list all reserves tokens in Aave
var AllTokens = await protocolDataProvider.GetAllReservesTokensQueryAsync();

foreach (var token in AllTokens.ReserveTokens)
{
    // Get the last price
    var price = await PriceOracle.GetAssetPriceQueryAsync(token.TokenAddress);
    // Get Aave information about the token
    var data = await protocolDataProvider.GetReserveDataQueryAsync(token.TokenAddress);
    string text = $"Synbol            - {token.Symbol}\n" +
                  $"Price             - {price}\n" +
                  $"Deposit APY       - {data.LiquidityRate}\n" +
                  $"Varible Barrow APR- {data.VariableBorrowRate}\n" +
                  $"Stable Barrow APR - {data.StableBorrowRate}\n";
    Console.WriteLine(text);
}

About

Library to accesses Aave price feed oracle using Nethereum

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages