智能合约互助公排流动性质押挖矿开发正式版丨智能合约互助公排流动性质押挖矿系统开发(详情开发及源码)

简介: The universe is the successor of the mobile internet,and the doors of the virtual world and the real world have been opened.The metauniverse may become the new direction of the development of the Internet,and may also be the next form of the development of the digital economy.The exploration of the

  The universe is the successor of the mobile internet,and the doors of the virtual world and the real world have been opened.The metauniverse may become the new direction of the development of the Internet,

and may also be the next form of the development of the digital economy.The exploration of the universe will promote the deep integration of the real economy and the digital economy,and promote the digital economy to a new stage.

  //given some amount of an asset and pair reserves,returns an equivalent amount of the other asset

  //添加流动性的时候,通过该方法查询输入A的数量,需要多少个B

  function quote(uint amountA,uint reserveA,uint reserveB)internal pure returns(uint amountB){

  //判断数量,首次添加流动性,随意定价,不需要查询该方法

  require(amountA>0,'UniswapV2Library:INSUFFICIENT_AMOUNT');

  require(reserveA>0&&reserveB>0,'UniswapV2Library:INSUFFICIENT_LIQUIDITY');

  //B数量=预期输入A的数量*B的储备量/A的储备量;//实际公式就是A/B=reserveA/reserveB,两个币的数量比例一致

  amountB=amountA.mul(reserveB)/reserveA;

  }

  //given an input amount of an asset and pair reserves,returns the maximum output amount of the other asset

  //通过精确输入金额,输入币的储备量,输出币的储备量,计算输出币的最大输出量

  function getAmountOut(uint amountIn,uint reserveIn,uint reserveOut)internal pure returns(uint amountOut){

  require(amountIn>0,'UniswapV2Library:INSUFFICIENT_INPUT_AMOUNT');

  require(reserveIn>0&&reserveOut>0,'UniswapV2Library:INSUFFICIENT_LIQUIDITY');

  //具体看下面的公式推导,要看该公式,首先要理解uniswap AMM,X*Y=K

  uint amountInWithFee=amountIn.mul(997);//手续费都是扣输入额的千三,所以需要去掉千三后才是实际用于交易的金额

  uint numerator=amountInWithFee.mul(reserveOut);//套下面公式理解吧!!

  uint denominator=reserveIn.mul(1000).add(amountInWithFee);

  amountOut=numerator/denominator;

 

相关文章
|
18天前
|
人工智能 区块链
dapp质押代币分红模式系统开发|指南需求|技术原理
Web3.0提出以来,就是一个包罗万象的术语,用于任何与下一代互联网相关的事情,即“去中心化的数字基础设施”。
|
8月前
|
区块链
Defi代币质押持币生息系统技术开发/源代码/质押挖矿dapp
Defi代币质押持币生息系统技术开发/源代码/质押挖矿dapp
|
8月前
|
存储 分布式计算 大数据
DAPP质押合约代币公排互助系统开发详情讲解
区块链和大数据都是新一代信息技术,它们的概念不同,应用领域也有着一定的区别
|
区块链
马蹄链智能合约代币预售流动性质押挖矿系统开发(成熟及方案)丨案例详细
  智能合约具有以下特点:首先,规范性。智能合约以计算机代码为基础,能够最大限度减少语言的模糊性,通过严密的逻辑结构来呈现。智能合约的内容及其执行过程对所有节点均是透明可见的,后者能够通过用户界面去观察、记录、验证合约状态。
|
JavaScript 前端开发 区块链
NFT质押借贷理财dapp系统开发|智能合约挖矿系统开发详情
NFT质押借贷理财dapp系统开发|智能合约挖矿系统开发详情
|
供应链 区块链 数据安全/隐私保护
什么是智能合约?质押借贷理财挖矿dapp系统开发案例源代码详情
什么是智能合约?质押借贷理财挖矿dapp系统开发案例源代码详情
|
安全 5G
dapp借贷理财挖矿开发案例丨dapp借贷理财挖矿系统开发(开发逻辑及方案)丨dapp借贷理财挖矿系统源码
  Blockchain is a distributed ledger that is open to all.It uses blockchain data structure to verify and store data,and uses cryptography to ensure the security of data transmission and access.It has the characteristics of decentralization,tamper-proof,transparency and openness.
|
5G 区块链 vr&ar
DAPP智能合约流动性质押挖矿分红开发案例版丨DAPP智能合约流动性质押挖矿分红系统开发(开发案例及源码)
The metauniverse is an immersive digital world created by the combination of virtual reality,augmented reality and the Internet.The connotation and key technologies of the metauniverse require further breaking the space-time limit(5G and the Internet of Things),real immersion(VR),and value transmi
|
JSON 区块链 数据格式
dapp互助公排质押挖矿开发详情版丨dapp互助公排质押挖矿系统开发(方案及功能)丨dapp互助公排质押挖矿源码平台
 智能合约是运行在区块链公链上的一种代码,该代码由Solidity编写,并通过区块链的智能合约虚拟机来执行,以达到对区块链编程的目标。可以将区块链公联理解为操作系统,Solidity是编写该操作系统应用程序的编程语言,智能合约虚拟机则是编程语言编译之后的代码运行环境。
|
存储 人工智能 物联网
DAPP/LP流动性质押挖矿互助公排模式系统开发详细,DAPP/LP流动性质押挖矿互助公排开发源码
依据计算机领域常用的形式化分层方法,元宇宙可以分为元网络、元系统、元服务、元场景和元空间五层架构。元网络包含了通信、存储、计算、网络等支撑性技术,为元宇宙提供底层基础设施;元系统以区块链为核心,集成大数据、云计算、人工智能、物联网、人机交互和信息安全等技术,为元服务提供系统级基础技术能力

热门文章

最新文章