当前位置:网站首页>Uniswapv2 peripheral contract learning (VII) -- exampleslidingwindoworacle sol
Uniswapv2 peripheral contract learning (VII) -- exampleslidingwindoworacle sol
2022-06-09 14:01:00 【MateZero】
I remember a sentence from my circle of friends , If Defi It is the crown of Ethereum , that Uniswap It is the Pearl in this crown .Uniswap So far V2 edition , relative V1, Its functions are more comprehensive and optimized , However, the contract source code is not complicated . This article is for personal learning UniswapV2 Source code of a series of record articles .
One 、ExampleSlidingWindowOracle Contract introduction
The contract is the same as that learned in the previous article ExampleOracleSimple The contract is the same , Is to use UniswapV2 As a price prediction machine . But the application scenarios of the two are different :
ExampleOracleSimpleThe contract is used for fixed window mode , In this mode, historical data is not important , The current price has the same weight as the historical price . therefore , Records per cycle ( to update ) Just average the price once .ExampleSlidingWindowOracleFor sliding window mode , You can record price related information multiple times in a cycle . Sliding window mode is also divided into two categories , One is simple moving average , In other words, each price calculation is equal weight . The other is the exponential moving average , The most recent price calculation has a greater weight value .
This contract is an example of a simple moving average . About using UniswapV2 For more information about the price prediction machine, please read its documentation Buiding an Oracle. This document also elaborates on the overflow problem in price calculation .
Two 、 Contract source code
pragma solid边栏推荐
- Yunna intelligent operation and maintenance management system platform, visual operation and maintenance system management
- ThreadLocal还不会?来看看!
- 面试题 08.01. 三步问题
- TCP(滑动窗口,流量控制)
- 51单片机定时器0作为时间基准以及延时函数参考使用
- CNN's performance is even stronger without looking at the whole picture and the parts
- Yunna | how to do a good inventory of fixed assets? How to count fixed assets
- 对某快捷酒店一次内网测试
- What is the difference between delete, drop and truncate in MySQL
- 面试题 08.02. 迷路的机器人
猜你喜欢

记录下bilibili(b站)小火箭页面上划动画效果的实现

斯坦福博士提出超快省显存Attention,GPT-2训练速度提升3.5倍,BERT速度创纪录

5G發牌三周年 雲網融合加速 如何解决企業網絡之憂?

Win11 enable multi-user remote desktop simultaneous login

Development and present situation of Network Space Surveying and mapping at home and abroad

Common image segmentation methods

AI 考生挑战高考作文,平均 1 秒生成 1 篇,水平超 75% 考生

TCP/IP协议机制详解

Yunna database monitoring tool, database monitoring operation and maintenance tool
mysql中的delete,drop和truncate有什么区别
随机推荐
Understand Huawei's "Three Outlooks" in these root technologies
Zhengzhou Evan technology security headlines
UniswapV2周边合约学习(五)-- ExampleFlashSwap.sol
Little known beyond relu, it was discovered three years later: the activation functions used by Bert, gpt-2, etc
Raspberry PI raspberry pie classification and introduction of its similar products
功能强大的开发板
2022.6.3-----leetcode.829
ThreadLocal还不会?来看看!
mysql中的delete,drop和truncate有什么区别
MySQL Installer 方式安装MySQL
51单片机定时器0作为时间基准以及延时函数参考使用
面试题 08.04. 幂集
Best practices and principles of lean product development system
Hype plagiarism, insider fraud common NFT scams and security suggestions on opensea
不看全图看局部,CNN性能竟然更强了
TCP/IP协议机制详解
QUIC必看
L'ambassade aux États - Unis avertit les citoyens chinois aux États - Unis de la sécurité des voyages d'été
临界区、事件、互斥量、 信号量--四种控制多线程同步与互斥的方法
详解mysql数据去重的三种方式