DAPP去中心化交易所系统开发详细项目/方案设计/案例介绍/源码平台
区块链技术,也被称之为分布式账本技术,是一种互联网数据库技术,其特点是去中心化、公开透明,让每个人均可参与数据库记录。区块链技术不是一个单项的技术,而是一个集成了多方面研究成果基础之上的综合性技术系统。There are three indispensable core technologies:consensus mechanism,Cryptography principle and distributed data storage.
DApp是指以区块链为底层技术平台的分布式应用程序,它使得开发者可以构建去中心化和自主运行的应用程序,并通过链上的合约机制实现代码不可更改性和事务透明性
'function getAmountsOut(uint amountIn,address[]memory path)public view returns(uint[]memory amounts)',
'function swapExactTokensForTokens(uint amountIn,uint amountOutMin,address[]calldata path,address to,uint deadline)external returns(uint[]memory amounts)',
'function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint amountIn,uint amountOutMin,address[]calldata path,address to,uint deadline)external returns(uint[]memory amounts)'
],
account
);
const erc=new ethers.Contract(
data.WBNB,
[{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"}],
account
);
const run=async()=>{
await checkLiq();
}
let checkLiq=async()=>{
const pairAddressx=await factory.getPair(tokenIn,tokenOut);
console.log(chalk.blue(`pairAddress:${pairAddressx}`));
if(pairAddressx!==null&&pairAddressx!==undefined){
if(pairAddressx.toString().indexOf('0x0000000000000')>-1){
console.log(chalk.cyan(`pairAddress${pairAddressx}not detected.Auto restart`));
return await run();
}
}
const pairBNBvalue=await erc.balanceOf(pairAddressx);
jmlBnb=await ethers.utils.formatEther(pairBNBvalue);
console.log(`value BNB:${jmlBnb}`);
if(jmlBnb>data.minBnb){
setTimeout(()=>buyAction(),5000);
}
else{
initialLiquidityDetected=false;
console.log('run again...');
return await run();
}
}