一、UniswapV2Library合约源码
使用的方法:
二、演示效果
合约请求返回值:
swap结果:
三、部分代码
function getTokenPrice(uint total) public view returns (uint[] memory amount1){
address[] memory path = new address[](2);
path[0] = a;
path[1] = b;
amount1 = router.getAmountsOut(total,path);
return amount1;
}
}