Functions readMaxValue and readMinValue need to be implemented

Đang mở
#2 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
solidity
Lĩnh vực
blockchain

Hướng nghiên cứu

Start by locating readMaxValue and readMinValue in the Solidity contracts, then read the existing value-submission and history logic. Confirm how N and gamma are represented before implementing the described historical traversal and update behavior; done means both functions return the highest or lowest value from the N most recent stored averages.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

These two functions are important for protocols such as Djed Shu.

There are different ways in which we could implement them. Here is a reasonable and simple one:

  • We keep an array of historical average values.

  • When readMaxValue is called, we traverse the N most recent values from this array and return the highest average price found.

  • When readMinValue is called, we traverse the N most recent values from this array and return the lowest average price found.

  • Let t be the timestamp of the most recent entry in the history array. Whenever a new value is submitted at time a t' and t' > t + gamma, the new average should be pushed into the history array.

The reason for having a minimal interval gamma is that we want the maximum and minimum value to be values over a significant period of time.

(I have a simple idea to optimize the traversals by caching some results. But let's implement the non-optimized version first, which traverses the history on every call to read...Value . Later we can discuss the caching optimization.)

Ngôn ngữ chính
Solidity
Star
3
Fork
3
Merge trung bình
15 giờ 55 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của StabilityNexus/OrbOracle-Solidity

Tất cả issue của StabilityNexus/OrbOracle-Solidity

Issue tương tự

Thêm issue về Blockchain

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.