区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。
区块链技术作为一种前沿技术,其特有的区块链技术、分布式记账、区块链智能合约、防篡改及可溯源性的技术特点
Web3.0是基于区块链技术实现去中心化的新型互联网,其支持新的商业和社交等模式。
去中心化存储技术是一种新型存储技术,它改变了传统的集中式存储技术,将数据从单一位置移到多个位置,这样就消除了存储数据的中心机构或服务器的责任,增加了安全性和数据的有效存储,确保用户的数据安全性。
当前Internet协议中最基本的协议是TCP/IP协议,也称为网络通信协议,它是Internet的基础,开发:MrsFu123 由网络层的IP协议和传输层的TCP协议组成。TCP/IP定义了电子设备如何连接到Internet以及如何在它们之间传输数据的标准。互联网上的每一个节点都执行这个协议,以相同的格式提供信息,这样信息就可以在互联网上点对点地自由传输。
Liquidity mining encourages users to pledge tokens and pledge vouchers to liquidity mining contracts.For users,using DeFi will not only obtain original profits,but also obtain liquidity mining rewards.Encouraged by liquidity mining,it has promoted users to become LPs of DeFi,promoting the rapid growth of DeFi.
//add bsv and token to liquidity pool
public function addLiquidity(PubKey sender,Sig senderSig,int tokenAmount,int senderBalance,int senderKeyIndex,int oldTokenBalance,
int lpSenderBalance,int lpSenderKeyIndex,int newBsvBalance,SigHashPreimage txPreimage){
require(checkSig(senderSig,sender));
int oldBsvBalance=SigHash.value(txPreimage);
//mint new lp tokens for the liquidity provider
if(oldBsvBalance==0){
//initialize pool
//initially,just mint new lp tokens per the amount of new bsvs deposited
int lpMint=newBsvBalance;
require(this.lpToken.mint(sender,lpSenderBalance,lpMint,lpSenderKeyIndex));
}else{
//add more liquidity
int bsvAmount=newBsvBalance-oldBsvBalance;
//deposit ratio must be the same with current pool ration
//i.e.,oldBsvBalance/oldTokenBalance==bsvAmount/tokenAmount
require(oldBsvBalancetokenAmount==bsvAmountoldTokenBalance);
//mint new lp tokens,proportinal to the amount of new bsvs deposited
int lpMint=this.lpToken.totalSupply()*bsvAmount/oldBsvBalance;
require(this.lpToken.mint(sender,lpSenderBalance,lpMint,lpSenderKeyIndex));
}
//transfer tokens to the pool
require(this.token.transferFrom(sender,this.poolPubkey,tokenAmount,senderBalance,senderKeyIndex,oldTokenBalance,senderKeyIndex));
require(this.propagateState(newBsvBalance,txPreimage));
}