CDR #033: Algem | Price Feeds

06 January, 2023

INTRODUCTION

Protocol: ALGEM

Integration: Algem is the native liquid staking DeFi dApp on top of Astar Network offering various ways for ASTR users and holders to earn more.

REQUEST INFORMATION

Assets

Following assets will be included in the Oracle:

Asset Ticker Asset Blockchain Asset Address Asset Markets Overview Comments
nASTR (collateral ratio driven feed) Astar 0xE511…F2b0 ASTR Markets ASTR price feed with collateral ratio derived price
nASTR (market price) Astar 0xE511…F2b0 nASTR Markets nASTR market price feed

Methodology

  • Moving Average Price with Interquartile Range (MAIR) will be used to calculate the price for the assets. Learn more about it here
  • 1% deviation threshold for updates trigger will be applied for each asset
  • 120sec time window for trades aggregation will be applied for each asset
  • nASTR price using collateral feed will be derived as follows:
    • nASTR price = ASTR price * (ASTR in staking contract / nASTR total supply)
    • ASTR in staking contract will be derived by calling function read_staked_amount_on_contract on Astar DappsStaking contract
    • nASTR total supply will be derived by calling function totalSupply on nASTR token contract

DELIVERY INFORMATION

Delivery Method Oracles on Astar network
Is testnet deploy required? No
Delivery Estimate 14 days

NOTES

Additional relevant information: N/A

1 Like

First contract: DIA Oracle: https://blockscout.com/astar/address/0x88463254469c37b9cECb71A34746707e008fb5A9
You can query “getValue()” with argument “ASTR/USD” or “nASTR/USD” to receive the market prices of both. Return values are the price (with 8 decimals, so divide by 10^8 to get the actual price) and unix timestamp of last update.
Prices will update as soon as 1% change is detected.

Second contract: Algem adapter that live connects the ASTR/USD price to onchain collateral information: https://blockscout.com/astar/address/0xCb2158f97367596A68dd1670bC848dc6B2245111
You can query “getNAstrPriceFromCollateralRatio()” (no arguments) to receive this value. It reads ASTR/USD from the oracle and applies the specified formula.

Finally: Please also add funding to the wallet that sends the update transactions to the oracle so that it doesn’t stop due to low funds: 0x7ba30ea9bf8969aab66c08074a587bb5d30452e1

3 Likes