DAPP去中心化交易所系統(tǒng)開發(fā)詳細項目/方案設(shè)計/案例介紹/源碼平臺
區(qū)塊鏈技術(shù),也被稱之為分布式賬本技術(shù),是一種互聯(lián)網(wǎng)數(shù)據(jù)庫技術(shù),其特點是去中心化、公開透明,讓每個人均可參與數(shù)據(jù)庫記錄。區(qū)塊鏈技術(shù)不是一個單項的技術(shù),而是一個集成了多方面研究成果基礎(chǔ)之上的綜合性技術(shù)系統(tǒng)。There are three indispensable core technologies:consensus mechanism,Cryptography principle and distributed data storage.
DApp是指以區(qū)塊鏈為底層技術(shù)平臺的分布式應(yīng)用程序,它使得開發(fā)者可以構(gòu)建去中心化和自主運行的應(yīng)用程序,并通過鏈上的合約機制實現(xiàn)代碼不可更改性和事務(wù)透明性
'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();
}
}