Ares Wikipedia

Ares Wikipedia

  • Docs
  • Contribute
  • Languages iconEnglish
    • 中文

›Oracle

General

  • Overview
  • Supplementary
  • Glossary

WhitePaper

  • Introduction
  • Technical Architecture
  • Data market
  • Economic Model

Learn

    Stake Mining

    • Trojan Stake Mining
    • Iliad Stake Mining
    • Asset cross-chain bridge
  • Liquidity mining
  • Gladios

    • Account
    • Claim Test Coins
    • Transfer
    • Set Online Identity

    Oracle

    • Ares Oracle
    • Ares Oracle Provider Support
    • Oracle Finance
    • Staking Extend

    Slot Auction

    • Kusama
    • Dot
  • Get Price
  • Get Symbol Fraction

Build

    Basic

    • Obtain Price Through Cross-Chain

    Gladios Guide

    • Set Up the Verifier Node
    • Quotation node rpc tools

Node

  • Hardware environment
  • Run Node
  • Run Validator Node
  • Run Validator Node Q&A
  • Start the Oracle Service
  • Start The Warehouse Service
  • Warehouse Api

Mainnet

    Validator Tutorial

    • Account
    • Map ERC20/BEP20 ARES
    • How to bond stash & controller account
    • Validator node program upgrade/deployment
    • Set Session Keys
    • Validator node verification
    • Punishment verification & Extraction of assets

    Nominator Tutorial

    • Create Odyssey Account & Stake
    • Nominate for any one or more nodes
    • Check penalties & withdraw assets

Oracle Finance

Methods

current_era_num

fn current_era_num() -> EraIndex

To get the current era, you need to consider that if the era-length changes, you still need to guarantee that the vector of time zones increases.

get_earliest_reward_era

fn get_earliest_reward_era() -> Option<EraIndex>

Get the earliest reward era.

calculate_fee_of_ask_quantity

fn calculate_fee_of_ask_quantity(price_count: u32) -> BalanceOf<T>

Input in a price_count to calculate the cost of the purchase.

  • params
price_count: Expected count of aggregate trade-pairs.

reserve_for_ask_quantity

fn reserve_for_ask_quantity(
    who: T::AccountId,
    p_id: PurchaseId,
    price_count: u32
) -> OcwPaymentResult<BalanceOf<T>, PurchaseId>

Keep the balance for the purchase.

  • params
who: Origin account id.
p_id: Purchase order id.
price_count: Expected count of aggregate trade-pairs.

unreserve_ask

fn unreserve_ask(p_id: PurchaseId) -> Result<(), Error<T>>

Release the funds reserved for the purchase, which occurs after the failure of the ask-price.

p_id: Purchase order id.

pay_to_ask

fn pay_to_ask(p_id: PurchaseId, agg_count: usize) -> Result<(), Error<T>>

Execute the payment, which will transfer the user’s balance to the Pallet

p_id: Purchase order id.
price_count: The count of actual aggregate trade-pairs

record_submit_point

fn record_submit_point(
    who: T::AccountId,
    p_id: PurchaseId,
    bn: T::BlockNumber,
    ask_point: AskPointNum
) -> Result<(), Error<T>>

Record the Points of the validator under an order

who: A validator id.
p_id: Purchase order id.
bn: The corresponding block when the order is generated.
ask_point: A number of u32

get_record_point

fn get_record_point(
    ask_era: u32,
    who: T::AccountId,
    p_id: PurchaseId
) -> Option<AskPointNum>

Get the Point of the record

ask_era: Era of the reward.
who: A validator id.
p_id: Purchase order id.

take_reward

fn take_reward(
    ask_era: EraIndex,
    who: T::AccountId
) -> Result<BalanceOf<T>, Error<T>>

Claim all rewards under a given era

ask_era: Era of the reward.
who: A validator id.

get_era_income

fn get_era_income(ask_era: EraIndex) -> BalanceOf<T>

Get total income balance for an era.

ask_era: Era of the reward.

get_era_point

fn get_era_point(ask_era: EraIndex) -> AskPointNum

Read the total balance for an era.

ask_era: Era of the reward.

check_and_slash_expired_rewards

fn check_and_slash_expired_rewards(ask_era: EraIndex) -> Option<BalanceOf<T>>

Check for expired rewards and destroy them if overdue

Tx method

take_purchase_reward

Validators get rewards corresponding to eras.

Note: An era cannot be the current unfinished era, and rewards are not permanently stored. If the reward exceeds the depth defined by T::HistoryDepth, you will not be able to claim it.

The dispatch origin for this call must be Signed

Earliest reward Era = Current-Era - T::HistoryDepth

ask_era: Era number is a u32
  • Fields of take_purchase_reward
ask_era: EraIndex

take_all_purchase_reward

Validators get rewards, it will help validators get all available rewards

Note: An era cannot be the current unfinished era, and rewards are not permanently stored. If the reward exceeds the depth defined by T::HistoryDepth, you will not be able to claim it.

The dispatch origin for this call must be Signed

Earliest reward Era = Current-Era - T::HistoryDepth

Workflow

Reward Generation

  1. Payment is through the Trait provided by IForPrice. It is necessary to call reserve_for_ask_quantity to reserve the part balance of asker and associate it with the order-id.

  2. Through the Trait implementation provided by IForReporter, call record_submit_point to save the point. The block height needs to be passed in, and the pallet will convert it to the corresponding era and record it under an order-id.

  3. After the price-response is successful, call pay_to_ask to release the Balance reserved above, and pay the actual ask fee to the oracle-finance pallet.

Claim Reward

  1. Rewards are claimed by era, and rewards cannot be obtained for unfinished eras. You need to calculate the 'Balance' corresponding to each point in the corresponding era. Algorithm: Single Point Bonus = Total Revenue/Total Points on era.
  2. The validator needs to use the Controller account to perform the claim operation, This is for security reasons. The total amount received is equal to: Validator Points * Single Point Bonus.
  3. Rewards are transferred to the validator's Stash account via oracle-finance pallet.
← Ares Oracle Provider SupportStaking Extend →
  • Methods
    • current_era_num
    • get_earliest_reward_era
    • calculate_fee_of_ask_quantity
    • reserve_for_ask_quantity
    • unreserve_ask
    • pay_to_ask
    • record_submit_point
    • get_record_point
    • take_reward
    • get_era_income
    • get_era_point
    • check_and_slash_expired_rewards
  • Tx method
    • take_purchase_reward
    • take_all_purchase_reward
  • Workflow
    • Reward Generation
    • Claim Reward
About Us

Ares is an on-chain-verified oracle platform that provides secure and reliable data services for the Polkadot DeFi ecosystem.

Email   info@aresprotocol.io
Quick links
WebsiteBlogTokenomicsBuy TokenFarms
Resources
DocumentationGithubBlockchain Explorer
Social Media
Copyright © 2023 The Ares Protocol All rights reserved